Exemplo n.º 1
0
        public override bool LoadAsync(string path, ResLoadMgr.OnLoadEnd onLoadEnd)
        {
            //Debug.Log(@"	start load Async	{0}", item.path);
            loadAsync   = true;
            loadedState = LoadState.Loding;
            resPath     = path;

            request = Resources.LoadAsync(path);

            if (request == null)
            {
                if (onLoadEnd != null)
                {
                    onLoadEnd(null);
                }
                loadedState = LoadState.Error;
                Debug.LogError("Not Exist Resource File :[" + path + "]");
                return(false);
            }
            if (onLoadEnd != null)
            {
                OnLoadedEnd += onLoadEnd;
            }
            IEnumeratorHelper.Start(_loadAsync());
            return(true);
        }
Exemplo n.º 2
0
        public void FixedLocalTime(bool force = false)
        {
            //避免频繁请求 上一次请求成功后的一定时间内认为时间不需要修正
            if (lastFixTime >= 0 && Time.realtimeSinceStartup - lastFixTime <= FIX_MIN_INTERVAL)
            {
                onLocalTimeFixed?.Invoke(true);
                Global.gApp.gMsgDispatcher.Broadcast(MsgIds.ServerTimeFixed, true);
                return;
            }

            if (InternetMgr.singleton.IsInternetConnect())
            {
                if (request == null)
                {
                    request = IEnumeratorHelper.Start(RequestServerTime(force));
                }
            }
            else
            {
                //broadcast
                onLocalTimeFixed?.Invoke(false);
                Global.gApp.gMsgDispatcher.Broadcast(MsgIds.ServerTimeFixed, false);
                //UI.UIMgr.singleton.BoradCast(UIEventType.SERVER_TIME, false);
                if (force)
                {
                    InternetMgr.singleton.funcOnNetworkStateChange -= OnNetworkStateChange;
                    InternetMgr.singleton.funcOnNetworkStateChange += OnNetworkStateChange;
                }
            }
        }
Exemplo n.º 3
0
 private void RequestPostServerData(string relativePath, string postData, ServerResponseCallback onResponse)
 {
     if (logged)
     {
         IEnumeratorHelper.Start(RequestPostServerDataIE(relativePath, postData, onResponse));
     }
 }
Exemplo n.º 4
0
        private void OnNetworkStateChange(bool isConnect)
        {
            if (isConnect)
            {
                if (request == null)
                {
                    request = IEnumeratorHelper.Start(RequestServerTime(true));
                }

                InternetMgr.singleton.funcOnNetworkStateChange -= OnNetworkStateChange;
            }
        }