Exemplo n.º 1
0
 public override void PostClose()
 {
     ModsConfig.Save();
     if (this.activeModsWhenOpenedHash != ModLister.InstalledModsListHash(true))
     {
         ModsConfig.RestartFromChangedMods();
     }
 }
Exemplo n.º 2
0
 public override void PreClose()
 {
     base.PreClose();
     Prefs.Save();
     if (Prefs.SimulateNotOwningRoyalty && !simulateNotOwningRoyaltyWhenOpened && ModsConfig.RoyaltyActive)
     {
         ModsConfig.SetActive(ModContentPack.RoyaltyModPackageId, active: false);
         ModsConfig.RestartFromChangedMods();
     }
 }
Exemplo n.º 3
0
 void RenderLoadFromSaveButton(Rect LoadFromSaveRect)
 {
     if (Widgets.ButtonText(LoadFromSaveRect, "ChangeLoadedMods".Translate()))
     {
         if (Current.ProgramState == ProgramState.Entry)
         {
             ModsConfig.SetActiveToList(ScribeMetaHeaderUtility.loadedModIdsList);
         }
         ModsConfig.SaveFromList(ScribeMetaHeaderUtility.loadedModIdsList);
         ModsConfig.RestartFromChangedMods();
     }
 }
 public override void PostClose()
 {
     ModsConfig.Save();
     foreach (ModMetaData item in ModsConfig.ActiveModsInLoadOrder)
     {
         item.UnsetPreviewImage();
     }
     Resources.UnloadUnusedAssets();
     if (activeModsWhenOpenedHash != ModLister.InstalledModsListHash(activeOnly: true))
     {
         ModsConfig.RestartFromChangedMods();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// После успешной регистрации или входа
        /// </summary>
        public static void InitConnected()
        {
            try
            {
                Loger.Log("Client InitConnected()");
                Data = new ClientData();
                TimersStop();
                Timers         = new WorkTimer();
                TimerReconnect = new WorkTimer();

                var connect    = SessionClient.Get;
                var serverInfo = connect.GetInfo(ServerInfoType.Full);
                ServerTimeDelta = serverInfo.ServerTime - DateTime.UtcNow;
                SetFullInfo(serverInfo);

                Loger.Log("Client ServerName=" + serverInfo.ServerName);
                Loger.Log("Client ServerVersion=" + serverInfo.VersionInfo + " (" + serverInfo.VersionNum + ")");
                Loger.Log("Client IsAdmin=" + serverInfo.IsAdmin
                          + " Seed=" + serverInfo.Seed
                          + " NeedCreateWorld=" + serverInfo.NeedCreateWorld
                          + " DelaySaveGame=" + Data.DelaySaveGame
                          + " DisableDevMode=" + Data.DisableDevMode);
                Loger.Log("Client Grants=" + serverInfo.My.Grants.ToString());

                if (serverInfo.IsModsWhitelisted && !CheckFiles())
                {
                    var msg = "OCity_SessionCC_FilesUpdated".Translate();
                    //Не все файлы прошли проверку, надо инициировать перезагрузку всех модов
                    Disconnected(msg, () => ModsConfig.RestartFromChangedMods());
                    return;
                }

                if (MainHelper.VersionNum < serverInfo.VersionNum)
                {
                    Disconnected("OCity_SessionCC_Client_UpdateNeeded".Translate() + serverInfo.VersionInfo);
                    return;
                }

                //создаем мир, если мы админ
                if (serverInfo.IsAdmin && serverInfo.Seed == "")
                {
                    Loger.Log("Client InitConnected() IsAdmin");
                    var form = new Dialog_CreateWorld();
                    form.PostCloseAction = () =>
                    {
                        if (!form.ResultOK)
                        {
                            Disconnected("OCity_SessionCC_MsgCanceledCreateW".Translate());
                            return;
                        }

                        GameStarter.SetMapSize        = int.Parse(form.InputMapSize);
                        GameStarter.SetPlanetCoverage = float.Parse(form.InputPlanetCoverage) / 100f;
                        GameStarter.SetSeed           = form.InputSeed;
                        GameStarter.SetDifficulty     = int.Parse(form.InputDifficulty);
                        GameStarter.SetScenario       = GetScenarioDefault();

                        GameStarter.AfterStart = CreatingServerWorld;
                        GameStarter.GameGeneration();
                    };

                    Find.WindowStack.Add(form);
                    return;
                }

                if (serverInfo.NeedCreateWorld)
                {
                    CreatePlayerWorld(serverInfo);
                    return;
                }

                LoadPlayerWorld();
            }
            catch (Exception ext)
            {
                Loger.Log("Exception InitConnected: " + ext.ToString());
            }
        }