예제 #1
0
 public void BuildSoldierRegions(ref List <ActorPreloadTab> list)
 {
     SoldierRegion[] regionArray = UnityEngine.Object.FindObjectsOfType <SoldierRegion>();
     if ((regionArray != null) && (regionArray.Length != 0))
     {
         for (int i = 0; i < regionArray.Length; i++)
         {
             SoldierRegion region = regionArray[i];
             if (((region != null) && (region.Waves != null)) && (region.Waves.Count > 0))
             {
                 for (int j = 0; j < region.Waves.Count; j++)
                 {
                     Assets.Scripts.GameLogic.SoldierWave wave = region.Waves[j];
                     if (((wave != null) && (wave.WaveInfo != null)) && ((wave.WaveInfo.astNormalSoldierInfo != null) && (wave.WaveInfo.astNormalSoldierInfo.Length > 0)))
                     {
                         for (int k = 0; k < wave.WaveInfo.astNormalSoldierInfo.Length; k++)
                         {
                             ResSoldierTypeInfo info = wave.WaveInfo.astNormalSoldierInfo[k];
                             if (info.dwSoldierID == 0)
                             {
                                 break;
                             }
                             ActorMeta actorMeta = new ActorMeta {
                                 ActorType = ActorTypeDef.Actor_Type_Monster,
                                 ConfigId  = (int)info.dwSoldierID
                             };
                             this.AddPreloadActor(ref list, ref actorMeta, info.dwSoldierNum * 2f, 0);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        public int GetNextRepeatTime(bool bWaveOrRepeat)
        {
            if (this.CurrentWave == null)
            {
                return(-1);
            }
            if (bWaveOrRepeat)
            {
                return((int)this.CurrentWave.WaveInfo.dwStartWatiTick);
            }
            bool flag = (long)this.CurrentWave.repeatCount >= (long)((ulong)this.CurrentWave.WaveInfo.dwRepeatNum);

            if (!flag)
            {
                return((int)(this.CurrentWave.WaveInfo.dwIntervalTick + this.CurrentWave.Selector.StatTotalCount * (uint)MonoSingleton <GlobalConfig> .get_instance().SoldierWaveInterval));
            }
            bool flag2 = this.CurrentWave.Index + 1 < this.Waves.get_Count();

            if (flag2)
            {
                SoldierWave soldierWave = this.Waves.get_Item(this.CurrentWave.Index + 1);
                return((int)(this.CurrentWave.Selector.StatTotalCount * (uint)MonoSingleton <GlobalConfig> .get_instance().SoldierWaveInterval + this.CurrentWave.WaveInfo.dwIntervalTick + soldierWave.WaveInfo.dwStartWatiTick));
            }
            return(-1);
        }
 public SoldierWaveParam(int inWaveIndex, int inRepeatCount, int inNextDuration, SoldierWave inWave)
 {
     this.WaveIndex    = inWaveIndex;
     this.RepeatCount  = inRepeatCount;
     this.NextDuration = inNextDuration;
     this.Wave         = inWave;
 }
예제 #4
0
 public void ContinueState(SoldierWave sw)
 {
     this.curTick      = sw.curTick;
     this.preSpawnTick = sw.preSpawnTick;
     this.firstTick    = sw.firstTick;
     this.idleTick     = sw.idleTick;
     this.bInIdleState = sw.bInIdleState;
     this.repeatCount  = 0;
 }
예제 #5
0
 public void CloneState(SoldierWave sw)
 {
     this.curTick          = sw.curTick;
     this.preSpawnTick     = sw.preSpawnTick;
     this.firstTick        = sw.firstTick;
     this.bInIdleState     = sw.bInIdleState;
     this.idleTick         = sw.idleTick;
     this.bInIdleState     = sw.bInIdleState;
     this.isCannonNotified = sw.isCannonNotified;
 }
        public int GetTotalCount()
        {
            int num = 0;

            ListView <SoldierWave> .Enumerator enumerator = this.Waves.GetEnumerator();
            while (enumerator.MoveNext())
            {
                SoldierWave current = enumerator.Current;
                if (current.WaveInfo.dwRepeatNum == 0u)
                {
                    return(0);
                }
                num += (int)current.WaveInfo.dwRepeatNum;
            }
            return(num);
        }
        public int GetTotalTime()
        {
            int num = 0;

            ListView <SoldierWave> .Enumerator enumerator = this.Waves.GetEnumerator();
            while (enumerator.MoveNext())
            {
                SoldierWave current = enumerator.Current;
                if (current.WaveInfo.dwRepeatNum == 0u)
                {
                    return(0);
                }
                num += (int)current.WaveInfo.dwStartWatiTick;
                num += (int)(current.WaveInfo.dwIntervalTick * (current.WaveInfo.dwRepeatNum - 1u));
            }
            return(num);
        }
 public void ResetRegion()
 {
     this.CurrentWave  = null;
     this.bShouldReset = true;
     this.waitTick     = 0;
     this.curTick      = 0;
     if (this.Waves != null)
     {
         for (int i = 0; i < this.Waves.Count; i++)
         {
             if (this.Waves[i] != null)
             {
                 this.Waves[i].Reset();
             }
         }
     }
 }
예제 #9
0
 public void SwitchWave(int newWaveID)
 {
     if (this.CurrentWave == null || this.CurrentWave.IsInIdle)
     {
         this._lastWave    = this.CurrentWave;
         this.CurrentWave  = null;
         this.bShouldReset = true;
         this.waitTick     = 0;
         this.curTick      = 0;
         this.Waves.Clear();
         this.LoadWave(newWaveID);
         this._toSwitchWaveID = 0;
     }
     else
     {
         this._toSwitchWaveID = newWaveID;
     }
 }
        public int GetRepeatCountTill(int inWaveIndex)
        {
            int num  = 0;
            int num2 = 0;

            ListView <SoldierWave> .Enumerator enumerator = this.Waves.GetEnumerator();
            while (enumerator.MoveNext() && num < inWaveIndex)
            {
                SoldierWave current = enumerator.Current;
                if (current.WaveInfo.dwRepeatNum == 0u)
                {
                    return(0);
                }
                num2 += (int)current.WaveInfo.dwRepeatNum;
                num++;
            }
            int repeatCount = this.Waves[inWaveIndex].repeatCount;

            return(num2 + repeatCount);
        }
예제 #11
0
 public int GetNextRepeatTime(bool bWaveOrRepeat)
 {
     if (this.CurrentWave != null)
     {
         if (bWaveOrRepeat)
         {
             return((int)this.CurrentWave.WaveInfo.dwStartWatiTick);
         }
         if (this.CurrentWave.repeatCount < this.CurrentWave.WaveInfo.dwRepeatNum)
         {
             return((int)(this.CurrentWave.WaveInfo.dwIntervalTick + (this.CurrentWave.Selector.StatTotalCount * MonoSingleton <GlobalConfig> .instance.SoldierWaveInterval)));
         }
         if ((this.CurrentWave.Index + 1) < this.Waves.Count)
         {
             SoldierWave wave = this.Waves[this.CurrentWave.Index + 1];
             return((int)(((this.CurrentWave.Selector.StatTotalCount * MonoSingleton <GlobalConfig> .instance.SoldierWaveInterval) + this.CurrentWave.WaveInfo.dwIntervalTick) + wave.WaveInfo.dwStartWatiTick));
         }
     }
     return(-1);
 }
        private void TrySwitch()
        {
            int num = 0;

            if (this._isInEmergency)
            {
                if (this._emergentWaveId != 0)
                {
                    num = this._emergentWaveId;
                    this._emergentWaveId = 0;
                    if (this._mainlineWaveId == 0)
                    {
                        if (this.CurrentWave != null)
                        {
                            this._mainlineWaveId = (int)this.CurrentWave.WaveInfo.dwSoldierWaveID;
                        }
                        else if (this.Waves.Count > 0)
                        {
                            this._mainlineWaveId = (int)this.Waves[0].WaveInfo.dwSoldierWaveID;
                        }
                    }
                }
            }
            else if (this._mainlineWaveId != 0)
            {
                num = this._mainlineWaveId;
                this._mainlineWaveId = 0;
            }
            if (num != 0)
            {
                this._lastWave    = this.CurrentWave;
                this.CurrentWave  = null;
                this.bShouldReset = true;
                this.waitTick     = 0;
                this.curTick      = 0;
                this.Waves.Clear();
                this.LoadWave(num);
            }
        }
        private SoldierWave FindNextValidWave()
        {
            if (this.CurrentWave == null)
            {
                this.CurrentWave = ((this.Waves.Count > 0) ? this.Waves[0] : null);
            }
            else
            {
                this.CurrentWave = ((this.CurrentWave.Index < this.Waves.Count - 1) ? this.Waves[this.CurrentWave.Index + 1] : null);
            }
            if (this.CurrentWave != null && this._lastWave != null)
            {
                this.CurrentWave.ContinueState(this._lastWave);
                this._lastWave = null;
            }
            int inWaveIndex = (this.CurrentWave != null) ? this.CurrentWave.Index : (this.Waves.Count - 1);
            SoldierWaveParam soldierWaveParam = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true), this.CurrentWave);

            Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref soldierWaveParam);

            return(this.CurrentWave);
        }
예제 #14
0
 private SoldierWave FindNextValidWave()
 {
     if (this.CurrentWave == null)
     {
         this.CurrentWave = ((this.Waves.get_Count() <= 0) ? null : this.Waves.get_Item(0));
     }
     else
     {
         this.CurrentWave = ((this.CurrentWave.Index >= this.Waves.get_Count() - 1) ? null : this.Waves.get_Item(this.CurrentWave.Index + 1));
     }
     if (this.CurrentWave != null && this._lastWave != null)
     {
         this.CurrentWave.CloneState(this._lastWave);
         this._lastWave = null;
     }
     if (this.bTriggerEvent)
     {
         int inWaveIndex = (this.CurrentWave == null) ? (this.Waves.get_Count() - 1) : this.CurrentWave.Index;
         SoldierWaveParam soldierWaveParam = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true));
         Singleton <GameEventSys> .get_instance().SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref soldierWaveParam);
     }
     return(this.CurrentWave);
 }
예제 #15
0
 private SoldierWave FindNextValidWave()
 {
     if (this.CurrentWave == null)
     {
         this.CurrentWave = (this.Waves.Count <= 0) ? null : this.Waves[0];
     }
     else
     {
         this.CurrentWave = (this.CurrentWave.Index >= (this.Waves.Count - 1)) ? null : this.Waves[this.CurrentWave.Index + 1];
     }
     if ((this.CurrentWave != null) && (this._lastWave != null))
     {
         this.CurrentWave.CloneState(this._lastWave);
         this._lastWave = null;
     }
     if (this.bTriggerEvent)
     {
         int inWaveIndex      = (this.CurrentWave == null) ? (this.Waves.Count - 1) : this.CurrentWave.Index;
         SoldierWaveParam prm = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true));
         Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref prm);
     }
     return(this.CurrentWave);
 }
예제 #16
0
 public void BuildSoldierRegions(ref List <ActorPreloadTab> list)
 {
     SoldierRegion[] array = Object.FindObjectsOfType <SoldierRegion>();
     if (array == null || array.Length == 0)
     {
         return;
     }
     for (int i = 0; i < array.Length; i++)
     {
         SoldierRegion soldierRegion = array[i];
         if (soldierRegion != null && soldierRegion.Waves != null && soldierRegion.Waves.Count > 0)
         {
             for (int j = 0; j < soldierRegion.Waves.Count; j++)
             {
                 Assets.Scripts.GameLogic.SoldierWave soldierWave = soldierRegion.Waves[j];
                 if (soldierWave != null && soldierWave.WaveInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo.Length > 0)
                 {
                     for (int k = 0; k < soldierWave.WaveInfo.astNormalSoldierInfo.Length; k++)
                     {
                         ResSoldierTypeInfo resSoldierTypeInfo = soldierWave.WaveInfo.astNormalSoldierInfo[k];
                         if (resSoldierTypeInfo.dwSoldierID == 0u)
                         {
                             break;
                         }
                         ActorMeta actorMeta  = default(ActorMeta);
                         ActorMeta actorMeta2 = actorMeta;
                         actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster;
                         actorMeta2.ConfigId  = (int)resSoldierTypeInfo.dwSoldierID;
                         actorMeta            = actorMeta2;
                         this.AddPreloadActor(ref list, ref actorMeta, resSoldierTypeInfo.dwSoldierNum * 2f, 0);
                     }
                 }
             }
         }
     }
 }
예제 #17
0
    public void AddPreloadActor(ref List <ActorPreloadTab> list, ref ActorMeta actorMeta, float spawnCnt, int ownerSkinID = 0)
    {
        ActorStaticData        inStaticData      = default(ActorStaticData);
        IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

        actorDataProvider.GetActorStaticData(ref actorMeta, ref inStaticData);
        ActorServerData        actorServerData    = default(ActorServerData);
        IGameActorDataProvider actorDataProvider2 = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.ServerDataProvider);

        actorDataProvider2.GetActorServerData(ref actorMeta, ref actorServerData);
        CActorInfo actorInfo = CActorInfo.GetActorInfo(inStaticData.TheResInfo.ResPath, enResourceType.BattleScene);

        if (actorInfo == null)
        {
            return;
        }
        for (int i = 0; i < list.get_Count(); i++)
        {
            ActorPreloadTab actorPreloadTab = list.get_Item(i);
            if (actorPreloadTab.theActor.ActorType == actorMeta.ActorType && actorPreloadTab.theActor.ConfigId == actorMeta.ConfigId)
            {
                if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero || actorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
                {
                    int actorMarkID = this.GetActorMarkID(actorMeta);
                    if (actorMarkID != actorPreloadTab.MarkID)
                    {
                        goto IL_13B;
                    }
                    uint skillID = 0u;
                    if (actorDataProvider2.GetActorServerCommonSkillData(ref actorMeta, out skillID))
                    {
                        this.AnalyseSkill(ref actorPreloadTab, (int)skillID);
                    }
                }
                else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster && spawnCnt > 0f)
                {
                    actorPreloadTab.spawnCnt += spawnCnt;
                    list.set_Item(i, actorPreloadTab);
                }
                LoaderHelper.retCnt++;
                return;
            }
            IL_13B :;
        }
        ActorPreloadTab actorPreloadTab2 = new ActorPreloadTab();

        actorPreloadTab2.theActor = actorMeta;
        actorPreloadTab2.modelPrefab.assetPath    = actorInfo.GetArtPrefabName((ownerSkinID != 0) ? ownerSkinID : ((int)actorServerData.SkinId), -1);
        actorPreloadTab2.modelPrefab.nInstantiate = 1;
        actorPreloadTab2.spawnCnt   = spawnCnt;
        actorPreloadTab2.MarkID     = this.GetActorMarkID(actorMeta);
        actorPreloadTab2.ageActions = new List <AssetLoadBase>();
        actorPreloadTab2.parPrefabs = new List <AssetLoadBase>();
        actorPreloadTab2.mesPrefabs = new List <AssetLoadBase>();
        if (actorServerData.SkinId != 0u)
        {
            actorInfo.PreLoadAdvanceSkin(actorPreloadTab2.mesPrefabs, actorServerData.SkinId, -1);
        }
        actorPreloadTab2.spritePrefabs = new List <AssetLoadBase>();
        actorPreloadTab2.soundBanks    = new List <AssetLoadBase>();
        actorPreloadTab2.behaviorXml   = new List <AssetLoadBase>();
        ActorStaticSkillData actorStaticSkillData = default(ActorStaticSkillData);

        for (int j = 0; j < 8; j++)
        {
            actorDataProvider.GetActorStaticSkillData(ref actorMeta, (ActorSkillSlot)j, ref actorStaticSkillData);
            this.AnalyseSkill(ref actorPreloadTab2, actorStaticSkillData.SkillId);
            this.AnalysePassiveSkill(ref actorPreloadTab2, actorStaticSkillData.PassiveSkillId);
        }
        if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero || actorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
        {
            int skillID2;
            int skillID3;
            int skillID4;
            int passiveSkillID;
            this.GetMapSkills(out skillID2, out skillID3, out skillID4, out passiveSkillID);
            this.AnalyseSkill(ref actorPreloadTab2, skillID2);
            this.AnalyseSkill(ref actorPreloadTab2, skillID3);
            this.AnalyseSkill(ref actorPreloadTab2, skillID4);
            this.AnalysePassiveSkill(ref actorPreloadTab2, passiveSkillID);
            uint skillID5 = 0u;
            if (actorDataProvider2.GetActorServerCommonSkillData(ref actorMeta, out skillID5))
            {
                this.AnalyseSkill(ref actorPreloadTab2, (int)skillID5);
            }
            this.AnalyseHeroBornAndReviveAge(ref actorPreloadTab2, actorMeta.ConfigId);
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey((uint)actorMeta.ConfigId);
            if (dataByKey != null)
            {
                this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey.iPassiveID1);
                this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey.iPassiveID2);
            }
        }
        else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
        {
            ActorStaticData        actorStaticData    = default(ActorStaticData);
            IGameActorDataProvider actorDataProvider3 = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

            actorDataProvider3.GetActorStaticData(ref actorMeta, ref actorStaticData);
            int randomPassiveSkillRule = actorStaticData.TheBaseAttribute.RandomPassiveSkillRule;
            if (randomPassiveSkillRule > 0 && !this.randomSkillCheckerSet.ContainsKey(randomPassiveSkillRule))
            {
                this.randomSkillCheckerSet.Add(randomPassiveSkillRule, true);
                ResRandomSkillPassiveRule dataByKey2 = GameDataMgr.randomSkillPassiveDatabin.GetDataByKey((long)randomPassiveSkillRule);
                if (dataByKey2.astRandomSkillPassiveID1 != null && dataByKey2.astRandomSkillPassiveID1.Length > 0)
                {
                    for (int k = 0; k < dataByKey2.astRandomSkillPassiveID1.Length; k++)
                    {
                        this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey2.astRandomSkillPassiveID1[k].iParam);
                    }
                }
                if (dataByKey2.astRandomSkillPassiveID2 != null && dataByKey2.astRandomSkillPassiveID2.Length > 0)
                {
                    for (int l = 0; l < dataByKey2.astRandomSkillPassiveID2.Length; l++)
                    {
                        this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey2.astRandomSkillPassiveID2[l].iParam);
                    }
                }
            }
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff(actorMeta.ConfigId);
            if (dataCfgInfoByCurLevelDiff != null && dataCfgInfoByCurLevelDiff.iBufDropID != 0 && dataCfgInfoByCurLevelDiff.iBufDropRate > 0)
            {
                ShenFuSystem.PreLoadShenfuResource(dataCfgInfoByCurLevelDiff.iBufDropID, ref actorPreloadTab2, this);
            }
            if (actorStaticData.TheMonsterOnlyInfo.SoldierType == 8 && dataCfgInfoByCurLevelDiff != null)
            {
                ListView <Assets.Scripts.GameLogic.SoldierWave> listView = new ListView <Assets.Scripts.GameLogic.SoldierWave>();
                int iKillByCamp1ChangeSoldierWave = dataCfgInfoByCurLevelDiff.iKillByCamp1ChangeSoldierWave;
                int iKillByCamp2ChangeSoldierWave = dataCfgInfoByCurLevelDiff.iKillByCamp2ChangeSoldierWave;
                listView.AddRange(SoldierRegion.GetWavesForPreLoad(iKillByCamp1ChangeSoldierWave));
                listView.AddRange(SoldierRegion.GetWavesForPreLoad(iKillByCamp2ChangeSoldierWave));
                for (int m = 0; m < listView.Count; m++)
                {
                    Assets.Scripts.GameLogic.SoldierWave soldierWave = listView[m];
                    if (soldierWave != null && soldierWave.WaveInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo.Length > 0)
                    {
                        for (int n = 0; n < soldierWave.WaveInfo.astNormalSoldierInfo.Length; n++)
                        {
                            ResSoldierTypeInfo resSoldierTypeInfo = soldierWave.WaveInfo.astNormalSoldierInfo[n];
                            if (resSoldierTypeInfo.dwSoldierID == 0u)
                            {
                                break;
                            }
                            ActorMeta actorMeta2 = default(ActorMeta);
                            ActorMeta actorMeta3 = actorMeta2;
                            actorMeta3.ActorType = ActorTypeDef.Actor_Type_Monster;
                            actorMeta3.ConfigId  = (int)resSoldierTypeInfo.dwSoldierID;
                            actorMeta2           = actorMeta3;
                            this.AddPreloadActor(ref list, ref actorMeta2, resSoldierTypeInfo.dwSoldierNum * 2f, 0);
                        }
                    }
                }
            }
        }
        if (!string.IsNullOrEmpty(actorInfo.deadAgePath))
        {
            actorPreloadTab2.ageActions.Add(new AssetLoadBase
            {
                assetPath = actorInfo.deadAgePath
            });
        }
        if (!string.IsNullOrEmpty(actorInfo.BtResourcePath) && !this.behaviorXmlSet.ContainsKey(actorInfo.BtResourcePath))
        {
            actorPreloadTab2.behaviorXml.Add(new AssetLoadBase
            {
                assetPath = actorInfo.BtResourcePath
            });
            this.behaviorXmlSet.Add(actorInfo.BtResourcePath, true);
        }
        actorPreloadTab2.soundBanks = new List <AssetLoadBase>();
        this.AnalyseSoundBanks(ref actorPreloadTab2, ref actorInfo, ref actorServerData);
        list.Add(actorPreloadTab2);
        if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
        {
            this.CheckCallMonsterSkill(actorInfo, ref list, ref actorMeta, (int)actorServerData.SkinId);
        }
        else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Organ)
        {
            this.CheckOrganSoldierWave(ref list, ref actorMeta, inStaticData);
        }
    }