Exemplo n.º 1
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag  = true;
                int  count = this.soldierAreas.get_Count();
                for (int i = 0; i < count; i++)
                {
                    SoldierRegion soldierRegion = this.soldierAreas.get_Item(i);
                    if (soldierRegion.isStartup)
                    {
                        SoldierSpawnResult soldierSpawnResult = soldierRegion.UpdateLogicSpec(delta);
                        flag &= (soldierSpawnResult != SoldierSpawnResult.ShouldWaitSoldierInterval);
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            int count2 = this.commonSpawnGroups.get_Count();

            for (int j = 0; j < count2; j++)
            {
                CommonSpawnGroup commonSpawnGroup = this.commonSpawnGroups.get_Item(j);
                if (commonSpawnGroup.isStartup)
                {
                    commonSpawnGroup.UpdateLogic(delta);
                }
            }
            for (int k = 0; k < this.spawnGroups.get_Count(); k++)
            {
                SpawnGroup spawnGroup = this.spawnGroups.get_Item(k);
                if (spawnGroup.isStartup)
                {
                    spawnGroup.UpdateLogic(delta);
                }
            }
            int count3 = this.objTriggerMultiMap.get_Count();

            for (int l = 0; l < count3; l++)
            {
                MapWrapper.ObjTriggerKeyValuePair objTriggerKeyValuePair = this.objTriggerMultiMap.get_Item(l);
                GameObject obj = objTriggerKeyValuePair.obj;
                ListView <AreaEventTrigger> triggers = objTriggerKeyValuePair.triggers;
                if (obj != null && obj.activeSelf && (ulong)(Singleton <FrameSynchr> .get_instance().CurFrameNum % 4u) == (ulong)((long)(l % 4)))
                {
                    bool flag2  = false;
                    int  count4 = triggers.get_Count();
                    for (int m = 0; m < count4; m++)
                    {
                        AreaEventTrigger areaEventTrigger = triggers.get_Item(m);
                        if (areaEventTrigger != null && areaEventTrigger.isStartup)
                        {
                            areaEventTrigger.UpdateLogic(delta * 4);
                            flag2 |= areaEventTrigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int n = 0; n < count4; n++)
                        {
                            AreaEventTrigger areaEventTrigger2 = triggers.get_Item(n);
                            if (areaEventTrigger2 != null)
                            {
                                areaEventTrigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }
        public bool FilterMatch(EGlobalGameEvent inEventType, PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> atker, ref SFilterMatchParam param, CTriggerMatch match, int inMatchIndex)
        {
            if (!this.CheckDifficulty())
            {
                return(false);
            }
            if (this.GlobalVariable != 0 && Singleton <BattleLogic> .instance.m_globalTrigger != null && this.GlobalVariable != Singleton <BattleLogic> .instance.m_globalTrigger.CurGlobalVariable)
            {
                return(false);
            }
            if (this.bCaptainSrc && (!src || src != Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().Captain))
            {
                return(false);
            }
            if (this.bCaptainAtker && (!atker || atker != Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().Captain))
            {
                return(false);
            }
            if (this.SrcActorCond != null)
            {
                STriggerCondActor[] srcActorCond = this.SrcActorCond;
                for (int i = 0; i < srcActorCond.Length; i++)
                {
                    STriggerCondActor sTriggerCondActor = srcActorCond[i];
                    if (!sTriggerCondActor.FilterMatch(ref src))
                    {
                        return(false);
                    }
                }
            }
            if (this.AtkerActorCond != null)
            {
                STriggerCondActor[] atkerActorCond = this.AtkerActorCond;
                for (int j = 0; j < atkerActorCond.Length; j++)
                {
                    STriggerCondActor sTriggerCondActor2 = atkerActorCond[j];
                    if (!sTriggerCondActor2.FilterMatch(ref atker))
                    {
                        return(false);
                    }
                }
            }
            switch (inEventType)
            {
            case EGlobalGameEvent.SpawnGroupDead:
                if (match.Originator != null)
                {
                    CommonSpawnGroup component  = match.Originator.GetComponent <CommonSpawnGroup>();
                    SpawnGroup       component2 = match.Originator.GetComponent <SpawnGroup>();
                    if (component != null && component != param.csg)
                    {
                        return(false);
                    }
                    if (component2 != null && component2 != param.sg)
                    {
                        return(false);
                    }
                }
                break;

            case EGlobalGameEvent.ActorDead:
            {
                PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(match.Originator);
                if (actorRoot && actorRoot != src)
                {
                    return(false);
                }
                break;
            }

            case EGlobalGameEvent.ActorDamage:
                if (!this.FilterMatchDamage(ref param.hurtInfo))
                {
                    return(false);
                }
                break;

            case EGlobalGameEvent.UseSkill:
                if (param.slot != (SkillSlotType)this.skillSlot)
                {
                    return(false);
                }
                break;

            case EGlobalGameEvent.TalentLevelChange:
                if (match.Condition.TalentLevel != param.intParam)
                {
                    return(false);
                }
                break;

            case EGlobalGameEvent.BattleGoldChange:
            {
                if (!src || !ActorHelper.IsHostCtrlActor(ref src))
                {
                    return(false);
                }
                int intParam = param.intParam;
                if (!this.FilterBattleGoldNum(intParam))
                {
                    return(false);
                }
                break;
            }

            case EGlobalGameEvent.SkillUseCanceled:
                if (param.slot != (SkillSlotType)this.skillSlot)
                {
                    return(false);
                }
                break;
            }
            return(true);
        }
Exemplo n.º 3
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag = true;
                for (int m = 0; m < this.soldierAreas.Count; m++)
                {
                    SoldierRegion region = this.soldierAreas[m];
                    if (region.isStartup)
                    {
                        SoldierSpawnResult result = region.UpdateLogicSpec(delta);
                        flag &= result != SoldierSpawnResult.ShouldWaitSoldierInterval;
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            for (int i = 0; i < this.commonSpawnGroups.Count; i++)
            {
                CommonSpawnGroup group = this.commonSpawnGroups[i];
                if (group.isStartup)
                {
                    group.UpdateLogic(delta);
                }
            }
            for (int j = 0; j < this.spawnGroups.Count; j++)
            {
                SpawnGroup group2 = this.spawnGroups[j];
                if (group2.isStartup)
                {
                    group2.UpdateLogic(delta);
                }
            }
            int count = this.objTriggerMultiMap.Count;

            for (int k = 0; k < count; k++)
            {
                ObjTriggerKeyValuePair      pair     = this.objTriggerMultiMap[k];
                GameObject                  obj2     = pair.obj;
                ListView <AreaEventTrigger> triggers = pair.triggers;
                if (((obj2 != null) && obj2.activeSelf) && ((Singleton <FrameSynchr> .instance.CurFrameNum % 4) == (k % 4)))
                {
                    bool flag2 = false;
                    for (int n = 0; n < triggers.Count; n++)
                    {
                        AreaEventTrigger trigger = triggers[n];
                        if ((trigger != null) && trigger.isStartup)
                        {
                            trigger.UpdateLogic(delta * 4);
                            flag2 |= trigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int num7 = 0; num7 < triggers.Count; num7++)
                        {
                            AreaEventTrigger trigger2 = triggers[num7];
                            if (trigger2 != null)
                            {
                                trigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        public bool FilterMatch(EGlobalGameEvent inEventType, PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> atker, object param, CTriggerMatch match, int inMatchIndex)
        {
            if (!this.CheckDifficulty())
            {
                return(false);
            }
            if (((this.GlobalVariable != 0) && (Singleton <BattleLogic> .instance.m_globalTrigger != null)) && (this.GlobalVariable != Singleton <BattleLogic> .instance.m_globalTrigger.CurGlobalVariable))
            {
                return(false);
            }
            if (this.bCaptainSrc && ((src == 0) || (src != Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().Captain)))
            {
                return(false);
            }
            if (this.bCaptainAtker && ((atker == 0) || (atker != Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().Captain)))
            {
                return(false);
            }
            if (this.SrcActorCond != null)
            {
                foreach (STriggerCondActor actor in this.SrcActorCond)
                {
                    if (!actor.FilterMatch(ref src))
                    {
                        return(false);
                    }
                }
            }
            if (this.AtkerActorCond != null)
            {
                foreach (STriggerCondActor actor2 in this.AtkerActorCond)
                {
                    if (!actor2.FilterMatch(ref atker))
                    {
                        return(false);
                    }
                }
            }
            switch (inEventType)
            {
            case EGlobalGameEvent.SpawnGroupDead:
            {
                if (match.Originator == null)
                {
                    break;
                }
                CommonSpawnGroup component = match.Originator.GetComponent <CommonSpawnGroup>();
                SpawnGroup       group2    = match.Originator.GetComponent <SpawnGroup>();
                if ((component == null) || (component == (param as CommonSpawnGroup)))
                {
                    if ((group2 == null) || (group2 == (param as SpawnGroup)))
                    {
                        break;
                    }
                    return(false);
                }
                return(false);
            }

            case EGlobalGameEvent.ActorDead:
            {
                PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(match.Originator);
                if ((actorRoot == 0) || !(actorRoot != src))
                {
                    break;
                }
                return(false);
            }

            case EGlobalGameEvent.ActorDamage:
            {
                HurtEventResultInfo inHurtInfo = (HurtEventResultInfo)param;
                if (this.FilterMatchDamage(ref inHurtInfo))
                {
                    break;
                }
                return(false);
            }

            case EGlobalGameEvent.UseSkill:
            {
                ActorSkillEventParam param2 = (ActorSkillEventParam)param;
                if (param2.slot == this.skillSlot)
                {
                    break;
                }
                return(false);
            }

            case EGlobalGameEvent.TalentLevelChange:
            {
                TalentLevelChangeParam param4 = (TalentLevelChangeParam)param;
                if (match.Condition.TalentLevel == param4.TalentLevel)
                {
                    break;
                }
                return(false);
            }

            case EGlobalGameEvent.BattleGoldChange:
                if ((src != 0) && ActorHelper.IsHostCtrlActor(ref src))
                {
                    int currentGold = (int)param;
                    if (!this.FilterBattleGoldNum(currentGold))
                    {
                        return(false);
                    }
                    break;
                }
                return(false);

            case EGlobalGameEvent.SkillUseCanceled:
            {
                DefaultSkillEventParam param3 = (DefaultSkillEventParam)param;
                if (param3.slot == this.skillSlot)
                {
                    break;
                }
                return(false);
            }
            }
            return(true);
        }