324 lines
13 KiB
Lua
324 lines
13 KiB
Lua
------------------------------------------------
|
|
--作者: 杨全福
|
|
--日期: 2020-04-01
|
|
--文件: WYJJieFengLogic.lua
|
|
--模块: WYJJieFengLogic
|
|
--描述: 万妖卷解封逻辑
|
|
------------------------------------------------
|
|
local L_AnimationPlayer = CS.Thousandto.Core.Asset.AnimationPlayer
|
|
local L_AnimationCurve = CS.UnityEngine.AnimationCurve
|
|
|
|
local WYJJieFengLogic = {
|
|
Parent = nil,
|
|
IsFinish = false,
|
|
LeaveTimer = 0,
|
|
|
|
OriOffsetX = 0,
|
|
OriOffsetY = 2,
|
|
TarOffsetX = 9,
|
|
TarOffsetY = 4,
|
|
|
|
StateTimer = 0,
|
|
CurState = WYJJieFengState.Finish,
|
|
|
|
AnimGo = nil,
|
|
IsHideMainUI = false,
|
|
IsPauseForm = false,
|
|
}
|
|
|
|
function WYJJieFengLogic:OnEnterScene(parent)
|
|
self.Parent = parent
|
|
|
|
--设置开关
|
|
GameCenter.MapLogicSwitch.CanRide = false
|
|
GameCenter.MapLogicSwitch.CanFly = false
|
|
GameCenter.MapLogicSwitch.CanRollDoge = true
|
|
GameCenter.MapLogicSwitch.CanMandate = true
|
|
GameCenter.MapLogicSwitch.CanOpenTeam = false
|
|
GameCenter.MapLogicSwitch.ShowNewFunction = false
|
|
GameCenter.MapLogicSwitch.UseAutoStrikeBack = true
|
|
GameCenter.MapLogicSwitch.CanTeleport = false
|
|
GameCenter.MapLogicSwitch.IsCopyMap = true
|
|
GameCenter.MapLogicSwitch.IsPlaneCopyMap = true
|
|
|
|
self.IsFinish = false
|
|
self.LeaveTimer = 0
|
|
self.IsPauseForm = false
|
|
|
|
--关掉菜单
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLOSE_MAINMENU)
|
|
--打开副本主界面
|
|
GameCenter.PushFixEvent(UIEventDefine.UIPlaneCopyMainForm_OPEN, self.Parent.MapCfg.MapId);
|
|
GameCenter.MapLogicSwitch.HoldFighting = true
|
|
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_ON_LP_DEAD, self.OnLPDead, self)
|
|
|
|
local _sceneRoot = GameObject.Find("SceneRoot").transform
|
|
if _sceneRoot ~= nil then
|
|
local _wyjTrans = _sceneRoot:Find("wanyaojuanfeizou")
|
|
if _wyjTrans ~= nil then
|
|
_wyjTrans.gameObject:SetActive(true)
|
|
local _animList = UIUtils.RequireAnimListBaseScript(_wyjTrans)
|
|
if _animList ~= nil then
|
|
self.AnimPlayer = L_AnimationPlayer(_animList, 1)
|
|
self.AnimPlayer.CullingType = 0
|
|
end
|
|
end
|
|
|
|
self.WYJFengYinVfx1 = UIUtils.FindGo(_sceneRoot, "Cuberongyan/fengying")
|
|
self.WYJFengYinVfx2 = UIUtils.FindGo(_sceneRoot, "Cuberongyan/zhuchenfazhenjiefeng")
|
|
self.WYJFengYinVfx3 = UIUtils.FindGo(_sceneRoot, "Cuberongyan/fengyingjiasu")
|
|
|
|
if self.WYJFengYinVfx1 ~= nil and self.WYJFengYinVfx2 ~= nil and self.WYJFengYinVfx3 ~= nil then
|
|
self.WYJFengYinVfx1.gameObject:SetActive(true)
|
|
self.WYJFengYinVfx2.gameObject:SetActive(false)
|
|
self.WYJFengYinVfx3.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
|
|
self.LP = GameCenter.GameSceneSystem:GetLocalPlayer()
|
|
local _scene = GameCenter.GameSceneSystem.ActivedScene
|
|
self.CameraControl = _scene.SceneCameraControl
|
|
self.CameraManager = _scene.CameraManager
|
|
UnityUtils.SetLocalEulerAngles(self.LP.ModelTransform, 0, 50, 0)
|
|
|
|
self.ShakeCurve = L_AnimationCurve()
|
|
self.ShakeCurve:AddKey(0, 0)
|
|
self.ShakeCurve:AddKey(0.1, 1)
|
|
self.ShakeCurve:AddKey(0.15, -1)
|
|
self.ShakeCurve:AddKey(0.2, 1.05)
|
|
self.ShakeCurve:AddKey(0.25, -1.05)
|
|
self.ShakeCurve:AddKey(0.3, 1.1)
|
|
self.ShakeCurve:AddKey(0.35, -1.1)
|
|
self.ShakeCurve:AddKey(0.4, 1.15)
|
|
self.ShakeCurve:AddKey(0.45, -1.15)
|
|
self.ShakeCurve:AddKey(0.5, 1.2)
|
|
self.ShakeCurve:AddKey(0.55, 1.2)
|
|
self.ShakeCurve:AddKey(0.6, -1.25)
|
|
self.ShakeCurve:AddKey(0.65, 1.25)
|
|
self.ShakeCurve:AddKey(0.7, -1.30)
|
|
self.ShakeCurve:AddKey(0.75, 1.30)
|
|
self.ShakeCurve:AddKey(0.8, -1.35)
|
|
self.ShakeCurve:AddKey(0.85, 1.35)
|
|
self.ShakeCurve:AddKey(0.9, -1.40)
|
|
self.ShakeCurve:AddKey(0.95, 1.40)
|
|
self.ShakeCurve:AddKey(1, 0)
|
|
|
|
self:ChangeState(WYJJieFengState.Wait)
|
|
end
|
|
|
|
function WYJJieFengLogic:ChangeState(state)
|
|
self.CurState = state
|
|
if state == WYJJieFengState.Wait then--等待开始
|
|
self.LP.IsCatching = true
|
|
self.StateTimer = 0
|
|
if self.AnimPlayer ~= nil then
|
|
self.AnimPlayer:Play("idle", 0, 2)
|
|
end
|
|
GameCenter.MandateSystem:End()
|
|
elseif state == WYJJieFengState.CameraFeature then--摄像机特写
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_HIDEANIMATION)
|
|
self.IsHideMainUI = true
|
|
self.CameraControl.FreeMode = true
|
|
self.StateTimer = 0
|
|
GameCenter.MandateSystem:End()
|
|
elseif state == WYJJieFengState.CameraShake then--摄像机震动
|
|
if self.AnimPlayer ~= nil then
|
|
self.AnimPlayer:Play("show_idle", 0, 2, true, 0.2, 1.5)
|
|
end
|
|
self.StateTimer = 0
|
|
--PlayShake
|
|
GameCenter.MapLogicSwitch:PlayCameraShake(self.ShakeCurve, 3, 2, 0.1)
|
|
GameCenter.MandateSystem:End()
|
|
if self.WYJFengYinVfx1 ~= nil and self.WYJFengYinVfx3 ~= nil then
|
|
self.WYJFengYinVfx1:SetActive(false)
|
|
self.WYJFengYinVfx3:SetActive(true)
|
|
end
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SUSPEND_ALL_FORM, true)
|
|
self.IsPauseForm = true
|
|
elseif state == WYJJieFengState.CameraBack then--摄像机还原
|
|
--摄像机还原
|
|
self.CameraControl.CurOffsetX = self.OriOffsetX
|
|
self.CameraControl.CurOffsetY = self.OriOffsetY
|
|
self.CameraControl:Update()
|
|
--播放切换到boss动画
|
|
GameCenter.BlockingUpPromptSystem:AddForceGuideByID(300, nil, false)
|
|
self.StateTimer = 5.65
|
|
elseif state == WYJJieFengState.Finish then--完成
|
|
self.StateTimer = -1
|
|
self.LP.IsCatching = false
|
|
self.CameraControl.FreeMode = false
|
|
self.IsPauseForm = false
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_RESUME_ALL_FORM)
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_SHOWANIMATION)
|
|
self.IsHideMainUI = false
|
|
GameCenter.MandateSystem:Start()
|
|
elseif state == WYJJieFengState.DeadShow then--死亡特写
|
|
GameCenter.BlockingUpPromptSystem:AddForceGuideByID(301, nil, false)
|
|
self.StateTimer = 6
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SUSPEND_ALL_FORM, true)
|
|
self.IsPauseForm = true
|
|
end
|
|
end
|
|
|
|
function WYJJieFengLogic:UpdateState(dt)
|
|
if self.CurState == WYJJieFengState.Wait then--等待开始
|
|
self.StateTimer = self.StateTimer + dt
|
|
if self.StateTimer >= 0.5 then
|
|
self:ChangeState(WYJJieFengState.CameraFeature)
|
|
end
|
|
elseif self.CurState == WYJJieFengState.CameraFeature then--摄像机特写
|
|
self.StateTimer = self.StateTimer + dt
|
|
if self.StateTimer <= 1 then
|
|
local _lerpValue = self.StateTimer / 1
|
|
self.CameraControl.CurOffsetX = math.Lerp(self.OriOffsetX, self.TarOffsetX, _lerpValue)
|
|
self.CameraControl.CurOffsetY = math.Lerp(self.OriOffsetY, self.TarOffsetY, _lerpValue)
|
|
else
|
|
self.CameraControl.CurOffsetX = self.TarOffsetX
|
|
self.CameraControl.CurOffsetY = self.TarOffsetY
|
|
end
|
|
|
|
if self.StateTimer >= 2 then
|
|
self:ChangeState(WYJJieFengState.CameraShake)
|
|
end
|
|
elseif self.CurState == WYJJieFengState.CameraShake then--摄像机震动
|
|
local _oldTimer = self.StateTimer
|
|
self.StateTimer = self.StateTimer + dt
|
|
if self.StateTimer >= 2.5 and _oldTimer < 2.5 then
|
|
if self.WYJFengYinVfx2 ~= nil then
|
|
self.WYJFengYinVfx2.gameObject:SetActive(true)
|
|
end
|
|
end
|
|
if self.StateTimer >= 3.5 and _oldTimer < 3.5 then
|
|
GameCenter.MapLogicSwitch:PlayRadiaBlur(0, 2, 0.4, true)
|
|
if self.WYJFengYinVfx3 ~= nil then
|
|
self.WYJFengYinVfx3.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
if self.StateTimer >= 3 and _oldTimer < 3 and self.AnimPlayer ~= nil then
|
|
self.AnimPlayer:Play("feizou", 0, 1)
|
|
end
|
|
if self.StateTimer > 6 then
|
|
self:ChangeState(WYJJieFengState.CameraBack)
|
|
end
|
|
elseif self.CurState == WYJJieFengState.CameraBack then--摄像机还原
|
|
local _oldTimer = self.StateTimer
|
|
self.StateTimer = self.StateTimer - dt
|
|
if _oldTimer >= 2 and self.StateTimer < 2 then
|
|
--刷怪
|
|
self.PlayBossIdle = false
|
|
GameCenter.Network.Send("MSG_copyMap.ReqFlashMonster", {num = 1})
|
|
end
|
|
if self.StateTimer <= 0 then
|
|
self:ChangeState(WYJJieFengState.Finish)
|
|
end
|
|
elseif self.CurState == WYJJieFengState.Finish then--完成
|
|
local _boss = GameCenter.MapLogicSwitch:FindMonsterByDataID(10999003)
|
|
if _boss ~= nil then
|
|
if not self.PlayBossIdle then
|
|
_boss:PlayAnim("idle", 0, 2, false)
|
|
self.PlayBossIdle = true
|
|
end
|
|
if _boss:IsDead() then
|
|
self:ChangeState(WYJJieFengState.DeadShow)
|
|
end
|
|
end
|
|
elseif self.CurState == WYJJieFengState.DeadShow then--死亡特写
|
|
if self.StateTimer > 0 then
|
|
self.StateTimer = self.StateTimer - dt
|
|
if self.StateTimer <= 0 then
|
|
GameCenter.MapLogicSystem:SendLeaveMapMsg(false)
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_SHOWANIMATION)
|
|
self.IsHideMainUI = false
|
|
self.IsPauseForm = false
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_RESUME_ALL_FORM)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function WYJJieFengLogic:OnLeaveScene()
|
|
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_ON_LP_DEAD, self.OnLPDead, self)
|
|
GameCenter.PushFixEvent(UIEventDefine.UIPlaneCopyMainForm_CLOSE);
|
|
--进入就开始挂机
|
|
GameCenter.MandateSystem:End()
|
|
GameCenter.MapLogicSwitch.HoldFighting = true
|
|
self.CameraControl.FreeMode = false
|
|
self.LP.IsCatching = false
|
|
self.CameraControl.CurOffsetX = self.OriOffsetX
|
|
self.CameraControl.CurOffsetY = self.OriOffsetY
|
|
if self.AnimPlayer ~= nil then
|
|
self.AnimPlayer:Destory()
|
|
end
|
|
if self.IsHideMainUI then
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_MAIN_SHOWANIMATION)
|
|
end
|
|
self.IsHideMainUI = false
|
|
|
|
if self.IsPauseForm then
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_RESUME_ALL_FORM)
|
|
end
|
|
self.IsPauseForm = false
|
|
end
|
|
|
|
function WYJJieFengLogic:OnLPDead(obj, sender)
|
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_INITIATIVE_EXIT_PLANECOPY)
|
|
GameCenter.PushFixEvent(UILuaEventDefine.UIPanelCopyFailedForm_OPEN)
|
|
GameCenter.TaskController:Stop()
|
|
end
|
|
|
|
function WYJJieFengLogic:OnMsgHandle(msg)
|
|
if msg.MsgID == GameCenter.Network.GetMsgID("MSG_copyMap.ResCopyMapBitFinish") then
|
|
self.IsFinish = true
|
|
self.LeaveTimer = 0.5
|
|
end
|
|
end
|
|
|
|
function WYJJieFengLogic:Update(dt)
|
|
self:UpdateState(dt)
|
|
if self.AnimPlayer ~= nil then
|
|
self.AnimPlayer:Update(dt)
|
|
end
|
|
-- if self.IsFinish then
|
|
-- self.LeaveTimer = self.LeaveTimer - dt
|
|
-- if self.LeaveTimer <= 0 then
|
|
-- --if GameCenter.MapLogicSwitch:PlaneEndEffectIsFinish(false) then
|
|
-- self.IsFinish = false
|
|
-- --end
|
|
-- end
|
|
-- end
|
|
end
|
|
|
|
function WYJJieFengLogic: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 WYJJieFengLogic:GetMainLeftUIState()
|
|
return {
|
|
[MainLeftSubPanel.Task] = true, --任务分页
|
|
[MainLeftSubPanel.Team] = true, --队伍分页
|
|
[MainLeftSubPanel.Other] = false, --其他分页
|
|
}
|
|
end
|
|
|
|
return WYJJieFengLogic; |