コード例 #1
0
        protected IEnumerator DownloadServerGroupData()
        {
            var www = new WWW(UrlUtility.GetRandomParametersUrl(RuntimeInfo.RemoteControlConfig.ServerGroupPath));

            yield return(www);

            if (www.error != null)
            {
                Debug.LogError("GameStartConfig - download server group data list failed:" + www.error);
                m_CoroutineWorkflow.AddFirst("DownloadServerGroupDataError", DownloadServerGroupDataError);
                yield break;
            }
            else
            {
                var parseExcepetion = false;
                try
                {
                    RuntimeInfo.ServerGroupList = JsonReader.Deserialize <List <ServerGroup> >(www.text);
                }
                catch (Exception e)
                {
                    Debug.LogError("GameStartConfig - parse server group data list error:" + e);
                    parseExcepetion = true;
                }

                if (parseExcepetion)
                {
                    m_CoroutineWorkflow.AddFirst("DownloadServerGroupDataError", DownloadServerGroupDataError);
                    yield break;
                }
            }
        }
コード例 #2
0
        protected IEnumerator DownloadGameControlInfo()
        {
            var www = new WWW(UrlUtility.GetRandomParametersUrl(RuntimeInfo.RemoteControlConfig.GameControlConfigPath));

            yield return(www);

            if (www.error != null)
            {
                Debug.LogError("GameStartConfig - download control info list failed:" + www.error);
                m_CoroutineWorkflow.AddFirst("DownloadGameControlInfoError", DownloadGameControlInfoError);
                yield break;
            }
            else
            {
                var parseExcepetion = false;
                try
                {
                    SetGameControlInfo(www.text);
                }
                catch (Exception e)
                {
                    Debug.LogError("GameStartConfig - parse control info list error:" + e);
                    parseExcepetion = true;
                }

                if (parseExcepetion)
                {
                    m_CoroutineWorkflow.AddFirst("DownloadGameControlInfoError", DownloadGameControlInfoError);
                    yield break;
                }
            }
        }
コード例 #3
0
        protected IEnumerator LoadRemoteControlConfig()
        {
            WWW www = new WWW(UrlUtility.GetRandomParametersUrl(m_RemoteConfigPath));

            yield return(www);

            if (www.error != null)
            {
                Debug.LogError("version control - download remote config error:" + www.error);
                m_CoroutineWorkflow.AddFirst("DownloadRemoteControlErrorNotify", DownloadRemoteControlErrorNotify);
            }
            else
            {
                var parseExcepetion = false;
                try
                {
                    GameRuntimeInfo.RemoteControlConfig = JsonReader.Deserialize <RemoteControlConfig>(www.text);
                }
                catch (Exception e)
                {
                    parseExcepetion = true;
                    Debug.LogError("version control - parse remote config error:" + e);
                }

                if (parseExcepetion)
                {
                    m_CoroutineWorkflow.AddFirst("ParseRemoteControlErrorNotify", ParseRemoteControlErrorNotify);
                    yield break;
                }
            }
        }
コード例 #4
0
        protected virtual IEnumerator CheckRemoteConfig()
        {
            //获取ReadonlyConfig.bytes中配置的url路径,得到远程配置信息
            var readonlyConfig  = Resources.Load("ReadonlyData/ReadonlyConfig") as TextAsset;
            var readonlyContent = readonlyConfig.text;

            Resources.UnloadAsset(readonlyConfig);
            WWW www = new WWW(UrlUtility.GetRandomParametersUrl(readonlyContent));

            yield return(www);

            if (www.error != null)
            {
                Debug.LogError("version control - download remote config error:" + www.error);
                m_CoroutineWorkflow.AddFirst("LoadRemoteErrorNotify", LoadRemoteErrorNotify);
                yield break;
            }
            else
            {
                var parseExcepetion = false;
                try
                {
                    GameRuntimeInfo.RemoteConfigInfo = JsonReader.Deserialize <RemoteConfig>(www.text);
                    m_RemoteConfigPath = GameRuntimeInfo.RemoteConfigInfo.DefaultConfigPath;

                    var enumerator = GameRuntimeInfo.RemoteConfigInfo.ProgramVerisonList.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        if (enumerator.Current.Key == GameRuntimeInfo.ProgramVersion)
                        {
                            m_RemoteConfigPath = enumerator.Current.Value;
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    parseExcepetion = true;
                    Debug.LogError("version control - parse remote config error:" + e);
                }

                if (parseExcepetion)
                {
                    m_CoroutineWorkflow.AddFirst("ParseRemoteErrorNotify", ParseRemoteErrorNotify);
                }
            }
        }
コード例 #5
0
        protected IEnumerator CheckResourceVersion()
        {
            var localResourceVn  = VersionNumber.ParseString(GameRuntimeInfo.ResourceVersion);
            var remoteResourceVn = VersionNumber.ParseString(GameRuntimeInfo.RemoteControlConfig.ResourceVersion);

            if (VersionNumber.CompareTo(remoteResourceVn, localResourceVn) > 0)
            {
                var www = new WWW(UrlUtility.GetRandomParametersUrl(GameRuntimeInfo.RemoteControlConfig.PatchListPath));
                yield return(www);

                if (www.error != null)
                {
                    Debug.LogError("version control - download patch list failed:" + www.error);
                    m_CoroutineWorkflow.AddFirst("ShowDownloadPatchListFail", DownloadPatchListErrorNotify);
                    yield break;
                }
                else
                {
                    var parseExcepetion = false;
                    try
                    {
                        m_PatchesMap = JsonReader.Deserialize <Dictionary <string, PatchInfoConfig> >(www.text);
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("version control - parse patch list error:" + e);
                        parseExcepetion = true;
                    }

                    if (parseExcepetion)
                    {
                        m_CoroutineWorkflow.AddFirst("ParsePatchListErrorNotify", ParsePatchListErrorNotify);
                    }
                    else
                    {
                        m_CoroutineWorkflow.AddFirst("CheckPatchList", CheckPatchList);
                    }
                    yield break;
                }
            }
        }