示例#1
0
        public static RemoteConfig From(ConfigReader reader)
        {
            if (reader == null)
            {
                return(null);
            }
            RemoteConfig remoteConfig = new RemoteConfig();

            remoteConfig.gameServerHost    = reader.GetString("gameServerHost");
            remoteConfig.gameServerPort    = reader.GetInt("gameServerPort", -1);
            remoteConfig.gameAppId         = reader.GetInt("gameAppId", -1);
            remoteConfig.chatAppId         = reader.GetInt("chatAppId", -1);
            remoteConfig.gameServerIsLocal = reader.GetBool("gameServerIsLocal");
            remoteConfig.gameServerProfile = reader.GetEnum("gameServerProfile", ServerProfile.None);
            remoteConfig.versionFileUrl    = ReplaceVars(reader.GetUrl("versionFileUrl"));
            remoteConfig.haapiServerUrl    = reader.GetString("haapiServerUrl");
            if (reader.HasProperty("gameServerDisplayName"))
            {
                remoteConfig.gameServerDisplayName = reader.GetString("gameServerDisplayName");
            }
            else
            {
                remoteConfig.gameServerDisplayName = remoteConfig.gameServerProfile.ToString();
            }
            remoteConfig.bundlesUrl = ReplaceVars(reader.GetUrl("bundlesUrl"));
            return(remoteConfig);
        }
示例#2
0
 public static void SetFromRemoteConfig(RemoteConfig config)
 {
     gameServerHost    = config.gameServerHost;
     gameServerPort    = config.gameServerPort;
     gameServerIsLocal = config.gameServerIsLocal;
     gameServerProfile = config.gameServerProfile;
     GameAppId         = config.gameAppId;
     ChatAppId         = config.chatAppId;
     bundlesUrl        = config.bundlesUrl;
     versionFileUrl    = config.versionFileUrl;
     haapiServerUrl    = config.haapiServerUrl;
     initialized       = true;
     OnServerConfigLoaded?.Invoke();
 }
示例#3
0
        public static IEnumerator ReadRemoteConfig(string remoteSettingsFileUrl)
        {
            TextWebRequest.AsyncResult remoteSettingsFileLoadResult = new TextWebRequest.AsyncResult();
            yield return(TextWebRequest.ReadFile(remoteSettingsFileUrl, remoteSettingsFileLoadResult));

            if (remoteSettingsFileLoadResult.hasException)
            {
                long responseCode = remoteSettingsFileLoadResult.exception.responseCode;
                if (responseCode == 404)
                {
                    Log.Error("Could not find remote settings file at URL '" + remoteSettingsFileUrl + "'.", 83, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Configuration\\ApplicationStarter.cs");
                }
                else
                {
                    Log.Error($"Error {responseCode} when trying to download remote settings file at URL '{remoteSettingsFileUrl}'.", 90, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Configuration\\ApplicationStarter.cs");
                }
            }
            else
            {
                ApplicationConfig.SetFromRemoteConfig(RemoteConfig.From(new ConfigReader(remoteSettingsFileLoadResult.value, remoteSettingsFileUrl)));
            }
        }
示例#4
0
 public static void Read([NotNull] ConfigReader reader)
 {
     remoteConfigUrl = RemoteConfig.ReplaceVars(reader.GetUrl("remoteConfigUrl", string.Empty));
     initialized     = true;
 }