Ejemplo n.º 1
0
 public void saveGame(Account account)
 {
     try
     {
         List <Account> acc = self.accounts;
         for (int i = 0; i < acc.Count; i++)
         {
             if (acc[i].name.Equals(account.name))
             {
                 acc[i] = account;
                 self.Save();
                 return;
             }
         }
     }
     catch (System.Exception e) {
         Debug.Log("Failed to save Acount");
     }
 }
Ejemplo n.º 2
0
 public static AccountContainer load()
 {
     if (self == null)
     {
         checkDirectory();
         string path;
         path = "file://" + Application.dataPath + "/SaveGame/SaveGame.xml";
         WWW file = new WWW(path);
         if (!file.text.Equals(""))
         {
             while (!file.isDone)
             {
                 ;
             }
             XmlSerializer serializer = new XmlSerializer(typeof(AccountContainer));
             StringReader  s          = new StringReader(file.text);
             self = serializer.Deserialize(s) as AccountContainer;
             foreach (Account a in self.accounts)
             {
                 a.updateNewGameSave(MinigameContainer.loadMinigame().minigames);
                 a.updateNewPenghargaanSave(PenghargaanContainer.load().penghargaans);
                 self.Save();
             }
             return(self);
         }
         else
         {
             AccountContainer a = new AccountContainer();
             a.Save();
             return(a);
         }
     }
     else
     {
         return(self);
     }
 }
Ejemplo n.º 3
0
 public void save(int starNum)
 {
     acc.currentAccount.setHighScore(gameName, starNum);
     acc.saveGame(acc.currentAccount);
     acc.Save();
 }