예제 #1
0
 /// <summary>
 /// update which slots are selectible and the info displayed on them
 /// </summary>
 public void refresh()
 {
     for (int i = 2; i >= 0; i--)             // for each save: (reverse order, so first valid slot is set at selected)
     {
         if (SaveObj.SaveExists(i + 1))       // if exists, set name and number-unlocked to match info in save, and make button interactible
         {
             SaveObj save = SaveObj.LoadGame(i + 1);
             slotNameText[i].text = save.slotName;
             int count = 0;
             for (int j = 0; j < GameManager.numLevels; j++)
             {
                 if (save.canAccess(j))
                 {
                     count++;
                 }
             }
             numUnlockedText[i].text    = count + "/" + GameManager.numLevels;
             slotButton[i].interactable = true;
             firstSelected = slotButton[i]; // set valid slot as selected
         }
         else                               // else set text to defualt and set non-interactible
         {
             slotNameText[i].text       = "-";
             numUnlockedText[i].text    = "~/" + GameManager.numLevels;
             slotButton[i].interactable = false;
         }
     }
 }
예제 #2
0
 protected override void _StartState(IState oldstate)
 {
     this.gameObject.SetActive(true);
     firstSelected = returnButton;
     for (int i = 2; i >= 0; i--)             // for each potential save:
     {
         if (SaveObj.SaveExists(i + 1))       // if exists, set name and number-unlocked to match info in save, and make button non-interactible
         {
             SaveObj save = SaveObj.LoadGame(i + 1);
             slotNameText[i].text = save.slotName;
             int count = 0;
             for (int j = 0; j < GameManager.numLevels; j++)
             {
                 if (save.canAccess(j))
                 {
                     count++;
                 }
             }
             numUnlockedText[i].text    = count + "/" + GameManager.numLevels;
             slotButton[i].interactable = false;
         }
         else                    // else set text to defualt and set interactible
         {
             slotNameText[i].text       = "-";
             numUnlockedText[i].text    = "~/" + GameManager.numLevels;
             slotButton[i].interactable = true;
             firstSelected = slotButton[i];
         }
     }
     //resetSelected();
 }
예제 #3
0
 protected override void _StartState(IState oldstate)
 {
     this.gameObject.SetActive(true);
     if (GameManager.settings.saveNum < 1 ||                 // set up save slot info display
         GameManager.settings.saveNum > 3 ||
         !SaveObj.SaveExists(GameManager.settings.saveNum))
     {
         slotNameText.text              = "-";
         numUnlockedText.text           = "~/" + GameManager.numLevels;
         resumeButton.interactable      = false;     // set buttons unusable
         levelSelectButton.interactable = false;
         firstSelected = newGameButton;              // if resume/level select are greyed out, set newgame as default selected
     }
     else
     {
         slotNameText.text = GameManager.saveGame.slotName;
         int count = 0;
         for (int i = 0; i < GameManager.numLevels; i++)
         {
             if (GameManager.saveGame.canAccess(i))
             {
                 count++;
             }
         }
         numUnlockedText.text           = count + "/" + GameManager.numLevels;
         resumeButton.interactable      = true;      // set buttons accesible
         levelSelectButton.interactable = true;
         firstSelected = resumeButton;               // set as default selected button
     }
 }