Exemple #1
0
	IEnumerator webAPIProcess(WWW www, BaseEvent baseEvent)
	{
		UtilMgr.ShowLoading (true);

		yield return www;
		
		if(www.error == null)
		{
			Debug.Log(www.text);
//			CommonDialogue.Show (www.text);
			baseEvent.Init(www.text);
		}
		else
		{
			Debug.Log(www.error);
		}

		UtilMgr.DismissLoading ();
	}
Exemple #2
0
    IEnumerator webAPIProcessInBackground(WWW www, BaseEvent baseEvent)
    {
        yield return(www);

        if (www.error != null)
        {
            Debug.Log("www.error InBackground : " + www.error.ToString());
        }

        if (www.error == null && www.isDone)
        {
            Debug.Log(www.text);
            if (baseEvent != null)
            {
                Debug.Log("baseEvent != null");
                baseEvent.Init(www.text);
            }
        }
    }
Exemple #3
0
    IEnumerator webAPIProcess(WWW www, BaseEvent baseEvent, bool showLoading, bool isUpload)
    {
        if (www == null)
        {
            Debug.Log("www is null");
            yield break;
        }
        if (www.error != null)
        {
            Debug.Log("www.error : " + www.error.ToString());
        }

        float timeSum = 0f;

        if (isUpload)
        {
            UtilMgr.ShowLoading(true, www);

            yield return(www);
        }
        else
        {
            if (showLoading)
            {
                UtilMgr.ShowLoading(showLoading);
            }

            while (!www.isDone &&
                   string.IsNullOrEmpty(www.error) &&
                   timeSum < TIMEOUT)
            {
                timeSum += Time.deltaTime;
                yield return(0);
            }
        }
        //Debug.Log("www.text : " + www.url);
        ;
        if (www.error == null && www.isDone)
        {
            Debug.Log(www.text);
            //            CommonDialogue.Show (www.text);
            if (baseEvent != null)
            {
                Debug.Log("baseEvent != null");
                baseEvent.Init(www.text);
            }
        }
        else
        {
            Debug.Log(www.error);
            //            DialogueMgr.ShowDialogue("네트워크오류", "네트워크 연결이 불안정합니다.\n인터넷 연결을 확인 후 다시 시도해주세요.", DialogueMgr.DIALOGUE_TYPE.Alert, null);

            if (Application.loadedLevelName.Equals("SceneLogin"))
            {
                DialogueMgr.ShowDialogue("네트워크오류", "네트워크 연결이 불안정합니다.\n인터넷 연결을 확인 후 다시 시도해주세요.",
                                         DialogueMgr.DIALOGUE_TYPE.YesNo, "재시도", "", "게임 종료", ConnectHandlerForHttp);
            }
            else
            {
                DialogueMgr.ShowDialogue("네트워크오류", "네트워크 연결이 불안정합니다.\n인터넷 연결을 확인 후 다시 시도해주세요.",
                                         DialogueMgr.DIALOGUE_TYPE.YesNo, "재시도", "", "타이틀로 가기", ConnectHandlerForHttp);
            }

            Debug.Log(www.text);
            mWWW       = www;
            mBaseEvent = baseEvent;
            mIsUpload  = isUpload;
            mIsLoading = showLoading;
        }

        UtilMgr.DismissLoading();
    }
    IEnumerator webAPIProcess(WWW www, BaseEvent baseEvent, bool showLoading, bool isUpload)
    {
        if(www == null){
            Debug.Log("www is null");
            yield break;
        }
        if (www.error != null) {
            Debug.Log("www.error : " +www.error.ToString());
        }

        float timeSum = 0f;

        if(isUpload){
            UtilMgr.ShowLoading(true, www);

            yield return www;
        } else{
            if(showLoading)
                UtilMgr.ShowLoading (showLoading);

            while(!www.isDone &&
                  string.IsNullOrEmpty(www.error) &&
                  timeSum < TIMEOUT) {
                timeSum += Time.deltaTime;
                yield return 0;
            }
        }
        //Debug.Log("www.text : " + www.url);

        UtilMgr.DismissLoading ();
        if(www.error == null && www.isDone)
        {
            Debug.Log(www.text);
            mRetryCnt = 0;
            //            CommonDialogue.Show (www.text);
            if(baseEvent != null){
                Debug.Log("baseEvent != null");
                baseEvent.Init(www.text);
            }
        }
        else
        {
            Debug.Log(www.error);
            mWWW = www;
            mBaseEvent = baseEvent;
            mIsUpload = isUpload;
            mIsLoading = showLoading;
            if(mRetryCnt < 10){
                mRetryCnt++;
                ConnectHandlerForHttp(DialogueMgr.BTNS.Btn1);
            } else{
                mRetryCnt = 0;

                if (Application.loadedLevelName.Equals ("Login")) {
                    DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrNetworkError"),
                                             UtilMgr.GetLocalText("StrNetworkError1"),
                                             DialogueMgr.DIALOGUE_TYPE.YesNo,
                                             UtilMgr.GetLocalText("StrRetry"), "",
                                             UtilMgr.GetLocalText("StrExit"), ConnectHandlerForHttp);
                } else
                    DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrNetworkError"),
                                             UtilMgr.GetLocalText("StrNetworkError1"),
                                         DialogueMgr.DIALOGUE_TYPE.YesNo,
                                             UtilMgr.GetLocalText("StrRetry"), "",
                                             UtilMgr.GetLocalText("StrGotoTitle"), ConnectHandlerForHttp);

            }
        }
    }
    IEnumerator webAPIProcessInBackground(WWW www, BaseEvent baseEvent)
    {
        yield return www;
        if (www.error != null) {
            Debug.Log("www.error InBackground : " +www.error.ToString());
        }

        if(www.error == null && www.isDone)
        {
            Debug.Log(www.text);
            if(baseEvent != null){
                Debug.Log("baseEvent != null");
                baseEvent.Init(www.text);
            }
        }
    }
    IEnumerator webAPIProcess(WWW www, BaseEvent baseEvent, bool showLoading, bool isUpload)
    {
        if (www == null)
        {
            Debug.Log("www is null");
            yield break;
        }
        if (www.error != null)
        {
            Debug.Log("www.error : " + www.error.ToString());
        }

        float timeSum = 0f;

        if (isUpload)
        {
            UtilMgr.ShowLoading(true, www);

            yield return(www);
        }
        else
        {
            if (showLoading)
            {
                UtilMgr.ShowLoading(showLoading);
            }

            while (!www.isDone &&
                   string.IsNullOrEmpty(www.error) &&
                   timeSum < TIMEOUT)
            {
                timeSum += Time.deltaTime;
                yield return(0);
            }
        }
        //Debug.Log("www.text : " + www.url);

        UtilMgr.DismissLoading();
        if (www.error == null && www.isDone)
        {
            Debug.Log(www.text);
            mRetryCnt = 0;
            //            CommonDialogue.Show (www.text);
            if (baseEvent != null)
            {
                Debug.Log("baseEvent != null");
                baseEvent.Init(www.text);
            }
        }
        else
        {
            Debug.Log(www.error);
            mWWW       = www;
            mBaseEvent = baseEvent;
            mIsUpload  = isUpload;
            mIsLoading = showLoading;
            if (mRetryCnt < 10)
            {
                mRetryCnt++;
                ConnectHandlerForHttp(DialogueMgr.BTNS.Btn1);
            }
            else
            {
                mRetryCnt = 0;

                if (Application.loadedLevelName.Equals("Login"))
                {
                    DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrNetworkError"),
                                             UtilMgr.GetLocalText("StrNetworkError1"),
                                             DialogueMgr.DIALOGUE_TYPE.YesNo,
                                             UtilMgr.GetLocalText("StrRetry"), "",
                                             UtilMgr.GetLocalText("StrExit"), ConnectHandlerForHttp);
                }
                else
                {
                    DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrNetworkError"),
                                             UtilMgr.GetLocalText("StrNetworkError1"),
                                             DialogueMgr.DIALOGUE_TYPE.YesNo,
                                             UtilMgr.GetLocalText("StrRetry"), "",
                                             UtilMgr.GetLocalText("StrGotoTitle"), ConnectHandlerForHttp);
                }
            }
        }
    }