Пример #1
0
        //ロード
        protected IEnumerator AsyncSceneLoadStart(string scene, float wait = 0.5f)
        {
            //読み込みチェック
            if (UnityEngine.SceneManagement.SceneManager.GetSceneByName(scene) == null)
            {
                InstantLog.StringLogError("Scene Missing");
                yield break;
            }

            //読み込み開始
            _async = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(scene);
            _async.allowSceneActivation = false;

            InstantLog.StringLog("Load Start", StringExtensions.TextColor.darkblue);

            //読み込み中
            while (_async.progress < 0.9f)
            {
                yield return(new WaitForEndOfFrame());
            }

            //読み込み終了
            InstantLog.StringLog("Scene Loaded", StringExtensions.TextColor.blue);
            if (_callbacks != null)
            {
                _callbacks();
            }
            yield return(new WaitForSeconds(wait));

            _async.allowSceneActivation = true;
        }
Пример #2
0
        public static async Task <T> PostRequestAsync <T>(string endpoint, byte[] post)
        {
            int number;

#if UNITY_EDITOR
            InstantLog.StringLog($"POST@REQUEST#{_requestNumber}: {endpoint}", StringExtensions.TextColor.yellow);
            number = _requestNumber++;
#endif
            var www = await ObservableWWW.Post(endpoint, post);

            if (www == null)
            {
                Debug.LogError("www request error");
            }
#if UNITY_EDITOR
            InstantLog.StringLog($"POST@RESPONCE#{number}: {www}", StringExtensions.TextColor.yellow);
#endif
            return(JsonUtility.FromJson <T>(www));
        }
Пример #3
0
        public static async Task <string> PostRequestAsync(string endpoint, WWWForm form)
        {
            int number;

#if UNITY_EDITOR
            InstantLog.StringLog($"POST@REQUEST#{_requestNumber}: {endpoint}", StringExtensions.TextColor.yellow);
            number = _requestNumber++;
#endif
            var www = await ObservableWWW.Post(endpoint, form);

            if (www == null)
            {
                Debug.LogError("www request error");
            }
#if UNITY_EDITOR
            InstantLog.StringLog($"POST@RESPONCE#{number}: {www}", StringExtensions.TextColor.yellow);
#endif
            return(www);
        }