예제 #1
0
        public void Move(int newX, int newY, float time)
        {
            Vector2 oldPos = ChangePostion(X, Y);
            Vector2 newPos = ChangePostion(newX, newY);

            X = newX;
            Y = newY;
            DOTween.To(() => oldPos, pos =>
            {
                try
                {
                    _sweet.xy = pos;
                }
                catch (Exception e)
                {
                    RGLog.Warn(e);
                }
            }, newPos, time);
        }
예제 #2
0
        // 从 cnd 上获取 配置信息
        IEnumerator GetConfig(string tandbyAddress = "")
        {
            string configUrl = "";

            if (VersionInfo.BType == VersionInfo.BUILD_TYPE.DEVELOP ||
                VersionInfo.BType == VersionInfo.BUILD_TYPE.DEVELOP_SPECITFY_SERVER ||
                VersionInfo.BType == VersionInfo.BUILD_TYPE.DEVELOP_SELECT_SERVER)
            {
                configUrl = "http://192.168.1.253./platform/devConfig.json";
            }
            else if (VersionInfo.BType == VersionInfo.BUILD_TYPE.LIVE || VersionInfo.BType == VersionInfo.BUILD_TYPE.LIVE_LOG)
            {
                if (string.IsNullOrEmpty(tandbyAddress))
                {
                    configUrl = "http://www.baidu.com";
                }
                else
                {
                    configUrl = tandbyAddress;
                }
            }

            Debug.Log("Config Url" + configUrl);

            WWW www = new WWW(configUrl);

            yield return(www);

            if (www.error != null)
            {
                RGLog.Warn("[GameManager] > GetConfig 02");
                RGLog.Error(www.error);

                // 错误提示弹窗
                hotUI.ShowPopup("错误", "提示", () =>
                {
                    Timers.inst.StartCoroutine(GetConfig("http://www.baidu.com/备用"));
                },
                                () =>
                {
                    Application.Quit();
                }, "Retry", "Quit");
            }
            else
            {
                if (www.isDone)
                {
                    ConfigJson config = JsonUtility.FromJson <ConfigJson>(www.text);

                    AppConst.WebUrl = config.UpdateUrl;

                    if (VersionInfo.BType == VersionInfo.BUILD_TYPE.LIVE_LOG)
                    {
                        //资源更新地址
                        AppConst.WebUrl = "http://192.168.1.253/platform/";
                        //备用资源更新地址
                        AppConst.UpdateUrl2 = "http://192.168.1.253/platform";
                    }

                    //校验版本
                    Timers.inst.StartCoroutine(CheckVersionInfo());
                }
            }
        }