private void DoTriggeringImpl(CTriggerMatch match, PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> atker) { ListView <TriggerActionBase> values = this.TriggerActionMultiMap.GetValues((uint)match.ActType, true); for (int i = 0; i < values.get_Count(); i++) { TriggerActionBase triggerActionBase = values.get_Item(i); if (triggerActionBase != null) { triggerActionBase.AppendRefObj(match.Listeners); triggerActionBase.TriggerEnter(src, atker, this); } } if (match.ActionList != null && match.ActionList.Length > 0) { int num = match.ActionList.Length; for (int j = 0; j < num; j++) { TriggerActionWrapper triggerActionWrapper = match.ActionList[j]; if (triggerActionWrapper != null) { TriggerActionBase actionInternal = triggerActionWrapper.GetActionInternal(); if (actionInternal == null) { triggerActionWrapper.Init(0); actionInternal = triggerActionWrapper.GetActionInternal(); DebugHelper.Assert(actionInternal != null); } actionInternal.AppendRefObj(match.Listeners); actionInternal.TriggerEnter(src, atker, this); } } } }
private void DoTriggeringImpl(CTriggerMatch match, PoolObjHandle<ActorRoot> src, PoolObjHandle<ActorRoot> atker, object param) { ListView<TriggerActionBase> values = this.TriggerActionMultiMap.GetValues((uint) match.ActType, true); for (int i = 0; i < values.Count; i++) { TriggerActionBase base2 = values[i]; if (base2 != null) { base2.AppendRefObj(match.Listeners); base2.TriggerEnter(src, atker, this, param); } } if ((match.ActionList != null) && (match.ActionList.Length > 0)) { int length = match.ActionList.Length; for (int j = 0; j < length; j++) { TriggerActionWrapper wrapper = match.ActionList[j]; if (wrapper != null) { TriggerActionBase actionInternal = wrapper.GetActionInternal(); if (actionInternal == null) { wrapper.Init(); actionInternal = wrapper.GetActionInternal(); DebugHelper.Assert(actionInternal != null); } actionInternal.AppendRefObj(match.Listeners); actionInternal.TriggerEnter(src, atker, this, param); } } } }
private void Awake() { if (Singleton<GameEventSys>.instance != null) { Singleton<GameEventSys>.instance.AddEventHandler<DefaultGameEventParam>(GameEventDef.Event_ActorDead, new RefAction<DefaultGameEventParam>(this.onActorDead)); Singleton<GameEventSys>.instance.AddEventHandler<SGroupDeadEventParam>(GameEventDef.Event_SpawnGroupDead, new RefAction<SGroupDeadEventParam>(this.onSpawnGroupDone)); Singleton<GameEventSys>.instance.AddEventHandler<DefaultGameEventParam>(GameEventDef.Event_FightPrepare, new RefAction<DefaultGameEventParam>(this.onFightPrepare)); Singleton<GameEventSys>.instance.AddEventHandler<HurtEventResultInfo>(GameEventDef.Event_ActorDamage, new RefAction<HurtEventResultInfo>(this.onActorDamage)); Singleton<GameEventSys>.instance.AddEventHandler<DefaultGameEventParam>(GameEventDef.Event_FightStart, new RefAction<DefaultGameEventParam>(this.onFightStart)); Singleton<GameEventSys>.instance.AddEventHandler<PoolObjHandle<ActorRoot>>(GameEventDef.Event_ActorInit, new RefAction<PoolObjHandle<ActorRoot>>(this.onActorInit)); Singleton<GameEventSys>.instance.AddEventHandler<DefaultGameEventParam>(GameEventDef.Event_ActorEnterCombat, new RefAction<DefaultGameEventParam>(this.onEnterCombat)); Singleton<GameEventSys>.instance.AddEventHandler<TalentLevelChangeParam>(GameEventDef.Event_TalentLevelChange, new RefAction<TalentLevelChangeParam>(this.onTalentLevelChange)); } if (Singleton<GameSkillEventSys>.instance != null) { Singleton<GameSkillEventSys>.instance.AddEventHandler<ActorSkillEventParam>(GameSkillEventDef.Event_UseSkill, new GameSkillEvent<ActorSkillEventParam>(this.onUseSkill)); } Singleton<EventRouter>.GetInstance().AddEventHandler<PoolObjHandle<ActorRoot>, int, int, bool>("HeroGoldCoinInBattleChange", new Action<PoolObjHandle<ActorRoot>, int, int, bool>(this, (IntPtr) this.OnActorBattleCoinChanged)); foreach (TriggerActionWrapper wrapper in this.ActionList) { if (wrapper != null) { EGlobalTriggerAct triggerType = wrapper.TriggerType; wrapper.Init(); TriggerActionBase actionInternal = wrapper.GetActionInternal(); DebugHelper.Assert(actionInternal != null); this.TriggerActionMultiMap.Add((uint) triggerType, actionInternal); } } }
public void Destroy() { if (this.m_internalAct != null) { this.m_internalAct.Destroy(); this.m_internalAct = null; } }
public void Init() { if (this.m_internalAct == null) { switch (this.TriggerType) { case EGlobalTriggerAct.Activate: this.m_internalAct = new TriggerActionActivator(this); this.m_internalAct.bEnable = true; break; case EGlobalTriggerAct.Deactivate: this.m_internalAct = new TriggerActionActivator(this); this.m_internalAct.bEnable = false; break; case EGlobalTriggerAct.TriggerBuff: this.m_internalAct = new TriggerActionBuff(this); break; case EGlobalTriggerAct.TriggerDialogue: this.m_internalAct = new TriggerActionDialogue(this); break; case EGlobalTriggerAct.TriggerSpawn: this.m_internalAct = new TriggerActionSpawn(this); break; case EGlobalTriggerAct.TriggerGuideTip: this.m_internalAct = new TriggerActionGuideTip(this); break; case EGlobalTriggerAct.TriggerDynamicBlock: this.m_internalAct = new TriggerActionBlockSwitcher(this); break; case EGlobalTriggerAct.TriggerAge: this.m_internalAct = new TriggerActionAge(this); break; case EGlobalTriggerAct.TriggerJungle: this.m_internalAct = new TriggerActionJungle(this); break; case EGlobalTriggerAct.TriggerBubbleText: this.m_internalAct = new TriggerActionTextBubble(this); break; case EGlobalTriggerAct.TriggerSkillHud: this.m_internalAct = new TriggerActionSkillHud(this); break; case EGlobalTriggerAct.TriggerBattleUi: this.m_internalAct = new TriggerActionShowToggleAuto(this); break; case EGlobalTriggerAct.TriggerNewbieForm: this.m_internalAct = new TriggerActionNewbieForm(this); break; case EGlobalTriggerAct.TriggerSoldierLine: this.m_internalAct = new TriggerActionSoldierLine(this); break; case EGlobalTriggerAct.TriggerPauseGame: this.m_internalAct = new TriggerActionPauseGame(this); break; case EGlobalTriggerAct.TriggerShenFu: this.m_internalAct = new TriggerActionShenFu(this); break; case EGlobalTriggerAct.TriggerBattleEquipLimit: this.m_internalAct = new TriggerActionBattleEquipLimit(this); break; case EGlobalTriggerAct.TriggerSetGlobalVariable: this.m_internalAct = new TriggerActionSetGlobalVariable(this); break; default: DebugHelper.Assert(false); break; } } }