示例#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.Collect:
        {
            GameObject btnObj = GameObject.Find(DialogName);
            if (null == btnObj)
            {
                DebugConsole.Log("null");
            }
            else
            {
                DebugConsole.Log("DoHide");
                DoHide(btnObj);
            }

            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.TakeLoginBonus();
        }
        break;

        default:
            break;
        }
    }