Esempio n. 1
0
        protected override void OnLoad()
        {
            MaxLevel = 0;

            dtLevel = GameEntry.DataTable.GetDataTable <DRLevel>();
            if (dtLevel == null)
            {
                throw new System.Exception("Can not get data table Level");
            }

            dicLevelData = new Dictionary <int, LevelData>();

            DataWave dataWave = GameEntry.Data.GetData <DataWave>();

            if (dataWave == null)
            {
                throw new System.Exception("Can not get data 'DataWave'");
            }

            DRLevel[] dRLevels = dtLevel.GetAllDataRows();
            foreach (var dRLevel in dRLevels)
            {
                SceneData sceneData = GameEntry.Data.GetData <DataScene>().GetSceneData(dRLevel.SceneId);

                int[]      waveIds   = dRLevel.WaveIds;
                WaveData[] waveDatas = new WaveData[waveIds.Length];
                for (int i = 0; i < waveIds.Length; i++)
                {
                    WaveData waveData = dataWave.GetWaveData(waveIds[i]);
                    if (waveData == null)
                    {
                        throw new System.Exception("Can not find Wave Data id :" + waveIds[i]);
                    }

                    waveDatas[i] = waveData;
                }

                LevelData levelData = new LevelData(dRLevel, waveDatas, sceneData);
                dicLevelData.Add(dRLevel.Id, levelData);

                if (dRLevel.Id > MaxLevel)
                {
                    MaxLevel = dRLevel.Id;
                }
            }

            //
            starScore    = new int[3];
            starScore[0] = GameEntry.Config.GetInt(Constant.Config.LevelStar1);
            starScore[1] = GameEntry.Config.GetInt(Constant.Config.LevelStar2);
            starScore[2] = GameEntry.Config.GetInt(Constant.Config.LevelStar3);

            Subscribe(LoadLevelFinishEventArgs.EventId, OnLoadLevelFinfish);
        }
Esempio n. 2
0
        public SceneData[] GetAllSceneData()
        {
            int index = 0;

            SceneData[] results = new SceneData[dicSceneData.Count];
            foreach (var sceneData in dicSceneData.Values)
            {
                results[index++] = sceneData;
            }

            return(results);
        }
Esempio n. 3
0
        protected override void OnLoad()
        {
            dtScene = GameEntry.DataTable.GetDataTable <DRScene>();
            if (dtScene == null)
            {
                throw new System.Exception("Can not get data table Scene");
            }

            dicSceneData = new Dictionary <int, SceneData>();

            DRScene[] dRScenes = dtScene.GetAllDataRows();
            foreach (var dRScene in dRScenes)
            {
                DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(dRScene.AssetId);
                SceneData    sceneData    = new SceneData(dRScene, dRAssetsPath);
                dicSceneData.Add(dRScene.Id, sceneData);
            }
        }
Esempio n. 4
0
 public LevelData(DRLevel dRLevel, WaveData[] waveData, SceneData sceneData)
 {
     this.dRLevel   = dRLevel;
     this.waveData  = waveData;
     this.sceneData = sceneData;
 }