190 lines
7.2 KiB
Lua
190 lines
7.2 KiB
Lua
|
------------------------------------------------
|
||
|
--作者: 丁华强
|
||
|
--日期: 2019-09-10
|
||
|
--文件: WuXianBossLogic.lua
|
||
|
--模块: WuXianBossLogic
|
||
|
------------------------------------------------
|
||
|
local L_Vector3 = CS.UnityEngine.Vector3
|
||
|
local L_HoldUITable = {
|
||
|
"UIWuxianBossCopyForm",
|
||
|
"UIWuxianBossCopyMainForm",
|
||
|
"UIHUDForm",
|
||
|
"UIMainForm",
|
||
|
"UIMainFormPC",
|
||
|
"UIGuideForm",
|
||
|
"UIReliveForm",
|
||
|
"UIMsgPromptForm",
|
||
|
"UIMsgMarqueeForm",
|
||
|
"UILoadingForm",
|
||
|
"UICinematicForm",
|
||
|
"UIGetEquipTIps",
|
||
|
"UIPowerSaveForm",
|
||
|
"UIPropertyChangeForm"
|
||
|
}
|
||
|
|
||
|
local L_LogicState = {
|
||
|
MoveToPos = 1,
|
||
|
HideUI = 2,
|
||
|
PlayAnim = 3,
|
||
|
Fighting = 4,
|
||
|
}
|
||
|
|
||
|
local WuXianBossLogic = {
|
||
|
--父逻辑系统
|
||
|
Parent = nil,
|
||
|
--当前状态
|
||
|
CurState = nil,
|
||
|
--状态计时器
|
||
|
StateTimer = 0,
|
||
|
|
||
|
TargetPosX = 59.66945,
|
||
|
TargetPosY = 99.87901,
|
||
|
}
|
||
|
|
||
|
function WuXianBossLogic:OnEnterScene(parent)
|
||
|
self.Parent = parent
|
||
|
|
||
|
--设置开关
|
||
|
GameCenter.MapLogicSwitch.CanRide = true
|
||
|
GameCenter.MapLogicSwitch.CanFly = true
|
||
|
GameCenter.MapLogicSwitch.CanRollDoge = true
|
||
|
GameCenter.MapLogicSwitch.CanMandate = true
|
||
|
GameCenter.MapLogicSwitch.CanOpenTeam = true
|
||
|
GameCenter.MapLogicSwitch.ShowNewFunction = true
|
||
|
GameCenter.MapLogicSwitch.UseAutoStrikeBack = true
|
||
|
GameCenter.MapLogicSwitch.CanTeleport = true
|
||
|
GameCenter.MapLogicSwitch.IsCopyMap = true
|
||
|
GameCenter.MapLogicSwitch.IsPlaneCopyMap = false
|
||
|
GameCenter.MapLogicSwitch.HoldFighting = false
|
||
|
GameCenter.MapLogicSwitch.EventOpen = UnityUtils.GetObjct2Int(UIEventDefine.UIWuxianBossCopyForm_OPEN)
|
||
|
GameCenter.MapLogicSwitch.EventClose = UnityUtils.GetObjct2Int(UIEventDefine.UIWuxianBossCopyForm_CLOSE)
|
||
|
GameCenter.MapLogicSwitch.OtherName = DataConfig.DataMessageString.Get("BOSS_WORLD_TITTLE")
|
||
|
GameCenter.MapLogicSwitch.OtherSprName = "tongyong"
|
||
|
--关掉菜单
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLOSE_MAINMENU)
|
||
|
GameCenter.PushFixEvent(UIEventDefine.UIWuxianBossCopyMainForm_OPEN, BossType.WuXianBoss)
|
||
|
GameCenter.PushFixEvent(UIEventDefine.UIUnlimitBossForm_CLOSE)
|
||
|
|
||
|
self.AinmTimer = -1
|
||
|
local _sceneRoot = GameObject.Find("SceneRoot").transform
|
||
|
if _sceneRoot ~= nil then
|
||
|
end
|
||
|
self:ChangeState(L_LogicState.MoveToPos)
|
||
|
GameCenter.MapLogicSwitch:PlayWaterWave(30, -30, 2, 0.2, 0.6)
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:OnLeaveScene()
|
||
|
GameCenter.PushFixEvent(UIEventDefine.UIWuxianBossCopyMainForm_CLOSE)
|
||
|
GameCenter.PushFixEvent(UIEventDefine.UIFristChargeForm_Close)
|
||
|
GameCenter.PushFixEvent(UIEventDefine.UIFirstChargeTipsForm_CLOSE)
|
||
|
GameCenter.MapLogicSwitch:PlayWaterWave(30, -30, 2, 0.2, 0.6)
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:ChangeState(state)
|
||
|
self.CurState = state
|
||
|
if state == L_LogicState.MoveToPos then
|
||
|
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
|
if _lp ~= nil then
|
||
|
_lp:Action_MoveTo(L_Vector3(self.TargetPosX, 0, self.TargetPosY), 0.2)
|
||
|
end
|
||
|
elseif state == L_LogicState.HideUI then
|
||
|
self.StateTimer = 0.5
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLOSE_ALL_FORM, L_HoldUITable)
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_HIDEANIMATION)
|
||
|
elseif state == L_LogicState.PlayAnim then
|
||
|
GameCenter.BlockingUpPromptSystem:AddForceGuideByID(302, nil, false)
|
||
|
self.StateTimer = 4
|
||
|
elseif state == L_LogicState.Fighting then
|
||
|
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
|
if _lp ~= nil then
|
||
|
_lp:Action_MoveTo(L_Vector3(62.6, 0, 109.8), 1)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:UpdateState(dt)
|
||
|
if self.CurState == L_LogicState.MoveToPos then
|
||
|
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
|
if _lp ~= nil then
|
||
|
if not _lp:IsMoving() then
|
||
|
_lp:Action_MoveTo(L_Vector3(self.TargetPosX, 0, self.TargetPosY), 0.2)
|
||
|
end
|
||
|
local _pos2d = _lp.Position2d
|
||
|
local _xDis = math.abs(_pos2d.x - self.TargetPosX)
|
||
|
local _yDis = math.abs(_pos2d.y - self.TargetPosY)
|
||
|
if _xDis * _xDis + _yDis * _yDis <= 0.045 then
|
||
|
self:ChangeState(L_LogicState.HideUI)
|
||
|
_lp:Stop_Action()
|
||
|
_lp:RayCastToGround(L_Vector3(self.TargetPosX, 0, self.TargetPosY))
|
||
|
end
|
||
|
end
|
||
|
if GameCenter.MandateSystem:IsRunning() then
|
||
|
GameCenter.MandateSystem:End()
|
||
|
end
|
||
|
elseif self.CurState == L_LogicState.HideUI then
|
||
|
self.StateTimer = self.StateTimer - dt
|
||
|
if self.StateTimer <= 0 then
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SUSPEND_ALL_FORM)
|
||
|
self:ChangeState(L_LogicState.PlayAnim)
|
||
|
end
|
||
|
elseif self.CurState == L_LogicState.PlayAnim then
|
||
|
self.StateTimer = self.StateTimer - dt
|
||
|
if self.StateTimer <= 0 then
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_SHOWANIMATION)
|
||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_RESUME_ALL_FORM)
|
||
|
self:ChangeState(L_LogicState.Fighting)
|
||
|
end
|
||
|
elseif self.CurState == L_LogicState.Fighting then
|
||
|
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
|
if _lp ~= nil then
|
||
|
if not _lp:IsMoving() and not GameCenter.MandateSystem:IsRunning() then
|
||
|
--挂机
|
||
|
GameCenter.MandateSystem:Start()
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:Update(dt)
|
||
|
self:UpdateState(dt)
|
||
|
end
|
||
|
|
||
|
--处理协议
|
||
|
function WuXianBossLogic:OnMsgHandle(msg)
|
||
|
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:GetMainUIState()
|
||
|
return {
|
||
|
[MainFormSubPanel.PlayerHead] = true, --主角头像
|
||
|
[MainFormSubPanel.TargetHead] = true, --目标头像
|
||
|
[MainFormSubPanel.TopMenu] = true, --顶部菜单
|
||
|
[MainFormSubPanel.MiniMap] = true, --小地图
|
||
|
[MainFormSubPanel.FlySwordGrave] = true, --境界
|
||
|
[MainFormSubPanel.TaskAndTeam] = true, --任务和组队
|
||
|
[MainFormSubPanel.Joystick] = true, --摇杆
|
||
|
[MainFormSubPanel.Exp] = true, --经验
|
||
|
[MainFormSubPanel.MiniChat] = true, --小聊天框
|
||
|
[MainFormSubPanel.Skill] = true, --技能
|
||
|
[MainFormSubPanel.SelectPkMode] = true, --选择PK模式
|
||
|
[MainFormSubPanel.FunctionFly] = true, --新功能开启飞行界面
|
||
|
[MainFormSubPanel.FastPrompt] = true, --快速提醒界面
|
||
|
[MainFormSubPanel.FastBts] = true, --快速操作按钮界面
|
||
|
[MainFormSubPanel.Ping] = true, --ping
|
||
|
[MainFormSubPanel.SkillWarning] = false, --技能释放警示
|
||
|
[MainFormSubPanel.CustomBtn] = true, --自定义按钮
|
||
|
[MainFormSubPanel.SitDown] = false, --打坐
|
||
|
[MainFormSubPanel.RemotePlayerHead] = true, --远程玩家头像
|
||
|
[MainFormSubPanel.ChangeSkill] = true, --变身技能
|
||
|
}
|
||
|
end
|
||
|
|
||
|
function WuXianBossLogic:GetMainLeftUIState()
|
||
|
return {
|
||
|
[MainLeftSubPanel.Task] = false, --任务分页
|
||
|
[MainLeftSubPanel.Team] = true, --队伍分页
|
||
|
[MainLeftSubPanel.Other] = true, --其他分页
|
||
|
}
|
||
|
end
|
||
|
|
||
|
return WuXianBossLogic
|