Exemplo n.º 1
0
 public bool setCurrentGameConfig(Game_Config config)
 {
     if (!this.game_Configs.Contains(config))
     {
         return(false);
     }
     this.current_Game_Config = config;
     this.crate = this.current_Game_Config.crate;
     this.SwitchCheckbox.IsChecked = this.current_Game_Config.switchActive;
     this.RenderLayout();
     return(true);
 }
Exemplo n.º 2
0
        public void setupDefaultGameConfigs()
        {
            Game_Config def = new Game_Config
            {
                game_name = "PM",
                tiltValue = 69,
                x1Value   = 30,
                x2Value   = 50,
                y1Value   = 38,
                y2Value   = 87,
                r         = 102,
                g         = 77,
                b         = 204,
                crate     = Crate.createCrateWithButtons()
            };
            Game_Config melee = new Game_Config
            {
                game_name    = "Melee",
                tiltValue    = 74,
                x1Value      = 27,
                x2Value      = 55,
                y1Value      = 27,
                y2Value      = 53,
                r            = 214,
                g            = 104,
                b            = 14,
                activator    = CrateButton.X2,
                crate        = Crate.createCrateWithButtons(),
                switchActive = true
            };
            Game_Config ultimate = new Game_Config
            {
                game_name    = "Ultimate",
                tiltValue    = 69,
                x1Value      = 30,
                x2Value      = 50,
                y1Value      = 38,
                y2Value      = 87,
                r            = 255,
                activator    = CrateButton.Y2,
                crate        = Crate.createCrateWithButtons(),
                switchActive = true
            };

            this.game_Configs = new List <Game_Config>()
            {
                def, melee, ultimate
            };
            this.setCurrentGameConfig(def);
        }
Exemplo n.º 3
0
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.comboBox.SelectedItem == null)
     {
         return;
     }
     if (this.comboBox.SelectedItem.Equals("add new configuration"))
     {
         SelectName window = new SelectName();
         if (window.ShowDialog() == false)
         {
             var index = 0;
             foreach (string item in this.comboBox.ItemsSource)
             {
                 if (item.Equals(this.current_Game_Config.game_name))
                 {
                     this.comboBox.SelectedIndex = index;
                     break;
                 }
                 index++;
             }
         }
         else
         {
             if (this.game_Configs.Find(conf => conf.game_name.Equals(window.name)) == null)
             {
                 this.game_Configs.Add(new Game_Config
                 {
                     game_name = window.name,
                     tiltValue = 69,
                     x1Value   = 30,
                     x2Value   = 50,
                     y1Value   = 38,
                     y2Value   = 87,
                     g         = 255
                 });
                 var col = ((ObservableCollection <string>) this.comboBox.ItemsSource);
                 col.Remove("add new configuration");
                 col.Add(window.name);
                 col.Add("add new configuration");
                 this.comboBox.SelectedIndex = col.Count - 2;
             }
             else
             {
                 var index = 0;
                 foreach (string item in this.comboBox.ItemsSource)
                 {
                     if (item.Equals(window.name))
                     {
                         this.comboBox.SelectedIndex = index;
                         break;
                     }
                     index++;
                 }
             }
             this.current_Game_Config = this.game_Configs.Find(config => config.game_name.Equals(window.name));
         }
     }
     else
     {
         this.setCurrentGameConfig(this.game_Configs.Find(config => config.game_name.Equals(this.comboBox.SelectedItem)));
         //this.current_Game_Config.crate.angles[0] = this.current_Game_Config.tilt;
         //this.current_Game_Config.crate.angles[1] = this.current_Game_Config.x1;
         //this.current_Game_Config.crate.angles[2] = this.current_Game_Config.x2;
         //this.current_Game_Config.crate.angles[3] = this.current_Game_Config.y1;
         //this.current_Game_Config.crate.angles[4] = this.current_Game_Config.y2;
         this.ledPicker.SelectedColor = new Color()
         {
             R = this.current_Game_Config.r,
             G = this.current_Game_Config.g,
             B = this.current_Game_Config.b,
             A = 255
         };;
     }
 }