Exemplo n.º 1
0
    private void InitUI()
    {
        MyLog.I("InitUI");
        // FB.Init(this.OnInitComplete, this.OnHideUnity);
        if (GetStartButton() != null)
        {
            GetStartButton().onClick.AddListener(() => {
                // webView
                // MyHttpRequestManager http = gameObject.AddComponent<MyHttpRequestManager>();
                gameObject.AddComponent <MyHttpRequestManager>();
            });
        }

        if (GetBuyButton() != null)
        {
            GetBuyButton().onClick.AddListener(() => {
                m_IAPHelper.Purchase(null);
                if (m_IAPHelper.m_PurchaseInProgress == true)
                {
                    return;
                }
            });
        }
        if (GetTapjoyButton() != null)
        {
            GetTapjoyButton().onClick.AddListener(() => {
                m_AdManager.TapjoyEvents();
            });
        }
        if (GetFacebookButton() != null)
        {
            GetFacebookButton().onClick.AddListener(() => {
                m_AdManager.FBAuth();
            });
        }
        if (GetMovieButton() != null)
        {
            GetMovieButton().onClick.AddListener(() => {
                MyLog.I("click Movie");
                if (null == m_Sound)
                {
                    m_Sound = GameObject.Find("SoundObject").GetComponent <MySoundManager>();
                }
                if (null != m_Sound)
                {
                    m_Sound.playSound1();
                    MyLog.I("playSound1");
                }
                else
                {
                    MyLog.I("playSound1 null");
                }
                //				// 動画再生
                // Handheld.PlayFullScreenMovie ("opmv", Color.black, FullScreenMovieControlMode.CancelOnInput);
            });
        }
        if (GetSoundButton() != null)
        {
            GetSoundButton().onClick.AddListener(() => {
                MyLog.I("click Sound");
                if (null == m_Sound)
                {
                    m_Sound = GameObject.Find("SoundObject").GetComponent <MySoundManager>();
                }
                if (null != m_Sound)
                {
                    m_Sound.playSound2();
                    MyLog.I("playSound2");
                }
                else
                {
                    MyLog.I("playSound2 null");
                }
                m_AdManager.toFacebookEvent();
            });
        }
        if (GetMailButton() != null)
        {
            GetMailButton().onClick.AddListener(() => {
                MyLog.I("click MailButton");
                MyMailer mail = new MyMailer();
                mail.OpenMailer();
            });
        }
        if (GetNativeButton() != null)
        {
            GetNativeButton().onClick.AddListener(() => {
                MyLog.I("click GetNativeButton");
                if (null == m_AndroidPluguin)
                {
                    m_AndroidPluguin = gameObject.AddComponent <AndroidPlugin>();
                    MyLog.I("add AndroidPlugin");
                }
                // ShowDialog(string method, string title, string message,
                // string positiveMS, string neutralMS, string negativeMS, string showMS) {
                m_AndroidPluguin.ShowDialog("ShowMessage", "NativeDialog", "Select", "Toast", "Neutoral", "no", "Android");
                // Native
            });
        }
        if (GetChangeButton() != null)
        {
            GetChangeButton().onClick.AddListener(() => {
                MyLog.I("click GetChangeButton");
                if (null == m_AndroidPluguin)
                {
                    m_AndroidPluguin = gameObject.AddComponent <AndroidPlugin>();
                    MyLog.I("add AndroidPlugin");
                }
                Button button = GetChangeButton();
                Text text     = button.GetComponentInChildren <Text>();

                if (tempValue == 0)
                {
                    tempValue = 3;
                }
                int after = m_AndroidPluguin.ChangeNative("ChangeValue", tempValue);
                text.text = "after = " + after;
                tempValue = after;
                MyLog.I("Top after = " + after);
                // Native
            });
        }
        if (GetPushButton() != null)
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                GetPushButton().onClick.AddListener(() => {
                    MyLog.I("click GetPushButton");
                    if (null == m_AndroidPluguin)
                    {
                        m_AndroidPluguin = gameObject.AddComponent <AndroidPlugin>();
                        MyLog.I("add AndroidPlugin");
                    }
                    string token = m_AndroidPluguin.GetToken("GetAndroidToken");
                    MyLog.I("GetPushButton token = " + token);
                    // Native
                });
            }
        }
    }