예제 #1
0
 private void RefreshList()
 {
     allSettings = SharedSettings.GetAll().ToList();
     if (allSettings == null)
     {
         allSettings = new List <UserSettings>();
     }
     if (allSettings.Count > 100)
     {
         allSettings = allSettings.OrderByDescending(us => us.Downloads).Take(100).ToList();
     }
 }
예제 #2
0
        private void ChooseName(string label, string steamName)
        {
            var newSettings = SharedSettings.Load(label, steamName)?.Settings;

            if (newSettings != null)
            {
                AccessTools.GetFieldNames(settings).Do(name2 =>
                {
                    var finfo = AccessTools.Field(typeof(SettingsGroup), name2);
                    finfo.SetValue(settings, finfo.GetValue(newSettings));
                });
                Close(true);
                Dialogs.scrollPosition = Vector2.zero;
            }
            else
            {
                Log.Error("Cannot load " + label + " by " + steamName);
            }
        }
예제 #3
0
 private void Save()
 {
     SharedSettings.Save(settings, name, description);
     Close(true);
 }
예제 #4
0
        public static void DoWindowContentsInternal(ref SettingsGroup settings, Rect inRect, bool isDefaults)
        {
            if (settings == null)
            {
                settings = new SettingsGroup();
            }
            var inGame = Current.Game != null && Current.ProgramState == ProgramState.Playing;

            inRect.yMin += 15f;
            inRect.yMax -= 15f;

            var numberOfColumns    = 2;
            var defaultColumnWidth = (inRect.width - (numberOfColumns - 1) * 2f * Listing.ColumnSpacing) / numberOfColumns;
            var list = new Listing_Standard()
            {
                ColumnWidth = defaultColumnWidth
            };

            var outRect    = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
            var scrollRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height * 2.2f);

            Widgets.BeginScrollView(outRect, ref scrollPosition, scrollRect, true);

            list.Begin(scrollRect);             // -----------------------------------------------------------------------------

            // When?
            list.Dialog_Enum("WhenDoZombiesSpawn", ref settings.spawnWhenType, true, false);

            // How?
            list.Dialog_Enum("HowDoZombiesSpawn", ref settings.spawnHowType);

            // Attack?
            list.Dialog_Enum("WhatDoZombiesAttack", ref settings.attackMode);
            list.Dialog_Checkbox("EnemiesAttackZombies", ref settings.enemiesAttackZombies);
            list.Dialog_Checkbox("AnimalsAttackZombies", ref settings.animalsAttackZombies);

            // Smash?
            list.Dialog_Enum("WhatDoZombiesSmash", ref settings.smashMode);
            if (settings.smashMode != SmashMode.Nothing)
            {
                list.Dialog_Checkbox("SmashOnlyWhenAgitated", ref settings.smashOnlyWhenAgitated);
            }

            // Senses
            list.Dialog_Enum("ZombieInstinctTitle", ref settings.zombieInstinct);
            list.Dialog_Checkbox("RagingZombies", ref settings.ragingZombies);
            list.Gap(4f);

            // Health
            list.Dialog_Label("ZombieHealthTitle");
            list.Dialog_Checkbox("DoubleTapRequired", ref settings.doubleTapRequired);
            list.Dialog_Checkbox("ZombiesDieVeryEasily", ref settings.zombiesDieVeryEasily);
            list.Gap(6f);

            // Eating
            list.Dialog_Label("ZombieEatingTitle");
            list.Dialog_Checkbox("ZombiesEatDowned", ref settings.zombiesEatDowned);
            list.Dialog_Checkbox("ZombiesEatCorpses", ref settings.zombiesEatCorpses);
            list.Gap(6f);

            // Eating
            list.Dialog_Label("SpecialZombiesTitle");
            list.Dialog_FloatSlider("SuicideBomberChance", "0%", ref settings.suicideBomberChance, 0f, 1f - settings.toxicSplasherChance - settings.tankyOperatorChance - settings.minerChance);
            list.Dialog_FloatSlider("ToxicSplasherChance", "0%", ref settings.toxicSplasherChance, 0f, 1f - settings.suicideBomberChance - settings.tankyOperatorChance - settings.minerChance);
            list.Dialog_FloatSlider("TankyOperatorChance", "0%", ref settings.tankyOperatorChance, 0f, 1f - settings.suicideBomberChance - settings.toxicSplasherChance - settings.minerChance);
            list.Dialog_FloatSlider("MinerChance", "0%", ref settings.minerChance, 0f, 1f - settings.suicideBomberChance - settings.toxicSplasherChance - settings.tankyOperatorChance);
            var normalChance = 1 - settings.suicideBomberChance - settings.toxicSplasherChance - settings.tankyOperatorChance - settings.minerChance;

            list.Dialog_Text(GameFont.Tiny, "NormalZombieChance", string.Format("{0:0%}", normalChance));

            list.NewColumn();
            list.ColumnWidth -= Listing.ColumnSpacing;             // ----------------------------------------------------------

            // Days
            list.Dialog_Label("NewGameTitle", false);
            list.Dialog_Integer("DaysBeforeZombiesCome", null, 0, 100, ref settings.daysBeforeZombiesCome);

            // Total
            list.Dialog_Label("ZombiesOnTheMap");
            list.Dialog_Integer("MaximumNumberOfZombies", "Zombies", 0, 5000, ref settings.maximumNumberOfZombies);
            list.Dialog_FloatSlider("ColonyMultiplier", "0.0x", ref settings.colonyMultiplier, 1f, 10f);

            // Events
            list.Dialog_Label("ZombieEventTitle");
            list.Dialog_Integer("ZombiesPerColonistInEvent", null, 0, 200, ref settings.baseNumberOfZombiesinEvent);
            list.Dialog_Integer("ExtraDaysBetweenEvents", null, 0, 10000, ref settings.extraDaysBetweenEvents);

            // Speed
            list.Dialog_Label("ZombieSpeedTitle");
            list.Dialog_FloatSlider("MoveSpeedIdle", "0.0x", ref settings.moveSpeedIdle, 0.05f, 2f);
            list.Gap(-4f);
            list.Dialog_FloatSlider("MoveSpeedTracking", "0.0x", ref settings.moveSpeedTracking, 0.2f, 3f);

            // Strength
            list.Dialog_Label("ZombieDamageFactorTitle");
            list.Dialog_FloatSlider("ZombieDamageFactor", "0.0x", ref settings.damageFactor, 0.1f, 4f);

            // Tweaks
            list.Dialog_Label("ZombieGameTweaks");
            list.Dialog_FloatSlider("ReduceTurretConsumption", "0%", ref settings.reducedTurretConsumption, 0f, 1f);

            // Infections
            list.Dialog_Label("ZombieInfections");
            list.Dialog_FloatSlider("ZombieBiteInfectionChance", "0%", ref settings.zombieBiteInfectionChance, 0f, 1f);
            list.Dialog_TimeSlider("ZombieBiteInfectionUnknown", ref settings.hoursInfectionIsUnknown, 0, 48);
            list.Dialog_TimeSlider("ZombieBiteInfectionTreatable", ref settings.hoursInfectionIsTreatable, 0, 6 * 24);
            list.Dialog_TimeSlider("ZombieBiteInfectionPersists", ref settings.hoursInfectionPersists, 0, 30 * 24, true);
            list.Dialog_Checkbox("AnyTreatmentStopsInfection", ref settings.anyTreatmentStopsInfection);

            // Miscellaneous
            list.Dialog_Label("ZombieMiscTitle");
            list.Dialog_Checkbox("UseCustomTextures", ref settings.useCustomTextures);
            list.Dialog_Checkbox("ReplaceTwinkie", ref settings.replaceTwinkie);
            list.Dialog_Checkbox("PlayCreepyAmbientSound", ref settings.playCreepyAmbientSound);
            list.Dialog_Checkbox("BetterZombieAvoidance", ref settings.betterZombieAvoidance);
            list.Dialog_Checkbox("ZombiesDropBlood", ref settings.zombiesDropBlood);
            list.Dialog_Checkbox("ZombiesBurnLonger", ref settings.zombiesBurnLonger);

            // Actions
            list.Dialog_Label("ZombieActionsTitle");
            list.Dialog_Button("ZombieSettingsReset", "Reset", false, settings.Reset);
            if (inGame)
            {
                list.Dialog_Button("UninstallZombieland", "UninstallButton", true, Dialog_Save.Save, false);
            }

            var now = DateTime.Now;

            if (now > nextNetworkCheck)
            {
                nextNetworkCheck = now.AddSeconds(10);
                var thread = new Thread(delegate() { isNetworkAvailable = SharedSettings.HasConnectivity(); });
                thread.Start();
            }
            if (isNetworkAvailable)
            {
                list.Gap(8f);
                list.Dialog_Button("LoadSettings", "LoadSettingsButton", false, settings.Load);
                list.Dialog_Button("PublishSettings", "PublishSettingsButton", false, settings.Publish);
            }

            list.End();             // -----------------------------------------------------------------------------------------

            Widgets.EndScrollView();
        }
예제 #5
0
 private void Delete(string label, string steamName)
 {
     SharedSettings.Delete(label, steamName);
     RefreshList();
 }