コード例 #1
0
	private void InitUI()
	{
		MyLog.I(TAG, "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 (GetNextButton() != null) 
		{
			GetNextButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				SceneManager.LoadScene("next");
				#endif
			});
		}

		if (GetCommonWriteFileButton() != null) 
		{
			GetCommonWriteFileButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				int writeResult = SgpJni.CallnativeWriteFile(m_FileName, "CallNativeWriteCommonFile", Common, Staging);
				MyLog.I(TAG, "GetNativeWriteButton CallnativeWriteFile writeResult = " + writeResult);
				#endif
			});
		}
		if (GetNativeReadButton() != null) 
		{
			GetNativeReadButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				string commonResurl = SgpJni.CallNativeReadFile(m_FileName, Common, Staging);
				MyLog.I(TAG, "GetNativeReadButton CallNativeReadFile commonResurl = " + commonResurl);

				string NotCommonResurl = SgpJni.CallNativeReadFile(m_FileName, NotCommon, Staging);
				MyLog.I(TAG, "GetNativeReadButton CallNativeReadFile NotCommonResurl = " + NotCommonResurl);
				#endif
			});
		}

		if (GetNativeWriteButton() != null)
		{
			GetNativeWriteButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				// int nativeWriteFile(const char* filename, char* text, int common, int svno);
				int commonResurl = SgpJni.CallnativeWriteFile(m_FileName, "common_CallnativeWriteFile", Common, Staging);
				MyLog.I(TAG, "GetNativeWriteButton CallnativeWriteFile commonResurl = " + commonResurl);

				int NotCommonResurl = SgpJni.CallnativeWriteFile(m_FileName, "1234test567890", NotCommon, Staging);
				MyLog.I(TAG, "GetNativeWriteButton CallnativeWriteFile NotCommonResurl = " + NotCommonResurl);
				#endif
			});
		}

		if (GetSolReadButton() != null) 
		{
			GetSolReadButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				string releaseCommon = SgpJni.CallnativeSolReadFile(m_Sol_Name, Common, Release);
				MyLog.I(TAG, "nativeSolReadFile releaseCommon = " + releaseCommon);
				// TODO 加工

				string releaseNotCommon = SgpJni.CallnativeSolReadFile(m_Sol_Name, NotCommon, Release);
				MyLog.I(TAG, "nativeSolReadFile releaseNotCommon = " + releaseNotCommon);

				string stagingCommon = SgpJni.CallnativeSolReadFile(m_Sol_STG, Common, Staging);
				MyLog.I(TAG, "nativeSolReadFile stagingCommon= " + stagingCommon);

				string stagingNotCommon = SgpJni.CallnativeSolReadFile(m_Sol_STG, NotCommon, Staging);
				MyLog.I(TAG, "nativeSolReadFile stagingNotCommon = " + stagingNotCommon);

				string developCommon = SgpJni.CallnativeSolReadFile(m_Sol_DEV, Common, Develop);
				MyLog.I(TAG, "nativeSolReadFile developCommon = " + developCommon);

				string developNotCommon = SgpJni.CallnativeSolReadFile(m_Sol_DEV, NotCommon, Develop);
				MyLog.I(TAG, "nativeSolReadFile developNotCommon = " + developNotCommon);
				#endif
			});
		}
		if (GetUAButton() != null) 
		{
			GetUAButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				string readResult = SgpJni.CallnativeGetUserAgent();
				MyLog.W(TAG, "GetUAButton CallnativeGetUserAgent = " + readResult);
				#endif

				AdjustConfig adjustConfig;
				adjustConfig = new AdjustConfig(MyConfig.ADJUST_TOKEN, AdjustEnvironment.Sandbox);
				Adjust.start(adjustConfig);

				// m_AdManager.SendMessage("test", this);
			});
		}

		if (GetFilePathButton() != null) 
		{
			GetFilePathButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				string common = SgpJni.CallgGetFileNameToUnity(m_FileName, Common, Staging);
				MyLog.W(TAG,"CallgGetFileNameToUnity common = " + common);

				string notCommon = SgpJni.CallgGetFileNameToUnity(m_FileName, NotCommon, Staging);
				MyLog.W(TAG,"CallgGetFileNameToUnity notCommon = " + notCommon);
				#endif
			});
		}
		if (GetCheckButton() != null) 
		{
			GetCheckButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				int check = SgpJni.CallnativeCheckNT();
				MyLog.W(TAG,"CallnativeCheckNT = " + check);

				string test = SgpJni.CallnativeTest();
				MyLog.W(TAG,"CallnativeTest test = " + test);
				#endif
			});
		}
		if (GetDeleteButton() != null) 
		{
			GetDeleteButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				int common = SgpJni.CallNativeDeleteFile(m_DeleteFileName, Common, Staging);
				MyLog.W(TAG, "GetDeleteButton GetDeleteButton = " + common);

				int notCommon = SgpJni.CallNativeDeleteFile(m_DeleteFileName, NotCommon, Staging);
				MyLog.W(TAG, "GetDeleteButton GetDeleteButton = " + notCommon);
				#endif
			});
		}

		if (GetNativeButton() != null) 
		{
			GetNativeButton().onClick.AddListener(() => {

				#if UNITY_ANDROID
				MyLog.I(TAG, "click GetNativeButton");
				if (null == m_AndroidPluguin) {
					m_AndroidPluguin = gameObject.AddComponent<AndroidPlugin>();
					MyLog.I(TAG, "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");
				#endif
			});
		}

		if (GetPushButton() != null) 
		{
				GetPushButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				MyLog.I(TAG, "click GetPushButton");
				if (null == m_AndroidPluguin) {
					m_AndroidPluguin = gameObject.AddComponent<AndroidPlugin>();
					MyLog.I(TAG, "add AndroidPlugin");
				}
				string token = m_AndroidPluguin.GetToken("GetAndroidToken");
				MyLog.I(TAG, "GetPushButton token = " + token);
				});
				#endif
		}
		if (GetCreateButton() != null) 
		{
			GetCreateButton().onClick.AddListener(() => {
				#if UNITY_ANDROID
				// authTask();
				#endif
			});
		}
	}
コード例 #2
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
                });
            }
        }
    }