public static string Save(SettingsGroup settings, string label, string description) { var currentSteamUser = SteamUtility.SteamPersonaName; var userSettings = new UserSettings() { Name = label, Creator = currentSteamUser, Description = description, Settings = settings, Downloads = 0 }; var path = "/Settings/" + Key(label, currentSteamUser); try { return(client.Put(path, userSettings)); } catch (Exception e) { Log.Error("Exception " + e + " while saving to " + path); } return(null); }
public static void Present(SettingsGroup settings) { Find.WindowStack.Add(new Dialog_PublishSettings(settings)); }
public Dialog_PublishSettings(SettingsGroup settings) { doCloseButton = true; absorbInputAroundWindow = true; this.settings = settings; }
public ZombieSettings(World world) : base(world) { Values = ZombieSettingsDefaults.Defaults(); }
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(); }
public static void DoWindowContentsInternal(ref SettingsGroup settings, Rect inRect, bool isDefaults) { if (settings == null) { settings = defaults; } Rect rect = inRect.AtZero(); rect.yMax -= 45f; var numberOfColumns = 3; var defaultColumnWidth = (rect.width - (numberOfColumns - 1) * Listing.ColumnSpacing) / numberOfColumns; Listing_Standard list = new Listing_Standard() { ColumnWidth = defaultColumnWidth }; list.Begin(inRect); list.Gap(); list.Dialog_Enum("WhenDoZombiesSpawn", ref settings.spawnWhenType); list.Dialog_Enum("HowDoZombiesSpawn", ref settings.spawnHowType); list.Dialog_Enum("WhatDoZombiesAttack", ref settings.attackMode); list.Dialog_Enum("WhatDoZombiesSmash", ref settings.smashMode, false); list.Dialog_Checkbox("SmashOnlyWhenAgitated", ref settings.smashOnlyWhenAgitated, false); list.NewColumn(); list.Gap(); list.Dialog_Label("NewGameTitle"); list.Dialog_Integer("DaysBeforeZombiesCome", null, 0, 100, ref settings.daysBeforeZombiesCome); list.Dialog_Label("ZombiesOnTheMap"); list.Dialog_Integer("MaximumNumberOfZombies", "Zombies", 0, 5000, ref settings.maximumNumberOfZombies); list.Dialog_Label("ZombieEventTitle"); list.Dialog_Integer("ZombiesPerColonistInEvent", null, 0, 200, ref settings.baseNumberOfZombiesinEvent); list.Dialog_Label("ZombieSpeedTitle"); list.Dialog_FloatSlider("MoveSpeedIdle", "0.0", ref settings.moveSpeedIdle, 0.05f, 2f); list.Dialog_FloatSlider("MoveSpeedTracking", "0.0", ref settings.moveSpeedTracking, 0.2f, 3f); list.Dialog_Label("ZombieDamageFactorTitle"); list.Dialog_FloatSlider("ZombieDamageFactor", "0.0", ref settings.damageFactor, 0.1f, 4f); list.Gap(list.verticalSpacing * -2); list.NewColumn(); list.Gap(); list.Dialog_Label("ZombieInfections"); list.Dialog_FloatSlider("ZombieBiteInfectionChance", "0", ref settings.zombieBiteInfectionChance, 0f, 1f, 100f); list.Dialog_Enum("ZombieInstinctTitle", ref settings.zombieInstinct, false); list.Gap(); list.Dialog_Label("ZombieHealthTitle"); list.Dialog_Checkbox("DoubleTapRequired", ref settings.doubleTapRequired); list.Dialog_Checkbox("ZombiesDieVeryEasily", ref settings.zombiesDieVeryEasily); list.Gap(); list.Dialog_Label("ZombieEatingTitle"); list.Dialog_Checkbox("ZombiesEatDowned", ref settings.zombiesEatDowned); list.Dialog_Checkbox("ZombiesEatCorpses", ref settings.zombiesEatCorpses, false); list.Gap(); list.Dialog_Label("ZombieMiscTitle"); list.Dialog_Checkbox("UseCustomTextures", ref settings.useCustomTextures); list.Dialog_Checkbox("ZombiesTriggerDangerMusic", ref settings.zombiesTriggerDangerMusic, false); list.End(); }
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 * 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); if (settings.attackMode == AttackMode.OnlyColonists) { list.Dialog_Checkbox("EnemiesAttackZombies", ref settings.enemiesAttackZombies); } // 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); 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); // Events list.Dialog_Label("ZombieEventTitle"); list.Dialog_Integer("ZombiesPerColonistInEvent", null, 0, 200, ref settings.baseNumberOfZombiesinEvent); // 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); // 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, 24, 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("ZombiesTriggerDangerMusic", ref settings.zombiesTriggerDangerMusic); list.Dialog_Checkbox("BetterZombieAvoidance", ref settings.betterZombieAvoidance); list.Dialog_Checkbox("ZombiesDropBlood", ref settings.zombiesDropBlood); // 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); } list.End(); // ----------------------------------------------------------------------------------------- Widgets.EndScrollView(); }