GetBool() 공개 메소드

public GetBool ( string section, string key, bool default_value = false ) : bool
section string
key string
default_value bool
리턴 bool
예제 #1
0
 public static void Load()
 {
     using (ConfigFile config = new ConfigFile(Application.dataPath + "/Configuration/Visuals.ini", ':', false))
     {
         config.Load();
         config.AutoSave        = false;
         FontName               = config.GetString("font");
         Font                   = AnarchyAssets.Load <Font>(FontName);
         BackgroundHex          = config.GetString("background");
         BackgroundTransparency = config.GetInt("backgroundTransparency");
         TextColors             = new string[6];
         TextColors[0]          = config.GetString("textNormal");
         TextColors[1]          = config.GetString("textHover");
         TextColors[2]          = config.GetString("textActive");
         TextColors[3]          = config.GetString("textOnNormal");
         TextColors[4]          = config.GetString("textOnHover");
         TextColors[5]          = config.GetString("textOnActive");
         TextureDeltas          = new Vector3[6];
         TextureDeltas[0]       = config.GetString("normalVector").ParseVector3();
         TextureDeltas[1]       = config.GetString("hoverVector").ParseVector3();
         TextureDeltas[2]       = config.GetString("activeVector").ParseVector3();
         TextureDeltas[3]       = config.GetString("onNormalVector").ParseVector3();
         TextureDeltas[4]       = config.GetString("onHoverVector").ParseVector3();
         TextureDeltas[5]       = config.GetString("onActiveVector").ParseVector3();
         if (!config.AllValues.ContainsKey("useVectors"))
         {
             UseVectors = false;
         }
         else
         {
             UseVectors = config.GetBool("useVectors");
         }
         TextureColors = new Color[6];
         if (!config.AllValues.ContainsKey("colorNormal") || !config.AllValues.ContainsKey("colorHover") || !config.AllValues.ContainsKey("colorActive") ||
             !config.AllValues.ContainsKey("colorOnNormal") || !config.AllValues.ContainsKey("colorOnHover") || !config.AllValues.ContainsKey("colorOnActive"))
         {
             UseVectors = true;
             Color[] colors = Helper.TextureColors(BackgroundColor, 6);
             for (int i = 0; i < 6; i++)
             {
                 TextureColors[i] = colors[i];
             }
             UseVectors = false;
         }
         else
         {
             TextureColors[0] = config.GetString("colorNormal").HexToColor();
             TextureColors[1] = config.GetString("colorHover").HexToColor();
             TextureColors[2] = config.GetString("colorActive").HexToColor();
             TextureColors[3] = config.GetString("colorOnNormal").HexToColor();
             TextureColors[4] = config.GetString("colorOnHover").HexToColor();
             TextureColors[5] = config.GetString("colorOnActive").HexToColor();
         }
         LoadPublicSettings();
     }
     wasLoaded = true;
     Initialize();
 }
예제 #2
0
        private IEnumerator Load()
        {
            string profile = "";

            Info.text = "Loading configuration...";
            using (ConfigFile file = new ConfigFile(Application.dataPath + "/Configuration/Settings.ini", ' ', false))
            {
                file.Load();
                file.AutoSave = false;
                string[] res    = file.GetString("resolution").Split('x');
                int      width  = Convert.ToInt32(res[0]);
                int      height = Convert.ToInt32(res[1]);
                Screen.SetResolution(width, height, file.GetBool("fullscreen"));
                profile = file.GetString("profile");
                int fps = file.GetInt("fps");
                Application.targetFrameRate = fps >= 30 ? fps : -1;
                QualitySettings.SetQualityLevel(file.GetInt("graphics"), true);
                Localization.Language.SetLanguage(file.GetString("language"));

                Configuration.Settings.Load();
                Configuration.VideoSettings.Apply();
            }
            yield return(new WaitForSeconds(0.5f));

            Info.text = "Loading RCAssets...";
            yield return(StartCoroutine(RC.RCManager.DownloadAssets()));

            Optimization.Caching.Pool.Create();
            yield return(new WaitForSeconds(0.5f));

            Info.text = $"Loading profile({profile})..";
            User.LoadProfile(profile);
            Localization.Language.UpdateFormats();
            Localization.Locale loc = new Localization.Locale("GUI", true);

            GUI.LabelEnabled  = loc["enabled"];
            GUI.LabelDisabled = loc["disabled"];
            yield return(new WaitForSeconds(0.5f));

            Info.text = "Loading visuals..";
            Style.Load();
            Style.ResetScreenParameters();
            UIManager.UpdateGUIScaling();
            Optimization.Labels.Font = Style.Font;
            yield return(new WaitForSeconds(0.5f));

            Info.text = "Enjoy!";
            Optimization.Labels.VERSION = string.Format(UIMainReferences.VersionShow, AnarchyManager.AnarchyVersion.ToString());
            textUpdate   = false;
            Loading.text = "Loading complete";
            yield return(new WaitForSeconds(2f));

            Destroy(gameObject);
            AnarchyManager.Background.Enable();
        }
예제 #3
0
 public static void Load()
 {
     using (ConfigFile config = new ConfigFile(Application.dataPath + "/Configuration/Visuals.ini", ':', false))
     {
         using (ConfigFile settings = new ConfigFile(Application.dataPath + "/Configuration/Settings.ini", ' ', false))
         {
             settings.Load();
             settings.AutoSave = true;
             string[] res = settings.GetString("resolution").Split('x');
             ScreenWidthDefault  = (float)System.Convert.ToInt32(res[0]);
             ScreenHeightDefault = (float)System.Convert.ToInt32(res[1]);
             if (PlayerPrefs.GetInt("AnarchyModLaunched") == 0)
             {
                 PlayerPrefs.SetInt("AnarchyModLaunched", 1);
                 float xScale     = ScreenWidthDefault / 1920f;
                 float yScale     = ScreenHeightDefault / 1080f;
                 float totalScale = (xScale + yScale) / 2f;
                 UIManager.HUDScaleGUI.Value = Mathf.Clamp(totalScale, 0.75f, 1.5f);
                 UIManager.HUDScaleGUI.Save();
             }
             ResetScreenParameters();
         }
         config.Load();
         config.AutoSave        = false;
         FontName               = config.GetString("font");
         Font                   = AnarchyAssets.Load <Font>(FontName);
         BackgroundHex          = config.GetString("background");
         BackgroundTransparency = config.GetInt("backgroundTransparency");
         TextColors             = new string[6];
         TextColors[0]          = config.GetString("textNormal");
         TextColors[1]          = config.GetString("textHover");
         TextColors[2]          = config.GetString("textActive");
         TextColors[3]          = config.GetString("textOnNormal");
         TextColors[4]          = config.GetString("textOnHover");
         TextColors[5]          = config.GetString("textOnActive");
         TextureDeltas          = new Vector3[6];
         TextureDeltas[0]       = config.GetString("normalVector").ParseVector3();
         TextureDeltas[1]       = config.GetString("hoverVector").ParseVector3();
         TextureDeltas[2]       = config.GetString("activeVector").ParseVector3();
         TextureDeltas[3]       = config.GetString("onNormalVector").ParseVector3();
         TextureDeltas[4]       = config.GetString("onHoverVector").ParseVector3();
         TextureDeltas[5]       = config.GetString("onActiveVector").ParseVector3();
         if (!config.AllValues.ContainsKey("useVectors"))
         {
             UseVectors = false;
         }
         else
         {
             UseVectors = config.GetBool("useVectors");
         }
         TextureColors = new Color[6];
         if (!config.AllValues.ContainsKey("colorNormal") || !config.AllValues.ContainsKey("colorHover") || !config.AllValues.ContainsKey("colorActive") ||
             !config.AllValues.ContainsKey("colorOnNormal") || !config.AllValues.ContainsKey("colorOnHover") || !config.AllValues.ContainsKey("colorOnActive"))
         {
             UseVectors = true;
             Color[] colors = Helper.TextureColors(BackgroundColor, 6);
             for (int i = 0; i < 6; i++)
             {
                 TextureColors[i] = colors[i];
             }
             UseVectors = false;
         }
         else
         {
             TextureColors[0] = config.GetString("colorNormal").HexToColor();
             TextureColors[1] = config.GetString("colorHover").HexToColor();
             TextureColors[2] = config.GetString("colorActive").HexToColor();
             TextureColors[3] = config.GetString("colorOnNormal").HexToColor();
             TextureColors[4] = config.GetString("colorOnHover").HexToColor();
             TextureColors[5] = config.GetString("colorOnActive").HexToColor();
         }
         LoadPublicSettings();
     }
     wasLoaded = true;
     Initialize();
 }
예제 #4
0
        static bool Prefix(PlayerPositionManager __instance)
        {
            List <PlayerPositionData> posData = new List <PlayerPositionData>();
            List <GameObject>         players = PlayerManager.singleton.players.ToList();
            bool smGhostMode = ConfigFile.GetBool("sm_enable_ghostmode", false);

            foreach (GameObject player in players)
            {
                posData.Add(new PlayerPositionData(player));
            }

            __instance.ReceiveData(posData.ToArray());

            foreach (GameObject gameObject in players)
            {
                CharacterClassManager component = gameObject.GetComponent <CharacterClassManager>();
                int pid1 = gameObject.GetComponent <QueryProcessor>().PlayerId;

                if (smGhostMode && gameObject != __instance.gameObject && component.curClass >= 0)
                {
                    for (int i = 0; i < posData.Count; i++)
                    {
                        if (players[i] == gameObject)
                        {
                            continue;
                        }

                        CharacterClassManager component2 = players[i].GetComponent <CharacterClassManager>();
                        int pid2 = players[i].GetComponent <QueryProcessor>().PlayerId;
                        if (component2.smGhostMode && component2.curClass >= 0 && component2.curClass != 2 && (component.curClass != 2 || (!component2.smVisibleToSpec && component.curClass == 2)) && (!component2.smVisibleWhenTalking || (component2.smVisibleWhenTalking && !component2.GetComponent <Radio>().NetworkisTransmitting)))
                        {
                            posData[i] = new PlayerPositionData
                            {
                                position = Vector3.up * 6000f,
                                rotation = 0f,
                                playerID = posData[i].playerID
                            }
                        }
                        ;

                        if (Methods.CheckHidden(pid1, pid2))
                        {
                            ServerConsole.AddLog("Returned true for " + pid1 + " " + pid2);
                            posData[i] = new PlayerPositionData
                            {
                                position = Vector3.up * 6000f, rotation = 0f, playerID = posData[i].playerID
                            };
                        }
                    }
                }

                switch (component.curClass)
                {
                case 16:
                case 17:
                {
                    List <PlayerPositionData> posData939 = new List <PlayerPositionData>(posData);

                    for (int i = 0; i < posData939.Count; i++)
                    {
                        CharacterClassManager component2 = players[i].GetComponent <CharacterClassManager>();
                        if (posData939[i].position.y < 800f && component2.klasy[component2.curClass].team != Team.SCP && component2.klasy[component2.curClass].team != Team.RIP && !players[i].GetComponent <Scp939_VisionController>().CanSee(component.GetComponent <Scp939PlayerScript>()))
                        {
                            posData939[i] = new PlayerPositionData
                            {
                                position = Vector3.up * 6000f,
                                rotation = 0f,
                                playerID = posData939[i].playerID
                            }
                        }
                        ;
                    }
                    __instance.CallTargetTransmit(gameObject.GetComponent <NetworkIdentity>().connectionToClient, posData939.ToArray());
                    break;
                }

                default:
                    __instance.CallTargetTransmit(gameObject.GetComponent <NetworkIdentity>().connectionToClient, posData.ToArray());
                    break;
                }
            }

            return(false);
        }
예제 #5
0
        public static Patron FromString(string fileLine)
        {
            fileLine = fileLine?.Trim();

            if (string.IsNullOrEmpty(fileLine))
            {
                return(null);
            }

            string[] args = ArgumentParsing.StringToArgs(fileLine);

            if (ArgumentParsing.ArrayIsNullOrEmpty(args))
            {
                return(null);
            }

            string steam64Match = args[0];

            string tagTagValue    = ArgumentParsing.GetParamFromArgs(args, tagKeys, tagAliases);
            string colourTagValue = ArgumentParsing.GetParamFromArgs(args, colourKeys, colourAliases);
            string itemTagValue   = ArgumentParsing.GetParamFromArgs(args, itemKeys, itemAliases);
            bool   autoRefresh    = ArgumentParsing.GetFlagFromArgs(args, autoRefreshKeys, autoRefreshAliases);
            bool   autoReserve    = ArgumentParsing.GetFlagFromArgs(args, autoReserveKeys, autoReserveAliases);
            string rankTagValue   = ArgumentParsing.GetParamFromArgs(args, rankKeys, rankAliases);

            // Set from default or rank values
            if (tagTagValue == null)
            {
                const string rankConf = ConfigOptions.RankTag;
                const string defConf  = ConfigOptions.PatreonTag;
                tagTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom tag value, using default tag from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + tagTagValue + "\"");
            }

            if (colourTagValue == null)
            {
                const string rankConf = ConfigOptions.RankTagColour;
                const string defConf  = ConfigOptions.PatreonTagColour;
                colourTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom colour value, using default colour from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + colourTagValue + "\"");
            }

            if (itemTagValue == null)
            {
                const string rankConf = ConfigOptions.RankItems;
                const string defConf  = ConfigOptions.PatreonItems;
                itemTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom items value, using default items from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + itemTagValue + "\"");
            }

            if (!autoRefresh)
            {
                const string rankConf = ConfigOptions.RankTagAutoRefresh;
                const string defConf  = ConfigOptions.PatreonTagAutoRefresh;
                autoRefresh = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetBool(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigBool(defConf);

                // PatreonPlugin.Singleton.Debug("No custom auto-refresh value, using default auto-refresh from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + AutoRefreshTags + "\"");
            }

            if (!autoReserve)
            {
                const string rankConf = ConfigOptions.RankAutoReserve;
                const string defConf  = ConfigOptions.PatreonAutoReserve;
                autoReserve = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetBool(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigBool(defConf);

                // PatreonPlugin.Singleton.Debug("No custom auto-reserve value, using default auto-reserve from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + AutoRefreshTags + "\"");
            }

            // Return new instance with values
            return(new Patron(steam64Match, tagTagValue, colourTagValue, itemTagValue, autoRefresh, autoReserve, rankTagValue));
        }
예제 #6
0
        public static Patron FromString(string fileLine)
        {
            fileLine = fileLine?.Trim();

            if (string.IsNullOrEmpty(fileLine))
            {
                return(null);
            }

            string steam64Match = FindFirstSteamId(fileLine);

            if (string.IsNullOrEmpty(steam64Match))
            {
                return(null);
            }

            string tagTagValue    = MatchOption(fileLine, tagRegex, tagOptionRegex);
            string colourTagValue = MatchOption(fileLine, colourRegex, colourOptionRegex);
            string itemTagValue   = MatchOption(fileLine, itemsRegex, itemsOptionRegex);
            bool   autoRefresh    = MatchFlag(fileLine, autoRefreshRegex);
            bool   autoReserve    = MatchFlag(fileLine, autoReserveRegex);
            string rankTagValue   = MatchOption(fileLine, rankRegex, rankOptionRegex);

            // Set from default or rank values
            if (tagTagValue == null)
            {
                const string rankConf = ConfigOptions.RankTag;
                const string defConf  = ConfigOptions.PatreonTag;
                tagTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom tag value, using default tag from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + tagTagValue + "\"");
            }

            if (colourTagValue == null)
            {
                const string rankConf = ConfigOptions.RankTagColour;
                const string defConf  = ConfigOptions.PatreonTagColour;
                colourTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom colour value, using default colour from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + colourTagValue + "\"");
            }

            if (itemTagValue == null)
            {
                const string rankConf = ConfigOptions.RankItems;
                const string defConf  = ConfigOptions.PatreonItems;
                itemTagValue = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetString(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigString(defConf);

                // PatreonPlugin.Singleton.Debug("No custom items value, using default items from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + itemTagValue + "\"");
            }

            if (!autoRefresh)
            {
                const string rankConf = ConfigOptions.RankTagAutoRefresh;
                const string defConf  = ConfigOptions.PatreonTagAutoRefresh;
                autoRefresh = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetBool(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigBool(defConf);

                // PatreonPlugin.Singleton.Debug("No custom auto-refresh value, using default auto-refresh from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + AutoRefreshTags + "\"");
            }

            if (!autoReserve)
            {
                const string rankConf = ConfigOptions.RankAutoReserve;
                const string defConf  = ConfigOptions.PatreonAutoReserve;
                autoReserve = ConfigOptions.ContainsRank(rankConf, rankTagValue) ? ConfigFile.GetBool(ConfigOptions.GetRankConf(rankConf, rankTagValue)) : PatreonPlugin.Singleton.GetConfigBool(defConf);

                // PatreonPlugin.Singleton.Debug("No custom auto-reserve value, using default auto-reserve from " + (ConfigOptions.ContainsRank(rankConf, rankTagValue) ? "rank" : "patreon") + " config: \"" + AutoRefreshTags + "\"");
            }

            // Return new instance with values
            return(new Patron(steam64Match, tagTagValue, colourTagValue, itemTagValue, autoRefresh, autoReserve, rankTagValue));
        }