-- 这个脚本是记录主将出生点信息 local EventSystem = require('Event/EventSystem') local Base = require("Battle/Logic/Level/LevelItemFactory/LevelItem") local LevelItem_MiniMap = class("LevelItem_MiniMap", Base) function LevelItem_MiniMap:initialize(data) Base.initialize(self,data) end --region --***************生命周期***************-- function LevelItem_MiniMap:OnActive() if Base.OnActive(self) then EventSystem.Dispatch(EventID.UI_MiniMap_AddMapPoint,self) return true end end function LevelItem_MiniMap:OnDeactive() if Base.OnDeactive(self) then EventSystem.Dispatch(EventID.UI_MiniMap_DeleteMapPoint,self) return true end end function LevelItem_MiniMap:OnUpdate() if self._refreshTimer and self._refreshTimer>0 then self._refreshTimer = self._refreshTimer - LuaConst.TimeSpan --高亮时间结束 if self._refreshTimer <= 0 then EventSystem.Dispatch(EventID.UI_MiniMap_MapItemAction,LuaConst.LevelActionType.MiniMap_HighLight_Deactive,self.ItemData) end end end function LevelItem_MiniMap:OnDestroy() Base.OnDestroy(self) end --region 生命周期 --region --***************事件相关***************-- function LevelItem_MiniMap:DoAction(actionType, match, param1, param2) Base.DoAction(self, actionType,param1,param2) if actionType == LuaConst.LevelActionType.MiniMap_Active or actionType == LuaConst.LevelActionType.MiniMap_HoldArea then self:OnActive() elseif actionType == LuaConst.LevelActionType.MiniMap_Active then self.StressEffect = param1 EventSystem.Dispatch(EventID.UI_MiniMap_MapItemAction,actionType,self.ItemData,param1) else if actionType == LuaConst.LevelActionType.MiniMap_Deactive then self:OnDeactive() elseif actionType == LuaConst.LevelActionType.MiniMap_HighLight_Active then if param1>0 then self._refreshTimer = param1 end end EventSystem.Dispatch(EventID.UI_MiniMap_MapItemAction,actionType,self.ItemData,param1,param2) end end --endregion 事件相关 return LevelItem_MiniMap