Exemple #1
0
 void SwitchCategory(Globals.Categories cat)
 {
     if (currState != Globals.MainMenu.Dialog && currState != Globals.MainMenu.Dialog)
     {
         categoriesPanel.SetActive(false);
         previousType = type;
         type         = cat;
         for (int xx = 0; xx < categories.Count; xx++)
         {
             if (categories [xx].type == previousType)
             {
                 for (int yy = 0; yy < categories [xx].buttons.Count; yy++)
                 {
                     categories [xx].buttons [yy].gameObject.SetActive(false);
                     categories [xx].buttons [yy].transform.SetParent(null);
                 }
             }
         }
         for (int xx = 0; xx < categories.Count; xx++)
         {
             if (categories [xx].type == type)
             {
                 for (int yy = 0; yy < categories [xx].buttons.Count; yy++)
                 {
                     categories [xx].buttons [yy].gameObject.SetActive(true);
                     categories [xx].buttons [yy].transform.SetParent(spritePanel.transform);
                 }
             }
         }
         spritePanel.SetActive(true);
         LayoutRebuilder.MarkLayoutForRebuild(spritePanel.GetComponent <RectTransform> ());
         lastState = currState;
         currState = Globals.MainMenu.Sprites;
     }
 }
Exemple #2
0
 public void CancelDialog()
 {
     yesButton.interactable = false;
     noButton.interactable  = false;
     targetState            = lastState;
     currState = Globals.MainMenu.Busy;
     anim.SetTrigger("Dialog");
 }
Exemple #3
0
 public void AnimationFinished()
 {
     if (targetState == Globals.MainMenu.Dialog)
     {
         yesButton.interactable = true;
         noButton.interactable  = true;
     }
     currState = targetState;
 }
Exemple #4
0
 public void OpenCategories()
 {
     if (currState != Globals.MainMenu.Dialog && currState != Globals.MainMenu.Busy)
     {
         spritePanel.SetActive(false);
         categoriesPanel.SetActive(true);
         lastState = currState;
         currState = Globals.MainMenu.Categories;
     }
 }
Exemple #5
0
 public void OpenDialog()
 {
     dialogText.text = "Would you like to unlock this art for 10 tokens?";
     yesButton.onClick.RemoveAllListeners();
     yesButton.onClick.AddListener(delegate {
         UnlockArt();
     });
     noButton.onClick.RemoveAllListeners();
     noButton.onClick.AddListener(delegate {
         CancelDialog();
     });
     lastState   = currState;
     currState   = Globals.MainMenu.Busy;
     targetState = Globals.MainMenu.Dialog;
     anim.SetTrigger("Dialog");
 }
Exemple #6
0
    void Start()
    {
        lastState = Globals.MainMenu.Categories;
        currState = Globals.MainMenu.Categories;
        bool initialData = false;

        if (File.Exists(Application.persistentDataPath + "/MainData/GameData.dat"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/MainData/GameData.dat", FileMode.Open);
            GameData        dat  = (GameData)bf.Deserialize(file);
            file.Close();
            gameData = dat;
        }
        else
        {
            GameData newDat = new GameData();
            newDat.tokenCount = 50;
            System.DateTime currTime = System.DateTime.Now;
            newDat.dayStarted = currTime;
            newDat.lastCheck  = currTime;
            newDat.unlocked   = new List <string> ();
            gameData          = newDat;
            initialData       = true;
        }
        categories = new List <Globals.CategoryCollection> ();
        StartCoroutine(InitializeData());
        if (initialData)
        {
            StartCoroutine(UnlockInitialData());
        }
        else
        {
            state = Globals.MainLoadState.UnlockingSprites;
        }
        StartCoroutine(SetLockedState());
        StartCoroutine(CheckTimeDiff());
    }