public static void Skip(BinaryReader aBinaryReader, int aVersion) { if (aVersion >= 100) { aBinaryReader.ReadBoolean(); int num = aBinaryReader.ReadInt16(); for (int i = 0; i < num; i++) { aBinaryReader.ReadString(); LevelWord.Skip(aBinaryReader, aVersion); } num = aBinaryReader.ReadInt16(); for (int j = 0; j < num; j++) { aBinaryReader.ReadString(); } aBinaryReader.ReadInt16(); aBinaryReader.ReadInt16(); aBinaryReader.ReadInt16(); aBinaryReader.ReadBoolean(); aBinaryReader.ReadInt16(); } if (aVersion >= 101) { aBinaryReader.ReadInt16(); } }
public void Set(LevelWord aWord, float aWordLetterOffset, bool aIsLevelCompleted, LevelType aLevelType) { levelWord = aWord; int num = int.MinValue; int num2 = int.MinValue; for (int i = 0; i < aWord.letters.Count; i++) { Object.Instantiate(boardLetterPrefab, base.transform).Set(aWord.letters[i], aWordLetterOffset, (i != 0) ? ((i != aWord.letters.Count - 1) ? BoardLetter.Order.Middle : BoardLetter.Order.Last) : BoardLetter.Order.First, (num == aWord.letters[i].x - 1) ? BoardLetter.HintDirection.Left : ((num == aWord.letters[i].x + 1) ? BoardLetter.HintDirection.Right : ((num2 == aWord.letters[i].y - 1) ? BoardLetter.HintDirection.Up : ((num2 == aWord.letters[i].y + 1) ? BoardLetter.HintDirection.Down : BoardLetter.HintDirection.None))), aIsLevelCompleted, aLevelType); num = aWord.letters[i].x; num2 = aWord.letters[i].y; } if (aWord.isCompleted) { IsCompleted = true; MarkLetters(aIsWithAnimation: false); } Hint(levelWord.hint, aIsNoneOnly: false, aIsForce: true, aIsWithAnimation: false); }
public void Load(BinaryReader aBinaryReader, int aVersion) { if (aVersion >= 100) { isCompleted = aBinaryReader.ReadBoolean(); int num = aBinaryReader.ReadInt16(); for (int i = 0; i < num; i++) { string value = aBinaryReader.ReadString(); bool flag = true; foreach (LevelWord word in words) { if (word.word.Equals(value)) { word.Load(aBinaryReader, aVersion); flag = false; break; } } if (flag) { LevelWord.Skip(aBinaryReader, aVersion); } } num = aBinaryReader.ReadInt16(); for (int j = 0; j < num; j++) { extraWords.Add(aBinaryReader.ReadString()); } stats.coins = aBinaryReader.ReadInt16(); stats.pointsNormal = aBinaryReader.ReadInt16(); stats.pointsExtra = aBinaryReader.ReadInt16(); stats.isPerfect = aBinaryReader.ReadBoolean(); stats.valid = aBinaryReader.ReadInt16(); } if (aVersion >= 101) { hintTipIndex = aBinaryReader.ReadInt16(); } }
public void ParseSettings(string aData, MonoBehaviour aCompleteInv, string aCompleteMet) { float realtimeSinceStartup = Time.realtimeSinceStartup; List <List <string> > list = new List <List <string> >(); int length = aData.Length; int num = 0; List <string> list2 = new List <string>(); string text = ""; bool flag = false; while (num < length) { char c = aData[num++]; switch (c) { case '"': if (!flag) { flag = true; } else if (num < length) { if (aData[num] == '"') { text += "\""; num++; } else { flag = false; } } break; case ',': if (flag) { text += c.ToString(); break; } list2.Add(text); text = ""; break; case '\n': if (flag) { text += c.ToString(); break; } list2.Add(text); if (list2.Count >= 1) { list.Add(list2); } list2 = new List <string>(); text = ""; break; default: text += c.ToString(); break; case '\r': break; } } list2.Add(text); if (list2.Count >= 1) { list.Add(list2); } list2 = new List <string>(); List <List <string> > list3 = list; UnityEngine.Debug.Log("Time CSV parse: " + (Time.realtimeSinceStartup - realtimeSinceStartup)); int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; bool flag2 = ELSingleton <ApplicationSettings> .Instance.deploymentEnvironment == DeploymentEnvironment.Live; Dictionary <string, int> dictionary = ParseCSVTitles(list3); World world = null; Pack pack = null; Level level = null; LevelWord levelWord = null; LevelLetter levelLetter = null; for (int i = 1; i < list3.Count; i++) { List <string> list4 = list3[i]; string text2 = list4[0]; if (text2 == null || text2.Length <= 0) { continue; } if ((flag2 && text2[0] == 'W') || (!flag2 && string.Equals(text2, "W"))) { world = new World(); world.name = list4[dictionary["Name"]]; world.packs = new List <Pack>(); world.isCompleted = false; } if ((flag2 && text2[0] == 'P') || (!flag2 && string.Equals(text2, "P"))) { pack = new Pack(); pack.index = num3; pack.name = list4[dictionary["Name"]]; pack.levels = new List <Level>(); pack.isCompleted = false; num3++; num4 = 0; } if ((flag2 && text2[0] == 'L') || (!flag2 && string.Equals(text2, "L"))) { level = new Level(); level.index = num4; level.name = list4[dictionary["Name"]]; level.number = num5; level.type = LevelType.Normal; level.isCompleted = false; num5++; num4++; string[] array = Chop(list4[dictionary["Value"]], 1); if (array.Length > 1) { level.width = Convert.ToInt32(array[0], 16); level.height = Convert.ToInt32(array[1], 16); } else { level.width = 10; level.height = 10; UnityEngine.Debug.LogError("LevelSettings: wrong level width or height at level: " + (level.number + 1) + " " + level.name); } level.words = new List <LevelWord>(); if (!levelSet.worlds.Contains(world)) { levelSet.worlds.Add(world); } if (!world.packs.Contains(pack)) { world.packs.Add(pack); } level.extraWords = new List <string>(); level.iconRect = new Rect(Convert.ToInt32(list4[3]), Convert.ToInt32(list4[4]), Convert.ToInt32(list4[5]), Convert.ToInt32(list4[6])); level.stats = new LevelStats(); level.hintTipIndex = -1; pack.levels.Add(level); } if ((flag2 && text2[0] == 'S') || (!flag2 && string.Equals(text2, "S"))) { num6++; level = new Level(); level.name = list4[dictionary["Name"]]; level.number = num6; level.type = LevelType.BonusRound; level.isCompleted = false; string[] array2 = Chop(list4[dictionary["Value"]], 1); if (array2.Length > 1) { level.width = Convert.ToInt32(array2[0], 16); level.height = Convert.ToInt32(array2[1], 16); } else { level.width = 10; level.height = 10; UnityEngine.Debug.LogError("LevelSettings: wrong level width or height at level: " + (level.number + 1) + " " + level.name); } level.words = new List <LevelWord>(); level.extraWords = new List <string>(); level.iconRect = new Rect(Convert.ToInt32(list4[3]), Convert.ToInt32(list4[4]), Convert.ToInt32(list4[5]), Convert.ToInt32(list4[6])); level.stats = new LevelStats(); level.hintTipIndex = -1; levelSet.specialLevels[level.height].Add(level); } if ((!flag2 || text2[0] != 'w') && (flag2 || !string.Equals(text2, "w"))) { continue; } levelWord = new LevelWord(); levelWord.word = list4[dictionary["Name"]]; levelWord.letters = new List <LevelLetter>(); levelWord.Reset(); string[] array3 = Chop(list4[dictionary["Value"]], 1); for (int j = 0; j < levelWord.word.Length; j++) { levelLetter = new LevelLetter(); levelLetter.letter = levelWord.word.Substring(j, 1); if (j * 2 + 1 < array3.Length) { levelLetter.x = Convert.ToInt32(array3[j * 2], 16); levelLetter.y = Convert.ToInt32(array3[j * 2 + 1], 16); } else { levelLetter.x = -1; levelLetter.y = -1; UnityEngine.Debug.LogError("LevelSettings: wrong letter x or y at level: " + (level.number + 1) + " " + level.name + " word: " + levelWord.word + " letter: " + levelLetter.letter); } levelLetter.isCoin = false; levelWord.letters.Add(levelLetter); } level.words.Add(levelWord); } UnityEngine.Debug.Log("Time Levels Parse: " + (Time.realtimeSinceStartup - realtimeSinceStartup)); realtimeSinceStartup = Time.realtimeSinceStartup; UnityEngine.Debug.Log(levelSet); levelSet.AfterParseAction(); UnityEngine.Debug.Log("Time Other: " + (Time.realtimeSinceStartup - realtimeSinceStartup)); realtimeSinceStartup = Time.realtimeSinceStartup; aCompleteInv.GetType().GetMethod(aCompleteMet).Invoke(aCompleteInv, null); }