Exemple #1
0
    IEnumerator InitializeApplication()
    {
                #if !UNITY_WEBGL && !DISABLE_WEBVIEW
        //Check IMEI
        if (!UserCommonData.IsLogin)
        {
            UserCommonData.pGlobal.Load();
            IsChecked = false;
            WWWForm form = new WWWForm();
            form.AddField("type", "getLogin");
            form.AddField("imei", UserCommonData.imei);
            api.wwwCallAPI(form);
            Debug.Log("apiCall " + UserCommonData.imei);
            while (!IsChecked)
            {
                yield return(null);
            }
            if (api.msg.msg == "OK")
            {
                //pull all UserData here
                UserCommonData.SetUserData(api.msg.user[0]);
                LoadingScript.ChangeScene("MainMenu");
            }
            else
            {
                if ((api.IsError) && (!UserCommonData.IsLogin))
                {
                    //popup and break;
                    PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาลองใหม่อีกครั้ง", "ตกลง", initApp);
                    yield break;
                }
            }
        }
        if (UserCommonData.IsSoundOn())
        {
            AudioListener.volume = 1.0f;
        }
        else
        {
            AudioListener.volume = 0.0f;
        }

        //		while(!FacebookLogin.IsInit)
        //		{
        //			yield return null;
        //		}
        //LoadingNewScene
        Debug.Log("IsFacebookLogin : "******"MainMenu");
                #else
        //Check IMEI
        {
            IsChecked = false;
            //api.wwwCallAPI(form,false);
            string getForm = "&type=getLoginWeb&user_id=" + UserCommonData.imei;
            api.wwwCallAPINoForm(getForm);
            Debug.Log("apiCall " + UserCommonData.imei);
            while (!IsChecked)
            {
                yield return(null);
            }
            if (api.msg.msg == "OK")
            {
                //pull all UserData here
                UserCommonData.SetUserData(api.msg.user[0]);
            }
            else
            {
                if (api.IsError)
                {
                    //popup and break;
                    PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาลองใหม่อีกครั้ง", "ตกลง", initApp);
                    yield break;
                }
            }
        }
        LoadingScript.ChangeScene("GameLand");
                #endif
        yield return(null);
    }
 public void mExitGame()
 {
     mGameUnPause();
     mGameReset();
     LoadingScript.ChangeScene("GameLand");
 }
Exemple #3
0
    //private AsyncOperation sceneLoadingOperation = null;

    public static void ChangeScene(string name)
    {
        //set next scene name here
        LoadingScript.ChangeScene(name);
        Debug.Log("Change Scene : " + name);
    }