Ejemplo n.º 1
0
    // Start is called before the first frame update
    public void Start()
    {
        Cursor.visible = false;
        this.texts     = GameObject.FindObjectsOfType <Text>();
        var tempTexts = new Text[this.texts.Length];

        tempTexts[0] = this.texts.FirstOrDefault(t => t.name == "Level");
        tempTexts[1] = this.texts.FirstOrDefault(t => t.name == "AdvancedFigures");
        tempTexts[2] = this.texts.FirstOrDefault(t => t.name == "Sound");
        tempTexts[3] = this.texts.FirstOrDefault(t => t.name == "Music");
        tempTexts[4] = this.texts.FirstOrDefault(t => t.name == "Back");
        this.texts   = tempTexts;
        this.sliders = GameObject.FindObjectsOfType <Slider>();
        if (Common.GameOptions == null)
        {
            Common.GameOptions = OptionsStreamer.LoadOptions();
        }

        this.level                   = Common.GameOptions.Level;
        this.advancedFigures         = Common.GameOptions.AdvancedFigures;
        this.sliders[0].value        = Common.GameOptions.SoundVolume * 100;
        this.sliders[1].value        = Common.GameOptions.MusicVolume * 100;
        this.texts[this.index].text  = $"{this.texts[this.index].text} {this.level}";
        this.texts[this.index].color = Color.yellow;
        this.texts[1].text           = $"Advanced Figures: {(this.advancedFigures ? "Enable" : "Disable")}";
    }
Ejemplo n.º 2
0
 private void SaveNewOptionsAndAssign()
 {
     Common.GameOptions.Level           = this.level;
     Common.GameOptions.AdvancedFigures = this.advancedFigures;
     Common.GameOptions.SoundVolume     = this.sliders[0].value / 100f;
     Common.GameOptions.MusicVolume     = this.sliders[1].value / 100f;
     OptionsStreamer.SaveOptions(Common.GameOptions);
     if (Common.IsGameStarted)
     {
         Common.SetupOptions();
         Common.SetByHiddenLevel();
     }
 }
Ejemplo n.º 3
0
    public void Start()
    {
        Cursor.visible = false;
        if (!OptionsStreamer.IsFileExist())
        {
            OptionsStreamer.SaveOptions(new GameOptions());
        }

        this.texts = GameObject.FindObjectsOfType <Text>();
        if (!Common.IsGameStarted)
        {
            Common.GameOptions           = OptionsStreamer.LoadOptions();
            this.texts[this.index].color = Color.gray;
            this.texts = this.texts.Where(t => t.text != "Resume").ToArray();
        }

        this.texts[this.index].color = Color.yellow;
    }