Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
--- @module Catch Module
--- @copyright Lilith Games, Avatar Team
--- @author Dead Ratman
local Catch, this = ModuleUtil.New("Catch", ClientBase)
local Catch, this = ModuleUtil.New('Catch', ClientBase)

--声明变量
local prey = nil

--- 初始化
function Catch:Init()
print("[Catch] Init()")
print('[Catch] Init()')
this:NodeRef()
this:DataInit()
this:EventBind()
Expand All @@ -35,19 +35,19 @@ end

--生成一个陷阱
function Catch:InstanceTrap(_ItemID)
local archetTypeName = ""
local archetTypeName = ''
if _ItemID == 4001 then
archetTypeName = "Trap1"
archetTypeName = 'Trap1'
elseif _ItemID == 4002 then
archetTypeName = "Trap2"
archetTypeName = 'Trap2'
elseif _ItemID == 4003 then
archetTypeName = "Trap3"
archetTypeName = 'Trap3'
end
SoundUtil.Play3DSE(localPlayer.Position, 42)
local trap =
world:CreateInstance(
archetTypeName,
"trap",
'trap',
world,
localPlayer.Position + localPlayer.Forward,
localPlayer.Rotation
Expand Down Expand Up @@ -79,19 +79,31 @@ function Catch:TrapAnimal(_rate, _trap, _animal)
invoke(
function()
if _animal.AnimalState.Value == 6 then
NetUtil.Fire_C("InsertInfoEvent", localPlayer, "你的陷阱成功困住了动物", 2, false)
NetUtil.Fire_C(
'InsertInfoEvent',
localPlayer,
LanguageUtil.GetText(Config.GuiText.PetGui_1.Txt),
2,
false
)
SoundUtil.Play3DSE(_animal.Position, 43)
_trap:SetParentTo(_animal, Vector3(0, -0.5, 0), EulerDegree(0, 0, 0))
_trap.Open:SetActive(false)
_trap.Close:SetActive(true)
else
NetUtil.Fire_C("InsertInfoEvent", localPlayer, "动物挣脱了你的陷阱", 2, false)
local tweener = Tween:ShakeProperty(_trap, {"Rotation"}, 0.5, 5)
NetUtil.Fire_C(
'InsertInfoEvent',
localPlayer,
LanguageUtil.GetText(Config.GuiText.PetGui_2.Txt),
2,
false
)
local tweener = Tween:ShakeProperty(_trap, {'Rotation'}, 0.5, 5)
tweener:Play()
local effect =
world:CreateInstance(
"AnimalEscape",
"AnimalEscape",
'AnimalEscape',
'AnimalEscape',
_animal,
_animal.Position + Vector3(0, -0.5, 0)
)
Expand All @@ -110,7 +122,7 @@ end

--与动物交互
function Catch:InteractAnimal()
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer, 19)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer, 19)
if prey then
if prey.AnimalState.Value == 6 then
this:Catch()
Expand All @@ -120,23 +132,23 @@ function Catch:InteractAnimal()
this:Touch()
end
else
NetUtil.Fire_C("InsertInfoEvent", localPlayer, "动物离你太远了", 2, false)
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer)
NetUtil.Fire_C('InsertInfoEvent', localPlayer, LanguageUtil.GetText(Config.GuiText.PetGui_3.Txt), 2, false)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer)
end
end

--捕捉
function Catch:Catch()
invoke(
function()
localPlayer.Avatar:PlayAnimation("PickUpLight", 2, 1, 0.1, true, false, 1)
localPlayer.Avatar:PlayAnimation('PickUpLight', 2, 1, 0.1, true, false, 1)
wait(.5)
NetUtil.Fire_C("InsertInfoEvent", localPlayer, "捕捉动物成功", 2, false)
NetUtil.Fire_C('InsertInfoEvent', localPlayer, LanguageUtil.GetText(Config.GuiText.PetGui_4.Txt), 2, false)
SoundUtil.Play2DSE(localPlayer.UserId, 13)
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer)
Pet:OpenNamedPetUI(prey.AnimalID.Value)
prey.AnimalCaughtEvent:Fire()
local effect = world:CreateInstance("CaughtSuccess", "CaughtSuccess", world, prey.Position)
local effect = world:CreateInstance('CaughtSuccess', 'CaughtSuccess', world, prey.Position)
wait(1)
effect:Destroy()
end
Expand All @@ -147,18 +159,18 @@ end
function Catch:Search()
invoke(
function()
localPlayer.Avatar:PlayAnimation("PickUpLight", 2, 1, 0.1, true, false, 1)
localPlayer.Avatar:PlayAnimation('PickUpLight', 2, 1, 0.1, true, false, 1)
wait(.5)
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer)
NetUtil.Fire_C("GetItemFromPoolEvent", localPlayer, Config.Animal[prey.AnimalID.Value].ItemPoolID, 0)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer)
NetUtil.Fire_C('GetItemFromPoolEvent', localPlayer, Config.Animal[prey.AnimalID.Value].ItemPoolID, 0)
--[[NetUtil.Fire_S(
"SpawnCoinEvent",
"P",
prey.Position + Vector3(0, 1, 0),
math.floor(self.config.IncomeFactor * Config.Animal[prey.AnimalID.Value].DropCoin)
)]]
prey.AnimalCaughtEvent:Fire()
local effect = world:CreateInstance("CaughtSuccess", "CaughtSuccess", world, prey.Position)
local effect = world:CreateInstance('CaughtSuccess', 'CaughtSuccess', world, prey.Position)
wait(1)
effect:Destroy()
end
Expand All @@ -167,16 +179,16 @@ end

--触摸
function Catch:Touch()
NetUtil.Fire_C("InsertInfoEvent", localPlayer, "尝试用陷阱把动物困住再捕捉吧", 2, false)
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer)
NetUtil.Fire_C('InsertInfoEvent', localPlayer, LanguageUtil.GetText(Config.GuiText.PetGui_5.Txt), 2, false)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer)
end

--更新捕捉互动UI
function Catch:UpdateCatchUI()
if prey then
if (prey.Position - localPlayer.Position).Magnitude > 3 then
prey = nil
NetUtil.Fire_C("ChangeMiniGameUIEvent", localPlayer)
NetUtil.Fire_C('ChangeMiniGameUIEvent', localPlayer)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
---? 客户端: SycnTimeCEventHandler(number clock)
---? 服务端: SycnTimeSEventHandler(number clock)
---? 其他的读表即可
local SceneTime, this = ModuleUtil.New("SceneTime", ServerBase)
local SceneTime, this = ModuleUtil.New('SceneTime', ServerBase)
local ModeEnum = {
Instant = "Instant", -- 每个小时更改一次
RealTime = "RealTime" -- 随时间实时更改(大概?)
Instant = 'Instant', -- 每个小时更改一次
RealTime = 'RealTime' -- 随时间实时更改(大概?)
}

local TimeMode = ModeEnum.RealTime --!可更改
Expand Down Expand Up @@ -39,7 +39,7 @@ end

---同步天空盒与表的数据
function SceneTime:SycnSkyData()
this[TimeMode .. "SycnSkyData"](self)
this[TimeMode .. 'SycnSkyData'](self)
end

function SceneTime:InstantSycnSkyData()
Expand Down Expand Up @@ -125,11 +125,11 @@ function SceneTime:GetNextClockData()
)
for k, v in pairs(tmpTable) do
if this.clock == v.ClockTime then
--print(tmpTable[k + 1].ClockTime or Config.TimeSkySetting[6].ClockTime)
--print(tmpTable[k + 1].ClockTime or Config.TimeSkySetting[6].ClockTime)
return tmpTable[k + 1] or tmpTable[1]
end
end

return nil
end

Expand All @@ -147,15 +147,30 @@ function SceneTime:Update(dt)
end
if Config.TimeSkySetting[this.clock] then
if this.clock == 10 then
NetUtil.Broadcast("ShowNoticeInfoEvent", "新的一天开始了", 20, Vector3(-61.4808, -10.0305, -44.5828))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.InfoGui_1.Txt),
20,
Vector3(-61.4808, -10.0305, -44.5828)
)
elseif this.clock == 18 then
NetUtil.Broadcast("ShowNoticeInfoEvent", "黄昏了,该回家了", 20, Vector3(-61.4808, -10.0305, -44.5828))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.InfoGui_2.Txt),
20,
Vector3(-61.4808, -10.0305, -44.5828)
)
elseif this.clock == 20 then
NetUtil.Broadcast("ShowNoticeInfoEvent", "黑夜了,该去帐篷睡觉了", 20, Vector3(-61.4808, -10.0305, -44.5828))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.InfoGui_3.Txt),
20,
Vector3(-61.4808, -10.0305, -44.5828)
)
end
end
NetUtil.Broadcast("SycnTimeCEvent", this.clock)
NetUtil.Fire_S("SycnTimeSEvent", this.clock)
NetUtil.Broadcast('SycnTimeCEvent', this.clock)
NetUtil.Fire_S('SycnTimeSEvent', this.clock)
this:SycnSkyData()
end
this.sky.ClockTime = this.clock + this.timer / this.timeSpeed
Expand All @@ -164,7 +179,7 @@ end
---@param _clock number
function SceneTime:SycnTimeSEventHandler(_clock)
if math.floor(_clock) == 19 then
NetUtil.Broadcast("PlayEffectEvent", 100, Vector3(-106.406, -13.9315, 39.7601))
NetUtil.Broadcast('PlayEffectEvent', 100, Vector3(-106.406, -13.9315, 39.7601))
world.Light:SetActive(true)
for k, v in pairs(world.HangLight:GetChildren()) do
for k1, v1 in pairs(v:GetChildren()) do
Expand All @@ -179,11 +194,11 @@ function SceneTime:SycnTimeSEventHandler(_clock)
end
end
end
print(string.format("[SceneTime] 当前时间 %s 点", math.floor(_clock))) --! 上线删除
print(string.format('[SceneTime] 当前时间 %s 点', math.floor(_clock))) --! 上线删除
end

function SceneTime:OnPlayerJoinEventHandler(_player)
NetUtil.Fire_C("SycnTimeCEvent", _player, this.clock)
NetUtil.Fire_C('SycnTimeCEvent', _player, this.clock)
end

return SceneTime
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,20 @@ function Snail:NodeRef()
end
championPanel = world.MiniGames.Game_08_Snail.Track.Billboard.SurfaceGUI.Panel.ChampionPanel
championEffect = world.MiniGames.Game_08_Snail.Track.ChampionEffect
world.MiniGames.Game_08_Snail.Track.Billboard.SurfaceGUI.Panel.TopText.Text =
LanguageUtil.GetText(Config.GuiText.SnailGui_10.Txt)
for i = 1, 4 do
world.MiniGames.Game_08_Snail.Track.Billboard.SurfaceGUI.Panel['SnailInfo' .. i].Text =
LanguageUtil.GetText(Config.GuiText.SnailGui_11.Txt)
end
end

--- 数据变量初始化
function Snail:DataInit()
dis = (endPoints[1].Position - startPoints[1].Position).Magnitude
for i = 1, 5 do
snailEmo[i] = LanguageUtil.GetText(Config.GuiText['SnailGui_' .. tostring(i + 11)].Txt)
end
this:UpdateSnailEmo()
end

Expand All @@ -104,7 +113,7 @@ function Snail:EnterMiniGameEventHandler(_player, _gameId)
if this:IsBetable(_player) then
NetUtil.Fire_C('InteractCEvent', _player, 8)
else
NetUtil.Fire_C('InsertInfoEvent', _player, '你不能多次投注或在比赛进行中投注', 3, true)
NetUtil.Fire_C('InsertInfoEvent', _player, LanguageUtil.GetText(Config.GuiText.SnailGui_3.Txt), 3, true)
end
end
end
Expand Down Expand Up @@ -153,7 +162,12 @@ function Snail:StartRaceCD(dt)
else
if startCD == 10 then
SoundUtil.Play3DSE(startPoints[1].Position, 9)
NetUtil.Broadcast('ShowNoticeInfoEvent', '蜗牛赛跑竞猜10秒后就要开始啦,快来下注吧', 10, Vector3(-30.1, -11.3, -29.7))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.SnailGui_1.Txt),
10,
Vector3(-30.1, -11.3, -29.7)
)
end
startCD = startCD - dt
end
Expand All @@ -162,7 +176,12 @@ end

--- 开始比赛
function Snail:StartSnailRace()
NetUtil.Broadcast('ShowNoticeInfoEvent', '蜗牛赛跑竞猜开始啦', 10, Vector3(-30.1, -11.3, -29.7))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.SnailGui_2.Txt),
10,
Vector3(-30.1, -11.3, -29.7)
)
SoundUtil.Play3DSE(startPoints[1].Position, 10)
for k, v in pairs(snailObjPool) do
this:InitMoveData(v)
Expand Down Expand Up @@ -293,13 +312,23 @@ function Snail:GiveReward(_snailObjPool)
NetUtil.Fire_C(
'InsertInfoEvent',
v.player,
'你投注的蜗牛获得了第' .. _snailObjPool.ranking .. '名,为你赢得了' .. v.money * reward .. '金币',
string.format(
LanguageUtil.GetText(Config.GuiText.SnailGui_4.Txt),
_snailObjPool.ranking,
v.money * reward
),
3,
false
)
SoundUtil.Play3DSE(v.player.Position, 11)
else
NetUtil.Fire_C('InsertInfoEvent', v.player, '你投注的蜗牛获得了第' .. _snailObjPool.ranking .. '名,并没有奖励', 3, false)
NetUtil.Fire_C(
'InsertInfoEvent',
v.player,
string.format(LanguageUtil.GetText(Config.GuiText.SnailGui_5.Txt), _snailObjPool.ranking),
3,
false
)
SoundUtil.Play3DSE(v.player.Position, 12)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ end
function UFOMgr:ActiveUFO()
durUFO = 45
UFO:SetActive(true)
NetUtil.Broadcast('ShowNoticeInfoEvent', '神秘的UFO出现了,天空出现了大量金币', 10, Vector3(54.3585, 66.6861, 24.6156))
NetUtil.Broadcast(
'ShowNoticeInfoEvent',
LanguageUtil.GetText(Config.GuiText.InfoGui_4.Txt),
10,
Vector3(54.3585, 66.6861, 24.6156)
)
end

--- UFO计时
Expand All @@ -78,7 +83,7 @@ end
--- 传送
function UFOMgr:Teleport(_player, _pos)
SoundUtil.Play3DSE(_player.Position, 108)
SoundUtil.Play3DSE(_pos, 108)
SoundUtil.Play3DSE(_pos, 108)
_player.Position = _pos
end

Expand Down
Loading