Exemplo n.º 1
0
    void OnClick(GameObject sender)
    {
        Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton);

        DebugConsole.Log(sender.name);
        int btnIndex = GetBtn(sender.name);

        if (btnIndex < 0)
        {
            DebugConsole.Log("Cant find button:" + sender.name);
            return;
        }
        switch ((DialogBtn)btnIndex)
        {
        case DialogBtn.Close:
        {
            GameObject btnObj = GameObject.Find(DialogName);
            if (null == btnObj)
            {
                DebugConsole.Log("null");
            }
            else
            {
                DebugConsole.Log("DoHide");
                DoHide(btnObj);
            }
        }
        break;

        case DialogBtn.CoinOff:
        case DialogBtn.GemOff:
        case DialogBtn.OnSaleOff:
            break;

        case DialogBtn.CoinOn:
        {
            m_activePage = 0;
            m_subPage    = 0;
            UpdateUI();
        }
        break;

        case DialogBtn.GemOn:
        {
            m_activePage = 1;
            m_subPage    = 0;
            UpdateUI();
        }
        break;

        case DialogBtn.OnSaleOn:
        {
            m_activePage = 2;
            m_subPage    = 0;
            UpdateUI();
        }
        break;

        case DialogBtn.CRecharge1:
        case DialogBtn.CRecharge2:
        case DialogBtn.CRecharge3:
        case DialogBtn.CRecharge4:
        case DialogBtn.CRecharge5:
        case DialogBtn.CRecharge6:
        {
            Reception.DoBuy("jb_" + (btnIndex - DialogBtn.CRecharge1 + 1).ToString());
        }
        break;

        case DialogBtn.GRecharge1:
        case DialogBtn.GRecharge2:
        case DialogBtn.GRecharge3:
        case DialogBtn.GRecharge4:
        case DialogBtn.GRecharge5:
        case DialogBtn.GRecharge6:
        {
            Reception.DoBuy("gem_" + (btnIndex - DialogBtn.CRecharge1 + 1).ToString());
        }
        break;

        case DialogBtn.SRecharge1:
        case DialogBtn.SRecharge2:
        case DialogBtn.SRecharge3:
        case DialogBtn.SRecharge4:
        case DialogBtn.SRecharge5:
        case DialogBtn.SRecharge6:
        {
            Reception.DoBuy("sale_" + (btnIndex - DialogBtn.CRecharge1 + 1).ToString());
        }
        break;

        default:
            break;
        }
    }