private void Start() { DbfRecord record = GameDbf.Scenario.GetRecord(this.m_missionId); if (record == null) { object[] messageArgs = new object[] { this.m_missionId }; Error.AddDevWarning("Error", "scenario {0} does not exist in the DBF", messageArgs); } else { if (this.m_name != null) { this.m_name.Text = record.GetLocString("SHORT_NAME"); } int @int = record.GetInt("CLIENT_PLAYER2_HERO_CARD_ID"); if (@int == 0) { @int = record.GetInt("PLAYER2_HERO_CARD_ID"); } string cardId = GameUtils.TranslateDbIdToCardId(@int); if (cardId != null) { DefLoader.Get().LoadCardDef(cardId, new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), null, null); } } }
private static List <Entry> LoadFileEntries(string path, Header header, string[] lines) { List <Entry> list = new List <Entry>(lines.Length); int num = Mathf.Max(header.m_keyIndex, header.m_valueIndex); for (int i = header.m_entryStartIndex; i < lines.Length; i++) { string str = lines[i]; if ((str.Length != 0) && !str.StartsWith("#")) { char[] separator = new char[] { '\t' }; string[] strArray = str.Split(separator); if (strArray.Length <= num) { object[] messageArgs = new object[] { i + 1, path }; Error.AddDevWarning("GameStrings Error", "GameStringTable.LoadFileEntries() - line {0} in \"{1}\" is malformed", messageArgs); } else { Entry item = new Entry { m_key = strArray[header.m_keyIndex], m_value = TextUtils.DecodeWhitespaces(strArray[header.m_valueIndex]) }; list.Add(item); } } } return(list); }
private void LoadCreditsText() { this.m_creditsTextLoadSucceeded = false; string filePath = this.GetFilePath(); if (filePath == null) { Error.AddDevWarning("Credits Error", "CreditsDisplay.LoadCreditsText() - Failed to find file for CREDITS.", new object[0]); this.m_creditsTextLoaded = true; } else { try { this.m_creditLines = System.IO.File.ReadAllLines(filePath); this.m_creditsTextLoadSucceeded = true; } catch (Exception exception) { object[] messageArgs = new object[] { filePath, exception.Message }; Error.AddDevWarning("Credits Error", "CreditsDisplay.LoadCreditsText() - Failed to read \"{0}\".\n\nException: {1}", messageArgs); } this.m_creditsTextLoaded = true; } }
private void InitDisplayedCreator() { if (base.m_entity != null) { Entity displayedCreator = base.m_entity.GetDisplayedCreator(); if (displayedCreator != null) { GameObject relative = base.m_mainCardActor.FindBone("HistoryCreatedByBone"); if (relative == null) { object[] messageArgs = new object[] { "HistoryCreatedByBone", base.m_mainCardActor }; Error.AddDevWarning("Missing Bone", "Missing {0} on {1}", messageArgs); } else { string name = displayedCreator.GetName(); object[] args = new object[] { name }; this.m_createdByText.Text = GameStrings.Format("GAMEPLAY_HISTORY_CREATED_BY", args); this.m_createdByText.transform.parent = base.m_mainCardActor.GetRootObject().transform; this.m_createdByText.gameObject.SetActive(true); TransformUtil.SetPoint(this.m_createdByText, new Vector3(0.5f, 0f, 1f), relative, new Vector3(0.5f, 0f, 0f)); this.m_createdByText.gameObject.SetActive(false); this.m_haveDisplayedCreator = true; } } } }
private static void CheckConflicts(GameStringTable table) { Map <string, string> .KeyCollection keys = table.GetAll().Keys; GameStringCategory category = table.GetCategory(); foreach (GameStringTable table2 in s_tables.Values) { foreach (string str in keys) { if (table2.Get(str) != null) { string message = string.Format("GameStrings.CheckConflicts() - Tag {0} is used in {1} and {2}. All tags must be unique.", str, category, table2.GetCategory()); Error.AddDevWarning("GameStrings Error", message, new object[0]); } } } }
private static void CheckConflicts(string path, List <Entry> entries) { if (entries.Count != 0) { for (int i = 0; i < entries.Count; i++) { string key = entries[i].m_key; for (int j = i + 1; j < entries.Count; j++) { string b = entries[j].m_key; if (string.Equals(key, b, StringComparison.OrdinalIgnoreCase)) { string message = string.Format("GameStringTable.CheckConflicts() - Tag {0} appears more than once in {1}. All tags must be unique.", key, path); Error.AddDevWarning("GameStrings Error", message, new object[0]); } } } } }
public bool Load(GameStringCategory cat, string path, string audioPath) { Header header; Header header2; this.m_category = GameStringCategory.INVALID; this.m_table.Clear(); List <Entry> entries = null; List <Entry> list2 = null; if (System.IO.File.Exists(path) && !LoadFile(path, out header, out entries)) { object[] messageArgs = new object[] { path, cat }; Error.AddDevWarning("GameStrings Error", "GameStringTable.Load() - Failed to load {0} for cat {1}.", messageArgs); return(false); } if (System.IO.File.Exists(audioPath) && !LoadFile(audioPath, out header2, out list2)) { object[] objArray2 = new object[] { audioPath, cat }; Error.AddDevWarning("GameStrings Error", "GameStringTable.Load() - Failed to load {0} for cat {1}.", objArray2); return(false); } if ((entries != null) && (list2 != null)) { this.BuildTable(path, entries, audioPath, list2); } else if (entries != null) { this.BuildTable(path, entries); } else if (list2 != null) { this.BuildTable(audioPath, list2); } else { object[] objArray3 = new object[] { cat }; Error.AddDevWarning("GameStrings Error", "GameStringTable.Load() - There are no entries for cat {0}.", objArray3); return(false); } this.m_category = cat; return(true); }
private static void CheckConflicts(string path1, List <Entry> entries1, string path2, List <Entry> entries2) { if (entries1.Count != 0) { CheckConflicts(path1, entries1); if (entries2.Count != 0) { CheckConflicts(path2, entries2); for (int i = 0; i < entries1.Count; i++) { string key = entries1[i].m_key; for (int j = 0; j < entries2.Count; j++) { string b = entries2[j].m_key; if (string.Equals(key, b, StringComparison.OrdinalIgnoreCase)) { string message = string.Format("GameStringTable.CheckConflicts() - Tag {0} is used in {1} and {2}. All tags must be unique.", key, path1, path2); Error.AddDevWarning("GameStrings Error", message, new object[0]); } } } } } }
public void InitEventTiming(IList <SpecialEventTiming> serverEventTimingList) { if (this.m_eventTimings.Count > 0) { Debug.LogWarning("SpecialEventManager.InitEventTiming(): m_eventTimings was not empty; clearing it first"); this.m_eventTimings.Clear(); } DateTime now = DateTime.Now; bool flag = false; for (int i = 0; i < serverEventTimingList.Count; i++) { SpecialEventType type; SpecialEventTiming timing = serverEventTimingList[i]; try { type = EnumUtils.GetEnum <SpecialEventType>(timing.Event); } catch (ArgumentException exception) { Error.AddDevWarning("GetEnum Error", exception.Message, new object[0]); flag = true; continue; } if (this.m_eventTimings.ContainsKey(type)) { Debug.LogWarning(string.Format("SpecialEventManager.InitEventTiming duplicate entry for event {0} received", type)); flag = true; } else { DateTime?startTime = null; if (timing.HasStart) { if (timing.Start > 0L) { startTime = new DateTime?(now.AddSeconds((double)timing.Start)); } else { startTime = new DateTime?(now); } } DateTime?endTime = null; if (timing.HasEnd) { if (timing.End > 0L) { endTime = new DateTime?(now.AddSeconds((double)timing.End)); } else { endTime = new DateTime?(now); } } this.m_eventTimings[type] = new EventTiming(startTime, endTime); } } if (flag && ApplicationMgr.IsInternal()) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < serverEventTimingList.Count; j++) { SpecialEventTiming timing2 = serverEventTimingList[j]; builder.Append("\n serverEvent=").Append(timing2.Event); builder.Append(" start=").Append(!timing2.HasStart ? "null" : timing2.Start.ToString()); builder.Append(" end=").Append(!timing2.HasEnd ? "null" : timing2.End.ToString()); } foreach (SpecialEventType type2 in this.m_eventTimings.Keys) { EventTiming timing3 = this.m_eventTimings[type2]; builder.Append("\n mgrEvent=").Append(type2); builder.Append(" start=").Append(!timing3.StartTime.HasValue ? "none" : timing3.StartTime.Value.ToString()); builder.Append(" end=").Append(!timing3.EndTime.HasValue ? "none" : timing3.EndTime.Value.ToString()); } Debug.LogWarning(string.Format("EventTiming dump: {0}", builder.ToString())); } }