Compare commits
35 Commits
6fafddc43d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 39b100acff | |||
| 239425c47d | |||
| 60596f2772 | |||
| 648386cd73 | |||
| 56994b3927 | |||
| 8c0623b397 | |||
| dab9990b44 | |||
| fc1078f20c | |||
| 580e7cf72b | |||
| 367ac0bab7 | |||
| 4ae803b4f2 | |||
| 541f89b0b2 | |||
| c89243452d | |||
| bccdc3d231 | |||
| 917322934d | |||
| 1e04c04600 | |||
| ddde270ad5 | |||
| e0d7329905 | |||
| f8a05026d5 | |||
| 696cdd1d11 | |||
| 8c612d19e2 | |||
| 3f8c38b000 | |||
| 089e0a2b2c | |||
| 7e7d2a6474 | |||
| c39b910f83 | |||
| 15a213a5c4 | |||
| 090bd16c67 | |||
| 4bb809b8e3 | |||
| c90b46f430 | |||
| 89d751ac34 | |||
| 4e7f89bd38 | |||
| 11896c87b1 | |||
| be6e40383d | |||
| bda98b0cce | |||
| 626808fde9 |
93
.emmyrc.json
93
.emmyrc.json
@ -1,93 +0,0 @@
|
|||||||
{
|
|
||||||
"completion": {
|
|
||||||
"enable": true,
|
|
||||||
"autoRequire": true,
|
|
||||||
"autoRequireFunction": "require",
|
|
||||||
"autoRequireNamingConvention": "keep",
|
|
||||||
"autoRequireSeparator": ".",
|
|
||||||
"callSnippet": false,
|
|
||||||
"postfix": "@",
|
|
||||||
"baseFunctionIncludesName": true
|
|
||||||
},
|
|
||||||
"diagnostics": {
|
|
||||||
"disable": [
|
|
||||||
"unnecessary-if"
|
|
||||||
],
|
|
||||||
"enable": true,
|
|
||||||
"globals": [],
|
|
||||||
"globalsRegex": [],
|
|
||||||
"severity": {},
|
|
||||||
"enables": [],
|
|
||||||
"diagnosticInterval": 500
|
|
||||||
},
|
|
||||||
"signature": {
|
|
||||||
"detailSignatureHelper": true
|
|
||||||
},
|
|
||||||
"hint": {
|
|
||||||
"enable": true,
|
|
||||||
"paramHint": true,
|
|
||||||
"indexHint": true,
|
|
||||||
"localHint": true,
|
|
||||||
"overrideHint": true,
|
|
||||||
"metaCallHint": true
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"version": "LuaLatest",
|
|
||||||
"requireLikeFunction": [],
|
|
||||||
"frameworkVersions": [],
|
|
||||||
"extensions": [],
|
|
||||||
"requirePattern": [],
|
|
||||||
"classDefaultCall": {
|
|
||||||
"functionName": "",
|
|
||||||
"forceNonColon": false,
|
|
||||||
"forceReturnSelf": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"workspace": {
|
|
||||||
"ignoreDir": [],
|
|
||||||
"ignoreGlobs": [],
|
|
||||||
"library": [],
|
|
||||||
"workspaceRoots": [],
|
|
||||||
"preloadFileSize": 0,
|
|
||||||
"encoding": "utf-8",
|
|
||||||
"moduleMap": [],
|
|
||||||
"reindexDuration": 5000,
|
|
||||||
"enableReindex": false
|
|
||||||
},
|
|
||||||
"resource": {
|
|
||||||
"paths": []
|
|
||||||
},
|
|
||||||
"codeLens": {
|
|
||||||
"enable": true
|
|
||||||
},
|
|
||||||
"strict": {
|
|
||||||
"requirePath": false,
|
|
||||||
"typeCall": false,
|
|
||||||
"arrayIndex": true,
|
|
||||||
"metaOverrideFileDefine": true,
|
|
||||||
"docBaseConstMatchBaseType": true
|
|
||||||
},
|
|
||||||
"semanticTokens": {
|
|
||||||
"enable": true
|
|
||||||
},
|
|
||||||
"references": {
|
|
||||||
"enable": true,
|
|
||||||
"fuzzySearch": true,
|
|
||||||
"shortStringSearch": false
|
|
||||||
},
|
|
||||||
"hover": {
|
|
||||||
"enable": true
|
|
||||||
},
|
|
||||||
"documentColor": {
|
|
||||||
"enable": true
|
|
||||||
},
|
|
||||||
"codeAction": {
|
|
||||||
"insertSpace": false
|
|
||||||
},
|
|
||||||
"inlineValues": {
|
|
||||||
"enable": true
|
|
||||||
},
|
|
||||||
"doc": {
|
|
||||||
"privateName": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
# ---> UnrealEngine
|
# ---> UnrealEngine
|
||||||
# Visual Studio 2015 user specific files
|
# Visual Studio 2015 user specific files
|
||||||
.vs/
|
.vs/
|
||||||
|
.idea/
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
@ -75,3 +76,16 @@ Plugins/**/Intermediate/*
|
|||||||
# Cache files for the editor to use
|
# Cache files for the editor to use
|
||||||
DerivedDataCache/*
|
DerivedDataCache/*
|
||||||
|
|
||||||
|
BusyRabbit.uproject.DotSettings.user
|
||||||
|
|
||||||
|
Plugins/SpinePlugin/Script/SpinePlugin.Glue
|
||||||
|
Script/ManagedBusyRabbit/bin
|
||||||
|
Script/ManagedBusyRabbit/obj
|
||||||
|
Script/ManagedBusyRabbit/Properties
|
||||||
|
Script/BusyRabbit.Glue/bin
|
||||||
|
Script/BusyRabbit.Glue/BusyRabbit
|
||||||
|
Script/BusyRabbit.Glue/obj
|
||||||
|
Script/BusyRabbit.Glue/Properties
|
||||||
|
Script/BusyRabbit.Glue/AssetIds.cs
|
||||||
|
Script/BusyRabbit.Glue/GameplayTags.cs
|
||||||
|
Script/BusyRabbit.Glue/TraceChannel.cs
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"FileVersion": 3,
|
"FileVersion": 3,
|
||||||
"EngineAssociation": "5.4",
|
"EngineAssociation": "5.6",
|
||||||
"Category": "",
|
"Category": "",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Modules": [
|
"Modules": [
|
||||||
@ -9,9 +9,7 @@
|
|||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "Default",
|
"LoadingPhase": "Default",
|
||||||
"AdditionalDependencies": [
|
"AdditionalDependencies": [
|
||||||
"slua_unreal",
|
|
||||||
"Engine",
|
"Engine",
|
||||||
"PaperZD",
|
|
||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"GameplayAbilities",
|
"GameplayAbilities",
|
||||||
"UMG"
|
"UMG"
|
||||||
@ -26,11 +24,6 @@
|
|||||||
"Editor"
|
"Editor"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "PaperZD",
|
|
||||||
"Enabled": true,
|
|
||||||
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/c4b43502026047d89296cd7bffd92828"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "GameplayAbilities",
|
"Name": "GameplayAbilities",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
|
|||||||
@ -15,10 +15,19 @@ ManualIPAddress=
|
|||||||
[/Script/EngineSettings.GameMapsSettings]
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
GlobalDefaultGameMode=/Game/Blueprint/Bp_BusyGameMode.Bp_BusyGameMode_C
|
GlobalDefaultGameMode=/Game/Blueprint/Bp_BusyGameMode.Bp_BusyGameMode_C
|
||||||
GameInstanceClass=/Script/BusyRabbit.BusyGameInstance
|
GameInstanceClass=/Script/BusyRabbit.BusyGameInstance
|
||||||
EditorStartupMap=/Game/Level/HomeLand.HomeLand
|
EditorStartupMap=/Game/Level/FalconPlain.FalconPlain
|
||||||
GameDefaultMap=/Game/Level/HomeLand.HomeLand
|
GameDefaultMap=/Game/Level/FalconPlain.FalconPlain
|
||||||
|
|
||||||
[/Script/Engine.RendererSettings]
|
[/Script/Engine.RendererSettings]
|
||||||
r.Mobile.AntiAliasing=0
|
r.Mobile.AntiAliasing=0
|
||||||
r.AntiAliasingMethod=2
|
r.AntiAliasingMethod=0
|
||||||
|
r.DefaultFeature.MotionBlur=False
|
||||||
|
r.MSAACount=1
|
||||||
|
r.DefaultFeature.AutoExposure=False
|
||||||
|
|
||||||
|
[CoreRedirects]
|
||||||
|
+PropertyRedirects=(OldName="/Script/BusyRabbit.TerrainTileSetConfig.TerrainTileMapping",NewName="/Script/BusyRabbit.TerrainTileSetConfig.n")
|
||||||
|
+PropertyRedirects=(OldName="/Script/BusyRabbit.TerrainLayerComponent.TerrainLayers",NewName="/Script/BusyRabbit.TerrainLayerComponent.TerrainMeshes")
|
||||||
|
+ClassRedirects=(OldName="/Script/BusyRabbit.LevelPlayerController",NewName="/Script/BusyRabbit.LevelPlayerController")
|
||||||
|
+ClassRedirects=(OldName="/Script/BusyRabbit.StaticResource",NewName="/Script/BusyRabbit.BusyStaticResource")
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
;METADATA=(Diff=true, UseCommands=true)
|
||||||
[/Script/GameplayTags.GameplayTagsSettings]
|
[/Script/GameplayTags.GameplayTagsSettings]
|
||||||
ImportTagsFromConfig=True
|
ImportTagsFromConfig=True
|
||||||
WarnOnInvalidTags=True
|
WarnOnInvalidTags=True
|
||||||
@ -5,14 +6,35 @@ ClearInvalidTags=False
|
|||||||
AllowEditorTagUnloading=True
|
AllowEditorTagUnloading=True
|
||||||
AllowGameTagUnloading=False
|
AllowGameTagUnloading=False
|
||||||
FastReplication=False
|
FastReplication=False
|
||||||
|
bDynamicReplication=False
|
||||||
InvalidTagCharacters="\"\',"
|
InvalidTagCharacters="\"\',"
|
||||||
NumBitsForContainerSize=6
|
NumBitsForContainerSize=6
|
||||||
NetIndexFirstBitSegment=16
|
NetIndexFirstBitSegment=16
|
||||||
|
+GameplayTagList=(Tag="Ability.Block.UltimatePlaying",DevComment="大招正在释放中")
|
||||||
|
+GameplayTagList=(Tag="Ability.Common",DevComment="通用技能")
|
||||||
|
+GameplayTagList=(Tag="Ability.Common.Move",DevComment="移动技能")
|
||||||
|
+GameplayTagList=(Tag="Ability.Flags.Cooldown",DevComment="技能冷却")
|
||||||
|
+GameplayTagList=(Tag="Ability.Flags.Recast",DevComment="可以再次释放技能的标记")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox",DevComment="狐狸技能标签")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.CastTag",DevComment="可以释放技能的标签")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.CastTag.Ultimate1",DevComment="可以使用大招第一阶段")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.CastTag.Ultimate2",DevComment="可以使用二阶大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.CastTag.Ultimate3",DevComment="可以使用第三阶段大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.StateTag",DevComment="状态标签")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.StateTag.Ultimate1",DevComment="正在使用第一阶段大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.StateTag.Ultimate2",DevComment="正在使用第二阶段大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.StateTag.Ultimate3",DevComment="正在使用第三阶段大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.UltimateStage1",DevComment="一阶大招")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.UltimateStage2",DevComment="二阶大招就绪标签")
|
||||||
|
+GameplayTagList=(Tag="Ability.Fox.UltimateStage3",DevComment="三阶大招就绪")
|
||||||
|
+GameplayTagList=(Tag="Ability.Recast",DevComment="技能可重新释放标签")
|
||||||
|
+GameplayTagList=(Tag="Ability.Recast.Ultimate",DevComment="大招可重新释放")
|
||||||
+GameplayTagList=(Tag="Ability.Role.AttributeConsume",DevComment="角色属性损耗debuff")
|
+GameplayTagList=(Tag="Ability.Role.AttributeConsume",DevComment="角色属性损耗debuff")
|
||||||
+GameplayTagList=(Tag="Ability.Role.EatFood",DevComment="干饭")
|
+GameplayTagList=(Tag="Ability.Role.EatFood",DevComment="干饭")
|
||||||
+GameplayTagList=(Tag="Ability.Role.Pick",DevComment="角色采集物品")
|
+GameplayTagList=(Tag="Ability.Role.Pick",DevComment="角色采集物品")
|
||||||
+GameplayTagList=(Tag="Ability.Role.Recover",DevComment="角色状态恢复技能")
|
+GameplayTagList=(Tag="Ability.Role.Recover",DevComment="角色状态恢复技能")
|
||||||
+GameplayTagList=(Tag="Ability.Role.Roll",DevComment="角色无敌翻滚")
|
+GameplayTagList=(Tag="Ability.Role.Roll",DevComment="角色无敌翻滚")
|
||||||
|
+GameplayTagList=(Tag="Ability.Role.Ultimate",DevComment="角色大招")
|
||||||
+GameplayTagList=(Tag="Buff.Indispersible.HungerConsume",DevComment="饥饿值消耗,不可被驱散")
|
+GameplayTagList=(Tag="Buff.Indispersible.HungerConsume",DevComment="饥饿值消耗,不可被驱散")
|
||||||
+GameplayTagList=(Tag="Buff.RoleConsume.Health",DevComment="角色因饥饿掉血的debuff")
|
+GameplayTagList=(Tag="Buff.RoleConsume.Health",DevComment="角色因饥饿掉血的debuff")
|
||||||
+GameplayTagList=(Tag="Buff.RoleConsume.Hunger",DevComment="角色每秒钟的饥饿消耗")
|
+GameplayTagList=(Tag="Buff.RoleConsume.Hunger",DevComment="角色每秒钟的饥饿消耗")
|
||||||
@ -25,6 +47,8 @@ NetIndexFirstBitSegment=16
|
|||||||
+GameplayTagList=(Tag="CookProcess.Diced",DevComment="切丁")
|
+GameplayTagList=(Tag="CookProcess.Diced",DevComment="切丁")
|
||||||
+GameplayTagList=(Tag="CookProcess.Mashed",DevComment="切泥")
|
+GameplayTagList=(Tag="CookProcess.Mashed",DevComment="切泥")
|
||||||
+GameplayTagList=(Tag="CookProcess.Sliced",DevComment="切片操作")
|
+GameplayTagList=(Tag="CookProcess.Sliced",DevComment="切片操作")
|
||||||
|
+GameplayTagList=(Tag="Effect.Duration",DevComment="效果的持续时长")
|
||||||
|
+GameplayTagList=(Tag="Effect.Factor",DevComment="效果的乘法系数")
|
||||||
+GameplayTagList=(Tag="GameItem.Building",DevComment="建筑物")
|
+GameplayTagList=(Tag="GameItem.Building",DevComment="建筑物")
|
||||||
+GameplayTagList=(Tag="GameItem.Food",DevComment="游戏内的可食用物品")
|
+GameplayTagList=(Tag="GameItem.Food",DevComment="游戏内的可食用物品")
|
||||||
+GameplayTagList=(Tag="Ingredient",DevComment="烹饪食材")
|
+GameplayTagList=(Tag="Ingredient",DevComment="烹饪食材")
|
||||||
@ -34,5 +58,18 @@ NetIndexFirstBitSegment=16
|
|||||||
+GameplayTagList=(Tag="Ingredient.Vegetable.Carrot",DevComment="胡萝卜")
|
+GameplayTagList=(Tag="Ingredient.Vegetable.Carrot",DevComment="胡萝卜")
|
||||||
+GameplayTagList=(Tag="Recover.Role.Health",DevComment="回复生命值")
|
+GameplayTagList=(Tag="Recover.Role.Health",DevComment="回复生命值")
|
||||||
+GameplayTagList=(Tag="Recover.Role.Hunger",DevComment="恢复饥饿值")
|
+GameplayTagList=(Tag="Recover.Role.Hunger",DevComment="恢复饥饿值")
|
||||||
|
+GameplayTagList=(Tag="Resource",DevComment="资源")
|
||||||
|
+GameplayTagList=(Tag="Resource.Building",DevComment="建筑物")
|
||||||
|
+GameplayTagList=(Tag="Resource.Building.Campsite",DevComment="营地")
|
||||||
+GameplayTagList=(Tag="Status.Role.Invincible",DevComment="不掉血标签")
|
+GameplayTagList=(Tag="Status.Role.Invincible",DevComment="不掉血标签")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Desert",DevComment="荒漠地形")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Forest",DevComment="森林")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Grassland",DevComment="草地")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Land",DevComment="土地")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Swamp",DevComment="沼泽")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Swamp.Land",DevComment="沼泽陆地")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Swamp.Water",DevComment="沼泽水域")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Water",DevComment="水体")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Water.Deep",DevComment="深水区")
|
||||||
|
+GameplayTagList=(Tag="Terrain.Water.Shallow",DevComment="浅水区")
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/RoamingCamera.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/RoamingCamera.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Role/BP_Fox.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Role/BP_Fox.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Role/BP_Rabbit.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Role/BP_Rabbit.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Static/BP_Campsite.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Static/BP_Campsite.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Static/BP_Carrot.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Static/BP_Carrot.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Static/BP_Stone.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Static/BP_Stone.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/Actor/Static/BP_Tree.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Static/BP_Tree.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/BP_LevelMap.uasset
Normal file
BIN
Content/Blueprint/Level/BP_LevelMap.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelGameMode.uasset
Normal file
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelGameMode.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelGameState.uasset
Normal file
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelGameState.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelPlayerState.uasset
Normal file
BIN
Content/Blueprint/Level/GameMode/BP_BusyLevelPlayerState.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Ability/FoxUltimateDataAsset.uasset
Normal file
BIN
Content/Data/Ability/FoxUltimateDataAsset.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Data/Homeland/PreCookItemConfig.uasset
Normal file
BIN
Content/Data/Homeland/PreCookItemConfig.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Homeland/Hearth/IA_PreCookTouchBegin.uasset
Normal file
BIN
Content/Data/Input/Homeland/Hearth/IA_PreCookTouchBegin.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Homeland/Hearth/IA_PreCookTouchEnd.uasset
Normal file
BIN
Content/Data/Input/Homeland/Hearth/IA_PreCookTouchEnd.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Data/Input/Level/IA_CameraDetach.uasset
Normal file
BIN
Content/Data/Input/Level/IA_CameraDetach.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Level/IA_Move.uasset
Normal file
BIN
Content/Data/Input/Level/IA_Move.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Level/IA_SwitchRole.uasset
Normal file
BIN
Content/Data/Input/Level/IA_SwitchRole.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Level/IA_UltimateSkill.uasset
Normal file
BIN
Content/Data/Input/Level/IA_UltimateSkill.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Input/Level/IMC_PlayerInputContext.uasset
Normal file
BIN
Content/Data/Input/Level/IMC_PlayerInputContext.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Data/Level/LevelResourceConfig.uasset
Normal file
BIN
Content/Data/Level/LevelResourceConfig.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Level/LevelRoleBaseConfig.uasset
Normal file
BIN
Content/Data/Level/LevelRoleBaseConfig.uasset
Normal file
Binary file not shown.
BIN
Content/Data/Level/LevelStaticResourceGenerateConfig.uasset
Normal file
BIN
Content/Data/Level/LevelStaticResourceGenerateConfig.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Ability/Role/Common/GA_MoveAbility.uasset
Normal file
BIN
Content/Gas/Ability/Role/Common/GA_MoveAbility.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset
Normal file
BIN
Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Calc/MMC_FoxUltimateCostCalc.uasset
Normal file
BIN
Content/Gas/Effects/Calc/MMC_FoxUltimateCostCalc.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_Accelerate.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_Accelerate.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateRecast.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateRecast.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,38 +0,0 @@
|
|||||||
---@enum EBusyRoleState
|
|
||||||
local EBusyRoleState = {
|
|
||||||
BonfireIdle = 0,
|
|
||||||
Searching = 1,
|
|
||||||
Picking = 2,
|
|
||||||
PickFinished = 3,
|
|
||||||
BackBonfire = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
---@enum ERoleMoveDirection
|
|
||||||
local ERoleMoveDirection = {
|
|
||||||
Move_Right = 0,
|
|
||||||
Move_Left = 1,
|
|
||||||
Move_All_Cnt = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
---@enum EBusyItemEffectType
|
|
||||||
local EBusyItemEffectType = {
|
|
||||||
Health = 0,
|
|
||||||
Hunger = 1,
|
|
||||||
Speed = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
---@enum EBusyAnimationPhase
|
|
||||||
local EBusyAnimationPhase = {
|
|
||||||
PrepareCast = 0,
|
|
||||||
Casting = 1,
|
|
||||||
PostCast = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
---@enum EWidgetLayoutType
|
|
||||||
local EWidgetLayoutType = {
|
|
||||||
MainLayer = 0,
|
|
||||||
PopupLayer = 1,
|
|
||||||
FloatLayer = 2,
|
|
||||||
TopLayer = 3,
|
|
||||||
LayerTypeMax = 4
|
|
||||||
};
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
-- 这个返回值固定返回的是string,我希望当我使用import("ERoleState")时,它返回的是ERoleState的注解,或者是ERoleState.lua这个文件返回值的注解
|
|
||||||
-- ---自定义导入函数,功能类似require但支持额外特性
|
|
||||||
-- ---@generic T
|
|
||||||
-- ---@param modulePath T 模块路径或预加载的模块
|
|
||||||
-- ---@param hotReload? boolean 是否启用热重载
|
|
||||||
-- ---@return T 返回加载的模块
|
|
||||||
-- function import(modulePath, hotReload) end
|
|
||||||
|
|
||||||
|
|
||||||
---自定义模块导入函数,支持类型感知的模块加载
|
|
||||||
---@generic T : string -- 限定modulePath为字符串类型
|
|
||||||
---@param modulePath `T` 模块路径(如"ERoleState")
|
|
||||||
---@param hotReload? boolean 是否启用热重载
|
|
||||||
---@return T 返回对应模块的类型
|
|
||||||
---@error 当模块加载失败时抛出错误
|
|
||||||
function import(modulePath, hotReload) end
|
|
||||||
|
|
||||||
|
|
||||||
function Class(a, b, c) end
|
|
||||||
|
|
||||||
---@class slua
|
|
||||||
slua = {
|
|
||||||
createDelegate = function(func) end
|
|
||||||
}
|
|
||||||
|
|
||||||
--- @class KismetSystemLibrary
|
|
||||||
KismetSystemLibrary = {
|
|
||||||
K2_ClearTimerHandle = function() end
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
---@enum ESlateVisibility
|
|
||||||
local ESlateVisibility = {
|
|
||||||
Visible = 0,
|
|
||||||
Collapsed = 1,
|
|
||||||
Hidden = 2,
|
|
||||||
HitTestInvisible = 3,
|
|
||||||
SelfHitTestInvisible = 4
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,222 +0,0 @@
|
|||||||
#ifndef LIBPDEBUG_H
|
|
||||||
#define LIBPDEBUG_H
|
|
||||||
|
|
||||||
//1.使用源码编译,要打开宏USE_SOURCE_CODE. win下要设置LUA_INTEGER和lua版本号
|
|
||||||
#define LUA_DEBUGGER_NAME "LuaPanda" //debugger's name in LuaDebug.lua
|
|
||||||
#define HOOK_LIB_VERSION "3.2.0" //lib version
|
|
||||||
//#define USE_SOURCE_CODE //using source code to build
|
|
||||||
#if !defined(USE_SOURCE_CODE) && defined(_WIN32)
|
|
||||||
#define LUA_INTEGER long long //set LUA_INTEGER. In 501 is ptrdiff_t. 503 can set longlong(64bit) or int(32bit)
|
|
||||||
#define LUA_VERSION_NUM 503 //lua version used by WIN32 build lib. eg. 501,503
|
|
||||||
#endif
|
|
||||||
//setting end
|
|
||||||
|
|
||||||
#if !defined(USE_SOURCE_CODE) && defined(_WIN32)
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <Tlhelp32.h>
|
|
||||||
#else
|
|
||||||
//2.如果lua源码是C++形式,注释掉下面extern "C"
|
|
||||||
extern "C"{
|
|
||||||
#include "lua.h"
|
|
||||||
#include "lualib.h"
|
|
||||||
#include "lauxlib.h"
|
|
||||||
#include "luaconf.h"
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//3.如果lua代码在命名空间中,要设置用户命名空间. 防止找不到lua方法
|
|
||||||
//using namespace slua;
|
|
||||||
|
|
||||||
#ifdef USE_SOURCE_CODE
|
|
||||||
extern "C" void pdebug_init(lua_State* L);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(USE_SOURCE_CODE) && defined(_WIN32)
|
|
||||||
/*
|
|
||||||
** Lua - An Extensible Extension Language
|
|
||||||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
|
||||||
** See Copyright Notice at the end of this file
|
|
||||||
*/
|
|
||||||
#if LUA_VERSION_NUM == 501
|
|
||||||
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LUA_TNONE (-1)
|
|
||||||
#define LUA_TNIL 0
|
|
||||||
#define LUA_TBOOLEAN 1
|
|
||||||
#define LUA_TLIGHTUSERDATA 2
|
|
||||||
#define LUA_TNUMBER 3
|
|
||||||
#define LUA_TSTRING 4
|
|
||||||
#define LUA_TTABLE 5
|
|
||||||
#define LUA_TFUNCTION 6
|
|
||||||
#define LUA_TUSERDATA 7
|
|
||||||
#define LUA_TTHREAD 8
|
|
||||||
#define LUA_NUMBER double
|
|
||||||
#define LUA_REGISTRYINDEX (-10000)
|
|
||||||
#define LUA_ENVIRONINDEX (-10001)
|
|
||||||
#define LUA_GLOBALSINDEX (-10002)
|
|
||||||
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
|
|
||||||
#define LUA_IDSIZE 60
|
|
||||||
#define LUA_HOOKCALL 0
|
|
||||||
#define LUA_HOOKRET 1
|
|
||||||
#define LUA_HOOKLINE 2
|
|
||||||
#define LUA_HOOKCOUNT 3
|
|
||||||
#define LUA_HOOKTAILRET 4
|
|
||||||
#define LUA_MASKCALL (1 << LUA_HOOKCALL)
|
|
||||||
#define LUA_MASKRET (1 << LUA_HOOKRET)
|
|
||||||
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
|
|
||||||
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
|
|
||||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
|
||||||
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
|
|
||||||
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
|
|
||||||
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
|
|
||||||
#define lua_pop(L,n) lua_settop(L, -(n)-1)
|
|
||||||
#define lua_newtable(L) lua_createtable(L, 0, 0)
|
|
||||||
|
|
||||||
struct lua_State;
|
|
||||||
struct lua_Debug {
|
|
||||||
int event;
|
|
||||||
const char *name; /* (n) */
|
|
||||||
const char *namewhat; /* (n) `global', `local', `field', `method' */
|
|
||||||
const char *what; /* (S) `Lua', `C', `main', `tail' */
|
|
||||||
const char *source; /* (S) */
|
|
||||||
int currentline; /* (l) */
|
|
||||||
int nups; /* (u) number of upvalues */
|
|
||||||
int linedefined; /* (S) */
|
|
||||||
int lastlinedefined; /* (S) */
|
|
||||||
char short_src[LUA_IDSIZE]; /* (S) */
|
|
||||||
/* private part */
|
|
||||||
int i_ci; /* active function */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef LUA_INTEGER lua_Integer;
|
|
||||||
typedef LUA_NUMBER lua_Number;
|
|
||||||
typedef int (*lua_CFunction) (lua_State *L);
|
|
||||||
typedef struct luaL_Reg {
|
|
||||||
const char *name;
|
|
||||||
lua_CFunction func;
|
|
||||||
} luaL_Reg;
|
|
||||||
|
|
||||||
#define LUA_KCONTEXT ptrdiff_t
|
|
||||||
typedef LUA_KCONTEXT lua_KContext;
|
|
||||||
|
|
||||||
//lua function
|
|
||||||
typedef lua_Integer(*luaDLL_checkinteger) (lua_State *L, int numArg);
|
|
||||||
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
|
|
||||||
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
|
|
||||||
typedef const lua_Number *(*luaDLL_version)(lua_State *L);
|
|
||||||
typedef void (*luaLDLL_register)(lua_State *L, const char *libname, const luaL_Reg *l);
|
|
||||||
typedef int (*luaDLL_gettop)(lua_State *L);
|
|
||||||
typedef const char *(*luaDLL_pushstring)(lua_State *L, const char *s);
|
|
||||||
typedef int (*luaDLL_settop)(lua_State *L, int idx);
|
|
||||||
typedef int (*luaDLL_tointeger)(lua_State *L, int idx);
|
|
||||||
typedef int (*luaDLL_next)(lua_State *L, int idx);
|
|
||||||
typedef int (*luaDLL_pcall)(lua_State *L, int nargs, int nresults, int errfunc);
|
|
||||||
typedef void (*luaDLL_pushnil)(lua_State *L);
|
|
||||||
typedef void (*luaDLL_getfield)(lua_State *L, int idx, const char *k);
|
|
||||||
typedef int (*luaDLL_getinfo)(lua_State *L, const char *what, void *ar);
|
|
||||||
typedef void (*luaDLL_pushinteger) (lua_State *L, lua_Integer n);
|
|
||||||
#if LUA_VERSION_NUM == 501
|
|
||||||
typedef int(*luaDLL_sethook)(lua_State *L, void* func, int mask, int count);
|
|
||||||
#else
|
|
||||||
typedef void (*luaDLL_sethook)(lua_State *L, lua_Hook f, int mask, int count);
|
|
||||||
#endif
|
|
||||||
typedef void (*luaDLL_pushnumber)(lua_State *L, lua_Number n);
|
|
||||||
typedef lua_Number (*luaDLL_checknumber)(lua_State *L, int narg);
|
|
||||||
typedef const char *(*luaDLL_checklstring)(lua_State *L, int narg, size_t *len);
|
|
||||||
typedef const char *(*luaDLL_tolstring)(lua_State *L, int idx, size_t *len);
|
|
||||||
typedef int (*luaDLL_type)(lua_State *L, int idx);
|
|
||||||
//5.3
|
|
||||||
typedef void (*luaDLL_createtable)(lua_State *L, int narray, int nrec);
|
|
||||||
typedef void (*luaDLL_setfuncs)(lua_State *L, const luaL_Reg *l, int nup);
|
|
||||||
typedef lua_Integer(*luaDLL_tointegerx)(lua_State *L, int idx, int *pisnum);
|
|
||||||
typedef int (*luaDLL_getglobal)(lua_State *L, const char *name);
|
|
||||||
typedef int (*luaDLL_pcallk)(lua_State *L, int nargs, int nresults, int msgh, lua_KContext ctx, lua_KFunction k);
|
|
||||||
typedef int (*luaDLL_toboolean)(lua_State *L, int index);
|
|
||||||
|
|
||||||
luaDLL_checkinteger luaL_checkinteger;
|
|
||||||
luaDLL_version lua_version;
|
|
||||||
luaDLL_gettop lua_gettop;
|
|
||||||
luaDLL_pushstring lua_pushstring;
|
|
||||||
luaLDLL_register luaL_register;
|
|
||||||
luaDLL_settop lua_settop;
|
|
||||||
luaDLL_pcall lua_pcall;
|
|
||||||
luaDLL_pushnumber lua_pushnumber;
|
|
||||||
luaDLL_checklstring luaL_checklstring;
|
|
||||||
luaDLL_tointeger lua_tointeger;
|
|
||||||
luaDLL_pushnil lua_pushnil;
|
|
||||||
luaDLL_getfield lua_getfield;
|
|
||||||
luaDLL_next lua_next;
|
|
||||||
luaDLL_getinfo lua_getinfo;
|
|
||||||
luaDLL_sethook lua_sethook;
|
|
||||||
luaDLL_checknumber luaL_checknumber;
|
|
||||||
luaDLL_type lua_type;
|
|
||||||
luaDLL_tolstring lua_tolstring;
|
|
||||||
luaDLL_pushinteger lua_pushinteger;
|
|
||||||
luaDLL_toboolean lua_toboolean;
|
|
||||||
//
|
|
||||||
HMODULE hInstLibrary;
|
|
||||||
|
|
||||||
//slua-ue header
|
|
||||||
#if LUA_VERSION_NUM > 501
|
|
||||||
//5.3
|
|
||||||
luaDLL_createtable lua_createtable;
|
|
||||||
luaDLL_setfuncs luaL_setfuncs;
|
|
||||||
luaDLL_tointegerx lua_tointegerx;
|
|
||||||
luaDLL_getglobal lua_getglobal;
|
|
||||||
luaDLL_pcallk lua_pcallk;
|
|
||||||
#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
|
|
||||||
#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL);
|
|
||||||
|
|
||||||
#define PURE_API =0
|
|
||||||
namespace slua {
|
|
||||||
struct LuaInterface {
|
|
||||||
virtual const lua_Number *lua_version(lua_State *L) PURE_API;
|
|
||||||
virtual const char *lua_pushstring(lua_State *L, const char *s) PURE_API;
|
|
||||||
virtual int lua_gettop(lua_State *L) PURE_API;
|
|
||||||
virtual void lua_settop(lua_State *L, int index) PURE_API;
|
|
||||||
virtual int lua_pcallk(lua_State *L, int nargs, int nresults, int msgh, lua_KContext ctx, lua_KFunction k) PURE_API;
|
|
||||||
virtual void lua_pushnumber(lua_State *L, lua_Number n) PURE_API;
|
|
||||||
virtual const char *luaL_checklstring(lua_State *L, int arg, size_t *l) PURE_API;
|
|
||||||
virtual const char *lua_tolstring(lua_State *L, int index, size_t *len) PURE_API;
|
|
||||||
virtual int lua_type(lua_State *L, int index) PURE_API;
|
|
||||||
virtual lua_Integer lua_tointegerx(lua_State *L, int index, int *isnum) PURE_API;
|
|
||||||
virtual void lua_pushnil(lua_State *L) PURE_API;
|
|
||||||
virtual int lua_getfield(lua_State *L, int index, const char *k) PURE_API;
|
|
||||||
virtual int lua_next(lua_State *L, int index) PURE_API;
|
|
||||||
virtual int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) PURE_API;
|
|
||||||
virtual void lua_sethook(lua_State *L, lua_Hook f, int mask, int count) PURE_API;
|
|
||||||
virtual lua_Number luaL_checknumber(lua_State *L, int arg) PURE_API;
|
|
||||||
virtual void lua_createtable(lua_State *L, int narr, int nrec) PURE_API;
|
|
||||||
virtual void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) PURE_API;
|
|
||||||
virtual int lua_getglobal(lua_State *L, const char *name) PURE_API;
|
|
||||||
virtual int lua_toboolean(lua_State *L, int index) PURE_API;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
typedef slua::LuaInterface* (*dll_GetLuaInterface)();
|
|
||||||
dll_GetLuaInterface getInter;
|
|
||||||
#endif //LUA_VERSION_NUM > 501
|
|
||||||
#endif //_WIN32
|
|
||||||
#endif //LIBPDEBUG_H
|
|
||||||
/******************************************************************************
|
|
||||||
* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
******************************************************************************/
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
local Bonfire = {}
|
|
||||||
local GamePlayUtils = require("GamePlay.Utils")
|
|
||||||
local Utils = require("GamePlay.Utils")
|
|
||||||
|
|
||||||
local item_effect_health_tag = "Change.Role.Health"
|
|
||||||
local item_effect_hunger_tag = "Change.Role.Health"
|
|
||||||
|
|
||||||
|
|
||||||
function Bonfire:ctor()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Bonfire:ReceiveBeginPlay()
|
|
||||||
self.Inventory:SetInventoryCapacity(20)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Bonfire:StoreItem(item_id)
|
|
||||||
return self.Inventory:DepositItems(item_id, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return Class(nil, nil, Bonfire)
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
-- 禁用不必要的if诊断警告
|
|
||||||
---@diagnostic disable: unnecessary-if
|
|
||||||
|
|
||||||
-- 导入基类模块
|
|
||||||
local PWClass = require("Core.PWClass")
|
|
||||||
|
|
||||||
--- @class StorageClass
|
|
||||||
--- @field max_capacity number 最大容量(格子总数)
|
|
||||||
--- @field cur_capacity number 当前已用容量
|
|
||||||
--- @field grids_list table[] 存储格子列表
|
|
||||||
local StorageClass = PWClass.derive("StorageClass")
|
|
||||||
|
|
||||||
--- 创建新物品格子
|
|
||||||
--- @param item_id any 物品唯一标识
|
|
||||||
--- @return table 新创建的物品格子
|
|
||||||
local function CreateGrid(item_id)
|
|
||||||
return {
|
|
||||||
item_id = item_id, -- 物品ID
|
|
||||||
cur_cnt = 0, -- 当前数量
|
|
||||||
max_cnt = 1 -- 最大堆叠数(可扩展为配置项)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 查找或创建可用物品格子
|
|
||||||
--- @param storage StorageClass 存储实例
|
|
||||||
--- @param item_id any 目标物品ID
|
|
||||||
--- @return table 可用格子(找不到时创建新格子)
|
|
||||||
local function FindOrCreateAvailableGrid(storage, item_id)
|
|
||||||
-- 优先查找同类型且未满的格子
|
|
||||||
for _, grid in ipairs(storage.grids_list) do
|
|
||||||
if grid.item_id == item_id and grid.cur_cnt < grid.max_cnt then
|
|
||||||
return grid
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 无可用格子时创建新的物品类型格子
|
|
||||||
local new_grid = CreateGrid(item_id)
|
|
||||||
table.insert(storage.grids_list, new_grid)
|
|
||||||
return new_grid
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 构造函数
|
|
||||||
function StorageClass:ctor()
|
|
||||||
self.max_capacity = 10 -- 默认最大容量
|
|
||||||
self.cur_capacity = 0 -- 当前使用容量
|
|
||||||
self.grids_list = {} -- 格子容器
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 设置存储容量上限
|
|
||||||
--- @param capacity number 新的最大容量
|
|
||||||
function StorageClass:SetMaxCapacity(capacity)
|
|
||||||
self.max_capacity = capacity
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 存储物品
|
|
||||||
--- @param item_id any 要存储的物品ID
|
|
||||||
function StorageClass:Store(item_id)
|
|
||||||
-- 容量检查
|
|
||||||
if self.cur_capacity >= self.max_capacity then
|
|
||||||
return false -- 建议返回操作结果
|
|
||||||
end
|
|
||||||
|
|
||||||
local grid = FindOrCreateAvailableGrid(self, item_id)
|
|
||||||
grid.cur_cnt = grid.cur_cnt + 1
|
|
||||||
self.cur_capacity = self.cur_capacity + 1
|
|
||||||
return true -- 建议添加返回值
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 取出物品
|
|
||||||
--- @param item_id any 目标物品ID
|
|
||||||
--- @return boolean 是否成功取出
|
|
||||||
function StorageClass:Withdraw(item_id)
|
|
||||||
-- 逆序遍历提高取出效率(通常新物品在末尾)
|
|
||||||
for i = #self.grids_list, 1, -1 do
|
|
||||||
local grid = self.grids_list[i]
|
|
||||||
if grid ~= nil and grid.item_id == item_id and grid.cur_cnt > 0 then
|
|
||||||
grid.cur_cnt = grid.cur_cnt - 1
|
|
||||||
self.cur_capacity = self.cur_capacity - 1
|
|
||||||
|
|
||||||
-- 清空空格子
|
|
||||||
if grid.cur_cnt == 0 then
|
|
||||||
table.remove(self.grids_list, i)
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function StorageClass:Visit(vistor)
|
|
||||||
for _, grid in ipairs(self.grids_list) do vistor(_, grid) end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 查询物品(满足条件的物品及数量)
|
|
||||||
--- @param query_function fun(item_id:any):boolean 物品过滤函数
|
|
||||||
--- @return table 物品ID到数量的映射表
|
|
||||||
function StorageClass:QueryItem(query_function)
|
|
||||||
local items = {}
|
|
||||||
for _, grid in ipairs(self.grids_list) do
|
|
||||||
-- 仅统计有物品且满足查询条件的格子
|
|
||||||
if grid.cur_cnt > 0 and query_function(grid.item_id) then
|
|
||||||
items[grid.item_id] = (items[grid.item_id] or 0) + grid.cur_cnt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return items
|
|
||||||
end
|
|
||||||
|
|
||||||
return StorageClass
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
local PlayerState = {}
|
|
||||||
|
|
||||||
function PlayerState:ctor()
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function PlayerState:ReceiveBeginPlay()
|
|
||||||
print(self, "PlayerState:ReceiveBeginPlay")
|
|
||||||
end
|
|
||||||
|
|
||||||
function PlayerState:ReceiveEndPlay()
|
|
||||||
print(self, "PlayerState:ReceiveEndPlay")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Class(nil, nil, PlayerState)
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
local FVector = import "Vector"
|
|
||||||
local Vector2D = require("Utils.Vector2D")
|
|
||||||
local Library = import "BusyGamePlayLibrary"
|
|
||||||
local GameplayStatics = import("GameplayStatics")
|
|
||||||
|
|
||||||
local SubSystem = {}
|
|
||||||
|
|
||||||
local function GetNearestBonfire(system, x, y)
|
|
||||||
local selected_bonfire = nil
|
|
||||||
local selected_distance = nil
|
|
||||||
|
|
||||||
for _, bonfire in ipairs(system.bonfire_list) do
|
|
||||||
local pos = bonfire:K2_GetActorLocation()
|
|
||||||
local distance = (x - pos.X) ^ 2 + (y - pos.Y) ^ 2
|
|
||||||
if selected_distance == nil or distance < selected_distance then
|
|
||||||
selected_distance = distance
|
|
||||||
selected_bonfire = bonfire
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return selected_bonfire
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:ctor()
|
|
||||||
self.current_role = nil
|
|
||||||
self.bonfire_list = {} -- 所有的篝火列表
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:ReceiveSubSystemInitialize()
|
|
||||||
self.current_role = nil
|
|
||||||
self.bonfire_list = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:GetNearestBonfire()
|
|
||||||
if self.current_role then
|
|
||||||
local cur_pos = self.current_role:K2_GetActorLocation()
|
|
||||||
return GetNearestBonfire(self, cur_pos.X, cur_pos.Y)
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:SpawnBonfire(position)
|
|
||||||
local pos = FVector()
|
|
||||||
local world = self:K2_GetWorld()
|
|
||||||
local cls = Library.GetGameClass("Bonfire")
|
|
||||||
pos.X, pos.Y, pos.Z = position.X, position.Y, 20
|
|
||||||
local bonfire = world:SpawnActor(cls, pos, nil, nil)
|
|
||||||
table.insert(self.bonfire_list, bonfire)
|
|
||||||
return bonfire
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:SpawnRole(bonfire)
|
|
||||||
local role_pos = FVector()
|
|
||||||
local world = self:K2_GetWorld()
|
|
||||||
local pos = bonfire:K2_GetActorLocation()
|
|
||||||
local cls = Library.GetGameClass("BusyRole")
|
|
||||||
role_pos.X, role_pos.Y, role_pos.Z = pos.X, pos.Y, pos.Z + 10
|
|
||||||
self.current_role = world:SpawnActor(cls, role_pos, nil, nil)
|
|
||||||
if self.current_role ~= nil then
|
|
||||||
self.current_role:SetRole("Rabbit")
|
|
||||||
return self.current_role
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:SpawnLevelItem(item_id)
|
|
||||||
-- 随机在角色周围生成
|
|
||||||
|
|
||||||
local distance = math.random(128, 500)
|
|
||||||
local angle = (math.random(0, 360) / 360) * 2 * 3.14;
|
|
||||||
|
|
||||||
local world = self:K2_GetWorld()
|
|
||||||
local item_position = FVector()
|
|
||||||
local center = self.current_role:K2_GetActorLocation()
|
|
||||||
local cls = import("BusyLevelItem")
|
|
||||||
|
|
||||||
item_position.Z = center.Z - 1
|
|
||||||
item_position.X = center.X + math.cos(angle) * distance
|
|
||||||
item_position.Y = center.Y + math.sin(angle) * distance
|
|
||||||
|
|
||||||
local item = world:SpawnActor(cls, item_position, nil, nil)
|
|
||||||
item:SetLevelItemID(item_id)
|
|
||||||
return center
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:SpawnLevelItemReward(level_item)
|
|
||||||
assert(self.current_role ~= nil)
|
|
||||||
|
|
||||||
local world = self:K2_GetWorld()
|
|
||||||
local cls = Library.GetGameClass("LevelItemReward")
|
|
||||||
|
|
||||||
local random_angle = (math.random() - 0.5) * (math.pi / 2)
|
|
||||||
local direction = Vector2D.Normalize(self.current_role:GetMoveDirection())
|
|
||||||
|
|
||||||
local sin, cos = math.sin(random_angle), math.cos(random_angle)
|
|
||||||
|
|
||||||
-- 应用旋转矩阵
|
|
||||||
direction.X = direction.X * cos - direction.Y * sin
|
|
||||||
direction.Y = direction.X * sin + direction.Y * cos
|
|
||||||
|
|
||||||
local item_location = level_item:K2_GetActorLocation()
|
|
||||||
|
|
||||||
local reward_location = Vector2D.Add(item_location, Vector2D.Mul(direction, 200))
|
|
||||||
|
|
||||||
local item = world:SpawnActor(cls,
|
|
||||||
Vector2D.ToUnrealEngine3D(reward_location, item_location.Z),
|
|
||||||
nil, nil
|
|
||||||
)
|
|
||||||
return item
|
|
||||||
end
|
|
||||||
|
|
||||||
return Class(nil, nil, SubSystem)
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
---@class ItemGenerator 物品生成器类
|
|
||||||
local ItemGenerator = {
|
|
||||||
item_data = {},
|
|
||||||
period = 100,
|
|
||||||
item_distributions = {}
|
|
||||||
}
|
|
||||||
ItemGenerator.__index = ItemGenerator
|
|
||||||
|
|
||||||
---数组洗牌函数(Fisher-Yates算法)
|
|
||||||
---@param array any[] 需要打乱顺序的数组
|
|
||||||
local function ShuffleArray(array)
|
|
||||||
for i = #array, 2, -1 do -- 从后往前遍历
|
|
||||||
local j = math.random(i) -- 生成1到i的随机数
|
|
||||||
array[i], array[j] = array[j], array[i] -- 交换元素位置
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---创建物品生成器实例
|
|
||||||
---@param period number 生成周期次数
|
|
||||||
---@param item_data table<number, number> 物品配置表 {物品ID = 总生成数量}
|
|
||||||
---@return ItemGenerator 物品生成器实例
|
|
||||||
local function CreateItemGenerator(period, item_data)
|
|
||||||
local self = setmetatable({}, ItemGenerator)
|
|
||||||
---@type number 存储生成周期
|
|
||||||
self.period = period
|
|
||||||
---@type table<number, number> 原始配置数据
|
|
||||||
self.item_data = item_data
|
|
||||||
---@type number 当前调用次数
|
|
||||||
self.current_call = 0
|
|
||||||
---@type table<number, number[]> 物品分布数据结构
|
|
||||||
self.item_distributions = {}
|
|
||||||
self:InitializeDistributions()
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
---初始化物品分布数据
|
|
||||||
function ItemGenerator:InitializeDistributions()
|
|
||||||
-- 遍历所有物品配置
|
|
||||||
for item_id, total in pairs(self.item_data) do
|
|
||||||
-- 计算基础值和余数(保证总数 = 基础值*period + 余数)
|
|
||||||
local base = math.floor(total / self.period)
|
|
||||||
local remainder = total % self.period
|
|
||||||
|
|
||||||
-- 创建初始分布数组(全部填充基础值)
|
|
||||||
local distribution = {}
|
|
||||||
for i = 1, self.period do
|
|
||||||
distribution[i] = base
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 生成索引数组并洗牌(用于随机分配余数)
|
|
||||||
local indices = {}
|
|
||||||
for i = 1, self.period do
|
|
||||||
indices[i] = i
|
|
||||||
end
|
|
||||||
ShuffleArray(indices) -- 打乱索引顺序
|
|
||||||
|
|
||||||
-- 将余数随机分配到前remainder个位置
|
|
||||||
for i = 1, remainder do
|
|
||||||
distribution[indices[i]] = distribution[indices[i]] + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 存储当前物品的分布数组
|
|
||||||
self.item_distributions[item_id] = distribution
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---重置生成器状态(当调用次数超过N时触发)
|
|
||||||
function ItemGenerator:Reinitialize()
|
|
||||||
self:InitializeDistributions() -- 重新生成分布数据
|
|
||||||
self.current_call = 0 -- 重置调用计数器
|
|
||||||
end
|
|
||||||
|
|
||||||
---生成物品列表(每次调用产生一个周期的结果)
|
|
||||||
---@return number[] 包含物品ID的数组(结果经过随机排序)
|
|
||||||
function ItemGenerator:Generate()
|
|
||||||
-- 当超过周期次数时重置状态
|
|
||||||
if self.current_call >= self.period then
|
|
||||||
self:Reinitialize()
|
|
||||||
end
|
|
||||||
|
|
||||||
local current_step = self.current_call + 1 -- 获取当前步骤(1-based)
|
|
||||||
local result = {} -- 结果收集器
|
|
||||||
|
|
||||||
-- 遍历所有物品的分布数据
|
|
||||||
for item_id, distribution in pairs(self.item_distributions) do
|
|
||||||
local count = distribution[current_step] -- 获取当前步骤应生成数量
|
|
||||||
for _ = 1, count do
|
|
||||||
table.insert(result, item_id) -- 按数量添加物品ID到结果集
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ShuffleArray(result) -- 打乱结果顺序保证随机性
|
|
||||||
self.current_call = self.current_call + 1 -- 增加调用计数器
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
---获取当前未生成的物品剩余数量
|
|
||||||
---@return table<number, number> 返回物品ID和剩余数量的映射表
|
|
||||||
function ItemGenerator:GetRemainingItems()
|
|
||||||
local remaining = {}
|
|
||||||
local current_step = self.current_call -- 注意这里使用已调用次数(0-based)
|
|
||||||
|
|
||||||
-- 遍历所有物品的分布数据
|
|
||||||
for item_id, distribution in pairs(self.item_distributions) do
|
|
||||||
local total_remaining = 0
|
|
||||||
|
|
||||||
-- 计算从下一个步骤到周期结束的总数量
|
|
||||||
for step = current_step + 1, self.period do
|
|
||||||
total_remaining = total_remaining + distribution[step]
|
|
||||||
end
|
|
||||||
|
|
||||||
remaining[item_id] = total_remaining
|
|
||||||
end
|
|
||||||
|
|
||||||
return remaining
|
|
||||||
end
|
|
||||||
|
|
||||||
return CreateItemGenerator
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
local SubSystem = {}
|
|
||||||
local Reactive = require("Core.Reactive")
|
|
||||||
local Library = import("BusyGamePlayLibrary")
|
|
||||||
local GameplayStatics = import("GameplayStatics")
|
|
||||||
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
|
|
||||||
|
|
||||||
|
|
||||||
local function CreateItemGenerator(level_config_data)
|
|
||||||
local Generator = require("GamePlay.Level.BusyLevelItemGenerator")
|
|
||||||
|
|
||||||
local item_data = {}
|
|
||||||
local period = level_config_data.Period
|
|
||||||
for k, v in pairs(level_config_data.LevelItemIds) do
|
|
||||||
item_data[k] = v.CountOfPeriod
|
|
||||||
end
|
|
||||||
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)
|
|
||||||
|
|
||||||
self.proxy = Reactive.ReactiveProperty({
|
|
||||||
current_seconds = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:ReceiveWorldBeginPlay()
|
|
||||||
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem").Get(self)
|
|
||||||
|
|
||||||
-- 读取关卡配置
|
|
||||||
local is_suc, row_data = Library.GetLevelBaseConfig("Default", nil)
|
|
||||||
assert(is_suc == true, "Can't find level base config")
|
|
||||||
self.level_base_config = row_data
|
|
||||||
|
|
||||||
-- 创建物品生成器
|
|
||||||
self.generator = CreateItemGenerator(row_data)
|
|
||||||
|
|
||||||
-- 创建初始篝火
|
|
||||||
local bonfire = BusyActorManagerSubSystem:SpawnBonfire(row_data.FirstBonfirePosition)
|
|
||||||
|
|
||||||
-- 创建角色
|
|
||||||
local role = BusyActorManagerSubSystem:SpawnRole(bonfire)
|
|
||||||
GameplayStatics.GetPlayerController(self, 0):Possess(role)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:ReceiveSubSystemTick(DeltaTime)
|
|
||||||
-- local proxy = self.proxy
|
|
||||||
-- local world = BusyGamePlayLibrary.K2_GetWorld(self)
|
|
||||||
-- local current_time = GameplayStatics.GetTimeSeconds(world)
|
|
||||||
-- local escapse_time = math.floor(current_time - self.start_time)
|
|
||||||
-- if escapse_time > proxy.current_seconds then
|
|
||||||
-- self:TrySpawnLevelItem()
|
|
||||||
-- proxy.current_seconds = escapse_time
|
|
||||||
-- print(proxy.current_seconds)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SubSystem:TrySpawnLevelItem()
|
|
||||||
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem").Get(self)
|
|
||||||
local items = self.generator:Generate()
|
|
||||||
for i, item_id in pairs(items) do
|
|
||||||
BusyActorManagerSubSystem:SpawnLevelItem(item_id)
|
|
||||||
print(i, item_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return Class(nil, nil, SubSystem)
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
--- @class BusyLevelItem
|
|
||||||
local LevelItem = {}
|
|
||||||
local Reactive = require("Core.Reactive")
|
|
||||||
local RoleUtils = require("GamePlay.Utils.RoleUtils")
|
|
||||||
local GameplayUtils = require("GamePlay.Utils")
|
|
||||||
local KismetSystemLibrary = import("KismetSystemLibrary")
|
|
||||||
|
|
||||||
function LevelItem:ReceiveBeginPlay()
|
|
||||||
self:SetLevelItemID(self.CurrentItemID)
|
|
||||||
self.world = self:GetWorld()
|
|
||||||
print("LevelItem:ReceiveBeginPlay")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function LevelItem:TempSetting()
|
|
||||||
self:ReceiveBeginPlay()
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelItem:ReceiveLevelItemSetted(Config)
|
|
||||||
self.config = Config
|
|
||||||
self.PickBar.Widget:BindLevelItem(self)
|
|
||||||
|
|
||||||
print("LevelItem:ReceiveLevelItemSetted", KismetSystemLibrary.IsValid(self))
|
|
||||||
|
|
||||||
|
|
||||||
self.attribute_watcher = Reactive.Watcher(function()
|
|
||||||
if self.LuaLevelItemAttribute.Health <= 0 then
|
|
||||||
self:GenerateDropItems()
|
|
||||||
local location = self:K2_GetActorLocation()
|
|
||||||
location.Z = -1000
|
|
||||||
self:K2_SetActorLocation(location, false, nil, false)
|
|
||||||
self:SetLifeSpan(0.3)
|
|
||||||
self.attribute_watcher:Destroy()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function LevelItem:GenerateDropItems()
|
|
||||||
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem").Get(self.world)
|
|
||||||
local role = RoleUtils.GetRole(self)
|
|
||||||
local role_location = role:K2_GetActorLocation()
|
|
||||||
local curr_location = self:K2_GetActorLocation()
|
|
||||||
|
|
||||||
local collection_config = GameplayUtils.GetItemConfigByID(self.CurrentItemID)
|
|
||||||
|
|
||||||
local generated_dict = {}
|
|
||||||
for _, config in pairs(collection_config.DropConfigs) do
|
|
||||||
local base = 0
|
|
||||||
local seed = math.random()
|
|
||||||
for _, rate in pairs(config.configs) do
|
|
||||||
local min = base
|
|
||||||
local max = base + rate.Rate
|
|
||||||
if seed >= min and seed < max then
|
|
||||||
generated_dict[config.ItemID] = rate.Count
|
|
||||||
break
|
|
||||||
end
|
|
||||||
base = max
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
for item_id, count in pairs(generated_dict) do
|
|
||||||
for _ = 1, count do
|
|
||||||
local reward = BusyActorManagerSubSystem:SpawnLevelItemReward(self)
|
|
||||||
|
|
||||||
reward.Movement.speed = 300.0
|
|
||||||
reward.Movement.accelerate = 600.0
|
|
||||||
reward.Movement.direction = {
|
|
||||||
X = curr_location.X - role_location.X,
|
|
||||||
Y = curr_location.Y - role_location.Y
|
|
||||||
}
|
|
||||||
reward:SetRewardID(item_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- 接口
|
|
||||||
function LevelItem:GetPickProcess()
|
|
||||||
local process = self.LuaLevelItemAttribute.Health / self.config.PickTimeCost
|
|
||||||
print("current process", process)
|
|
||||||
return process
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function LevelItem:GetPickCost()
|
|
||||||
return self.LevelItemConfig.PickHungerCost
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelItem:IsAlive()
|
|
||||||
return self.LuaLevelItemAttribute.Health > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelItem:GetItemID()
|
|
||||||
return self.CurrentItemID
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return Class(nil, nil, LevelItem)
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
local PlayerController = {}
|
|
||||||
local KismetSystemLibrary = import("KismetSystemLibrary")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function PlayerController:convertCursorToWorldPosition()
|
|
||||||
-- 将当前鼠标的位置转化为世界的位置
|
|
||||||
local FVector = import("Vector")
|
|
||||||
local WorldOrigin, WorldDirection = FVector(), FVector()
|
|
||||||
local _, MouseX, MouseY = self:GetMousePosition(nil, nil)
|
|
||||||
if self:DeprojectScreenPositionToWorld(
|
|
||||||
MouseX, MouseY, WorldOrigin, WorldDirection
|
|
||||||
)then
|
|
||||||
return WorldOrigin.X, WorldOrigin.Y
|
|
||||||
else
|
|
||||||
return nil, nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function PlayerController:QuitGame()
|
|
||||||
KismetSystemLibrary.QuitGame(self, self, 0, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
return Class(nil, nil, PlayerController)
|
|
||||||
@ -1,203 +0,0 @@
|
|||||||
local UIUtils = require("UI.Utils")
|
|
||||||
local Reactive = require("Core.Reactive")
|
|
||||||
local ERoleState = import("EBusyRoleState")
|
|
||||||
local EBusyItemEffectType = import("EBusyItemEffectType")
|
|
||||||
local GameplayStatics = import ("GameplayStatics")
|
|
||||||
local GetGameplayTag = require("GamePlay.Utils").GetGameplayTag
|
|
||||||
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem")
|
|
||||||
local GamePlayUtils = require("GamePlay.Utils")
|
|
||||||
local KismetMathLibrary = import("KismetMathLibrary")
|
|
||||||
|
|
||||||
local LevelItemRewardClass = import("LevelItemReward")
|
|
||||||
|
|
||||||
--- @class BusyRole
|
|
||||||
local Role={
|
|
||||||
movement_watcher = nil,
|
|
||||||
interacte_item = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
local PickAbilityTag = "Ability.Role.Pick"
|
|
||||||
local RecoverAbilityTag = "Ability.Role.Recover"
|
|
||||||
local ConsumeAbilityTag = "Ability.Role.AttributeConsume"
|
|
||||||
local RollAbilityTag = "Ability.Role.Roll"
|
|
||||||
|
|
||||||
-- 私有函数
|
|
||||||
|
|
||||||
-- 采集相关
|
|
||||||
|
|
||||||
--- @param role BusyRole
|
|
||||||
--- @param pick_targer BusyLevelItem
|
|
||||||
local function ResetPickWatcher(role, pick_targer)
|
|
||||||
if role.pick_watcher ~= nil then
|
|
||||||
role.pick_watcher:Destroy()
|
|
||||||
end
|
|
||||||
role.pick_watcher = Reactive.Watcher(function()
|
|
||||||
if not pick_targer:IsAlive() then
|
|
||||||
role.pick_watcher:Destroy()
|
|
||||||
role.pick_watcher = nil
|
|
||||||
role.carried_item_id = pick_targer:GetItemID()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 存储正在搬运的物品
|
|
||||||
local function StoreCarriedItem(role)
|
|
||||||
-- if not role.carried_item_id then return end
|
|
||||||
-- local sub_system = BusyActorManagerSubSystem.Get(role)
|
|
||||||
-- local bonfire = sub_system:GetNearestBonfire()
|
|
||||||
-- if bonfire:StoreItem(role.carried_item_id) then
|
|
||||||
-- role.carried_item_id = nil
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:ctor()
|
|
||||||
self.pick_timer = nil
|
|
||||||
self.carried_item_id = nil
|
|
||||||
self.time_limited_tags = {}
|
|
||||||
self.pick_watcher = nil -- 监听正在采集物品的状态
|
|
||||||
self.proxy = Reactive.ReactiveProperty({
|
|
||||||
state = ERoleState.BonfireIdle,
|
|
||||||
is_alive = true,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:ReceiveBeginPlay()
|
|
||||||
self.bCanEverTick = false
|
|
||||||
self.Inventory:DepositItems(200001, 2)
|
|
||||||
self.movement_watcher = Reactive.Watcher(function()
|
|
||||||
self:UpdateRoleState()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:ReceiveEndPlay()
|
|
||||||
print(self, "Role:ReceiveEndPlay")
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:ReceiveSetRole(_)
|
|
||||||
self:TryActiveAbility(ConsumeAbilityTag, nil)
|
|
||||||
UIUtils.ShowWidget(self, "RoleState", {role=self})
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:UpdateRoleState()
|
|
||||||
-- 在auto run中访问Reactive Property的值,会导致多次调用,有性能隐患
|
|
||||||
local role_state = Reactive.RawGet(self.proxy, "state")
|
|
||||||
local move_proxy = self.Movement.proxy
|
|
||||||
if move_proxy.isIdle then
|
|
||||||
if role_state == ERoleState.Searching or role_state == ERoleState.PickFinished then
|
|
||||||
self.proxy.state = ERoleState.BackBonfire
|
|
||||||
self.Movement:BackBonfire()
|
|
||||||
elseif role_state == ERoleState.BackBonfire then
|
|
||||||
-- StoreCarriedItem(self)
|
|
||||||
self.proxy.state = ERoleState.BonfireIdle
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if role_state == ERoleState.BonfireIdle then
|
|
||||||
self.proxy.state = ERoleState.Searching
|
|
||||||
end
|
|
||||||
end
|
|
||||||
print("old", role_state, "new", Reactive.RawGet(self.proxy, "state"), move_proxy.isIdle)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:StartPick(level_item)
|
|
||||||
local GameplayEventData = import("GameplayEventData")
|
|
||||||
local EventData = GameplayEventData()
|
|
||||||
EventData.Instigator = self
|
|
||||||
EventData.Target = level_item
|
|
||||||
self.proxy.state = ERoleState.Picking
|
|
||||||
self:TryActiveAbility(PickAbilityTag, EventData)
|
|
||||||
-- ResetPickWatcher(self, level_item)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:OnTouch(_)
|
|
||||||
local role_proxy = self.proxy
|
|
||||||
if role_proxy.state == ERoleState.BonfireIdle then
|
|
||||||
local pc = GameplayStatics.GetPlayerController(self:GetWorld(), 0)
|
|
||||||
local world_x, world_y = pc:convertCursorToWorldPosition()
|
|
||||||
role_proxy.state = ERoleState.Searching
|
|
||||||
self.Movement:SetDestination(world_x, world_y)
|
|
||||||
else
|
|
||||||
print("nothing")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:OnOverlapBegin(OverlappedComp, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
|
|
||||||
if KismetMathLibrary.ClassIsChildOf(OtherActor:GetClass(), LevelItemRewardClass) then
|
|
||||||
self.Inventory:DepositItems(OtherActor.RewardID, 1)
|
|
||||||
OtherActor:ConditionalBeginDestroy()
|
|
||||||
else
|
|
||||||
if self.proxy.state ~= ERoleState.Searching then return end
|
|
||||||
self.proxy.state = ERoleState.Picking
|
|
||||||
self.Movement:Stop()
|
|
||||||
self:StartPick(OtherActor)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- 使用翻滚技能
|
|
||||||
function Role:UseRollSkill()
|
|
||||||
self:TryActiveAbility(RollAbilityTag, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 接口
|
|
||||||
function Role:GetPickEffect()
|
|
||||||
return self.RoleConfig.PickEffect
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:GetHealthPercent()
|
|
||||||
local current_health = self.LuaRoleAttribute.Health or 0
|
|
||||||
return current_health / self.RoleConfig.Health
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:GetHungerPercent()
|
|
||||||
return self.LuaRoleAttribute.Hunger / self.RoleConfig.Hunger
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:GetHungerConsumeSpeed()
|
|
||||||
if self.time_limited_tags["SkillRole"] ~= nil then
|
|
||||||
return self.RoleConfig.HungerConsumeSpeed * 8
|
|
||||||
else
|
|
||||||
return self.RoleConfig.HungerConsumeSpeed
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:GetSpeed()
|
|
||||||
return self.LuaRoleAttribute.MoveSpeed
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:GetMoveDirection()
|
|
||||||
return self.Movement.proxy.direction
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- 返回即将消耗的饥饿值和生命值
|
|
||||||
function Role:CalcRealChangeByHunger(value)
|
|
||||||
local config = self.RoleConfig
|
|
||||||
local fixed_change, extra_health_need = 0, 0
|
|
||||||
local cost_rate = config.HealthConsumeSpeed / config.HungerConsumeSpeed
|
|
||||||
local remain_hunger = self.LuaRoleAttribute.Hunger + value
|
|
||||||
if remain_hunger < 0 then
|
|
||||||
fixed_change = remain_hunger
|
|
||||||
extra_health_need = remain_hunger * cost_rate
|
|
||||||
elseif remain_hunger > self.RoleConfig.Hunger then
|
|
||||||
fixed_change = remain_hunger - self.RoleConfig.Hunger
|
|
||||||
end
|
|
||||||
return value - fixed_change, self:CalcRealChangeByHealth(extra_health_need)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Role:CalcRealChangeByHealth(value)
|
|
||||||
if value == 0 then return 0 end
|
|
||||||
local fixed_change = 0
|
|
||||||
local remain_health = self.LuaRoleAttribute.Health + value
|
|
||||||
if remain_health < 0 then
|
|
||||||
fixed_change = remain_health
|
|
||||||
elseif remain_health > self.RoleConfig.Health then
|
|
||||||
fixed_change = remain_health - self.RoleConfig.Health
|
|
||||||
end
|
|
||||||
return value - fixed_change
|
|
||||||
end
|
|
||||||
|
|
||||||
return Class(nil, nil, Role)
|
|
||||||
@ -1,14 +1,39 @@
|
|||||||
local WidgetUtils = require("Utils.UI.WidgetUtils")
|
local WidgetUtils = require("Utils.UI.WidgetUtils")
|
||||||
|
local Emitter = require("Utils.Emitter")
|
||||||
local HearthMain = {}
|
local HearthMain = {}
|
||||||
|
|
||||||
|
function HearthMain:ctor()
|
||||||
|
self.switch_to_prep_cook_station_handle = nil
|
||||||
|
end
|
||||||
|
|
||||||
function HearthMain:OnInitialized()
|
function HearthMain:OnInitialized()
|
||||||
self.BtnBack.OnClicked:Add(function()
|
self.BtnBack.OnClicked:Add(function()
|
||||||
WidgetUtils.Hide(self, "HearthMain")
|
self:BP_Close()
|
||||||
end)
|
|
||||||
self.BtnOpenRecipe.OnClicked:Add(function()
|
|
||||||
WidgetUtils.Show(self, "RecipeMenu")
|
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HearthMain:Construct()
|
||||||
|
self.switch_to_prep_cook_station_handle = Emitter.OnEvent(
|
||||||
|
"switch_to_prep_station", function() self:SwitchToPrepCookStation() end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HearthMain:Destruct()
|
||||||
|
Emitter.OffEvent("switch_to_prep_station", self.switch_to_prep_cook_station_handle)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HearthMain:SwitchToPrepCookStation()
|
||||||
|
if self:IsAnimationPlaying(self.Anim_StartPrepCook) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:PlayAnimation(self.Anim_StartPrepCook, 0, 1, 0, 1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HearthMain:OnAnimationFinished(anim)
|
||||||
|
if anim == self.Anim_StartPrepCook then
|
||||||
|
WidgetUtils.Show(self, "PreCookStation")
|
||||||
|
print("HearthMain:OnAnimationFinished")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Class(nil, nil, HearthMain)
|
return Class(nil, nil, HearthMain)
|
||||||
184
Content/Lua/HomeLand/UI/Hearth/PreCookStationPanel.lua
Normal file
184
Content/Lua/HomeLand/UI/Hearth/PreCookStationPanel.lua
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
|
||||||
|
local EPreCookSlotType = import("EPreCookSlotType")
|
||||||
|
|
||||||
|
--- @class PreCookStationPanel
|
||||||
|
--- @field WBP_PreCookCenter PreCookCenterWidget
|
||||||
|
local PreCookStationPanel = {}
|
||||||
|
|
||||||
|
--- @class PreCookManager
|
||||||
|
local PreCookManager = {}
|
||||||
|
|
||||||
|
local PRE_COOK_TOOL_CNT = 3
|
||||||
|
local PRE_COOK_CONTAINER_CNT = 3
|
||||||
|
local PRE_COOK_MATERIAL_CNT = 5
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookStationPanel:ctor()
|
||||||
|
self.cook_tool_slots = {}
|
||||||
|
self.cook_container_slots = {}
|
||||||
|
self.cook_raw_slots = {}
|
||||||
|
self.cook_finished_slots = {}
|
||||||
|
|
||||||
|
self.all_slots = {
|
||||||
|
[EPreCookSlotType.PreCookTool] = self.cook_tool_slots,
|
||||||
|
[EPreCookSlotType.PreCookContainer] = self.cook_container_slots,
|
||||||
|
[EPreCookSlotType.PreCookRawMaterial] = self.cook_raw_slots,
|
||||||
|
[EPreCookSlotType.PreCookFinishedMaterial] = self.cook_finished_slots,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.slot_clicked_callback = {
|
||||||
|
[EPreCookSlotType.PreCookTool] = self.OnToolsSlotClicked,
|
||||||
|
[EPreCookSlotType.PreCookContainer] = self.OnContainerSlotClicked,
|
||||||
|
[EPreCookSlotType.PreCookRawMaterial] = self.OnRawMaterialSlotClicked,
|
||||||
|
[EPreCookSlotType.PreCookFinishedMaterial] = self.OnFinishedMaterialSlotClicked,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.actived_tool_slot_idx = nil --正在使用的预处理工具
|
||||||
|
self.actived_container_slot_idx = nil -- 正在使用的预处理容器
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnInitialized()
|
||||||
|
|
||||||
|
self.BackBtn.OnClicked:Add(function() self:BP_Close() end)
|
||||||
|
|
||||||
|
for i = 1, PRE_COOK_TOOL_CNT do
|
||||||
|
local slot_name = "PreCookToolSlot_" .. tostring(i)
|
||||||
|
table.insert(self.cook_tool_slots, self[slot_name])
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, PRE_COOK_CONTAINER_CNT do
|
||||||
|
local slot_name = "PreCookContainer_" .. tostring(i)
|
||||||
|
table.insert(self.cook_container_slots, self[slot_name])
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, PRE_COOK_MATERIAL_CNT do
|
||||||
|
local raw_name = "PreCookRawMaterial_" .. tostring(i)
|
||||||
|
local finished_name = "PreCookFinishedMaterial_" .. tostring(i)
|
||||||
|
table.insert(self.cook_raw_slots, self[raw_name])
|
||||||
|
table.insert(self.cook_finished_slots, self[finished_name])
|
||||||
|
end
|
||||||
|
|
||||||
|
self.pre_cook_click_handles = {}
|
||||||
|
for slot_type, slots in pairs(self.all_slots) do
|
||||||
|
local callback = self.slot_clicked_callback[slot_type] or function(_, _) end
|
||||||
|
for idx, slot in pairs(slots) do
|
||||||
|
local handle = slot:BP_BindLuaEvent("PreCookSlotClicked", function()
|
||||||
|
callback(self, idx)
|
||||||
|
end)
|
||||||
|
table.insert(self.pre_cook_click_handles, handle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.WBP_PreCookCenter:SetEmpty()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:Construct()
|
||||||
|
|
||||||
|
self:Refresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:Destruct()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:Refresh()
|
||||||
|
self:RefreshPreCookTools()
|
||||||
|
self:RefreshPreCookContainer()
|
||||||
|
self:RefreshPreCookRawMaterial()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:RefreshPreCookTools()
|
||||||
|
local display_tools = {"PCT0001", "PCT0002"}
|
||||||
|
for i = 1, PRE_COOK_TOOL_CNT do
|
||||||
|
print(self.cook_tool_slots[i], i)
|
||||||
|
self.cook_tool_slots[i]:SetPreCookTool(display_tools[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:RefreshPreCookContainer()
|
||||||
|
local display_containers = {"PCC0001", "PCC0002"}
|
||||||
|
for i = 1, PRE_COOK_CONTAINER_CNT do
|
||||||
|
self.cook_container_slots[i]:SetPreCookContainer(display_containers[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:RefreshPreCookRawMaterial()
|
||||||
|
local display_containers = {"PCM0001", "PCM0002", "400001"}
|
||||||
|
for i = 1, PRE_COOK_MATERIAL_CNT do
|
||||||
|
self.cook_raw_slots[i]:SetPreCookContainer(display_containers[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnPreCookSlotClicked(slot_type, slot_item_id)
|
||||||
|
local slots = self.all_slots[slot_type]
|
||||||
|
if not slots then return end
|
||||||
|
for _, slot in pairs(slots) do
|
||||||
|
if slot:GetSlotItemID() == slot_item_id then
|
||||||
|
slot:ActiveSlot()
|
||||||
|
else
|
||||||
|
slot:DeactiveSlot()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnToolsSlotClicked(idx)
|
||||||
|
-- 过滤掉空的选择
|
||||||
|
local new_active_slot = self.cook_tool_slots[idx]
|
||||||
|
local slot_item_id = new_active_slot:GetSlotItemID()
|
||||||
|
if not slot_item_id then return end
|
||||||
|
|
||||||
|
-- 点了正在使用的,放回去
|
||||||
|
if idx == self.actived_tool_slot_idx then
|
||||||
|
new_active_slot:DeactiveToolSlot()
|
||||||
|
self.actived_tool_slot_idx = nil
|
||||||
|
print("deactive only", idx)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 之前有其他工具正在使用,放回去
|
||||||
|
if self.actived_tool_slot_idx then
|
||||||
|
self.cook_tool_slots[self.actived_tool_slot_idx]:DeactiveToolSlot()
|
||||||
|
print("deactive old", idx)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 使用新的工具
|
||||||
|
new_active_slot:ActiveToolSlot()
|
||||||
|
self.actived_tool_slot_idx = idx
|
||||||
|
print("active new", idx)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnContainerSlotClicked(idx)
|
||||||
|
local new_active_slot = self.cook_container_slots[idx] --- @type PreCookSlot
|
||||||
|
local old_active_slot = self.cook_container_slots[self.actived_container_slot_idx] ---@type PreCookSlot
|
||||||
|
|
||||||
|
if new_active_slot == old_active_slot then
|
||||||
|
self.actived_container_slot_idx = nil
|
||||||
|
old_active_slot:DeactiveContianerSlot()
|
||||||
|
self.WBP_PreCookCenter:RemoveContainer()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if old_active_slot then
|
||||||
|
old_active_slot:DeactiveContianerSlot()
|
||||||
|
end
|
||||||
|
new_active_slot:ActiveContainerSlot()
|
||||||
|
self.actived_container_slot_idx = idx
|
||||||
|
|
||||||
|
self.WBP_PreCookCenter:AddContainer(new_active_slot:GetSlotItemID())
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnRawMaterialSlotClicked(idx)
|
||||||
|
local material_slot = self.cook_raw_slots[idx] --- @type PreCookSlot
|
||||||
|
local material_id = material_slot:GetSlotItemID()
|
||||||
|
if not material_id then return end
|
||||||
|
material_slot:PushSlotItem()
|
||||||
|
self.WBP_PreCookCenter:AddCookMaterial(material_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookStationPanel:OnFinishedMaterialSlotClicked(idx)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return Class(nil, nil, PreCookStationPanel)
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
local CookPrepStationEntry = {}
|
||||||
|
local Emitter = require("Utils.Emitter")
|
||||||
|
|
||||||
|
function CookPrepStationEntry:OnInitialized()
|
||||||
|
self.MainBtn.OnClicked:Add(function()
|
||||||
|
Emitter.EmitEvent("switch_to_prep_station")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return Class(nil, nil, CookPrepStationEntry)
|
||||||
@ -88,11 +88,11 @@ end
|
|||||||
|
|
||||||
function CookingBench:UpdateCookState()
|
function CookingBench:UpdateCookState()
|
||||||
if self.temperature > 0 then
|
if self.temperature > 0 then
|
||||||
self.WBP_CookingProcess:SetVisible(true)
|
self.WBP_CookingProcess:BP_SetVisible(true)
|
||||||
local percent = self.temperature / self.max_temperature
|
local percent = self.temperature / self.max_temperature
|
||||||
self.WBP_CookingProcess.TemperatureProcess:SetPercent(percent)
|
self.WBP_CookingProcess.TemperatureProcess:SetPercent(percent)
|
||||||
else
|
else
|
||||||
self.WBP_CookingProcess:SetVisible(false)
|
self.WBP_CookingProcess:BP_SetVisible(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
223
Content/Lua/HomeLand/UI/Hearth/Widgets/PreCookCenterWidget.lua
Normal file
223
Content/Lua/HomeLand/UI/Hearth/Widgets/PreCookCenterWidget.lua
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
local DataTableUtils = require("Utils.DataTableUtils")
|
||||||
|
local ESlateVisibility = import("ESlateVisibility")
|
||||||
|
local SlateBlueprintLibrary = import("SlateBlueprintLibrary")
|
||||||
|
local WidgetLayoutLibrary = import("WidgetLayoutLibrary")
|
||||||
|
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
|
||||||
|
|
||||||
|
local CUT_MASK_DISPLAY_TIME = 1.2 -- 刀光显示的时长
|
||||||
|
local CUT_MASK_FADEOUT_TIME = 0.6 -- 刀光开始渐隐的时间点
|
||||||
|
|
||||||
|
--- @class PreCookCenterWidget
|
||||||
|
--- @field ImgContainer table
|
||||||
|
--- @field ImgCookMaterial table
|
||||||
|
--- @field BtnMain table
|
||||||
|
local PreCookCenterWidget = {}
|
||||||
|
|
||||||
|
function PreCookCenterWidget:ctor()
|
||||||
|
self.mouse_tracks = {} -- 记录当前鼠标的轨迹
|
||||||
|
self.rendering_tracks = {} -- 正在被渲染的刀光
|
||||||
|
self.is_pressed = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookCenterWidget:OnInitialized()
|
||||||
|
self.bHasScriptImplementedTick = true
|
||||||
|
|
||||||
|
self:BP_BindLuaEnhancedInput(self.IA_TouchBegin, function()
|
||||||
|
self.is_pressed = true
|
||||||
|
self.mouse_tracks = {}
|
||||||
|
self.rendering_tracks = {self.mouse_tracks}
|
||||||
|
print("new track start")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self:BP_BindLuaEnhancedInput(self.IA_TouchEnd, function()
|
||||||
|
self.is_pressed = false
|
||||||
|
self.mouse_tracks = {}
|
||||||
|
print("track end")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self.BtnMain:SetVisibility(ESlateVisibility.Collapsed)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:Construct()
|
||||||
|
-- self.bHasScriptImplementedTick = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:Destruct()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:SetEmpty()
|
||||||
|
self.ImgContainer:SetVisibility(ESlateVisibility.Collapsed)
|
||||||
|
self.ImgCookMaterial:SetVisibility(ESlateVisibility.Collapsed)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:AddContainer(pre_cook_contianer_id)
|
||||||
|
local row = DataTableUtils.GetDataTableRow("PreCookItemConfig", pre_cook_contianer_id)
|
||||||
|
if not row then return end
|
||||||
|
self.ImgContainer:SetBrushFromSoftTexture(row.CenterDisplayResource, true)
|
||||||
|
self.ImgContainer:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:RemoveContainer()
|
||||||
|
self.ImgContainer:SetVisibility(ESlateVisibility.Collapsed)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:AddCookMaterial(pre_cook_material_id)
|
||||||
|
local row = DataTableUtils.GetDataTableRow("PreCookItemConfig", pre_cook_material_id)
|
||||||
|
if not row then return end
|
||||||
|
self.ImgCookMaterial:SetBrushFromSoftTexture(row.CenterDisplayResource, true)
|
||||||
|
self.ImgCookMaterial:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- 从起点到终点画一条线,以这条线为新的x坐标轴,将所有的点坐标映射到新坐标系下
|
||||||
|
local function TransformCurveToEndpointAxes(points)
|
||||||
|
local A = points[1]
|
||||||
|
local B = points[#points]
|
||||||
|
|
||||||
|
-- 计算向量AB
|
||||||
|
local dx = B.X - A.X
|
||||||
|
local dy = B.Y - A.Y
|
||||||
|
local len = math.sqrt(dx * dx + dy * dy)
|
||||||
|
if len == 0 then
|
||||||
|
return {}
|
||||||
|
-- error("Start and end points are the same, cannot define X-axis.")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 计算X轴单位向量
|
||||||
|
local ux = dx / len
|
||||||
|
local uy = dy / len
|
||||||
|
|
||||||
|
-- 计算Y轴单位向量(逆时针旋转90度)
|
||||||
|
local vx = -uy
|
||||||
|
local vy = ux
|
||||||
|
|
||||||
|
-- 映射所有点到新坐标系
|
||||||
|
local new_points = {}
|
||||||
|
for i, point in ipairs(points) do
|
||||||
|
local apx = point.X - A.X
|
||||||
|
local apy = point.Y - A.Y
|
||||||
|
local new_x = apx * ux + apy * uy -- 点积与X轴单位向量
|
||||||
|
local new_y = apx * vx + apy * vy -- 点积与Y轴单位向量
|
||||||
|
new_points[i] = {X = new_x, Y = new_y}
|
||||||
|
end
|
||||||
|
|
||||||
|
return new_points
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- 将曲线的Y坐标规范到(-0.5,0.5)的范围内,供材质使用
|
||||||
|
local function NormalizeCurveYToHalfRange(points)
|
||||||
|
if #points < 2 then return end
|
||||||
|
local length = points[#points].X - points[1].X
|
||||||
|
for _, point in pairs(points) do
|
||||||
|
point.Y = - point.Y / length -- 临时加个取反
|
||||||
|
point.X = point.X / length
|
||||||
|
end
|
||||||
|
return points
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function UpdateCutMaskData(rendering_tracks, delta_time)
|
||||||
|
local new_visible_tracks = {}
|
||||||
|
for _, track in ipairs(rendering_tracks) do
|
||||||
|
local is_visible = false
|
||||||
|
for _, point in pairs(track) do
|
||||||
|
local remain = math.max(point.remain - delta_time, 0)
|
||||||
|
point.remain = remain
|
||||||
|
if remain > 0 then is_visible = true end
|
||||||
|
end
|
||||||
|
if is_visible then
|
||||||
|
table.insert(new_visible_tracks, track)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return new_visible_tracks
|
||||||
|
end
|
||||||
|
|
||||||
|
local function DrawCutMaskImage(widget, mouse_tracks)
|
||||||
|
local FVector2D = import("Vector2D")
|
||||||
|
local FWidgetTransform = import("WidgetTransform")
|
||||||
|
-- 设置图片合理的位移、旋转、缩放的参数
|
||||||
|
local translation, scale = FVector2D(), FVector2D()
|
||||||
|
local render_transform = FWidgetTransform()
|
||||||
|
local first_point, last_point = mouse_tracks[1], mouse_tracks[#mouse_tracks]
|
||||||
|
local delta_x = last_point.X - first_point.X
|
||||||
|
local delta_y = last_point.Y - first_point.Y
|
||||||
|
local mask_length = (delta_x^2 + delta_y^2)^0.5 -- 轨迹长度,确定缩放参数
|
||||||
|
translation.X, translation.Y = first_point.X, first_point.Y -- 第一个点确定图片唯一
|
||||||
|
scale.X, scale.Y = mask_length / 512, 1
|
||||||
|
render_transform.Scale = scale
|
||||||
|
render_transform.Translation = translation
|
||||||
|
render_transform.Angle = (math.atan(delta_y, delta_x) / (2 * math.pi)) * 360 -- 第一个点与最后一个点连线确定图片旋转角度
|
||||||
|
|
||||||
|
widget:SetRenderTransform(render_transform)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- 更新刀痕的材质
|
||||||
|
local function UpdateCusMaskMaterial(widget, texture, mouse_track)
|
||||||
|
local transformed_tracks = TransformCurveToEndpointAxes(mouse_track)
|
||||||
|
local normalize_tracks = NormalizeCurveYToHalfRange(transformed_tracks)
|
||||||
|
|
||||||
|
local offsets = {}
|
||||||
|
for _, track in ipairs(normalize_tracks) do
|
||||||
|
table.insert(offsets, track.Y)
|
||||||
|
end
|
||||||
|
|
||||||
|
BusyGamePlayLibrary.UpdateTextureBuffer(texture, offsets)
|
||||||
|
|
||||||
|
local material = widget:GetDynamicMaterial()
|
||||||
|
material:SetTextureParameterValue("Param", texture)
|
||||||
|
material:SetScalarParameterValue("VertexCount", #offsets)
|
||||||
|
material:SetScalarParameterValue("SourceWidth", 512)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:GetValidCutMaskWidget()
|
||||||
|
return self.ImgMask
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookCenterWidget:ResetAllCutMaskWidget()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookCenterWidget:Tick(geometry, delta_time)
|
||||||
|
-- 计算鼠标点被限定在该区域下的坐标
|
||||||
|
|
||||||
|
local size = SlateBlueprintLibrary.GetLocalSize(geometry)
|
||||||
|
local cursor_pos = WidgetLayoutLibrary.GetMousePositionOnViewport(self)
|
||||||
|
local left_top = SlateBlueprintLibrary.GetLocalTopLeft(geometry)
|
||||||
|
|
||||||
|
-- local fixed_x = math.min(math.max(cursor_pos.X - left_top.X, 0), size.X)
|
||||||
|
-- local fixed_y = math.min(math.max(cursor_pos.Y - left_top.Y, 0), size.Y)
|
||||||
|
|
||||||
|
local fixed_x, fixed_y = cursor_pos.X - left_top.X, cursor_pos.Y - left_top.Y
|
||||||
|
if fixed_x < 0 or fixed_x > size.X or fixed_y < 0 or fixed_y > size.Y then return end
|
||||||
|
|
||||||
|
|
||||||
|
-- 更新鼠标移动轨迹
|
||||||
|
if self.is_pressed then
|
||||||
|
local last_point = self.mouse_tracks[#self.mouse_tracks]
|
||||||
|
if not last_point or math.abs(last_point.X - fixed_x) > 1 or math.abs(last_point.Y - fixed_y) > 1 then
|
||||||
|
table.insert(self.mouse_tracks, {X=fixed_x, Y=fixed_y, remain=0.5})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 更新正在渲染的轨迹数据
|
||||||
|
local rendering_tracks = UpdateCutMaskData(self.rendering_tracks, delta_time)
|
||||||
|
|
||||||
|
-- 绘制刀迹
|
||||||
|
for _, track in ipairs(rendering_tracks) do
|
||||||
|
if #track > 2 then
|
||||||
|
local widget = self:GetValidCutMaskWidget()
|
||||||
|
DrawCutMaskImage(widget, track)
|
||||||
|
-- UpdateCusMaskMaterial(widget, self.DataTexture, track)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- print("Ticking", #rendering_tracks)
|
||||||
|
|
||||||
|
self.rendering_tracks = rendering_tracks
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return Class(nil, nil, PreCookCenterWidget)
|
||||||
81
Content/Lua/HomeLand/UI/Hearth/Widgets/PreCookSlot.lua
Normal file
81
Content/Lua/HomeLand/UI/Hearth/Widgets/PreCookSlot.lua
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
local DataTableUtils = require("Utils.DataTableUtils")
|
||||||
|
local Emitter = require("Utils.Emitter")
|
||||||
|
local EPreCookSlotType = import("EPreCookSlotType")
|
||||||
|
|
||||||
|
--- @class PreCookSlot
|
||||||
|
local PreCookSlot = {}
|
||||||
|
|
||||||
|
function PreCookSlot:OnInitialized()
|
||||||
|
self.slot_item_id = nil
|
||||||
|
self.is_slot_item_active = false
|
||||||
|
|
||||||
|
self.BtnMain.OnClicked:Add(function() self:BP_EmitLuaEvent("PreCookSlotClicked") end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:Construct()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:Destruct()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:Reset()
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:GetSlotType()
|
||||||
|
return self.PreCookSlotType
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:GetSlotItemID()
|
||||||
|
return self.slot_item_id
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:SetPreCookItemID(pre_cook_item_id)
|
||||||
|
self:Reset()
|
||||||
|
if not pre_cook_item_id then return end
|
||||||
|
|
||||||
|
local row_data = DataTableUtils.GetDataTableRow("PreCookItemConfig", pre_cook_item_id)
|
||||||
|
if not row_data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.SlotImg:SetBrushFromSoftTexture(row_data.DisplayResource, true)
|
||||||
|
self.slot_item_id = pre_cook_item_id
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:SetPreCookTool(pre_cook_tool_id)
|
||||||
|
self:SetPreCookItemID(pre_cook_tool_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:SetPreCookContainer(pre_cook_container_id)
|
||||||
|
self:SetPreCookItemID(pre_cook_container_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:ActiveToolSlot()
|
||||||
|
self:PlayAnimation(self.Anim_UseTool, 0, 1, 0, 5, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:DeactiveToolSlot()
|
||||||
|
self:PlayAnimation(self.Anim_UseTool, 0, 1, 1, 1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PreCookSlot:PushSlotItem()
|
||||||
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 0, 1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:ActiveContainerSlot()
|
||||||
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 0, 1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function PreCookSlot:DeactiveContianerSlot()
|
||||||
|
print("PreCookSlot:DeactiveContianerSlot")
|
||||||
|
self:PlayAnimation(self.Anim_PushItem, 0, 1, 1, 1, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Class(nil, nil, PreCookSlot)
|
||||||
11
Content/Lua/UI/ModelView/Hearth/PreCookModelView.lua
Normal file
11
Content/Lua/UI/ModelView/Hearth/PreCookModelView.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local function InitPreCookViewModel(vm, wco)
|
||||||
|
vm.selected_precook_tools = {}
|
||||||
|
vm.selected_precook_containers = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return function(wco)
|
||||||
|
local vm = {}
|
||||||
|
InitPreCookViewModel(vm, wco)
|
||||||
|
return vm
|
||||||
|
end
|
||||||
@ -1,7 +1,7 @@
|
|||||||
local HomeLandHud = {}
|
local HomeLandHud = {}
|
||||||
|
|
||||||
function HomeLandHud:ReceiveBeginPlay()
|
function HomeLandHud:ReceiveBeginPlay()
|
||||||
self:ShowWidget("HomeLandMain")
|
self:BP_PushWidget("HomeLandMain")
|
||||||
end
|
end
|
||||||
|
|
||||||
return Class(nil, nil, HomeLandHud)
|
return Class(nil, nil, HomeLandHud)
|
||||||
7
Content/Lua/UI/ViewModel/Hearth/PreCookViewModel.lua
Normal file
7
Content/Lua/UI/ViewModel/Hearth/PreCookViewModel.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
local PreCookModelView = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return function(wco)
|
||||||
|
|
||||||
|
end
|
||||||
39
Content/Lua/Utils/DataTableUtils.lua
Normal file
39
Content/Lua/Utils/DataTableUtils.lua
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
local DataTableUtils = {}
|
||||||
|
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
|
||||||
|
|
||||||
|
|
||||||
|
function DataTableUtils.GetDataTable(table_name)
|
||||||
|
return BusyGamePlayLibrary.GetGameDataTable(table_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
function DataTableUtils.GetDataTableRow(table_name, row_name)
|
||||||
|
local data_table = DataTableUtils.GetDataTable(table_name)
|
||||||
|
if not data_table then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return data_table:FindRow(row_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
LuaExtensionMethod.cpp:22-28
|
||||||
|
|
||||||
|
|
||||||
|
// 封装函数示例
|
||||||
|
static int FindRowWrapper(lua_State* L) {
|
||||||
|
UDataTable* dataTable = LuaObject::checkUD<UDataTable>(L, 1);
|
||||||
|
FName rowName = LuaObject::checkValue<FName>(L, 2);
|
||||||
|
UScriptStruct* rowStruct = LuaObject::checkUD<UScriptStruct>(L, 3);
|
||||||
|
// 使用反射调用 FindRow
|
||||||
|
uint8* rowData = dataTable->FindRowUnchecked(rowName);
|
||||||
|
if (rowData && rowStruct) {
|
||||||
|
// 将结果推送到 Lua
|
||||||
|
return LuaObject::pushStruct(L, rowStruct, rowData);
|
||||||
|
}
|
||||||
|
return LuaObject::pushNil(L);
|
||||||
|
}
|
||||||
|
这段代码中,pushStruct只接受两个参数,如何改
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
return DataTableUtils
|
||||||
@ -10,10 +10,10 @@ end
|
|||||||
function WidgetUtils.Show(wco, widget_name)
|
function WidgetUtils.Show(wco, widget_name)
|
||||||
local hud = GetHud(wco)
|
local hud = GetHud(wco)
|
||||||
if not hud then return end
|
if not hud then return end
|
||||||
return hud:ShowWidget(widget_name)
|
return hud:BP_PushWidget(widget_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function WidgetUtils.Hide(wco, widget_name)
|
function WidgetUtils.Close(wco, widget_name)
|
||||||
local hud = GetHud(wco)
|
local hud = GetHud(wco)
|
||||||
if not hud then return end
|
if not hud then return end
|
||||||
return hud:PopWidget(widget_name)
|
return hud:PopWidget(widget_name)
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
local Vector2D = {}
|
local Vector2D = {
|
||||||
|
Zero = {X = 0, Y = 0}
|
||||||
|
}
|
||||||
function Vector2D.New(x, y)
|
function Vector2D.New(x, y)
|
||||||
return {X = x or 0, Y = y or 0}
|
return {X = x or 0, Y = y or 0}
|
||||||
end
|
end
|
||||||
@ -46,5 +48,10 @@ function Vector2D.ToUnrealEngine3D(vector, z)
|
|||||||
return new_vector
|
return new_vector
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Vector2D.Equals(a, b, tolerance)
|
||||||
|
local tol = tolerance or 0.001
|
||||||
|
print(tol, a.X-b.X, a.Y-b.Y)
|
||||||
|
return math.abs(a.X - b.X) < tol and math.abs(a.Y - b.Y) < tol
|
||||||
|
end
|
||||||
|
|
||||||
return Vector2D
|
return Vector2D
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/Test/NewBlueprint.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/Test/NewBlueprint.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/Test/grass-tilemap1.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/Test/grass-tilemap1.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/Test/swamp-water-tilemap.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/Test/swamp-water-tilemap.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/deep-water-tilemap.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/deep-water-tilemap.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/grass-tilemap_TileSet.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/grass-tilemap_TileSet.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/land-tilemap.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/land-tilemap.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/land-tilemap_TileSet.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/land-tilemap_TileSet.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Map/FalconPlain/swamp-land-tilemap.uasset
Normal file
BIN
Content/Resource/Map/FalconPlain/swamp-land-tilemap.uasset
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user