Compare commits

...

28 Commits

Author SHA1 Message Date
39b100acff 优化角色生成位置 #2
同时也将地图扩大为128 * 128
2025-10-30 23:11:08 +08:00
239425c47d UI框架调整,主界面重做 #16
初步调整
2025-10-28 23:51:17 +08:00
60596f2772 Merge pull request 'CSharpMigrate' (#15) from CSharpMigrate into main
Reviewed-on: #15
2025-10-26 21:51:42 +08:00
648386cd73 Lua向C#逻辑迁移 一期 #13
将整个插件代码上传
2025-10-26 21:48:39 +08:00
56994b3927 Lua向C#逻辑迁移 一期 #13
瓦片地图实现修改
2025-10-26 19:01:10 +08:00
8c0623b397 Lua向C#逻辑迁移 一期 #13
狐狸移动,技能迁移和完善
2025-10-26 15:46:04 +08:00
dab9990b44 Lua向C#逻辑迁移 一期
创建了若干C#文件,替代对应lua文件
2025-10-25 05:53:20 +08:00
fc1078f20c 成功编译C#插件 #12
添加了C#二进制相关文件的忽略
2025-10-25 05:22:01 +08:00
580e7cf72b 移除slua插件,升级UE5.6 #11
额外移除emmylua的配置
2025-10-25 04:21:55 +08:00
367ac0bab7 移除slua插件,升级UE5.6 #11 2025-10-25 04:15:58 +08:00
4ae803b4f2 将直接继承于slua的蓝图父类修改为UE对应的蓝图父类 #10 2025-10-25 03:21:43 +08:00
541f89b0b2 if语句内赋值修正 #9
顺便把烦人的.user文件加入ignore
2025-10-25 02:52:36 +08:00
c89243452d 优化资源排布算法 #1
之前的实现有bug,现在营地基本一定能生成
现在还有一个问题是,森林非常小的情况下,在森林的资源点可能达不到必须生成的数量要求
需要进一步解决这个问题
2025-10-21 00:05:40 +08:00
bccdc3d231 剔除不需要的插件依赖,比如Paper2D系列 #8
Paper2D系列还需要,如瓦片地图。提出了对PaperZD的依赖,以及依赖FlipBook组件的Actor
2025-10-20 22:45:08 +08:00
917322934d 暂存现阶段所有代码 #7
狐狸技能数据化配置暂时搁置
2025-10-20 22:23:51 +08:00
1e04c04600 狐狸大招碰撞解决 2025-10-19 03:33:01 +08:00
ddde270ad5 解决了狐狸大招冷却和消耗的问题 2025-10-18 17:30:58 +08:00
e0d7329905 通过GAS实现狐狸的技能,还差碰撞、参数配置化、消耗和冷却 2025-10-18 04:37:34 +08:00
f8a05026d5 角色属性配置化 2025-10-13 12:57:04 +08:00
696cdd1d11 狐狸技能临时版 2025-10-13 11:57:19 +08:00
8c612d19e2 可以通过设置渲染分辨率比例和屏幕分辨率解决模糊的问题,与抗锯齿无关 2025-10-08 15:22:38 +08:00
3f8c38b000 狐狸接入 2025-10-08 02:52:32 +08:00
089e0a2b2c 解决打包后游戏打不开的问题 2025-10-01 00:52:38 +08:00
7e7d2a6474 物品随机生成预研完成 2025-09-30 23:58:10 +08:00
c39b910f83 资源随机生成初步接入 2025-09-30 02:52:12 +08:00
15a213a5c4 阶段暂存 2025-09-28 01:32:54 +08:00
090bd16c67 补GameMode 2025-09-24 14:09:51 +08:00
4bb809b8e3 联机版实现,先备份 2025-09-24 13:57:17 +08:00
1267 changed files with 57764 additions and 171862 deletions

View File

@ -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": []
}
}

13
.gitignore vendored
View File

@ -76,3 +76,16 @@ Plugins/**/Intermediate/*
# Cache files for the editor to use
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

View File

@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "5.4",
"EngineAssociation": "5.6",
"Category": "",
"Description": "",
"Modules": [
@ -9,9 +9,7 @@
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"slua_unreal",
"Engine",
"PaperZD",
"CoreUObject",
"GameplayAbilities",
"UMG"
@ -26,11 +24,6 @@
"Editor"
]
},
{
"Name": "PaperZD",
"Enabled": true,
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/c4b43502026047d89296cd7bffd92828"
},
{
"Name": "GameplayAbilities",
"Enabled": true

View File

@ -1,5 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=4F8A2207_002DE0F5_002DA9C1_002D5E41_002D4243D0FAAC15_002Fd_003Aboost_002D1_005F82_005F0_002Fd_003Ainclude_002Fd_003Aboost_002Fd_003Acoroutine_002Fd_003Adetail_002Ff_003Apreallocated_002Ehpp/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=4F8A2207_002DE0F5_002DA9C1_002D5E41_002D4243D0FAAC15_002Fd_003Aboost_002D1_005F82_005F0_002Fd_003Ainclude_002Fd_003Aboost_002Fd_003Asafe_005Fnumerics_002Fd_003Aconcept_002Ff_003Apromotion_005Fpolicy_002Ehpp/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=5E061600_002DD0A1_002DF678_002DBF8E_002D1D2CD7670646_002Fd_003AEigen_002Fd_003Asrc_002Fd_003ACore_002Fd_003Autil_002Ff_003AConstants_002Eh/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=B5255153_002DA839_002D6956_002D3EF8_002D0716EE76F13A_002Fd_003A5414_002Fd_003AInclude_002Fd_003Atools_002Fd_003Aclang_002Fd_003Arewrite_005Fto_005Fchrome_005Fstyle_002Fd_003Atests_002Fd_003Agen_002Ff_003Athing_002Eh/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

View File

@ -15,16 +15,19 @@ ManualIPAddress=
[/Script/EngineSettings.GameMapsSettings]
GlobalDefaultGameMode=/Game/Blueprint/Bp_BusyGameMode.Bp_BusyGameMode_C
GameInstanceClass=/Script/BusyRabbit.BusyGameInstance
EditorStartupMap=/Game/Level/HomeLand.HomeLand
GameDefaultMap=/Game/Level/HomeLand.HomeLand
EditorStartupMap=/Game/Level/FalconPlain.FalconPlain
GameDefaultMap=/Game/Level/FalconPlain.FalconPlain
[/Script/Engine.RendererSettings]
r.Mobile.AntiAliasing=0
r.AntiAliasingMethod=3
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")

View File

@ -1,3 +1,4 @@
;METADATA=(Diff=true, UseCommands=true)
[/Script/GameplayTags.GameplayTagsSettings]
ImportTagsFromConfig=True
WarnOnInvalidTags=True
@ -5,14 +6,35 @@ ClearInvalidTags=False
AllowEditorTagUnloading=True
AllowGameTagUnloading=False
FastReplication=False
bDynamicReplication=False
InvalidTagCharacters="\"\',"
NumBitsForContainerSize=6
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.EatFood",DevComment="干饭")
+GameplayTagList=(Tag="Ability.Role.Pick",DevComment="角色采集物品")
+GameplayTagList=(Tag="Ability.Role.Recover",DevComment="角色状态恢复技能")
+GameplayTagList=(Tag="Ability.Role.Roll",DevComment="角色无敌翻滚")
+GameplayTagList=(Tag="Ability.Role.Ultimate",DevComment="角色大招")
+GameplayTagList=(Tag="Buff.Indispersible.HungerConsume",DevComment="饥饿值消耗,不可被驱散")
+GameplayTagList=(Tag="Buff.RoleConsume.Health",DevComment="角色因饥饿掉血的debuff")
+GameplayTagList=(Tag="Buff.RoleConsume.Hunger",DevComment="角色每秒钟的饥饿消耗")
@ -25,6 +47,8 @@ NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="CookProcess.Diced",DevComment="切丁")
+GameplayTagList=(Tag="CookProcess.Mashed",DevComment="切泥")
+GameplayTagList=(Tag="CookProcess.Sliced",DevComment="切片操作")
+GameplayTagList=(Tag="Effect.Duration",DevComment="效果的持续时长")
+GameplayTagList=(Tag="Effect.Factor",DevComment="效果的乘法系数")
+GameplayTagList=(Tag="GameItem.Building",DevComment="建筑物")
+GameplayTagList=(Tag="GameItem.Food",DevComment="游戏内的可食用物品")
+GameplayTagList=(Tag="Ingredient",DevComment="烹饪食材")
@ -34,6 +58,9 @@ NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="Ingredient.Vegetable.Carrot",DevComment="胡萝卜")
+GameplayTagList=(Tag="Recover.Role.Health",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="Terrain.Desert",DevComment="荒漠地形")
+GameplayTagList=(Tag="Terrain.Forest",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.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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
};

View File

@ -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
}

View File

@ -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

View File

@ -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.
******************************************************************************/

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1,11 +0,0 @@
local BusyPlayerRole = {}
function BusyPlayerRole:UpdateMoveDirection(InDirection)
if(InDirection.Y > 0) then
self["SpineAnimationComponent"]:SetSkin("front/move")
else
self["SpineAnimationComponent"]:SetSkin("back/move")
end
end
return Class(nil, nil, BusyPlayerRole)

View File

@ -1,4 +1,6 @@
local Vector2D = {}
local Vector2D = {
Zero = {X = 0, Y = 0}
}
function Vector2D.New(x, y)
return {X = x or 0, Y = y or 0}
end
@ -46,5 +48,10 @@ function Vector2D.ToUnrealEngine3D(vector, z)
return new_vector
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

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/UI/Level/bar.uasset Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
Plugins/UnrealSharp/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

84
Plugins/UnrealSharp/.gitignore vendored Normal file
View File

@ -0,0 +1,84 @@
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/*
Plugins/*/Binaries/*
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Built data for maps
*_BuiltData.uasset
# Configuration files generated by the Editor
Saved/*
# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
*.user
.idea/
bin/
Generated/
obj/
*.props
!Directory.Packages.props

View File

@ -0,0 +1,117 @@
{
"Structs": {
"CustomTypes": [
"FInstancedStruct"
],
"BlittableTypes": [
{
"Name": "EStreamingSourcePriority"
},
{
"Name": "ETriggerEvent"
},
{
"Name": "FVector",
"ManagedType": "UnrealSharp.CoreUObject.FVector"
},
{
"Name": "FVector2D",
"ManagedType": "UnrealSharp.CoreUObject.FVector2D"
},
{
"Name": "FVector_NetQuantize",
"ManagedType": "UnrealSharp.CoreUObject.FVector"
},
{
"Name": "FVector_NetQuantize10",
"ManagedType": "UnrealSharp.CoreUObject.FVector"
},
{
"Name": "FVector_NetQuantize100",
"ManagedType": "UnrealSharp.CoreUObject.FVector"
},
{
"Name": "FVector_NetQuantizeNormal",
"ManagedType": "UnrealSharp.CoreUObject.FVector"
},
{
"Name": "FVector2f",
"ManagedType": "UnrealSharp.CoreUObject.FVector2f"
},
{
"Name": "FVector3f",
"ManagedType": "UnrealSharp.CoreUObject.FVector3f"
},
{
"Name": "FVector4f",
"ManagedType": "UnrealSharp.CoreUObject.FVector4f"
},
{
"Name": "FQuatf4",
"ManagedType": "UnrealSharp.CoreUObject.FVector4f"
},
{
"Name": "FRotator",
"ManagedType": "UnrealSharp.CoreUObject.FRotator"
},
{
"Name": "FMatrix44f",
"ManagedType": "UnrealSharp.CoreUObject.FMatrix44f"
},
{
"Name": "FTransform",
"ManagedType": "UnrealSharp.CoreUObject.FTransform"
},
{
"Name": "FTimerHandle",
"ManagedType": "UnrealSharp.Engine.FTimerHandle"
},
{
"Name": "FInputActionValue",
"ManagedType": "UnrealSharp.EnhancedInput.FInputActionValue"
},
{
"Name": "FRandomStream",
"ManagedType": "UnrealSharp.CoreUObject.FRandomStream"
},
{
"Name": "FSubsystemCollectionBaseRef",
"ManagedType": "UnrealSharp.UnrealSharpCore.FSubsystemCollectionBaseRef"
}
],
"NativelyTranslatableTypes": [
{
"Name": "FMoverDataCollection",
"HasDestructor": false
},
{
"Name": "FPaintContext",
"HasDestructor": false
},
{
"Name": "FGeometry",
"HasDestructor": false
},
{
"Name": "FGameplayEffectSpec",
"HasDestructor": true
},
{
"Name": "FGameplayEffectSpecHandle",
"HasDestructor": true
},
{
"Name": "FKeyEvent",
"HasDestructor": false
},
{
"Name": "FInputEvent",
"HasDestructor": false
},
{
"Name": "FKey",
"HasDestructor": false
}
]
}
}

View File

@ -0,0 +1,5 @@
[CoreRedirects]
+ClassRedirects=(OldName="/Script/CSharpForUE.CSClass",NewName="/Script/UnrealSharpCore.CSClass")
+StructRedirects=(OldName="/Script/CSharpForUE.CSScriptStruct",NewName="/Script/UnrealSharpCore.CSScriptStruct")
+EnumRedirects=(OldName="/Script/CSharpForUE.CSEnum",NewName="/Script/UnrealSharpCore.CSEnum")
+ClassRedirects=(OldName="/Script/UnrealSharpCore.CSDeveloperSettings",NewName="/Script/UnrealSharpCore.CSUnrealSharpSettings")

View File

@ -0,0 +1,18 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="LanguageExt.Core" Version="4.4.9" />
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.13.9" />
<PackageVersion Include="Microsoft.Build" Version="17.13.9" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.9.1" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 UnrealSharp
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.

View File

@ -0,0 +1,47 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __CORECLR_DELEGATES_H__
#define __CORECLR_DELEGATES_H__
#include <stdint.h>
#if defined(_WIN32)
#define CORECLR_DELEGATE_CALLTYPE __stdcall
#ifdef _WCHAR_T_DEFINED
typedef wchar_t char_t;
#else
typedef unsigned short char_t;
#endif
#else
#define CORECLR_DELEGATE_CALLTYPE
typedef char char_t;
#endif
#define UNMANAGEDCALLERSONLY_METHOD ((const char_t*)-1)
// Signature of delegate returned by coreclr_delegate_type::load_assembly_and_get_function_pointer
typedef int (CORECLR_DELEGATE_CALLTYPE *load_assembly_and_get_function_pointer_fn)(
const char_t *assembly_path /* Fully qualified path to assembly */,
const char_t *type_name /* Assembly qualified type name */,
const char_t *method_name /* Public static method name compatible with delegateType */,
const char_t *delegate_type_name /* Assembly qualified delegate type name or null
or UNMANAGEDCALLERSONLY_METHOD if the method is marked with
the UnmanagedCallersOnlyAttribute. */,
void *reserved /* Extensibility parameter (currently unused and must be 0) */,
/*out*/ void **delegate /* Pointer where to store the function pointer result */);
// Signature of delegate returned by load_assembly_and_get_function_pointer_fn when delegate_type_name == null (default)
typedef int (CORECLR_DELEGATE_CALLTYPE *component_entry_point_fn)(void *arg, int32_t arg_size_in_bytes);
typedef int (CORECLR_DELEGATE_CALLTYPE *get_function_pointer_fn)(
const char_t *type_name /* Assembly qualified type name */,
const char_t *method_name /* Public static method name compatible with delegateType */,
const char_t *delegate_type_name /* Assembly qualified delegate type name or null,
or UNMANAGEDCALLERSONLY_METHOD if the method is marked with
the UnmanagedCallersOnlyAttribute. */,
void *load_context /* Extensibility parameter (currently unused and must be 0) */,
void *reserved /* Extensibility parameter (currently unused and must be 0) */,
/*out*/ void **delegate /* Pointer where to store the function pointer result */);
#endif // __CORECLR_DELEGATES_H__

Some files were not shown because too many files have changed in this diff Show More