阶段暂存

This commit is contained in:
2025-09-28 01:32:54 +08:00
parent 090bd16c67
commit 15a213a5c4
53 changed files with 405 additions and 728 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
--- @class BusyGameplayLibrary
--- @field K2_GetWorld fun(obj:table):table
local BusyGameplayLibrary = {}

View File

@ -27,3 +27,9 @@ slua = {
KismetSystemLibrary = {
K2_ClearTimerHandle = function() end
}
--- @class GameplayStatics
--- @field GetPlayerController fun(uobj:table,idx:number):table
--- @field GetGameState fun(uobj:table):table
local GameplayStatics

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

@ -0,0 +1,4 @@
local LevelFoxRole = {}
return Class(nil, nil, LevelFoxRole)

View File

@ -0,0 +1,58 @@
local LevelRabbitRole = {}
function LevelRabbitRole:ctor()
self.last_animation = "back/move"
end
function LevelRabbitRole:ReceiveBeginPlay()
self["SpineAnimationComponent"]:SetSkin("back/move");
self["SpineAnimationComponent"]:SetAnimation(0, "animation", true);
end
function LevelRabbitRole:OnMove(location)
-- 控制器移动相应函数
self["MovementComponent"]:MoveTo(location)
end
function LevelRabbitRole:UpdateMoveDirection(InDirection)
-- 运动组件更新方向响应函数
local cur_animation
if(InDirection.Y >= 0) then
cur_animation = "front/move"
else
cur_animation = "back/move"
end
if cur_animation ~= self.last_animation then
self["SpineAnimationComponent"]:SetSkin(cur_animation)
self["SpineAnimationComponent"]:SetSlotsToSetupPose()
self.last_animation = cur_animation
end
end
function LevelRabbitRole:OnDetachCamera()
print(self, "LevelRabbitRole.OnDetachCamera")
-- 禁用弹簧臂的附着
self["SpringArmComponent"].bEnableCameraRotationLag = true
self["SpringArmComponent"].CameraRotationLagSpeed = 0
-- 保持当前位置,停止跟随
self["SpringArmComponent"].bInheritPitch = true
self["SpringArmComponent"].bInheritYaw = true
self["SpringArmComponent"].bInheritRoll = true
-- (Pitch=0.000000,Yaw=-90.000000,Roll=0.000000)
end
function LevelRabbitRole:OnReattachCamera()
print(self, "LevelRabbitRole.OnReattachCamera")
end
function LevelRabbitRole:OnMoveCamera(direction)
print(self, "LevelRabbitRole.OnMoveCamera", direction.X, direction.Y)
end
return Class(nil, nil, LevelRabbitRole)

View File

@ -0,0 +1,4 @@
local Campsite = {}
return Class(nil, nil, Campsite)

View File

@ -1,13 +1,36 @@
local Vector = import("Vector")
local GameplayStatics = import("GameplayStatics")
local BusyGameplayLibrary = import("BusyGameplayLibrary")
--- 保留到以后做联机内容时拓展
--- @class LevelGameMode
--- @field GameMapActorClass table
local LevelGameMode = {}
function LevelGameMode:K2_PostLogin(new_player_controller)
local new_player_state = new_player_controller.PlayerState
local role = new_player_state:CreateRoleRoster(new_player_controller)
new_player_controller:Possess(role)
function LevelGameMode:ctor()
self.map_actor = nil
end
function LevelGameMode:ReceiveBeginPlay()
print("LevelGameMode:ReceiveBeginPlay", self.GameMapActorClass)
local world = BusyGameplayLibrary.K2_GetWorld(self)
local game_state = GameplayStatics.GetGameState(self) --- @type LevelGameState
if self.GameMapActorClass then
local map_actor = world:SpawnActor(self.GameMapActorClass, Vector(), nil, nil)
game_state:SetGameMapActor(map_actor)
end
end
-- function LevelGameMode:K2_PostLogin(new_player_controller)
-- local new_player_state = new_player_controller.PlayerState
-- local role = new_player_state:CreateRoleRoster(new_player_controller)
-- local new_pos = FVector()
-- new_pos.X = 500
-- new_pos.Y = 500
-- new_pos.Z = 50
-- role:K2_SetActorLocation(new_pos, true, nil, false)
-- new_player_controller:Possess(role)
-- end
return Class(nil, nil, LevelGameMode)

View File

@ -0,0 +1,9 @@
--- @class LevelGameState
local LevelGameState = {}
function LevelGameState:SetGameMapActor(game_map_actor)
self.GameMapActor = game_map_actor
end
return Class(nil, nil, LevelGameState)

View File

@ -0,0 +1,12 @@
local GameplayStatics = import("GameplayStatics")
local LevelPlayerState = {}
function LevelPlayerState:ReceiveBeginPlay()
local pc = GameplayStatics.GetPlayerController(self, 0)
local role = self:CreateRoleRoster(pc)
print("LevelPlayerState:ReceiveBeginPlay", role, self:HasAuthority())
pc:Possess(role)
end
return Class(nil, nil, LevelPlayerState)

Binary file not shown.

Binary file not shown.