大厅接入
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,6 +41,7 @@
|
||||
*.sdf
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
.vsconfig
|
||||
|
||||
# Precompiled Assets
|
||||
SourceArt/**/*.png
|
||||
|
||||
@ -15,8 +15,8 @@ ManualIPAddress=
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
GlobalDefaultGameMode=/Game/Blueprint/Bp_BusyGameMode.Bp_BusyGameMode_C
|
||||
GameInstanceClass=/Script/BusyRabbit.BusyGameInstance
|
||||
EditorStartupMap=/Game/Level/FalconPlain.FalconPlain
|
||||
GameDefaultMap=/Game/Level/FalconPlain.FalconPlain
|
||||
EditorStartupMap=/Game/Level/HomeLand.HomeLand
|
||||
GameDefaultMap=/Game/Level/HomeLand.HomeLand
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
r.Mobile.AntiAliasing=0
|
||||
|
||||
BIN
Content/Blueprint/Bp_HomelandGameMode.uasset
Normal file
BIN
Content/Blueprint/Bp_HomelandGameMode.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/HomeLand/Bp_HomeLandHud.uasset
Normal file
BIN
Content/Blueprint/HomeLand/Bp_HomeLandHud.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/HomeLand/Bp_HomeLandPlayerController.uasset
Normal file
BIN
Content/Blueprint/HomeLand/Bp_HomeLandPlayerController.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/HomeLand/Bp_HomelandGameMode.uasset
Normal file
BIN
Content/Blueprint/HomeLand/Bp_HomelandGameMode.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,6 +16,10 @@ local function CreateItemGenerator(level_config_data)
|
||||
return Generator(period, item_data)
|
||||
end
|
||||
|
||||
function SubSystem:Bp_ShouldCreateSubsystem(world)
|
||||
return false
|
||||
end
|
||||
|
||||
function SubSystem:ReceiveSubSystemInitialize()
|
||||
local world = BusyGamePlayLibrary.K2_GetWorld(self)
|
||||
self.start_time = GameplayStatics.GetTimeSeconds(world)
|
||||
|
||||
@ -5,26 +5,15 @@ local RoleUtils = require("GamePlay.Utils.RoleUtils")
|
||||
local GameplayUtils = require("GamePlay.Utils")
|
||||
local KismetSystemLibrary = import("KismetSystemLibrary")
|
||||
|
||||
--[[
|
||||
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0" ExportPath="/Script/BlueprintGraph.K2Node_CallFunction'/Game/Blueprint/Bp_BusyCharacter.Bp_BusyCharacter:EventGraph.K2Node_CallFunction_0'"
|
||||
bIsPureFunc=True
|
||||
FunctionReference=(MemberParent="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",MemberName="IsValid")
|
||||
NodePosX=416
|
||||
NodePosY=576
|
||||
NodeGuid=FAEC35AE4921EA704624228C12C6567F
|
||||
CustomProperties Pin (PinId=560B26AF426C21B8AC88EDB90990EDF1,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet System Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/Engine.KismetSystemLibrary'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetSystemLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=5F3C3BC8429FA25D9B78099F2107C098,PinName="Object",PinToolTip="Object\nObject Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject="/Script/CoreUObject.Class'/Script/CoreUObject.Object'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=5C7188354FCB6B61DE0AC8A14D6E3EEC,PinName="ReturnValue",PinToolTip="Return Value\nBoolean\n\nReturn true if the object is usable : non-null and not pending kill",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
|
||||
|
||||
]]
|
||||
|
||||
function LevelItem:ReceiveBeginPlay()
|
||||
self.Super:ReceiveBeginPlay()
|
||||
self:SetLevelItemID(self.CurrentItemID)
|
||||
self.world = self:GetWorld()
|
||||
print("LevelItem:ReceiveBeginPlay")
|
||||
end
|
||||
|
||||
|
||||
function LevelItem:TempSetting()
|
||||
self:ReceiveBeginPlay()
|
||||
end
|
||||
|
||||
function LevelItem:ReceiveLevelItemSetted(Config)
|
||||
@ -46,17 +35,6 @@ function LevelItem:ReceiveLevelItemSetted(Config)
|
||||
end)
|
||||
end
|
||||
|
||||
-- function LevelItem:ReceiveDamage(value)
|
||||
-- local remain = self.proxy.RemainProcess - value
|
||||
-- if remain > 0 then
|
||||
-- self.proxy.RemainProcess = remain
|
||||
-- return true
|
||||
-- else
|
||||
-- self.proxy.RemainProcess = 0
|
||||
-- self:SetLifeSpan(0.3)
|
||||
-- return false
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function LevelItem:GenerateDropItems()
|
||||
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem").Get(self.world)
|
||||
|
||||
11
Content/Lua/HomeLand/UI/HomeLandMainUI.lua
Normal file
11
Content/Lua/HomeLand/UI/HomeLandMainUI.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local GameplayStatics = import("GameplayStatics")
|
||||
local HomeLandMainUI = {}
|
||||
|
||||
function HomeLandMainUI:Construct()
|
||||
self.Gateway.OnClicked:Add(function()
|
||||
GameplayStatics.OpenLevel(self, "FalconPlain", false, "")
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
return Class(nil, nil, HomeLandMainUI)
|
||||
7
Content/Lua/UI/UIHud/HomeLandHud.lua
Normal file
7
Content/Lua/UI/UIHud/HomeLandHud.lua
Normal file
@ -0,0 +1,7 @@
|
||||
local HomeLandHud = {}
|
||||
|
||||
function HomeLandHud:ReceiveBeginPlay()
|
||||
self:PushWidget("HomeLandMain")
|
||||
end
|
||||
|
||||
return Class(nil, nil, HomeLandHud)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/UI/HomeLand/WBP_HomeLandMain.uasset
Normal file
BIN
Content/UI/HomeLand/WBP_HomeLandMain.uasset
Normal file
Binary file not shown.
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "BusyLevelLogicSubSystem.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
UBusyLevelLogicSubSystem::UBusyLevelLogicSubSystem(){
|
||||
|
||||
@ -12,6 +13,14 @@ void UBusyLevelLogicSubSystem::Initialize(FSubsystemCollectionBase& Collection){
|
||||
ReceiveSubSystemInitialize();
|
||||
}
|
||||
|
||||
bool UBusyLevelLogicSubSystem::ShouldCreateSubsystem(UObject* Outer) const{
|
||||
if (!Super::ShouldCreateSubsystem(Outer)) {
|
||||
return false;
|
||||
}
|
||||
auto s = UGameplayStatics::GetCurrentLevelName(Outer);
|
||||
return UGameplayStatics::GetCurrentLevelName(Outer) != "HomeLand";
|
||||
}
|
||||
|
||||
void UBusyLevelLogicSubSystem::Tick(float DeltaTime){
|
||||
Super::Tick(DeltaTime);
|
||||
ReceiveSubSystemTick(DeltaTime);
|
||||
|
||||
37
Source/BusyRabbit/Private/Core/UI/PW_UIHud.cpp
Normal file
37
Source/BusyRabbit/Private/Core/UI/PW_UIHud.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "Core/UI/PW_UIHud.h"
|
||||
#include "Core/PW_UserWidget.h"
|
||||
#include "Core/UI/PW_UILayer.h"
|
||||
|
||||
FString APW_UIHud::GetLuaFilePath_Implementation() const {
|
||||
return LuaFilePath;
|
||||
}
|
||||
|
||||
void APW_UIHud::BeginPlay() {
|
||||
ensureMsgf(LayerClass, TEXT("LayerClass not be nullptr"));
|
||||
if ((UILayer = CreateWidget<UPW_UILayer>(GetWorld(), LayerClass))) {
|
||||
UILayer->AddToViewport();
|
||||
}
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
UPW_UserWidget* APW_UIHud::PushWidget(const FName& WidgetName) {
|
||||
if (UILayer == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
TSubclassOf<UPW_UserWidget>* WidgetClass = UIClassMapping.Find(WidgetName);
|
||||
if (WidgetClass == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
UPW_UserWidget* Inst = CreateWidget<UPW_UserWidget>(GetWorld(), WidgetClass->Get());
|
||||
if (Inst == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (UILayer->PushWidget(WidgetName, Inst)) {
|
||||
return Inst;
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
53
Source/BusyRabbit/Private/Core/UI/PW_UILayer.cpp
Normal file
53
Source/BusyRabbit/Private/Core/UI/PW_UILayer.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Core/UI/PW_UILayer.h"
|
||||
#include "Core/PW_UserWidget.h"
|
||||
#include "Components/Overlay.h"
|
||||
#include "Components/OverlaySlot.h"
|
||||
|
||||
|
||||
|
||||
bool UPW_UILayer::ShowWidget(const FName& WidgetName){
|
||||
UPW_UserWidget* Widget = *WidgetPool.Find(WidgetName);
|
||||
if (Widget == nullptr) {
|
||||
return false;
|
||||
}
|
||||
Widget->SetVisible(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UPW_UILayer::HideWidget(const FName& WidgetName){
|
||||
UPW_UserWidget* Widget = *WidgetPool.Find(WidgetName);
|
||||
if (Widget == nullptr) {
|
||||
return false;
|
||||
}
|
||||
Widget->SetVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UPW_UILayer::PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst){
|
||||
UOverlay* Overlay;
|
||||
UOverlaySlot* OverlaySlot;
|
||||
switch (WidgetInst->LayoutType) {
|
||||
case EWidgetLayoutType::MainLayer: Overlay = MainLayer; break;
|
||||
case EWidgetLayoutType::PopupLayer: Overlay = PopupLayer; break;
|
||||
case EWidgetLayoutType::FloatLayer: Overlay = FloatLayer; break;
|
||||
case EWidgetLayoutType::TopLayer: Overlay = TopLayer; break;
|
||||
default: return false;
|
||||
}
|
||||
Overlay->AddChild(WidgetInst);
|
||||
if ((OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot))) {
|
||||
OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill);
|
||||
OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill);
|
||||
WidgetInst->SetVisible(true);
|
||||
WidgetPool.Add(WidgetName, WidgetInst);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool UPW_UILayer::PopWidget(const FName& WidgetName){
|
||||
return true;
|
||||
}
|
||||
@ -3,12 +3,8 @@
|
||||
|
||||
#include "Hud/BusyGameHud.h"
|
||||
|
||||
|
||||
|
||||
FString ABusyGameHud::GetLuaFilePath_Implementation() const{
|
||||
return LuaFilePath;
|
||||
}
|
||||
|
||||
//void ABusyGameHud::PushWidget(const FName& WidgetName){
|
||||
// auto WidgetClass = UIClassMapping.Find(WidgetName);
|
||||
// APlayerController* PC = GetOwningPlayerController();
|
||||
// CreateWidget<UUserWidget>();
|
||||
//}
|
||||
}
|
||||
@ -39,6 +39,18 @@ void ABusyLevelItem::BeginPlay(){
|
||||
PickBar->SetWidgetClass(cls);
|
||||
}
|
||||
Super::BeginPlay();
|
||||
bIsBeginPlay = true;
|
||||
}
|
||||
|
||||
void ABusyLevelItem::EndPlay(const EEndPlayReason::Type EndPlayReason){
|
||||
Super::EndPlay(EndPlayReason);
|
||||
bIsBeginPlay = false;
|
||||
}
|
||||
|
||||
void ABusyLevelItem::PostLuaHook(){
|
||||
if (bIsBeginPlay) {
|
||||
CallLuaFunctionIfExist("TempSetting");
|
||||
}
|
||||
}
|
||||
|
||||
void ABusyLevelItem::InitCapsule(){
|
||||
|
||||
@ -23,6 +23,9 @@ public:
|
||||
public:
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||
|
||||
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
|
||||
|
||||
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
virtual FString GetLuaFilePath_Implementation() const override;
|
||||
@ -47,5 +50,4 @@ public: //
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void ReceiveSubSystemTick(float DeltaTime);
|
||||
|
||||
|
||||
};
|
||||
|
||||
BIN
Source/BusyRabbit/Public/BusyRabbit.lnk
Normal file
BIN
Source/BusyRabbit/Public/BusyRabbit.lnk
Normal file
Binary file not shown.
34
Source/BusyRabbit/Public/Core/UI/PW_UIHud.h
Normal file
34
Source/BusyRabbit/Public/Core/UI/PW_UIHud.h
Normal file
@ -0,0 +1,34 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/HUD.h"
|
||||
#include "LuaOverriderInterface.h"
|
||||
#include "PW_UIHud.generated.h"
|
||||
|
||||
class UPW_UILayer;
|
||||
class UPW_UserWidget;
|
||||
|
||||
UCLASS()
|
||||
class BUSYRABBIT_API APW_UIHud : public AHUD, public ILuaOverriderInterface {
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual FString GetLuaFilePath_Implementation() const override;
|
||||
|
||||
virtual void BeginPlay()override;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UPW_UserWidget* PushWidget(const FName& WidgetName);
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FString LuaFilePath;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSubclassOf<UPW_UILayer> LayerClass;
|
||||
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "UI Class Mapping")
|
||||
TMap<FName, TSubclassOf<UPW_UserWidget>> UIClassMapping;
|
||||
|
||||
protected:
|
||||
TObjectPtr<UPW_UILayer> UILayer;
|
||||
};
|
||||
48
Source/BusyRabbit/Public/Core/UI/PW_UILayer.h
Normal file
48
Source/BusyRabbit/Public/Core/UI/PW_UILayer.h
Normal file
@ -0,0 +1,48 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Core/PW_UserWidget.h"
|
||||
#include "PW_UILayer.generated.h"
|
||||
|
||||
class UOverlay;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class BUSYRABBIT_API UPW_UILayer : public UPW_UserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool ShowWidget(const FName& WidgetName);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool HideWidget(const FName& WidgetName);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool PopWidget(const FName& WidgetName);
|
||||
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
|
||||
TObjectPtr<UOverlay> MainLayer;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
|
||||
TObjectPtr<UOverlay> PopupLayer;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
|
||||
TObjectPtr<UOverlay> FloatLayer;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
|
||||
TObjectPtr<UOverlay> TopLayer;
|
||||
|
||||
protected:
|
||||
TMap<FName, UPW_UserWidget*> WidgetPool;
|
||||
};
|
||||
@ -29,6 +29,7 @@ public:
|
||||
virtual void PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue)override;
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FPW_OnAttributeChanged OnAttributeChanged;
|
||||
|
||||
protected:
|
||||
|
||||
@ -15,11 +15,6 @@ class BUSYRABBIT_API ABusyGameHud : public AHUD, public ILuaOverriderInterface{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual FString GetLuaFilePath_Implementation() const override;
|
||||
|
||||
public:
|
||||
//UFUNCTION(BlueprintCallable)
|
||||
//void PushWidget(const FName& WidgetName);
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FString LuaFilePath;
|
||||
|
||||
@ -63,6 +63,10 @@ public:
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason)override;
|
||||
|
||||
virtual void PostLuaHook() override;
|
||||
|
||||
protected:
|
||||
void InitCapsule();
|
||||
void InitSprite();
|
||||
@ -102,6 +106,9 @@ protected:
|
||||
UPROPERTY()
|
||||
TObjectPtr<UBusyLevelItemAttributeSet> LevelItemAttribute;
|
||||
|
||||
protected:
|
||||
bool bIsBeginPlay;
|
||||
|
||||
public: // 需要蓝图实现的函数
|
||||
// LevelItem被设置时的回调
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
|
||||
Reference in New Issue
Block a user