public void AddEntry(JournalEntryInfo entry)
 {
     if (!Contains(entry.Id))
     {
         entries.Add(entry);
         RavenhillEvents.OnJournalEntryAdded(entry);
     }
 }
 public bool IsFirst(JournalEntryInfo info)
 {
     if (entries.Count > 0)
     {
         return(entries[0].Id == info.Id);
     }
     return(false);
 }
 public int GetEntryIndex(JournalEntryInfo info)
 {
     for (int i = 0; i < entries.Count; i++)
     {
         if (entries[i].Id == info.Id)
         {
             return(i);
         }
     }
     return(-1);
 }
 public JournalEntryInfo GetPrev(JournalEntryInfo info)
 {
     if (IsFirst(info))
     {
         return(null);
     }
     else
     {
         int index = entries.IndexOf(info);
         if (index > 0)
         {
             return(entries[index - 1]);
         }
         return(null);
     }
 }
 public JournalEntryInfo GetNext(JournalEntryInfo info)
 {
     if (IsLast(info))
     {
         return(null);
     }
     else
     {
         int index = entries.IndexOf(info);
         if (index >= 0 && (index + 1) < entries.Count)
         {
             return(entries[index + 1]);
         }
         return(null);
     }
 }
 public bool Load(string saveStr)
 {
     if (saveStr.IsValid())
     {
         UXMLDocument document = UXMLDocument.FromXml(saveStr);
         entries.Clear();
         document.Element(saveId).Elements("entry").ForEach(entryElement => {
             JournalEntryInfo info = new JournalEntryInfo();
             info.Load(entryElement);
             if (info.IsValid)
             {
                 entries.Add(info);
             }
         });
         isLoaded = true;
     }
     else
     {
         InitSave();
     }
     return(isLoaded);
 }
Exemple #7
0
 public static void OnJournalEntryEndTextClosed(JournalEntryInfo info)
 {
     JournalEntryEndTextClosed?.Invoke(info);
 }
Exemple #8
0
 public static void OnJournalEntryRemoved(JournalEntryInfo info)
 {
     JournalEntryRemoved?.Invoke(info);
 }