// Decompiled with JetBrains decompiler
// Type: GameOption
// Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: DF4C6C3A-AD7F-49DB-A385-AF294186A2A2
// Assembly location: D:\20-10-14\Desktop\PE LOGS\333bb.dll
using System;
using UnityEngine;
[Serializable]
public class GameOption
{
private bool[] BoolOptions = new bool[23];
public float MasterVolume = 1f;
public float MusicVolume = 1f;
public float SoundVolume = 1f;
public float TooltipDelay = 1f;
public string LanguageName = string.Empty;
public float ScrollSpeed = 1f;
private float m_FontScale = 1f;
public float MinZoom = 1f;
public float MaxZoom = 1.5f;
private AutoPauseOptions m_autopause = new AutoPauseOptions();
public UIDropdownResolution.MyResolution Resolution;
public GameOption.FontScaleChangedDelegate OnFontScaleChanged;
public bool DeveloperCommentary
{
get
{
return this.GetOption(GameOption.BoolOption.DEVELOPER_COMMENTARY);
}
set
{
this.SetOption(GameOption.BoolOption.DEVELOPER_COMMENTARY, value);
}
}
public bool DeathIsPermanent
{
get
{
return this.GetOption(GameOption.BoolOption.DEATH_IS_PERMANENT);
}
set
{
this.SetOption(GameOption.BoolOption.DEATH_IS_PERMANENT, value);
}
}
public bool AoeHighlighting
{
get
{
return this.GetOption(GameOption.BoolOption.AOE_HIGHLIGHTING);
}
set
{
this.SetOption(GameOption.BoolOption.AOE_HIGHLIGHTING, value);
}
}
public bool DisplayUnqualifiedInteractions
{
get
{
return this.GetOption(GameOption.BoolOption.DISPLAY_UNQUALIFIED_INTERACTIONS);
}
set
{
this.SetOption(GameOption.BoolOption.DISPLAY_UNQUALIFIED_INTERACTIONS, value);
}
}
public bool DisplayInteractionQualifier
{
get
{
return this.GetOption(GameOption.BoolOption.DISPLAY_INTERACTION_QUALIFIER);
}
set
{
this.SetOption(GameOption.BoolOption.DISPLAY_INTERACTION_QUALIFIER, value);
}
}
public bool DisplayPersonalityReputationIndicators
{
get
{
return this.GetOption(GameOption.BoolOption.DISPLAY_PERSONALITY_REPUTATION_INDICATORS);
}
set
{
this.SetOption(GameOption.BoolOption.DISPLAY_PERSONALITY_REPUTATION_INDICATORS, value);
}
}
public bool DisplayRelativeDefenses
{
get
{
return this.GetOption(GameOption.BoolOption.DISPLAY_RELATIVE_DEFENSES);
}
set
{
this.SetOption(GameOption.BoolOption.DISPLAY_RELATIVE_DEFENSES, value);
}
}
public bool DisplayQuestObjectiveTitles
{
get
{
return this.GetOption(GameOption.BoolOption.DISPLAY_QUEST_OBJECTIVE_TITLES);
}
set
{
this.SetOption(GameOption.BoolOption.DISPLAY_QUEST_OBJECTIVE_TITLES, value);
}
}
public float FontScale
{
get
{
return this.m_FontScale;
}
set
{
if ((double) this.m_FontScale == (double) value)
return;
this.m_FontScale = value;
if (this.OnFontScaleChanged == null)
return;
this.OnFontScaleChanged(value);
}
}
public AutoPauseOptions AutoPause
{
get
{
return this.m_autopause;
}
set
{
this.m_autopause = value;
}
}
public bool GetOption(GameOption.BoolOption option)
{
return this.BoolOptions[(int) option];
}
public void SetOption(GameOption.BoolOption option, bool setting)
{
this.BoolOptions[(int) option] = setting;
}
public void CopyFrom(GameOption other)
{
other.BoolOptions.CopyTo((Array) this.BoolOptions, 0);
this.MasterVolume = other.MasterVolume;
this.MusicVolume = other.MusicVolume;
this.SoundVolume = other.SoundVolume;
this.TooltipDelay = other.TooltipDelay;
this.FontScale = other.FontScale;
this.ScrollSpeed = other.ScrollSpeed;
this.LanguageName = other.LanguageName;
this.MinZoom = other.MinZoom;
this.MaxZoom = other.MaxZoom;
this.Resolution = new UIDropdownResolution.MyResolution(other.Resolution);
this.AutoPause.CopyFrom(other.AutoPause);
}
public bool Matches(GameOption other)
{
for (int index = 0; index < this.BoolOptions.Length; ++index)
{
if (this.BoolOptions[index] != other.BoolOptions[index])
return false;
}
if ((double) other.MasterVolume == (double) this.MasterVolume && (double) other.MusicVolume == (double) this.MusicVolume && ((double) other.SoundVolume == (double) this.SoundVolume && (double) other.TooltipDelay == (double) this.TooltipDelay) && ((double) other.FontScale == (double) this.FontScale && (double) other.ScrollSpeed == (double) this.ScrollSpeed && (other.LanguageName.Equals(this.LanguageName) && (double) other.MinZoom == (double) this.MinZoom)) && ((double) other.MaxZoom == (double) this.MaxZoom && other.Resolution.Equals((object) this.Resolution)))
return this.AutoPause.Matches(other.AutoPause);
else
return false;
}
public static bool BoolOptionDefault(GameOption.BoolOption c)
{
if (c != GameOption.BoolOption.COMBAT_TOOLTIPS_UI && c != GameOption.BoolOption.QUEST_UPDATES_UI && (c != GameOption.BoolOption.COLORBLIND_MODE && c != GameOption.BoolOption.GIBS) && (c != GameOption.BoolOption.SCREEN_EDGE_SCROLLING && c != GameOption.BoolOption.VSYNC && (c < GameOption.BoolOption.AOE_HIGHLIGHTING || c > GameOption.BoolOption.DISPLAY_QUEST_OBJECTIVE_TITLES)))
return c == GameOption.BoolOption.DONT_RESTRICT_STASH;
else
return true;
}
public void LoadFromPrefs()
{
for (int index = 0; index < 23; ++index)
{
bool flag = GameOption.BoolOptionDefault((GameOption.BoolOption) index);
bool setting = PlayerPrefs.GetInt(((GameOption.BoolOption) index).ToString(), !flag ? 0 : 1) > 0;
this.SetOption((GameOption.BoolOption) index, setting);
}
this.MasterVolume = PlayerPrefs.GetFloat("MasterVolume", 1f);
this.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f);
this.SoundVolume = PlayerPrefs.GetFloat("SoundVolume", 1f);
this.TooltipDelay = PlayerPrefs.GetFloat("TooltipDelay", 1f);
this.ScrollSpeed = PlayerPrefs.GetFloat("ScrollSpeed", 1f);
this.FontScale = PlayerPrefs.GetFloat("FontScale", 1f);
this.MinZoom = PlayerPrefs.GetFloat("MinZoom", 1f);
this.MaxZoom = PlayerPrefs.GetFloat("MaxZoom", 1.5f);
this.LanguageName = PlayerPrefs.GetString("LanguageName", StringTableManager.CurrentLanguage.Name);
string str1 = "Resolution";
int width1 = Screen.get_width();
int height1 = Screen.get_height();
Resolution currentResolution1 = Screen.get_currentResolution();
// ISSUE: explicit reference operation
int refreshRate1 = ((Resolution) @currentResolution1).get_refreshRate();
string str2 = new UIDropdownResolution.MyResolution(width1, height1, refreshRate1).SerialString();
this.Resolution = new UIDropdownResolution.MyResolution(PlayerPrefs.GetString(str1, str2));
this.AutoPause.Initialize();
BigHeads.Enabled = GameState.Option.GetOption(GameOption.BoolOption.BIG_HEADS);
int num1 = GameState.Option.Resolution.width;
Resolution currentResolution2 = Screen.get_currentResolution();
// ISSUE: explicit reference operation
int width2 = ((Resolution) @currentResolution2).get_width();
if (num1 == width2)
{
int num2 = GameState.Option.Resolution.height;
Resolution currentResolution3 = Screen.get_currentResolution();
// ISSUE: explicit reference operation
int height2 = ((Resolution) @currentResolution3).get_height();
if (num2 == height2)
{
int num3 = GameState.Option.Resolution.refreshRate;
Resolution currentResolution4 = Screen.get_currentResolution();
// ISSUE: explicit reference operation
int refreshRate2 = ((Resolution) @currentResolution4).get_refreshRate();
if (num3 == refreshRate2)
goto label_7;
}
}
Screen.SetResolution(GameState.Option.Resolution.width, GameState.Option.Resolution.height, Screen.get_fullScreen(), GameState.Option.Resolution.refreshRate);
label_7:
if (StringTableManager.CurrentLanguage.Name != GameState.Option.LanguageName)
StringTableManager.SetCurrentLanguageByName(GameState.Option.LanguageName);
if (GameState.OnDifficultyChanged != null)
GameState.OnDifficultyChanged(GameState.Mode.Difficulty);
QualitySettings.set_vSyncCount(!this.GetOption(GameOption.BoolOption.VSYNC) ? 0 : 1);
UICamera.tooltipDelay = this.TooltipDelay;
WinCursor.Clip(true);
}
public void SaveToPrefs()
{
for (int index = 0; index < 23; ++index)
PlayerPrefs.SetInt(((GameOption.BoolOption) index).ToString(), !this.GetOption((GameOption.BoolOption) index) ? 0 : 1);
PlayerPrefs.SetFloat("MasterVolume", this.MasterVolume);
PlayerPrefs.SetFloat("MusicVolume", this.MusicVolume);
PlayerPrefs.SetFloat("SoundVolume", this.SoundVolume);
PlayerPrefs.SetFloat("TooltipDelay", this.TooltipDelay);
PlayerPrefs.SetFloat("FontScale", this.FontScale);
PlayerPrefs.SetFloat("MinZoom", this.MinZoom);
PlayerPrefs.SetFloat("MaxZoom", this.MaxZoom);
PlayerPrefs.SetFloat("ScrollSpeed", this.ScrollSpeed);
PlayerPrefs.SetString("LanguageName", this.LanguageName);
PlayerPrefs.SetString("Resolution", this.Resolution.SerialString());
this.AutoPause.SaveOptions();
PlayerPrefs.Save();
}
public enum BoolOption
{
DEATH_IS_PERMANENT,
AOE_HIGHLIGHTING,
DISPLAY_UNQUALIFIED_INTERACTIONS,
DISPLAY_INTERACTION_QUALIFIER,
DISPLAY_PERSONALITY_REPUTATION_INDICATORS,
DISPLAY_RELATIVE_DEFENSES,
DISPLAY_QUEST_OBJECTIVE_TITLES,
BIG_HEADS,
HIDE_CIRCLES,
HIDE_OFFSCREEN_POINTERS,
ALWAYS_SAVE_OPTIONS,
LIGATURES,
DEVELOPER_COMMENTARY,
COMBAT_TOOLTIPS_UI,
QUEST_UPDATES_UI,
COLORBLIND_MODE,
SOLID_HUD,
GIBS,
SCREEN_EDGE_SCROLLING,
DONT_WARN_STORE_TOO_POOR,
VSYNC,
CLIP_CURSOR,
DONT_RESTRICT_STASH,
COUNT,
}
public delegate void FontScaleChangedDelegate(float newscale);
}