Ejemplo n.º 1
0
 private Button ParseButtonID(string id)
 {
     if (id == null)
     {
         return(null);
     }
     try
     {
         Button b = null;
         if (id.StartsWith("key"))
         {
             b = new Key(id);
         }
         if (id.StartsWith("hat"))
         {
             b = new HatButton(id);
         }
         if (id.StartsWith("joy"))
         {
             b = new JoystickButton(id);
         }
         if (b != null)
         {
             return(b);
         }
         return(null);
     }
     catch (Exception e)
     {
         Debug.Log("[ACM]: Error while loading a button:");
         Debug.LogException(e);
         return(null);
     }
 }
Ejemplo n.º 2
0
    private void Start()
    {
        hat_man = HatUnlockManager.hat_manager;

        for (int i = 0; i < hat_man.best_hats.Count; i++)
        {
            GameObject button_obj = Instantiate(hat_button, transform);

            button_obj.GetComponent <Toggle>().group = toggle_group;

            HatButton button = button_obj.GetComponent <HatButton>();
            button.index     = i;
            button.use_total = false;
            button.text.text = hat_man.best_hats[i].name;
            if (i < PlayerPrefs.GetInt("BestUnlockedHatCount"))
            {
                button.unlocked = true;
            }
            else
            {
                button.unlocked = false;
            }
        }

        for (int i = 0; i < hat_man.total_hats.Count; i++)
        {
            GameObject button_obj = Instantiate(hat_button, transform);

            button_obj.GetComponent <Toggle>().group = toggle_group;

            HatButton button = button_obj.GetComponent <HatButton>();
            button.index     = i;
            button.use_total = true;
            button.text.text = hat_man.total_hats[i].name;
            if (i < PlayerPrefs.GetInt("TotalUnlockedHatCount"))
            {
                button.unlocked = true;
            }
            else
            {
                button.unlocked = false;
            }
        }
    }