/// <summary> /// Gets the item by ID. /// </summary> /// <returns>The reminder item by ID.</returns> /// <param name="idx">Index.</param> public static ReminderItem GetItemByID(int idx) { string itemString = InfoSaver.GetStringFromResource(FileName.ReminderItem, idx); string[] splitted = itemString.Split(' '); return(new ReminderItem(idx, int.Parse(splitted[0]), int.Parse(splitted[1]), splitted[2], splitted[3])); }
/// <summary> /// Gets the item by Index. /// </summary> /// <returns>The usable item by the specified Index.</returns> /// <param name="idx">Index.</param> public static UsableItem GetItemByID(int idx) { string itemString = InfoSaver.GetStringFromResource(FileName.PermamnentItem, idx); string[] splitted = itemString.Split(' '); UsableItem retItem = new UsableItem(idx, splitted[0], splitted[1], splitted[2], splitted[3]); return(retItem); }
public static void UnlockNewContent(ContentType type, string targetFileName, int number) { string contentText = InfoSaver.GetStringFromResource(targetFileName, number); //!!!!!!UNSAFE coding way. Please make sure that the targetFile is absolutely correct!!!!!! string[] lineComponents = contentText.Split('#'); int index = number; string title = lineComponents[0]; string content = lineComponents[1]; int higher = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[2])); int another = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[3])); int another2 = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[4])); Content newContentEntry = new Content(type, title, content, index, another, another2, higher); //To be CONTINUED : WRITE A NEW CONTENT CLASS AND IMPLEMENT ITS INITIALIZER, THEN ADD IT HERE!!!! UIGrid targetTable = null; switch (type) { case ContentType.Reminder: targetTable = instance.reminderTable; break; case ContentType.Conclusion: targetTable = instance.conclusionTable; break; case ContentType.Truth: targetTable = instance.truthTable; break; default: break; } GameObject targetContent = NGUITools.AddChild(targetTable.gameObject, instance.contentPrefab); ContentLine targetLine = targetContent.GetComponent <ContentLine>(); targetLine.Initialize(newContentEntry); }