Example #1
0
        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);
                    }
                }
            }
        }
Example #2
0
 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 BuildInternalWrappers()
 {
     if (this.PresetActWrapper != null)
     {
         this.m_internalActList = AreaEventTrigger.AddElement <TriggerActionWrapper>(this.m_internalActList, this.PresetActWrapper);
     }
     if (this.TriggerActions.Length > 0)
     {
         this.m_internalActList = AreaEventTrigger.AppendElements <TriggerActionWrapper>(this.m_internalActList, this.TriggerActions);
     }
     TriggerActionWrapper[] internalActList = this.m_internalActList;
     for (int i = 0; i < internalActList.Length; i++)
     {
         TriggerActionWrapper triggerActionWrapper = internalActList[i];
         if (triggerActionWrapper != null && triggerActionWrapper.GetActionInternal() == null)
         {
             triggerActionWrapper.Init(this.ID);
         }
     }
 }
Example #4
0
        private void Awake()
        {
            if (Singleton <GameEventSys> .get_instance() != null)
            {
                Singleton <GameEventSys> .get_instance().AddEventHandler <GameDeadEventParam>(GameEventDef.Event_ActorDead, new RefAction <GameDeadEventParam>(this.onActorDead));

                Singleton <GameEventSys> .get_instance().AddEventHandler <SGroupDeadEventParam>(GameEventDef.Event_SpawnGroupDead, new RefAction <SGroupDeadEventParam>(this.onSpawnGroupDone));

                Singleton <GameEventSys> .get_instance().AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_FightPrepare, new RefAction <DefaultGameEventParam>(this.onFightPrepare));

                Singleton <GameEventSys> .get_instance().AddEventHandler <HurtEventResultInfo>(GameEventDef.Event_ActorDamage, new RefAction <HurtEventResultInfo>(this.onActorDamage));

                Singleton <GameEventSys> .get_instance().AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_FightStart, new RefAction <DefaultGameEventParam>(this.onFightStart));

                Singleton <GameEventSys> .get_instance().AddEventHandler <PoolObjHandle <ActorRoot> >(GameEventDef.Event_ActorInit, new RefAction <PoolObjHandle <ActorRoot> >(this.onActorInit));

                Singleton <GameEventSys> .get_instance().AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_ActorEnterCombat, new RefAction <DefaultGameEventParam>(this.onEnterCombat));

                Singleton <GameEventSys> .get_instance().AddEventHandler <TalentLevelChangeParam>(GameEventDef.Event_TalentLevelChange, new RefAction <TalentLevelChangeParam>(this.onTalentLevelChange));
            }
            if (Singleton <GameSkillEventSys> .get_instance() != null)
            {
                Singleton <GameSkillEventSys> .get_instance().AddEventHandler <ActorSkillEventParam>(GameSkillEventDef.AllEvent_UseSkill, new GameSkillEvent <ActorSkillEventParam>(this.onUseSkill));
            }
            Singleton <EventRouter> .GetInstance().AddEventHandler <PoolObjHandle <ActorRoot>, int, bool, PoolObjHandle <ActorRoot> >("HeroGoldCoinInBattleChange", new Action <PoolObjHandle <ActorRoot>, int, bool, PoolObjHandle <ActorRoot> >(this.OnActorBattleCoinChanged));

            TriggerActionWrapper[] actionList = this.ActionList;
            for (int i = 0; i < actionList.Length; i++)
            {
                TriggerActionWrapper triggerActionWrapper = actionList[i];
                if (triggerActionWrapper != null)
                {
                    EGlobalTriggerAct triggerType = triggerActionWrapper.TriggerType;
                    triggerActionWrapper.Init(0);
                    TriggerActionBase actionInternal = triggerActionWrapper.GetActionInternal();
                    DebugHelper.Assert(actionInternal != null);
                    this.TriggerActionMultiMap.Add((uint)triggerType, actionInternal);
                }
            }
        }