public static void LoadGameSettings() { // create the file if it doesn't already exist if (!File.Exists(GameSettings.GetDirectory() + "settings.ini")) SaveGameSettings(); INIParser ini = new INIParser(); ini.Open(GameSettings.GetDirectory() + "settings.ini"); { GameSettings.GS_RESOLUTION.x = ini.ReadValue("Display", "Screen Width", Screen.width); GameSettings.GS_RESOLUTION.y = ini.ReadValue("Display", "Screen Height", Screen.height); GameSettings.GS_FULLSCREEN = ini.ReadValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN); GameSettings.GS_FRAMECAP = ini.ReadValue("Display", "Framecap", GameSettings.GS_FRAMECAP); GameSettings.GS_DRAWDISTANCE = ini.ReadValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE); GameSettings.GS_BLOOM = ini.ReadValue("Rendering", "Bloom", GameSettings.GS_BLOOM); GameSettings.GS_FXAA = ini.ReadValue("Rendering", "FXAA", GameSettings.GS_FXAA); GameSettings.GS_CRT = ini.ReadValue("Rendering", "CRT", GameSettings.GS_CRT); GameSettings.GS_VAPORWAVE = ini.ReadValue("Rendering", "Vape", GameSettings.GS_VAPORWAVE); AudioSettings.VOLUME_MAIN= ini.ReadValue("Audio", "Master Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MAIN)); AudioSettings.VOLUME_SFX = ini.ReadValue("Audio", "SFX Volume", Mathf.RoundToInt(AudioSettings.VOLUME_SFX)); AudioSettings.VOLUME_VOICES = ini.ReadValue("Audio", "Voices Volume", Mathf.RoundToInt(AudioSettings.VOLUME_VOICES)); AudioSettings.VOLUME_MUSIC = ini.ReadValue("Audio", "Music Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MUSIC)); } ini.Close(); }
public static void SaveGameSettings() { INIParser ini = new INIParser(); ini.Open(GameSettings.GetDirectory() + "settings.ini"); { ini.WriteValue("Display", "Screen Width", Screen.width); ini.WriteValue("Display", "Screen Height", Screen.height); ini.WriteValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN); ini.WriteValue("Display", "Framecap", GameSettings.GS_FRAMECAP); ini.WriteValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE); ini.WriteValue("Rendering", "Bloom", GameSettings.GS_BLOOM); ini.WriteValue("Rendering", "Dynamic Resolution", GameSettings.GS_DYNAMICRESOLUTION); ini.WriteValue("Rendering", "AA", GameSettings.GS_AA); ini.WriteValue("Rendering", "AO", GameSettings.GS_AO); ini.WriteValue("Rendering", "CAMDMG", GameSettings.GS_CAMERADAMAGE); ini.WriteValue("Rendering", "TONEMAP", GameSettings.GS_TONEMAPPING); ini.WriteValue("Audio", "Master Volume", AudioSettings.VOLUME_MAIN); ini.WriteValue("Audio", "SFX Volume", AudioSettings.VOLUME_SFX); ini.WriteValue("Audio", "Voices Volume", AudioSettings.VOLUME_VOICES); ini.WriteValue("Audio", "Music Volume", AudioSettings.VOLUME_MUSIC); ini.WriteValue("Audio", "Custom Music", AudioSettings.customMusicEnabled); ini.WriteValue("Gameplay", "Default Camera", GameSettings.G_DEFAULTCAMERA); ini.WriteValue("Gameplay", "Countdown Mode", GameSettings.G_COUNTDOWNTYPE); ini.WriteValue("Gameplay", "Intro Voices", GameSettings.G_TRACKINTROVOICES); ini.WriteValue("Gameplay", "Mirror", GameSettings.G_MIRROR); ini.WriteValue("Gameplay", "Language", (int)GameSettings.G_LANGUAGE); ini.WriteValue("Gameplay", "Custom HUD Color R", GameSettings.G_CUSTOMHUDCOLOR.r); ini.WriteValue("Gameplay", "Custom HUD Color B", GameSettings.G_CUSTOMHUDCOLOR.b); ini.WriteValue("Gameplay", "Custom HUD Color G", GameSettings.G_CUSTOMHUDCOLOR.g); ini.WriteValue("Gameplay", "Custom HUD Color A", GameSettings.G_CUSTOMHUDCOLOR.a); ini.WriteValue("Control Settings", "Vibration", GameSettings.IN_VIBRATION); ini.WriteValue("Control Settings", "Analog Steer Deadzone", GameSettings.steerDeadZone); ini.WriteValue("Control Settings", "Analog Pitch Deadzone", GameSettings.pitchDeadZone); ini.WriteValue("Controls", "Thrust 1", (int)GameSettings.IN_KB_THRUST); ini.WriteValue("Controls", "Thrust 2", (int)GameSettings.IN_GP_THRUST); ini.WriteValue("Controls", "Camera 1", (int)GameSettings.IN_KB_CAMERA); ini.WriteValue("Controls", "Camera 2", (int)GameSettings.IN_GP_CAMERA); ini.WriteValue("Controls", "Look Behind 1", (int)GameSettings.IN_KB_LOOKBEHIND); ini.WriteValue("Controls", "Look Behind 2", (int)GameSettings.IN_GP_LOOKBEHIND); ini.WriteValue("Controls", "Afterburner 1", (int)GameSettings.IN_KB_AFTERBURN); ini.WriteValue("Controls", "Afterburner 2", (int)GameSettings.IN_GP_AFTERBURN); ini.WriteValue("Controls", "Airbrake Left 1", (int)GameSettings.IN_KB_AIRBRAKE_LEFT); ini.WriteValue("Controls", "Airbrake Left 2", (int)GameSettings.IN_GP_AIRBRAKE_LEFT); ini.WriteValue("Controls", "Airbrake Right 1", (int)GameSettings.IN_KB_AIRBRAKE_RIGHT); ini.WriteValue("Controls", "Airbrake Right 2", (int)GameSettings.IN_GP_AIRBRAKE_RIGHT); ini.WriteValue("Controls", "Pause 1", (int)GameSettings.IN_KB_PAUSE); ini.WriteValue("Controls", "Pause 2", (int)GameSettings.IN_GP_PAUSE); ini.WriteValue("Controls", "Steer -1", (int)GameSettings.IN_KB_STEER_LEFT); ini.WriteValue("Controls", "Steer 1", (int)GameSettings.IN_KB_STEER_RIGHT); ini.WriteValue("Controls", "Pitch -1", (int)GameSettings.IN_KB_PITCH_UP); ini.WriteValue("Controls", "Pitch 1", (int)GameSettings.IN_KB_PITCH_DOWN); } ini.Close(); }
private void WriteExtraData(INIParser _ini) { var dict = TGData.extraData; foreach (string k in dict.Keys) { _ini.WriteValue("ret", k, dict[k]); } }
void Start() { Value = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); ini = new INIParser(); TextAsset textFile = Resources.Load <TextAsset>("event"); ini.OpenFromString(textFile.text); card = new Card(1, ini); }
public void Awake() { TextAsset text_asset = Resources.Load("SDKManager") as TextAsset; INIParser ini = new INIParser(); ini.Open(text_asset); CurSDK = ini.ReadValue("platform", "name", "version_poker_window"); ini.Close(); }
void LoadSettingsConfig(Skin customSkin) { if (Directory.Exists(skinDirectory)) { // Load in all settings INIParser iniparse = new INIParser(); iniparse.Open(skinDirectory + "\\settings.ini"); System.Text.RegularExpressions.Regex hexRegex = new System.Text.RegularExpressions.Regex("#[a-fA-F0-9]{8,8}"); for (int i = 0; i < customSkin.sustain_mats.Length; ++i) { string hex = iniparse.ReadValue("Sustain Colors", i.ToString(), "#00000000"); if (hex.Length == 9 && hexRegex.IsMatch(hex)) // # r g b a { try { int r = int.Parse(new string(new char[] { hex[1], hex[2] }), System.Globalization.NumberStyles.HexNumber); int g = int.Parse(new string(new char[] { hex[3], hex[4] }), System.Globalization.NumberStyles.HexNumber); int b = int.Parse(new string(new char[] { hex[5], hex[6] }), System.Globalization.NumberStyles.HexNumber); int a = int.Parse(new string(new char[] { hex[7], hex[8] }), System.Globalization.NumberStyles.HexNumber); if (a > 0) { customSkin.sustain_mats[i] = new Material(sustainResources.sustainColours[i]); customSkin.sustain_mats[i].name = i.ToString(); customSkin.sustain_mats[i].SetColor("_Color", new Color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f)); } } catch (Exception e) { Debug.LogError(e.Message); } } //iniparse.WriteValue("Sustain Colors", i.ToString(), customSkin.sustain_colors[i].GetHex()); } iniparse.Close(); iniparse.Open(skinDirectory + "\\settings.ini"); for (int i = 0; i < customSkin.sustain_mats.Length; ++i) { if (customSkin.sustain_mats[i]) { iniparse.WriteValue("Sustain Colors", i.ToString(), "#" + customSkin.sustain_mats[i].GetColor("_Color").GetHex()); } else { iniparse.WriteValue("Sustain Colors", i.ToString(), "#00000000"); } } iniparse.Close(); } }
void LoadConfigFile() { INIParser iniParser = new INIParser(); iniParser.Open(Application.streamingAssetsPath + "/asteroid.ini"); this.url = iniParser.ReadValue("connect", "url", "ws://localhost:19999/api/asteroid"); this.R = iniParser.ReadValue("scene", "radius", 20); iniParser.Close(); }
static void Body( ) { #region Initialize Program Log.Init( ); InitDirectories( ); var setting = new INIParser("Globals.ini"); var AuthData = "Authenticate"; string consumerKey = setting.GetValue(AuthData, "ConsumerKey"); string consumerSecret = setting.GetValue(AuthData, "CconsumerSecret"); string accessToken = setting.GetValue(AuthData, "AccessToken"); string accessSecret = setting.GetValue(AuthData, "AccessSecret"); if ( string.IsNullOrEmpty(consumerKey) || string.IsNullOrEmpty(consumerSecret) || string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(accessSecret)) { Log.Error(LogHeader, "유저 인증 정보를 찾을 수 없습니다. 토큰 발급 창으로 이동합니다."); var frm = new Display.Authenticate(); frm.ShowDialog( ); if (frm.Result == true) { } else { Log.Error(LogHeader, "유저 인증에 실패했습니다. 프로그램을 종료합니다."); Exit( ); return; } } else { //TODO: User가 null일 경우의 대처 Globals.Instance.Initialize(consumerKey, consumerSecret, accessToken, accessSecret); } #endregion SetDebugParams( ); Globals.Instance.OwnerID = long.Parse(setting.GetValue("AppInfo", "OwnerID")); StringSetsManager.LoadStringsets("Stringsets"); ModuleManager.Initialize( ); ModuleManager.LoadAllModules("Modules"); new Display.AppConsole( ).ShowDialog( ); foreach (var module in ModuleManager.Modules) { var parser = new INIParser(Path.Combine("Modules", module.Name + ".ini")); module.SaveSettings(parser); parser.Save( ); } Exit( ); }
protected override void Start() { base.Start(); index = 2; mType = TYPE.SWORD; INIParser ini = new INIParser(); TextAsset configAsset = Resources.Load("Config/config.ini") as TextAsset; ini.Open(configAsset); mVelocityThreshold = (float)ini.ReadValue("sword", "velocity_threshold", 0.0); }
public static void test1() { INIParser ini = new INIParser(); ini.Open($"D:/SDKDomeProject/TestProject/Outputs/Android/sjoys_app.ini"); ini.WriteValue("Player", "app_id", "123"); ini.WriteValue("Player", "sdkversion", "5.3.3"); ini.WriteValue("Player", "debug", 1); ini.Close(); }
public override void SaveSettings(INIParser parser) { parser.SetValue("Module", "IsRunning", IsRunning); parser.SetValue("Module", "Type", this.GetType( ).FullName); parser.SetValue("Module", "Name", Name); parser.SetValue("Module", "ReactorStringset", stringsetname); parser.SetValue("Cycle", "Duration", duration); parser.SetValue("Cycle", "Variation", variation); }
//public RobotConnector.TargetPorts TargetPorts; Settings() { _robotSettings = new INIParser (); _robotSettings.Open (Application.dataPath + "\\Data\\RobotSettings.ini"); /* TargetPorts.VideoPort = _robotSettings.ReadValue ("Ports", "VideoPort", 7000); TargetPorts.AudioPort = _robotSettings.ReadValue ("Ports", "AudioPort", 7005); TargetPorts.HandsPort = _robotSettings.ReadValue ("Ports", "HandsPort", 7010);*/ //TargetPorts.CommPort = _robotSettings.ReadValue ("Ports", "CommPort", 6000); }
/// <summary> /// 读取SDKManager.xml /// </summary> public void initSDKMgrXML() { if (_isSDKXMLInited) { return; } TextAsset text_asset = Resources.Load("SDKManager") as TextAsset; INIParser ini = new INIParser(); ini.Open(text_asset); CurSDK = ini.ReadValue("platform", "name", "version_poker_window"); if (!string.IsNullOrEmpty(JARUtilTools.Channel_Name)) { CurSDK = JARUtilTools.Channel_Name; Debug.Log("JARUtilTools.CurChannel========>" + CurSDK); } else { Debug.Log("JARUtilTools.CurChannel is null !!!!!!!!!!!!"); } Q_ID = ini.ReadValue(CurSDK, "qid", 0); if (!string.IsNullOrEmpty(JARUtilTools.Channel_QID)) { int.TryParse(JARUtilTools.Channel_QID, out Q_ID); } S_QID = ini.ReadValue(CurSDK, "sqid", 0); if (!string.IsNullOrEmpty(JARUtilTools.Channel_SQID)) { int.TryParse(JARUtilTools.Channel_SQID, out S_QID); } bAppStore = ini.ReadValue(CurSDK, "appstore", false); string xmlFile = ini.ReadValue(CurSDK, "xmlfile", "SDKManager.xml"); APKName = ini.ReadValue(CurSDK, "apkname", "BuYu_Official"); if (!string.IsNullOrEmpty(JARUtilTools.Channel_ApkName)) { APKName = JARUtilTools.Channel_ApkName; } if (CurSDK != "version_poker_android_out_test" && CurSDK != "version_poker_android_in_test") { #if UNITY_IOS url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", "version_poker_ios_appstore", xmlFile); #else url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", "version_poker_android_official", xmlFile); #endif } else { url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", CurSDK, xmlFile); } ini.Close(); _isSDKXMLInited = true; }
protected ChessType(ChessTypeId chessTypeId, float default_rt, float default_mt, float default_wt) { id = (int)chessTypeId; INIParser iniParser = new INIParser(); iniParser.Open(Application.streamingAssetsPath + "/ChessAttr.ini"); ready_time = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameReadyTime, default_rt)); move_time = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameMoveTime, default_mt)); load_time = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameLoadTime, default_wt)); iniParser.Close(); }
// [FILE] must be provided without extension. // Write [VALUE] to [FILE], under [SECTION], at the entry identifed with [KEY] // Credit: https://www.assetstore.unity3d.com/en/#!/content/23706 public void writeIni(string section, string key, string value) { INIParser ini = new INIParser(); ini.Open(iniFile); ini.WriteValue(section, key, value); ini.Close(); Debug.Log("Wrote value: '" + value + "' " + section + ", " + key); return; }
public LevelLoadDialogue() { InitializeComponent(); // Load default level using (INIParser settings = new INIParser("settings.ini")) { //CampaignTextBox.Text; CampaignTextBox.Text = settings.Get("level_default", "campaign", ""); LevelTextBox.Text = settings.Get("level_default", "level", ""); } }
//这里封装了一个简单的通用方法。 static bool BulidTarget(string sKey, string apkName) { string app_name = apkName; string target_name = app_name + ".apk"; //BuildTargetGroup targetGroup = BuildTargetGroup.Android; BuildTarget buildTarget = BuildTarget.Android; string applicationPath = Application.dataPath.Replace("/Assets", ""); #if UNITY_ANDROID target_name = app_name + ".apk"; PlayerSettings.keystorePass = "******"; PlayerSettings.keyaliasPass = "******"; //targetGroup = BuildTargetGroup.Android; //PlayerSettings.bundleIdentifier = "com.game.qq"; #elif UNITY_IOS #endif //PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, sKey); string iniPath = Application.dataPath + "/Resources/SDKManager.bytes"; INIParser ini = new INIParser(); ini.Open(iniPath); ini.WriteValue("platform", "name", sKey); ini.Close(); //每次build删除之前的残留 if (Directory.Exists(Out_Path)) { if (File.Exists(Out_Path + "/" + target_name)) { File.Delete(Out_Path + "/" + target_name); } } else { Directory.CreateDirectory(Out_Path); } PlayerSettings.bundleVersion = ClientDefine.LOCAL_PROGRAM_VERSION; int code = 0; if (int.TryParse(_versionCode, out code)) { PlayerSettings.Android.bundleVersionCode = code; } else { _log = "version code 错误!"; return(false); } AssetDatabase.Refresh(); //==================这里是比较重要的东西======================= //开始Build场景,等待吧~ return(GenericBuild(SCENES, Out_Path + "/" + target_name, buildTarget, BuildOptions.None)); }
public void Init() { if (_inited) { return; } _inited = true; _robotSettings = new INIParser(); _robotSettings.Open(Application.dataPath + "\\Data\\RobotSettings.ini"); Debug.Log("Settings File loaded"); }
/// <summary> /// <para>Eng. Init option data with option ini file. </para> /// <para>Kor. 옵션 정보 ini을 가져와 초기화합니다. </para> /// </summary> public void ReadOptionData() { INIParser _iniParser = new INIParser(); if (File.Exists(Application.dataPath + "/option.ini")) { // if, file has exists _iniParser.Open(Application.dataPath + "/option.ini"); // -------------- Graphic -------------- SetOptiondataResolution(_iniParser.ReadValue("Graphic", "ResolutionWidth", Screen.currentResolution.width), _iniParser.ReadValue("Graphic", "ResolutionHeight", Screen.currentResolution.height)); _optionData.FullscreenModeIndex = _iniParser.ReadValue("Graphic", "FullscreenMode", 0); _optionData.QualityIndex = _iniParser.ReadValue("Graphic", "Quality", QualitySettings.GetQualityLevel()); // -------------- Sound -------------- _optionData.BGMVolume = _iniParser.ReadValue("Sound", "BGM", 1f); _optionData.EffectVolume = _iniParser.ReadValue("Sound", "Effect", 1f); // -------------- Game -------------- _optionData.DialogueSpeedIndex = _iniParser.ReadValue("Game", "DialogueSpeed", 0); // -------------- End -------------- _iniParser.Close(); } else { _iniParser.Open(Application.dataPath + "/option.ini"); // -------------- Graphic -------------- _optionData._resolution = Screen.currentResolution; _optionData._fullscreenModeIndex = ConvertFullscreenModeToIndex(Screen.fullScreenMode); _optionData._qualityIndex = QualitySettings.GetQualityLevel(); // -------------- Sound -------------- _optionData._bgmVolume = InGameManager.GetInstance()._sceneBGM.volume; _optionData._effectVolume = InGameManager.GetInstance()._scriptSoundEffect.volume; // -------------- Game -------------- _optionData._dialogueSpeedIndex = InGameManager.GetInstance().DialogueSpeed; // -------------- End -------------- _iniParser.Close(); SaveOptionData(); } }
private void LoadPlayer(INIParser ini) { PlayerConfig.maxHealth = ini.ReadValue("Player", "MaxHealth", 100); PlayerConfig.respawnTime = ini.ReadValue("Player", "RespawnTime", 5); PlayerConfig.jumpForce = ini.ReadValue("Player", "JumpForce", 10); PlayerConfig.movementSmoothing = (float)ini.ReadValue("Player", "MovementSmoothing", 0.2f); PlayerConfig.airControl = ini.ReadValue("Player", "AirControl", true); PlayerConfig.minLightIntensity = ini.ReadValue("Player", "MinLightIntensity", 0); PlayerConfig.maxLightIntensity = (float)ini.ReadValue("Player", "MaxLightIntensity", 0.8); PlayerConfig.minLightRadius = ini.ReadValue("Player", "MinLightRadius", 1); PlayerConfig.maxLightRadius = ini.ReadValue("Player", "MaxLightRadius", 4); }
// Read [VALUE] from [FILE], under [SECTION], at the entry identifed with [KEY]. If no value can be read, return [DEFAULTVALUE]. // Credit: https://www.assetstore.unity3d.com/en/#!/content/23706 public string readIni(string section, string key, string defaultValue) { INIParser ini = new INIParser(); ini.Open(iniFile); string value = ini.ReadValue(section, key, defaultValue); ini.Close(); Debug.Log("Received value: '" + value + "' from " + section + ", " + key); return(value); }
public override void SaveSettings(INIParser parser) { parser.SetValue("Module", "IsRunning", IsRunning); parser.SetValue("Module", "Type", this.GetType( ).FullName); parser.SetValue("Module", "Name", Name); parser.SetValue("Module", "ReactorStringset", stringset); parser.SetValue("Expire", "Time", ExpireTime); parser.SetValue("Expire", "Delay", ExpireDelay); parser.SetValue("TimeLimit", "StartTime", moduleWakeup); parser.SetValue("TimeLimit", "EndTime", moduleSleep); }
private void InitParser() { string path = m_controller.RootPath + "/" + fileName; m_iniParser = new INIParser(); m_iniParser.Open(path); if (string.IsNullOrEmpty(m_iniParser.iniString)) { m_controller.ErrorQuit("Config is NULL! Path = " + path); return; } }
private void InitParser() { string path = TGPaths.MainGameConfig; m_iniParser = new INIParser(); m_iniParser.Open(path); if (string.IsNullOrEmpty(m_iniParser.iniString)) { m_controller.ErrorQuit("Config is NULL! Path = " + path); return; } }
/// <summary> /// 写微信授权用户信息到本地 /// </summary> private void WriteWeChatAuthInfo() { string AccountConfigPath = GameDefine.AppPersistentDataPath + GameDefine.AccountInfoFile; INIParser IniFile = new INIParser(); IniFile.Open(AccountConfigPath); IniFile.WriteValue("WXUser", "nickname", GetUserNickname()); IniFile.WriteValue("WXUser", "sex", GetUserSex().ToString()); IniFile.WriteValue("WXUser", "headimgurl", GetUserHeadImgUrl()); IniFile.WriteValue("WXUser", "unionid", GetUserUnionId()); IniFile.Close(); }
public static void LoadConfig() { var parser = new INIParser("settings.conf"); if (parser.TryGetValue("Settings", "Expansion", out byte exp)) { ExpansionLevel = exp; } if (parser.TryGetValue("Settings", "Password", out string pass)) { Password = pass; } }
public void saveToFile(string _filename = "") { if (_filename == "") { _filename = filename; } var ini = new INIParser(); ini.Open(Application.streamingAssetsPath + g.MapPath + _filename + ".ini"); ini.WriteValue("Map", "width", width); ini.WriteValue("Map", "height", height); ini.WriteValue("Map", "cells", exportCells()); ini.Close(); }
public override void OpenSettings(INIParser parser) { var ownerID = parser.GetValue("Module", "OwnerID"); if (string.IsNullOrEmpty(ownerID)) { IsRunning = false; this.OwnerID = 0; } else { this.OwnerID = long.Parse(ownerID); } }
/// <summary> /// 새 모듈을 생성합니다. /// </summary> /// <param name="parser">모듈 INI</param> /// <returns></returns> public static Module Create(INIParser parser) { var running = parser.GetValue("Module", "IsRunning"); var type = parser.GetValue("Module", "Type"); var name = parser.GetValue("Module", "Name"); Module module = null; if (type == typeof(ReactorModule).FullName) { module = new ReactorModule(name); } else if (type == typeof(ControllerModule).FullName) { module = new ControllerModule(name); } else if (type == typeof(ReflectorModule).FullName) { module = new ReflectorModule(name); } else if (type == typeof(SchedulerModule).FullName) { module = new SchedulerModule(name); } else if (type == typeof(WeatherModule).FullName) { module = new WeatherModule(name); } else if (type == typeof(RegularTweet).FullName) { module = new RegularTweet(name); } else { return(null); } module.OpenSettings(parser); if (!string.IsNullOrEmpty(running)) { module.IsRunning = bool.Parse(running); } else { module.IsRunning = true; } return(module); }
public static void AddCloneHeroIniTags(Song song, INIParser ini, float songLengthSeconds) { AddTagFn AddTagIfNonExistant = (string key, string defaultVal) => { string realKey = key.Trim() + " "; ini.WriteValue(INI_SECTION_HEADER, realKey, ini.ReadValue(INI_SECTION_HEADER, realKey, PrefixSpaceToINIValue(defaultVal))); }; AddDefaultIniTags(song, ini, songLengthSeconds); foreach (var tag in chTags) { AddTagIfNonExistant(tag.Key, tag.Value); } }
private void Init() { Debug.Log("Loading config..." + Application.persistentDataPath + "/config.ini"); var ini = new INIParser(); ini.Open(Application.persistentDataPath + "/config.ini"); LoadGame(ini); LoadPlayer(ini); LoadWeapons(ini); ini.Close(); Debug.Log("Done."); }
public static void PopulateIniWithSongMetadata(Song song, INIParser ini, float songLengthSeconds) { Metadata metaData = song.metaData; int songLength = (int)(songLengthSeconds * 1000); ini.WriteValue(INI_SECTION_HEADER, "name ", PrefixSpaceToINIValue(song.name)); ini.WriteValue(INI_SECTION_HEADER, "artist ", PrefixSpaceToINIValue(metaData.artist)); ini.WriteValue(INI_SECTION_HEADER, "album ", PrefixSpaceToINIValue(metaData.album)); ini.WriteValue(INI_SECTION_HEADER, "genre ", PrefixSpaceToINIValue(metaData.genre)); ini.WriteValue(INI_SECTION_HEADER, "year ", PrefixSpaceToINIValue(metaData.year)); ini.WriteValue(INI_SECTION_HEADER, "song_length ", PrefixSpaceToINIValue(songLength.ToString())); ini.WriteValue(INI_SECTION_HEADER, "charter ", PrefixSpaceToINIValue(metaData.charter)); }
/// <summary> /// Loads the current settings from the ini /// </summary> public void LoadSettings() { INIParser ini = new INIParser(); ini.Open(settingsPath); disableSecondChaseCam = ini.ReadValue("Options", "Disable Close Chase Cam", disableSecondChaseCam); vrInterfaceOffset = JsonUtility.FromJson <Vector3>(ini.ReadValue("VR Interface", "Position Offset", JsonUtility.ToJson(vrInterfaceOffset))); vrInterfaceScale = JsonUtility.FromJson <Vector3>(ini.ReadValue("VR Interface", "Scale", JsonUtility.ToJson(vrInterfaceScale))); vrInterfaceCurve = (float)ini.ReadValue("VR Interface", "Curve Amount", vrInterfaceCurve); ini.Close(); }
/// <summary> /// Writes the current settings to the ini /// </summary> public void SaveSettings() { INIParser ini = new INIParser(); ini.Open(settingsPath); ini.WriteValue("Options", "Disable Close Chase Cam", disableSecondChaseCam); ini.WriteValue("VR Interface", "Position Offset", JsonUtility.ToJson(vrInterfaceOffset)); ini.WriteValue("VR Interface", "Scale", JsonUtility.ToJson(vrInterfaceScale)); ini.WriteValue("VR Interface", "Curve Amount", (int)vrInterfaceCurve); ini.Close(); }
public static void LoadGameSettings() { if (!File.Exists(GameSettings.GetDirectory() + "settings.ini")) SaveGameSettings(); INIParser ini = new INIParser(); ini.Open(GameSettings.GetDirectory() + "settings.ini"); { GameSettings.GS_RESOLUTION.x = ini.ReadValue("Display", "Screen Width", Screen.width); GameSettings.GS_RESOLUTION.y = ini.ReadValue("Display", "Screen Height", Screen.height); GameSettings.GS_FULLSCREEN = ini.ReadValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN); GameSettings.GS_FRAMECAP = ini.ReadValue("Display", "Framecap", GameSettings.GS_FRAMECAP); GameSettings.GS_DRAWDISTANCE = ini.ReadValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE); GameSettings.GS_BLOOM = ini.ReadValue("Rendering", "Bloom", GameSettings.GS_BLOOM); GameSettings.GS_DYNAMICRESOLUTION = ini.ReadValue("Rendering", "Dynamic Resolution", GameSettings.GS_DYNAMICRESOLUTION); GameSettings.GS_AA = ini.ReadValue("Rendering", "AA", GameSettings.GS_AA); GameSettings.GS_AO = ini.ReadValue("Rendering", "AO", GameSettings.GS_AO); GameSettings.GS_CAMERADAMAGE = ini.ReadValue("Rendering", "CAMDMG", GameSettings.GS_CAMERADAMAGE); GameSettings.GS_TONEMAPPING = ini.ReadValue("Rendering", "TONEMAP", GameSettings.GS_TONEMAPPING); AudioSettings.VOLUME_MAIN = (float)ini.ReadValue("Audio", "Master Volume", AudioSettings.VOLUME_MAIN); AudioSettings.VOLUME_SFX = (float)ini.ReadValue("Audio", "SFX Volume", AudioSettings.VOLUME_SFX); AudioSettings.VOLUME_VOICES = (float)ini.ReadValue("Audio", "Voices Volume", AudioSettings.VOLUME_VOICES); AudioSettings.VOLUME_MUSIC = (float)ini.ReadValue("Audio", "Music Volume", AudioSettings.VOLUME_MUSIC); AudioSettings.customMusicEnabled = ini.ReadValue("Audio", "Custom Music", AudioSettings.customMusicEnabled); GameSettings.IN_VIBRATION = ini.ReadValue("Control Settings", "Vibration", GameSettings.IN_VIBRATION); GameSettings.G_DEFAULTCAMERA = ini.ReadValue("Gameplay", "Default Camera", GameSettings.G_DEFAULTCAMERA); GameSettings.G_COUNTDOWNTYPE = ini.ReadValue("Gameplay", "Countdown Mode", GameSettings.G_COUNTDOWNTYPE); GameSettings.G_TRACKINTROVOICES = ini.ReadValue("Gameplay", "Intro Voices", GameSettings.G_TRACKINTROVOICES); GameSettings.G_MIRROR = ini.ReadValue("Gameplay", "Mirror", GameSettings.G_MIRROR); GameSettings.G_LANGUAGE = (Enumerations.E_LANGUAGE)ini.ReadValue("Gameplay", "Language", (int)GameSettings.G_LANGUAGE); GameSettings.G_CUSTOMHUDCOLOR.r = (float)ini.ReadValue("Gameplay", "Custom HUD Color R", GameSettings.G_CUSTOMHUDCOLOR.r); GameSettings.G_CUSTOMHUDCOLOR.g = (float)ini.ReadValue("Gameplay", "Custom HUD Color G", GameSettings.G_CUSTOMHUDCOLOR.g); GameSettings.G_CUSTOMHUDCOLOR.b = (float)ini.ReadValue("Gameplay", "Custom HUD Color B", GameSettings.G_CUSTOMHUDCOLOR.b); GameSettings.G_CUSTOMHUDCOLOR.a = (float)ini.ReadValue("Gameplay", "Custom HUD Color A", GameSettings.G_CUSTOMHUDCOLOR.a); } ini.Close(); }
public static void SaveGameSettings() { INIParser ini = new INIParser(); ini.Open(GameSettings.GetDirectory() + "settings.ini"); { ini.WriteValue("Display", "Screen Width", Screen.width); ini.WriteValue("Display", "Screen Height", Screen.height); ini.WriteValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN); ini.WriteValue("Display", "Framecap", GameSettings.GS_FRAMECAP); ini.WriteValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE); ini.WriteValue("Rendering", "Bloom", GameSettings.GS_BLOOM); ini.WriteValue("Rendering", "FXAA", GameSettings.GS_FXAA); ini.WriteValue("Rendering", "CRT", GameSettings.GS_CRT); ini.WriteValue("Rendering", "Vape", GameSettings.GS_VAPORWAVE); ini.WriteValue("Audio", "Master Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MAIN)); ini.WriteValue("Audio", "SFX Volume", Mathf.RoundToInt(AudioSettings.VOLUME_SFX)); ini.WriteValue("Audio", "Voices Volume", Mathf.RoundToInt(AudioSettings.VOLUME_VOICES)); ini.WriteValue("Audio", "Music Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MUSIC)); } ini.Close(); }