예제 #1
0
        public void AddPatternToAll(string url, RouteValueDictionary defaults)
        {
            List <ControllerInfo> newControllers =
                AllControllers
                .Where(c => !Controllers.Any(ci => ci.Controller.FullName == c.FullName))
                .Select(c => new ControllerInfo(c, url, defaults))
                .ToList();

            foreach (ControllerInfo controller in Controllers)
            {
                controller.TryAddPattern(url, defaults);
            }
            Controllers.AddRange(newControllers);
        }
        private void EnlistController(IPAddress ipAddress, string caption, string description)
        {
            if (!Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.Invoke(() => EnlistController(ipAddress, caption, description));
                return;
            }

            if (Controllers.Any(c => c.IPAddress.Equals(ipAddress)))
            {
                return;
            }

            var controllerItem = new ControllerItemVM(ipAddress, caption, description);

            Controllers.Add(controllerItem);
        }
예제 #3
0
파일: SvgSkin.cs 프로젝트: ROMaster2/munia
        public void Load(string svgPath)
        {
            try {
                Path        = svgPath;
                SvgDocument = SvgDocument.Open(svgPath);
                _dimensions = SvgDocument.GetDimensions();

                // load button/stick/trigger mapping from svg
                RecursiveGetElements(SvgDocument);

                DefaultRemap = ColorRemap.CreateFromSkin(this);
                EmbeddedRemaps.Insert(0, DefaultRemap);
                EmbeddedRemaps.ForEach(r => r.IsSkinDefault = true);

                LoadResult = Controllers.Any() ? SkinLoadResult.Ok : SkinLoadResult.Fail;
            }
            catch { LoadResult = SkinLoadResult.Fail; }
        }
예제 #4
0
파일: SvgSkin.cs 프로젝트: valandil/munia
        public void Load(string svgPath)
        {
            try {
                Path         = svgPath;
                _svgDocument = SvgDocument.Open(svgPath);
                _dimensions  = _svgDocument.GetDimensions();

                // cleanup
                Buttons.ForEach(b => {
                    if (b.PressedTexture != -1)
                    {
                        GL.DeleteTexture(b.PressedTexture);
                    }
                    if (b.Texture != -1)
                    {
                        GL.DeleteTexture(b.Texture);
                    }
                });
                Sticks.ForEach(s => { if (s.Texture != -1)
                                      {
                                          GL.DeleteTexture(s.Texture);
                                      }
                               });
                Triggers.ForEach(t => { if (t.Texture != -1)
                                        {
                                            GL.DeleteTexture(t.Texture);
                                        }
                                 });
                Buttons.Clear();
                Sticks.Clear();
                Triggers.Clear();

                // load button/stick/trigger mapping from svg
                RecursiveGetElements(_svgDocument);
                LoadResult = Controllers.Any() ? SkinLoadResult.Ok : SkinLoadResult.Fail;
            }
            catch { LoadResult = SkinLoadResult.Fail; }
        }
예제 #5
0
        private void setupControllersCfg(savedata conf)
        {
            if (Program.SystemConfig.isOptSet("disableautocontrollers") && Program.SystemConfig["disableautocontrollers"] == "1")
            {
                return;
            }

            if (!Controllers.Any())
            {
                return;
            }

            bool hasKeyb = false;

            for (int idx = 0; idx < 4; idx++)
            {
                var c = Controllers.FirstOrDefault(j => j.Index == idx + 1);
                if (c == null || c.Input == null)
                {
                    if (hasKeyb)
                    {
                        conf.keys[idx].up         = 0;
                        conf.keys[idx].down       = 0;
                        conf.keys[idx].left       = 0;
                        conf.keys[idx].right      = 0;
                        conf.keys[idx].attack1    = 0;
                        conf.keys[idx].attack2    = 0;
                        conf.keys[idx].attack3    = 0;
                        conf.keys[idx].attack4    = 0;
                        conf.keys[idx].jump       = 0;
                        conf.keys[idx].special    = 0;
                        conf.keys[idx].start      = 0;
                        conf.keys[idx].screenshot = 0;
                        conf.keys[idx].esc        = 0;
                    }
                    else
                    {
                        conf.keys[idx].up         = 82;
                        conf.keys[idx].down       = 81;
                        conf.keys[idx].left       = 80;
                        conf.keys[idx].right      = 79;
                        conf.keys[idx].attack1    = 4;
                        conf.keys[idx].attack2    = 22;
                        conf.keys[idx].attack3    = 29;
                        conf.keys[idx].attack4    = 27;
                        conf.keys[idx].jump       = 7;
                        conf.keys[idx].special    = 9;
                        conf.keys[idx].start      = 40;
                        conf.keys[idx].screenshot = 69;
                        conf.keys[idx].esc        = 41;
                        hasKeyb = true;
                    }

                    continue;
                }

                if (c.Input.Type == "keyboard")
                {
                    hasKeyb                   = true;
                    conf.keys[idx].up         = KeyboardValue(InputKey.up, c);
                    conf.keys[idx].down       = KeyboardValue(InputKey.down, c);
                    conf.keys[idx].left       = KeyboardValue(InputKey.left, c);
                    conf.keys[idx].right      = KeyboardValue(InputKey.right, c);
                    conf.keys[idx].attack1    = KeyboardValue(InputKey.a, c); // ATTACK
                    conf.keys[idx].attack2    = KeyboardValue(InputKey.x, c);
                    conf.keys[idx].attack3    = KeyboardValue(InputKey.y, c);
                    conf.keys[idx].attack4    = KeyboardValue(InputKey.rightshoulder, c); // ATTACK4
                    conf.keys[idx].jump       = KeyboardValue(InputKey.b, c);             // JUMP
                    conf.keys[idx].special    = KeyboardValue(InputKey.select, c);
                    conf.keys[idx].start      = KeyboardValue(InputKey.start, c);
                    conf.keys[idx].screenshot = 69; // F12
                    conf.keys[idx].esc        = 41; // Esc
                    continue;
                }

                conf.keys[idx].up         = JoystickValue(InputKey.up, c);
                conf.keys[idx].down       = JoystickValue(InputKey.down, c);
                conf.keys[idx].left       = JoystickValue(InputKey.left, c);
                conf.keys[idx].right      = JoystickValue(InputKey.right, c);
                conf.keys[idx].attack1    = JoystickValue(InputKey.a, c); // ATTACK
                conf.keys[idx].attack2    = JoystickValue(InputKey.x, c);
                conf.keys[idx].attack3    = JoystickValue(InputKey.y, c);
                conf.keys[idx].attack4    = JoystickValue(InputKey.rightshoulder, c); // ATTACK4
                conf.keys[idx].jump       = JoystickValue(InputKey.b, c);             // JUMP
                conf.keys[idx].special    = JoystickValue(InputKey.select, c);
                conf.keys[idx].start      = JoystickValue(InputKey.start, c);
                conf.keys[idx].screenshot = 0;

                if (Program.EnableHotKeyStart)
                {
                    conf.keys[idx].esc = JoystickValue(InputKey.hotkey, c); // esc
                }
                else
                {
                    conf.keys[idx].esc = 0;
                }
            }
        }
예제 #6
0
        private void setupControllers(ConfigFile ini)
        {
            if (Program.SystemConfig.isOptSet("disableautocontrollers") && Program.SystemConfig["disableautocontrollers"] == "1")
            {
                return;
            }

            if (!Controllers.Any())
            {
                return;
            }

            bool hasKeyb = false;

            for (int idx = 0; idx < 4; idx++)
            {
                var c = Controllers.FirstOrDefault(j => j.Index == idx + 1);
                if (c == null || c.Input == null)
                {
                    if (hasKeyb)
                    {
                        ini["keys." + idx + ".0"]  = "0";
                        ini["keys." + idx + ".1"]  = "0";
                        ini["keys." + idx + ".2"]  = "0";
                        ini["keys." + idx + ".3"]  = "0";
                        ini["keys." + idx + ".4"]  = "0";
                        ini["keys." + idx + ".5"]  = "0";
                        ini["keys." + idx + ".6"]  = "0";
                        ini["keys." + idx + ".7"]  = "0";
                        ini["keys." + idx + ".8"]  = "0";
                        ini["keys." + idx + ".9"]  = "0";
                        ini["keys." + idx + ".10"] = "0";
                        ini["keys." + idx + ".11"] = "0";
                        ini["keys." + idx + ".12"] = "0";
                        ini["keys." + idx + ".13"] = "0"; // axis up
                        ini["keys." + idx + ".14"] = "0"; // axis down
                        ini["keys." + idx + ".15"] = "0"; // axis left
                        ini["keys." + idx + ".16"] = "0"; // axis right
                    }
                    else
                    {
                        ini["keys." + idx + ".0"]  = "82";
                        ini["keys." + idx + ".1"]  = "81";
                        ini["keys." + idx + ".2"]  = "80";
                        ini["keys." + idx + ".3"]  = "79";
                        ini["keys." + idx + ".4"]  = "4";
                        ini["keys." + idx + ".5"]  = "22";
                        ini["keys." + idx + ".6"]  = "29";
                        ini["keys." + idx + ".7"]  = "27";
                        ini["keys." + idx + ".8"]  = "7";
                        ini["keys." + idx + ".9"]  = "9";
                        ini["keys." + idx + ".10"] = "40";
                        ini["keys." + idx + ".11"] = "69";
                        ini["keys." + idx + ".12"] = "41"; // Esc
                        ini["keys." + idx + ".13"] = "0";  // axis up
                        ini["keys." + idx + ".14"] = "0";  // axis down
                        ini["keys." + idx + ".15"] = "0";  // axis left
                        ini["keys." + idx + ".16"] = "0";  // axis right
                        hasKeyb = true;
                    }

                    continue;
                }

                if (c.Input.Type == "keyboard")
                {
                    hasKeyb = true;
                    ini["keys." + idx + ".0"]  = KeyboardValue(InputKey.up, c).ToString();
                    ini["keys." + idx + ".1"]  = KeyboardValue(InputKey.down, c).ToString();
                    ini["keys." + idx + ".2"]  = KeyboardValue(InputKey.left, c).ToString();
                    ini["keys." + idx + ".3"]  = KeyboardValue(InputKey.right, c).ToString();
                    ini["keys." + idx + ".4"]  = KeyboardValue(InputKey.a, c).ToString(); // ATTACK
                    ini["keys." + idx + ".5"]  = KeyboardValue(InputKey.x, c).ToString();
                    ini["keys." + idx + ".6"]  = KeyboardValue(InputKey.y, c).ToString();
                    ini["keys." + idx + ".7"]  = KeyboardValue(InputKey.rightshoulder, c).ToString(); // ATTACK4
                    ini["keys." + idx + ".8"]  = KeyboardValue(InputKey.b, c).ToString();             // JUMP
                    ini["keys." + idx + ".9"]  = KeyboardValue(InputKey.select, c).ToString();
                    ini["keys." + idx + ".10"] = KeyboardValue(InputKey.start, c).ToString();
                    ini["keys." + idx + ".11"] = "69"; // F12
                    ini["keys." + idx + ".12"] = "41"; // Esc
                    ini["keys." + idx + ".13"] = "0";  // axis up
                    ini["keys." + idx + ".14"] = "0";  // axis down
                    ini["keys." + idx + ".15"] = "0";  // axis left
                    ini["keys." + idx + ".16"] = "0";  // axis right
                    continue;
                }

                ini["keys." + idx + ".0"]  = JoystickValue(InputKey.up, c).ToString();
                ini["keys." + idx + ".1"]  = JoystickValue(InputKey.down, c).ToString();
                ini["keys." + idx + ".2"]  = JoystickValue(InputKey.left, c).ToString();
                ini["keys." + idx + ".3"]  = JoystickValue(InputKey.right, c).ToString();
                ini["keys." + idx + ".4"]  = JoystickValue(InputKey.a, c).ToString(); // ATTACK
                ini["keys." + idx + ".5"]  = JoystickValue(InputKey.x, c).ToString();
                ini["keys." + idx + ".6"]  = JoystickValue(InputKey.y, c).ToString();
                ini["keys." + idx + ".7"]  = JoystickValue(InputKey.rightshoulder, c).ToString(); // ATTACK4
                ini["keys." + idx + ".8"]  = JoystickValue(InputKey.b, c).ToString();             // JUMP
                ini["keys." + idx + ".9"]  = JoystickValue(InputKey.select, c).ToString();
                ini["keys." + idx + ".10"] = JoystickValue(InputKey.start, c).ToString();
                ini["keys." + idx + ".11"] = "0";

                if (Program.EnableHotKeyStart)
                {
                    ini["keys." + idx + ".12"] = JoystickValue(InputKey.hotkey, c).ToString(); // esc
                }
                else
                {
                    ini["keys." + idx + ".12"] = "0";
                }

                ini["keys." + idx + ".13"] = JoystickValue(InputKey.joystick1up, c).ToString();
                ini["keys." + idx + ".14"] = JoystickValue(InputKey.joystick1up, c, true).ToString();
                ini["keys." + idx + ".15"] = JoystickValue(InputKey.joystick1left, c).ToString();
                ini["keys." + idx + ".16"] = JoystickValue(InputKey.joystick1left, c, true).ToString();
            }
        }
예제 #7
0
 public bool Contains(string pluginName)
 {
     return(Controllers.Any(plugin => plugin.Name == pluginName));
 }