protected virtual void DoWriteToXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Id", Id.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Title", Title); writer.WriteAttributeString("SetsMusicVolume", SetsMusicVolume ? "true" : "false"); writer.WriteAttributeString("SetsSoundVolume", SetsSoundVolume ? "true" : "false"); writer.WriteAttributeString("MusicVolume", MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("SoundVolume", SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); }
private void UpdateMusicVolumn() { musicSource.volume = MusicVolume / 100.0f; var config = Config.Instance; var volumn = MusicVolume.ToString(); config.SetValue("Audio", "MusicVolumn", volumn); }
private void WriteSettings(XmlWriter writer) { writer.WriteStartElement("Settings"); writer.WriteAttributeString("Version", 1.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteElementString("MusicDirectory", MusicDirectory); writer.WriteElementString("SoundsDirectory", SoundDirectory); writer.WriteElementString("LastDownloadLocation", LastDownloadLocation); writer.WriteStartElement("WindowLayout"); writer.WriteRaw(WindowLayout); writer.WriteEndElement(); writer.WriteStartElement("Volumes"); writer.WriteAttributeString("Overall", GlobalVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Music", MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Sound", SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Network"); writer.WriteAttributeString("TcpPort", TcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UdpPort", UdpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("IPAddress", IPAddress); writer.WriteAttributeString("CheckForUpdate", CheckForUpdate ? "true" : "false"); writer.WriteAttributeString("Enabled", UseLegacyNetwork ? "true" : "false"); writer.WriteAttributeString("WebTcpPort", WebTcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UseWebNetwork", UseWebNetwork ? "true" : "false"); writer.WriteEndElement(); RecentFiles.WriteFiles(writer); writer.WriteStartElement("Tools"); writer.WriteElementString("SoundFileEditor", SoundFileEditor); writer.WriteElementString("ExternalMusicPlayer", ExternalMusicPlayer); writer.WriteEndElement(); writer.WriteStartElement("Options"); writer.WriteAttributeString("MessageFilterLevel", MessageFilterLevel.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("ShowKeys", ShowKeysInButtons ? "true" : "false"); writer.WriteAttributeString("GlobalKeyHook", GlobalKeyHook ? "true" : "false"); writer.WriteAttributeString("OutputDevice", OutputDeviceIndex.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Streaming"); writer.WriteAttributeString("Active", UseStreaming ? "true" : "false"); writer.WriteAttributeString("Address", StreamingServerAddress); writer.WriteAttributeString("Port", StreamingServerPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("Password", StreamingPassword); writer.WriteAttributeString("Encoding", StreamingEncoder.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("StreamName", StreamingStreamName); writer.WriteAttributeString("Bitrate", StreamingBitrate.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("UserName", StreamingUserName); writer.WriteEndElement(); writer.WriteStartElement("OnlineDB"); writer.WriteAttributeString("UserId", OnlineDBUserId); writer.WriteAttributeString("DialogAfterDownload", ShowDialogAfterDownload ? "true" : "false"); writer.WriteAttributeString("DialogAfterUpload", ShowDialogAfterUpload ? "true" : "false"); writer.WriteEndElement(); writer.WriteStartElement("TagMusicFading"); writer.WriteAttributeString("FadeTime", TagMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("FadeOnlyOnChange", TagMusicFadeOnlyOnChange ? "true" : "false"); writer.WriteEndElement(); writer.WriteStartElement("Music"); writer.WriteAttributeString("PlayOnAllSpeakers", PlayMusicOnAllSpeakers ? "true" : "false"); writer.WriteAttributeString("ButtonFadeMode", ButtonMusicFadeMode.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteAttributeString("ButtonFadeTime", ButtonMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Controllers"); writer.WriteAttributeString("LocalPlayerPath", LocalPlayerPath); writer.WriteEndElement(); writer.WriteStartElement("TipOfTheDay"); writer.WriteAttributeString("ShowTip", ShowTipOfTheDay ? "true" : "false"); writer.WriteAttributeString("LastTip", LastTipOfTheDay.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteStartElement("Tpm2NetTarget"); writer.WriteAttributeString("Host", Tpm2NetTargetHost); writer.WriteAttributeString("Port", Tpm2NetTargetPort.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteEndElement(); writer.WriteEndElement(); }
public string DescribeValue(GameMode mode, IDs option) { switch (option) { case IDs.GAME_AGGRESSIVE_HUNGRY_CIVILIANS: return(IsAggressiveHungryCiviliansOn ? "ON (default ON)" : "OFF (default ON)"); case IDs.GAME_ALLOW_UNDEADS_EVOLUTION: return(AllowUndeadsEvolution ? "YES (default YES)" : "NO (default YES)"); case IDs.GAME_CITY_SIZE: return(String.Format("{0:D2}* (default {1:D2})", CitySize, GameOptions.DEFAULT_CITY_SIZE)); case IDs.GAME_DAY_ZERO_UNDEADS_PERCENT: return(String.Format("{0:D3}% (default {1:D3}%)", DayZeroUndeadsPercent, GameOptions.DEFAULT_DAY_ZERO_UNDEADS_PERCENT)); case IDs.GAME_DEATH_SCREENSHOT: return(IsDeathScreenshotOn ? "YES (default YES)" : "NO (default YES)"); case IDs.GAME_DISTRICT_SIZE: return(String.Format("{0:D2}* (default {1:D2})", DistrictSize, GameOptions.DEFAULT_DISTRICT_SIZE)); case IDs.GAME_MAX_CIVILIANS: return(String.Format("{0:D3}* (default {1:D3})", MaxCivilians, GameOptions.DEFAULT_MAX_CIVILIANS)); case IDs.GAME_MAX_DOGS: return(String.Format("{0:D3}* (default {1:D3})", MaxDogs, GameOptions.DEFAULT_MAX_DOGS)); case IDs.GAME_MAX_REINCARNATIONS: return(String.Format("{0:D3} (default {1:D3})", MaxReincarnations, GameOptions.DEFAULT_MAX_REINCARNATIONS)); case IDs.GAME_MAX_UNDEADS: return(String.Format("{0:D3}* (default {1:D3})", MaxUndeads, GameOptions.DEFAULT_MAX_UNDEADS)); case IDs.GAME_NATGUARD_FACTOR: return(String.Format("{0:D3}% (default {1:D3}%)", NatGuardFactor, GameOptions.DEFAULT_NATGUARD_FACTOR)); case IDs.GAME_NPC_CAN_STARVE_TO_DEATH: return(NPCCanStarveToDeath ? "YES (default YES)" : "NO (default YES)"); case IDs.GAME_PERMADEATH: return(IsPermadeathOn ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_RATS_UPGRADE: return(RatsUpgrade ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_REINC_LIVING_RESTRICTED: return(IsLivingReincRestricted ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_REINCARNATE_AS_RAT: return(CanReincarnateAsRat ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_REINCARNATE_TO_SEWERS: return(CanReincarnateToSewers ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_REVEAL_STARTING_DISTRICT: return(RevealStartingDistrict ? "YES (default YES)" : "NO (default YES)"); case IDs.GAME_SHAMBLERS_UPGRADE: return(ShamblersUpgrade ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_SKELETONS_UPGRADE: return(SkeletonsUpgrade ? "YES (default NO)" : "NO (default NO)"); case IDs.GAME_SIM_THREAD: return(SimThread ? "YES* (default YES)" : "NO* (default YES)"); case IDs.GAME_SIMULATE_DISTRICTS: return(String.Format("{0,-4}* (default {1})", GameOptions.Name(SimulateDistricts), GameOptions.Name(GameOptions.DEFAULT_SIM_DISTRICTS))); case IDs.GAME_SIMULATE_SLEEP: return(SimulateWhenSleeping ? "YES* (default NO)" : "NO* (default NO)"); case IDs.GAME_STARVED_ZOMBIFICATION_CHANCE: return(String.Format("{0:D3}% (default {1:D3}%)", StarvedZombificationChance, GameOptions.DEFAULT_STARVED_ZOMBIFICATION_CHANCE)); case IDs.GAME_SUPPLIESDROP_FACTOR: return(String.Format("{0:D3}% (default {1:D3}%)", SuppliesDropFactor, GameOptions.DEFAULT_SUPPLIESDROP_FACTOR)); case IDs.GAME_ZOMBIE_INVASION_DAILY_INCREASE: return(String.Format("{0:D3}% (default {1:D3}%)", ZombieInvasionDailyIncrease, GameOptions.DEFAULT_ZOMBIE_INVASION_DAILY_INCREASE)); case IDs.GAME_ZOMBIFICATION_CHANCE: return(String.Format("{0:D3}% (default {1:D3}%)", ZombificationChance, GameOptions.DEFAULT_ZOMBIFICATION_CHANCE)); case IDs.GAME_UNDEADS_UPGRADE_DAYS: return(String.Format("{0:D3} (default {1:D3})", GameOptions.Name(ZombifiedsUpgradeDays), GameOptions.Name(GameOptions.DEFAULT_ZOMBIFIEDS_UPGRADE_DAYS))); case IDs.UI_ADVISOR: return(IsAdvisorEnabled ? "YES" : "NO "); case IDs.UI_ANIM_DELAY: return(IsAnimDelayOn ? "ON " : "OFF"); case IDs.UI_COMBAT_ASSISTANT: return(IsCombatAssistantOn ? "ON (default OFF)" : "OFF (default OFF)"); case IDs.UI_MUSIC: return(PlayMusic ? "ON " : "OFF"); case IDs.UI_MUSIC_VOLUME: return(MusicVolume.ToString() + "%"); case IDs.UI_SHOW_MINIMAP: return(IsMinimapOn ? "ON " : "OFF"); case IDs.UI_SHOW_PLAYER_TAG_ON_MINIMAP: return(ShowPlayerTagsOnMinimap ? "YES" : "NO "); case IDs.UI_SHOW_PLAYER_TARGETS: return(ShowPlayerTargets ? "ON (default ON)" : "OFF (default ON)"); case IDs.UI_SHOW_TARGETS: return(ShowTargets ? "ON (default ON)" : "OFF (default ON)"); case IDs.GAME_AUTOSAVE_PERIOD: return(String.Format("{0,-4} (default {1}h)", m_AutoSavePeriodInHours == 0 ? "OFF" : m_AutoSavePeriodInHours.ToString() + "h", GameOptions.DEFAULT_AUTOSAVE_PERIOD)); default: return("???"); } }
/// <summary> /// Saves settings. /// </summary> public void SaveSettings() { PlayerPrefs.SetFloat(SFXVolume.ToString(), SFXVolume); PlayerPrefs.SetFloat(MusicVolume.ToString(), MusicVolume); Utils.SetBool(MuteAudio.ToString(), MuteAudio); }