Пример #1
0
    private void SetSkinInfo(GameObject skinParent, GameObject skinPrefab, SkinObject skinData)
    {
        skinPrefab.transform.SetParent(skinParent.transform);
        skinPrefab.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);

        SkinUI ui = skinPrefab.GetComponent <SkinUI>();

        ui.SetICON(skinData.GetSkinICON());
        ui.SetSkinID(skinData.GetSkinID());

        if (PlayerDataManager.instance.GetUsingSkin() == skinData.GetSkinID())
        {
            ui.SetLabel(m_selectLabel);
            m_skinSelectButton.GetComponent <SkinChooseUI>().HoldSkinUI(ui);
            m_skinSelectButton.GetComponent <SkinChooseUI>().SetSkinUI();
        }
        else
        {
            if (!PlayerDataManager.instance.GetSkin(skinData.GetSkinID()))
            {
                ui.SetLabel(m_lockedLabel);
            }
            else
            {
                ui.HideLabel();
            }
        }

        ui.GetButton().onClick.AddListener(delegate
        {
            SelectSkin(skinData.GetSkinID(), ui);
        });
    }
Пример #2
0
    public void BuySkin(int skinID, SkinUI prefab)
    {
        int skinCost = m_skin[skinID].GetSkinCost();

        if (!PlayerDataManager.instance.GetSkin(skinID))
        {
            if (PlayerDataManager.instance.GetCoin() >= skinCost)
            {
                //Player Sound
                UIManager.instance.OnButtonPressed();
                //Unlocked Skin
                PlayerDataManager.instance.SubtractCoins(skinCost);
                PlayerDataManager.instance.SetUnlockSkin(skinID);
                //
                UIManager.instance.m_skinBuyButton.SetActive(false);
                UIManager.instance.m_skinSelectButton.SetActive(true);
                UIManager.instance.UpdateCoinValue();
                //Change Label
                prefab.HideLabel();
                Button selectButton = UIManager.instance.m_skinSelectButton.GetComponent <Button>();
                //Reset Select Button
                selectButton.onClick.RemoveAllListeners();

                ////Add Function
                //selectButton.onClick.AddListener(delegate
                //{
                //    ChangeSkin(skinID);
                //    //Hide Label
                //    selectButton.GetComponent<SkinChooseUI>().SetSkinUI();
                //    selectButton.GetComponent<SkinChooseUI>().GetCurrSkinUI().SetLabel(UIManager.instance.m_selectLabel);
                //    selectButton.GetComponent<SkinChooseUI>().ShowCurrentLabel();
                //    selectButton.GetComponent<SkinChooseUI>().HidePreviousLabel();
                //    //Hide Select Button
                //    selectButton.gameObject.SetActive(false);
                //    //Play Sound
                //    UIManager.instance.OnButtonPressed();
                //});
                UIManager.instance.MinusCoinSkin(skinCost);

                //SaveData
                PlayerDataManager.instance.SaveDataLocal();

                UIManager.instance.SelectSkin(skinID, prefab);
            }
            else
            {
                AudioManager.instance.Play("Cancel");
            }
        }
    }
Пример #3
0
 public void HideCurrentLabel()
 {
     m_currentSkin.HideLabel();
 }
Пример #4
0
 public void HidePreviousLabel()
 {
     m_previousSkin.HideLabel();
 }