Exemple #1
0
    void OnClick()
    {
        if (gameObject.name == "bt_StartGame")
        {
            EnterGame();
        }
        else if (gameObject.name == "bt_PlayVideo")
        {
            GameObject mainCamera = GameObject.Find("@MainCamera");
            if (mainCamera != null && (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer))
            {
                sdMovieVideo movie = mainCamera.GetComponent <sdMovieVideo>();
                if (movie != null)
                {
                    movie.PlayMovie("DS_intro.mp4");
                }
            }

            //sdUICharacter.Instance.ShowMsgLine("错误提示测试!",MSGCOLOR.Red);
        }
        else if (gameObject.name == "bt_Username")
        {
            Debug.Log("bt_Username button onclick");
            sdUICharacter.Instance.HideLoginMsg();
            GameObject goUIRoot = GameObject.Find("UI Root (2D)");
            if (goUIRoot)
            {
                Debug.Log("Find ui root");
                GHome.GetInstance().Logout((code, msg, data) =>
                {
                    Debug.Log("GHome logout callback code: " + code + "msg: " + msg);

                    if (code == 0)
                    {
                        LoginUI loginUI = goUIRoot.GetComponent <LoginUI>();
                        loginUI.Relogin();
                    }
                });
            }

            gameObject.SetActive(false);
        }
        else if (gameObject.name == "bt_Server")
        {
            List <JsonNode> lst = SDNetGlobal.m_lstSrvInfo;
            if (lst.Count > 0)
            {
                sdUICharacter.Instance.ShowSelectSrvWnd(true);
            }
        }
    }