Set() public method

Set the variable and value if they dont exist. Updates the variables value if does exist.
public Set ( string subSection, string key, string value ) : void
subSection string The Section this key belongs to
key string The variable nameThe value of the variable
value string
return void
Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (mode == DisplayMode.Colors)
        {
            background = new Texture2D(1, 1);
            background.SetPixel(1, 1, colors.background);
            background.wrapMode = TextureWrapMode.Repeat;
            background.Apply();

            foreground = new Texture2D(1, 1);
            foreground.SetPixel(1, 1, colors.foreground);
            foreground.wrapMode = TextureWrapMode.Repeat;
            foreground.Apply();

            xpShadow = new Texture2D(1, 1);
            xpShadow.SetPixel(1, 1, colors.xpShadowIncrease);
            xpShadow.wrapMode = TextureWrapMode.Repeat;
            xpShadow.Apply();
        }
        else
        {
            background = textures.background;
            foreground = textures.foreground;
            xpShadow   = textures.xpShadowIncrease;
        }

        barwidth = Screen.width * screenPer;
        boxwidth = barwidth / 10;
        barstrt  = Screen.width * ((1.0f - screenPer) / 2);
        Debug.Log(barstrt + ":" + Screen.width);

        parser.Load(IniFiles.XP);
        if (parser.Get("XP").Equals(""))
        {
            parser.Set("", "XP", "0");

            float curxp = 0;

            for (int i = 0; i < 200; i++)
            {
                if (i != 0)
                {
                    curxp += 800 + (400 * (i - 1));
                }

                int cp = Mathf.CeilToInt(curxp);
                parser.Set("Ranks", "level-" + i, curxp.ToString());
            }
            curxp = 9999999;

            parser.Set("Ranks", "level-200", curxp.ToString());
            parser.Save(IniFiles.XP);
        }
        localxp = int.Parse(parser.Get("XP"));

        calc();
    }
Exemplo n.º 2
0
    void Awake()
    {
        parser = new iniParser();

        if (!parser.DoesExist("WormballSettings"))
        {
            parser.Set("MatchLength", ScoreManager.instance.totalGameTime.ToString());
            parser.save("WormballSettings");
        }
        else
        {
            parser.load("WormballSettings");

            float parseVal = 5f;
            if (float.TryParse(parser.Get("MatchLength"), out parseVal))
            {
                ScoreManager.instance.totalGameTime = float.Parse(parser.Get("MatchLength"));
            }
            else
            {
                ScoreManager.instance.totalGameTime = 45f;
            }
        }

        gameState = GameState.Menu;
        prevState = gameState;

        StartCoroutine(UpdateState());

#if UNITY_EDITOR
        AssetDatabase.Refresh();
#endif
    }
Exemplo n.º 3
0
    public void Create()
    {
        parser.Set("Audio", "a_masterlvl", "100", "Scale of 0 - 100");
        parser.Set("Audio", "a_musiclvl", "25", "Scale of 0 - 100");
        parser.Set("Audio", "a_ambientlvl", "75", "Scale of 0 - 100");

        bool fullscreen = Screen.fullScreen;

        parser.Set("Graphics", "g_resolution", Screen.width + "x" + Screen.height);
        parser.Set("Graphics", "g_windowed", fullscreen.ToString(), "Toggle Windowed mode");
        parser.Set("Graphics", "g_qualitylvl", QualitySettings.GetQualityLevel().ToString(), "Scale of 0 - 6, 0 being lowest, 5 being max and 6 being custom");
        parser.Set("Graphics", "g_antialias", "8", "Can only be: 0, 1, 2, 4, 8");
        parser.Set("Graphics", "g_vsync", "2", "Can only be: 0, 1, 2");

        // shaders

        parser.Set("Post Processing", "fx_enable", "True", "Dissable or enable post processing effects");

        // --- DoF
        parser.Set("Post Processing", "fx_dof", "True", "Dissable or enable Depth of Field effect");
        parser.Set("Post Processing", "fx_dof_visualizeFocus", "False");
        parser.Set("Post Processing", "fx_dof_smoothtime", "2", "Dynamic DoF smooth from - to distance");
        parser.Set("Post Processing", "fx_dof_foreground", "True", "Dissable or enable Depth of Field effect on foreground aswell as background");
        parser.Set("Post Processing", "fx_dof_bokeh", "True", "Dissable or enable bokeh effect, Requires Depth of Field to be active");
        parser.Set("Post Processing", "fx_dof_focaldistance", "1");
        parser.Set("Post Processing", "fx_dof_smoothness", "0.5");
        parser.Set("Post Processing", "fx_dof_focalSize", "0");
        parser.Set("Post Processing", "fx_dof_blurriness", "1", "0 = low, 1 = high, 2 = very high");
        parser.Set("Post Processing", "fx_dof_blurSpread", "0.5");
        parser.Set("Post Processing", "fx_dof_foregroundSize", "0");
        parser.Set("Post Processing", "fx_dof_bokeh_destination", "0", " 0 = BackGround, 1 = background + foreground, 2 = foreground");
        parser.Set("Post Processing", "fx_dof_bokeh_intensity", "0.15", "Scale of 0.00 - 1.00");
        parser.Set("Post Processing", "fx_dof_bokeh_minLuminance", "0.55", "Scale of 0.00 - 1.00");
        parser.Set("Post Processing", "fx_dof_bokeh_minContrast", "0.1", "Scale of 0.00 - 1.00");
        parser.Set("Post Processing", "fx_dof_bokeh_DownSample", "1", "Can only be: 1, 2, 3");
        parser.Set("Post Processing", "fx_dof_bokeh_sizeScale", "2.4", "Scale of 0.00 - 20.00");


        // --- SSAO

        parser.Set("Post Processing", "fx_SSAO", "True", "Dissable or enable Screen Space Ambient Occlusion");
        parser.Set("Post Processing", "fx_SSAO_intensity", "0.50", "Scale of 0.00 - 3.00");
        parser.Set("Post Processing", "fx_SSAO_radius", "0.50", "Scale of 0.00 - 3.00");
        parser.Set("Post Processing", "fx_SSAO_blurIterations", "1", "Can only be: 0, 1, 2, 3");
        parser.Set("Post Processing", "fx_SSAO_blurFilterDistance", "1.25", "Scale of 0.00 - 3.00");
        parser.Set("Post Processing", "fx_SSAO_downsample", "0", "Can only be: 0, 1");

        // --- noise grain

        parser.Set("Post Processing", "fx_noisegrain", "True", "Dissable or Enable noise effect, Requires DX11");
        parser.Set("Post Processing", "fx_noisegrain_intensity", "0.1");

        // --- Bloom

        parser.Set("Post Processing", "fx_bloom", "True", "Dissable or enable Light glow / bleed");
        parser.Set("Post Processing", "fx_bloom_quality", "1", "0 = cheap, 1 = high");
        parser.Set("Post Processing", "fx_bloom_mode", "1", "0 = basic, 1 = complex");
        parser.Set("Post Processing", "fx_bloom_blendMode", "1", "0 = screen, 1 = add");
        parser.Set("Post Processing", "fx_bloom_hdr", "True", "Dissable or enable High Dynamic Range");
        parser.Set("Post Processing", "fx_bloom_intensity", "0.50");
        parser.Set("Post Processing", "fx_bloom_threshhold", "0.50", "Scale of 0.00 - 3.00");
        parser.Set("Post Processing", "fx_bloom_blurIterations", "2", "Scale of 1 - 4");
        parser.Set("Post Processing", "fx_bloom_sampleDistance", "2", "Scale of 0.00 - 10.00");
        parser.Set("Post Processing", "fx_bloom_lensFlareMode", "0", "0 = Ghosting, 1 = anamorphic, 2 = combined");
        parser.Set("Post Processing", "fx_bloom_LFlocalIntensity", "0.00");
        parser.Set("Post Processing", "fx_bloom_LFthreshhold", "0.30", "Scale of 0.00 - 4.00");

        // --- Sun Shafts (God rays)

        parser.Set("Post Processing", "fx_sunshaft", "True", "Dissable or enable sun shafts (God rays)");
        parser.Set("Post Processing", "fx_sunshaft_zBuffer", "True", "Toggle Rely on Z Buffer");
        parser.Set("Post Processing", "fx_sunshaft_resolution", "2", "0 = low, 1 = normal, 2 = high");
        parser.Set("Post Processing", "fx_sunshaft_blendMode", "0", "0 = add, 1 = screen");
        parser.Set("Post Processing", "fx_sunshaft_distFalloff", "0.250", "Distance fallout, scale of 0.00 - 1.00");
        parser.Set("Post Processing", "fx_sunshaft_blurSize", "2.5", "Scale of 0.00 - 10.00");
        parser.Set("Post Processing", "fx_sunshaft_blurIterations", "2", "Scale of 0 - 4");
        parser.Set("Post Processing", "fx_sunshaft_intensity", "1.15");
        parser.Set("Post Processing", "fx_sunshaft_alphaMask", "0.75", "Scale of 0.00 - 1.00");

        // --- Edge Detect

        parser.Set("Post Processing", "fx_edgeDetect", "True", "Toggle edge detection, Similar to borderlands");

        // --- Vignetting

        parser.Set("Post Processing", "fx_vignetting", "True", "Toggle simulation of common lens artifacts");
        parser.Set("Post Processing", "fx_vignetting_intensity", "0.375");
        parser.Set("Post Processing", "fx_vignetting_blurredCornors", "0.00");
        parser.Set("Post Processing", "fx_vignetting_aberration", "0.2");



        parser.Set("Controls", "input_controller", "True", "If using Controller");

        parser.Save(IniFiles.CONFIG);
    }
Exemplo n.º 4
0
    void Save(string menu)
    {
        switch (menu)
        {
        case "audio":
            parser.Set("Audio", "a_masterlvl", masterLVL.ToString());
            parser.Set("Audio", "a_musiclvl", musicLVL.ToString());
            parser.Set("Audio", "a_ambientlvl", ambientlvl.ToString());
            break;

        case "game":
            parser.Set("Controls", "input_controller", controller.ToString());
            break;

        case "video":
            parser.Set("Graphics", "g_resolution", Screen.resolutions[curResInt].width + "x" + Screen.resolutions[curResInt].height);
            parser.Set("Graphics", "g_windowed", windowed.ToString());
            parser.Set("Graphics", "g_vsync", vsync.ToString());
            switch (antialiasSel)
            {
            case 1:
                parser.Set("Graphics", "g_antialias", "1");
                break;

            case 2:
                parser.Set("Graphics", "g_antialias", "2");
                break;

            case 3:
                parser.Set("Graphics", "g_antialias", "4");
                break;

            case 4:
                parser.Set("Graphics", "g_antialias", "8");
                break;

            default:
                parser.Set("Graphics", "g_antialias", "0");
                break;
            }
            break;
        }

        parser.Save(IniFiles.CONFIG);
        parser.Load(IniFiles.CONFIG);
        loadSettings();
    }