private void SetTotalDropList(StageEndRsp rsp, out List <DropItem> totalList, out DropItem normalDropItem, out DropItem fastDropItem, out DropItem sonicDropItem) { totalList = Singleton <LevelScoreManager> .Instance.GetTotalDropList(); normalDropItem = null; fastDropItem = null; sonicDropItem = null; List <int> configChallengeIds = Singleton <LevelScoreManager> .Instance.configChallengeIds; LevelMetaData levelMeta = LevelMetaDataReader.TryGetLevelMetaDataByKey((int)rsp.get_stage_id()); foreach (StageSpecialChallengeData data2 in rsp.get_special_challenge_list()) { int num = (int)data2.get_challenge_index(); if (num < configChallengeIds.Count) { LevelChallengeDataItem item = new LevelChallengeDataItem(configChallengeIds[num], levelMeta, 0); if (item.IsFinishStageNomalChallenge()) { normalDropItem = data2.get_drop_item(); totalList.Add(normalDropItem); } else if (item.IsFinishStageFastChallenge()) { fastDropItem = data2.get_drop_item(); totalList.Add(fastDropItem); } else if (item.IsFinishStageVeryFastChallenge()) { sonicDropItem = data2.get_drop_item(); totalList.Add(sonicDropItem); } } } }
public static List <LevelMetaData> Parse(string path) { using (BinaryReader b = new BinaryReader(File.Open(path, FileMode.Open))) { var res = new List <LevelMetaData>(); while (b.BaseStream.Position != b.BaseStream.Length) { var m = new LevelMetaData(); for (int i = 0; i < 20; i++) { m.randomRectsCoords[i] = RandomRectCoords.Parse(b); } for (int i = 0; i < 20; i++) { m.TimesIn10k[i] = b.ReadInt16().SwapBytes(); } for (int i = 0; i < 20; i++) { m.BattleRange[i] = RandomRectBattleRange.Parse(b); } for (int i = 0; i < 20; i++) { for (int j = 0; j < 3; j++) { m.XapNum[i, j] = b.ReadInt16().SwapBytes(); } } for (int i = 0; i < 20; i++) { for (int j = 0; j < 3; j++) { m.XapChance[i, j] = b.ReadInt16().SwapBytes(); } } m.LandType = b.ReadByte(); m.unknown = b.ReadBytes(0x16); m.PercentOption = b.ReadBytes(20); m.unused = b.ReadByte(); for (int i = 0; i < 20; i++) { m.sound[i] = b.ReadInt16().SwapBytes(); } for (int i = 0; i < 20; i++) { m.text[i] = b.ReadInt16().SwapBytes(); } res.Add(m); } return(res); } }
public static void Parse(string fileName, ref LevelMetaData data) { fileName = fileName + "_md"; try { List <string> textLines = ParseUtils.TextAssetToList(Resources.Load(path + fileName) as TextAsset); int doorIndex = 0; int id = 0; int elementIndex = 0; data.requirements = new List <RequirementsMetaData>(); foreach (string line in textLines) { if (line != null) { if (line.Split(' ').Length == 2) { int x = int.Parse(line.Split(' ')[0]); int y = int.Parse(line.Split(' ')[1]); data.requirements.Add(new RequirementsMetaData()); data.requirements[doorIndex].doorToOpen = new Vector2(x, y); data.requirements[doorIndex].requirements = new List <RequirementMetaData>(); doorIndex++; elementIndex = 0; } else if (line.Split(' ').Length == 3) { int a = int.Parse(line.Split(' ')[0]); int b = int.Parse(line.Split(' ')[1]); int c = int.Parse(line.Split(' ')[2]); RequirementsMetaData temp = data.requirements[doorIndex - 1]; temp.requirements.Add(new RequirementMetaData()); temp.requirements[elementIndex].positionInGrid = new Vector2(a, b); temp.requirements[elementIndex].type = c; temp.requirements[elementIndex].id = id; id++; elementIndex++; } } } } catch (Exception e) { Debug.Log("Unable to Load file " + fileName + "\n" + e.Message); return; } //setupGrid(data, colCount); }
// Use this for initialization void Start() { //AudioManager.Instance.PlayMusic("BGM"); activityName = GameStateManager.Instance.getCurrentSceneName(); levelData = new LevelMetaData(SessionManager.Instance.nombre_jugador, "Seres" + activityName); spritesAlreadyInUse = new ArrayList(); ResetOrder(); Spawn(); }
public void LoadMap(LevelData levelData) { destroyContent(); this.MapName = levelData.name; LoadMap(); LevelMetaData metadata = gameObject.AddComponent(typeof(LevelMetaData)) as LevelMetaData; MDParser.Parse(levelData.name, ref metadata); metadata.LoadMetaData(); GetComponent <EnemySpawner>().SpawnEnemies(levelData.name, model.Height, model.Width); model.levelInfo = levelData; DisplayOverlays(); }
public SpecialLevelTimeChallenge(LevelChallengeHelperPlugin helper, LevelChallengeMetaData metaData) : base(helper, metaData) { this._finished = true; if (metaData.conditionId != 0x1b) { LevelMetaData levelMetaDataByKey = LevelMetaDataReader.GetLevelMetaDataByKey(Singleton <LevelScoreManager> .Instance.LevelId); this.targetLevelTime = (metaData.conditionId != 0x1d) ? ((float)levelMetaDataByKey.fastBonusTime) : ((float)levelMetaDataByKey.sonicBonusTime); } else { this.targetLevelTime = (float)base._metaData.paramList[0]; } }
public LevelChallengeDataItem(int challengeId, LevelMetaData levelMeta, int rewardId = 0) { this.challengeId = challengeId; this._metaData = LevelChallengeMetaDataReader.GetLevelChallengeMetaDataByKey(challengeId); if (this.IsFinishStageFastChallenge() || this.IsFinishStageVeryFastChallenge()) { int num = !this.IsFinishStageFastChallenge() ? levelMeta.sonicBonusTime : levelMeta.fastBonusTime; this._metaData = new LevelChallengeMetaData(this._metaData.challengeId, this._metaData.conditionId, new List <int> { num }, this._metaData.diaplayTarget); } this.Finished = false; }
// Use this for initialization void Start() { //AudioManager.Instance.PlayMusic("BGM"); activityName = GameStateManager.Instance.getCurrentSceneName(); levelData = new LevelMetaData(SessionManager.Instance.nombre_jugador, "Animales-" + activityName); spritesAlreadyInUse = new ArrayList(); ResetOrder(); print(AnimalManager.Instance.FilterByUtility(0).Count); Spawn(); }
public static void LoadScenario() { var path = Application.dataPath + "/Resources/Scenarios/City Of Bywater/"; GameData.LevelData = LevelData.Parse(path + "Data LD"); GameData.ScenarioData = ScenarioData.Parse(path + "City of Bywater"); GameData.SolidSpecial = Solid.Parse(path + "Data Solids"); GameData.ActionPoints = ActionPointData.Parse(path + "Data DD"); GameData.ActionPointsExtra = ActionPointData.Parse(path + "Data ED3"); GameData.Strings = String.Parse(path + "Data SD2"); GameData.SimpleEncounter = SimpleEncounterData.Parse(path + "Data ED"); GameData.ExtraCodes = ExtraCode.Parse(path + "Data EDCD"); GameData.LevelMetaData = LevelMetaData.Parse(path + "Data RD"); GameData.x = GameData.ScenarioData.StartX; GameData.y = GameData.ScenarioData.StartY; GameData.level = GameData.ScenarioData.StartLevel; }
public void destroyContent() { pool.returnAllObjects(); wallPool.returnAllObjects(); keyBoardOverlay.returnAllObjects(); foreach (Transform t in contentParent) { Destroy(t.gameObject); } Box.ClearList(); Key.ClearList(); Door.ClearList(); PressurePlate.ClearList(); LevelMetaData toDestroy = GetComponent <LevelMetaData> (); if (toDestroy != null) { DestroyImmediate(toDestroy); } }
public LevelDataItem(int levelId, LevelMetaData levelMetaData) { this.levelId = levelId; this._metaData = levelMetaData; this.Initialized = false; this.status = 1; this.challengeList = new List <LevelChallengeDataItem>(); foreach (LevelMetaData.LevelChallengeMetaNode node in this._metaData.challengeList) { this.challengeList.Add(new LevelChallengeDataItem(node.challengeId, this._metaData, node.rewardId)); } this.isNewLevel = true; this._actID = this._metaData.actId; this._chapterID = this._metaData.chapterId; this.isDropActivityOpen = false; this.isDoubleDrop = false; this.displayDropList = new List <int>(); this.displayFirstDropList = new List <int>(); this.displayBonusDropList = new List <int>(); this.dropDisplayInfoReceived = false; }
private void SetupStatusTab() { GameObject gameObject = base.view.transform.Find("Dialog/StatusTab").gameObject; Button component = base.view.transform.Find("Dialog/TabBtns/TabBtn_1").GetComponent <Button>(); this._tabManager.SetTab("StatusTab", component, gameObject); this._levelScoreManager = Singleton <LevelScoreManager> .Instance; if ((this._levelScoreManager.isTryLevel || this._levelScoreManager.isDebugLevel) || (this._levelScoreManager.LevelType == 4)) { this.SetupViewForTryOrDebugLevel(); } else { string str; this._levelData = Singleton <LevelModule> .Instance.GetLevelById(this._levelScoreManager.LevelId); if (this._levelData.LevelType == 1) { string[] textArray1 = new string[] { this._levelScoreManager.chapterTitle, " ", this._levelScoreManager.actTitle, " ", this._levelScoreManager.stageName, " ", this._levelScoreManager.LevelTitle }; str = string.Concat(textArray1); } else { str = Singleton <LevelModule> .Instance.GetWeekDayActivityByID(this._levelData.ActID).GetActitityTitle() + " " + this._levelData.Title; } base.view.transform.Find("Dialog/StatusTab/Content/Title/Text").GetComponent <Text>().text = str; base.view.transform.Find("Dialog/StatusTab/Content/CurrentGetItems/Scoin/Num").GetComponent <Text>().text = Mathf.FloorToInt(this._levelScoreManager.scoinInside).ToString(); Transform transform = base.view.transform.Find("Dialog/StatusTab/Content/CurrentGetItems/Items"); this._dropItemList = this._levelScoreManager.GetDropListToShow(); transform.gameObject.SetActive(this._dropItemList.Count > 0); this._dropGridScroller = transform.Find("ScrollView").GetComponent <MonoGridScroller>(); this._dropGridScroller.Init(new MonoGridScroller.OnChange(this.OnScrollerChange), this._dropItemList.Count, null); bool flag = this._dropItemList.Count > this._dropGridScroller.GetMaxItemCountWithouScroll(); transform.Find("PrevBtn").gameObject.SetActive(flag); transform.Find("NextBtn").gameObject.SetActive(flag); Transform transform2 = base.view.transform.Find("Dialog/StatusTab/Content/ChallengePanel"); List <LevelChallengeDataItem> list = new List <LevelChallengeDataItem>(); LevelScoreManager instance = Singleton <LevelScoreManager> .Instance; LevelMetaData levelMetaDataByKey = LevelMetaDataReader.GetLevelMetaDataByKey(this._levelData.levelId); foreach (int num in instance.configChallengeIds) { LevelChallengeDataItem item = new LevelChallengeDataItem(num, levelMetaDataByKey, 0); list.Add(item); } Dictionary <int, BaseLevelChallenge> dictionary = new Dictionary <int, BaseLevelChallenge>(); foreach (BaseLevelChallenge challenge in Singleton <LevelManager> .Instance.levelActor.GetPlugin <LevelChallengeHelperPlugin>().challengeList) { dictionary[challenge.challengeId] = challenge; } for (int i = 0; i < list.Count; i++) { LevelChallengeDataItem item2 = list[i]; Transform child = transform2.GetChild(i); child.Find("Content").GetComponent <Text>().text = item2.DisplayTarget; bool flag2 = !(dictionary.ContainsKey(item2.challengeId) && !dictionary[item2.challengeId].IsFinished()); bool flag3 = dictionary.ContainsKey(item2.challengeId); child.Find("Achieve").gameObject.SetActive(flag2); child.Find("Unachieve").gameObject.SetActive(!flag2); child.Find("Achieve/CompleteMark").gameObject.SetActive(!flag3); child.Find("Achieve/Progress").gameObject.SetActive(flag3); child.Find("Unachieve/Progress").gameObject.SetActive(flag3); if (flag3) { string localizedText = this.GetLocalizedText(dictionary[item2.challengeId].GetProcessMsg()); child.Find("Achieve/Progress").GetComponent <Text>().text = localizedText; child.Find("Unachieve/Progress").GetComponent <Text>().text = localizedText; } } } }
void SetLevel(int idx) { levelValues = Resources.Load <LevelMetaData>(STR_LEVELMETADATA_FILENAME + "_" + idx); }