Ejemplo n.º 1
0
        private static Controller BindToDefinition(ControllerDefinition def, IDictionary <string, Dictionary <string, string> > allbinds, IDictionary <string, Dictionary <string, Config.AnalogBind> > analogbinds)
        {
            var ret = new Controller(def);
            Dictionary <string, string> binds;

            if (allbinds.TryGetValue(def.Name, out binds))
            {
                foreach (var cbutton in def.BoolButtons)
                {
                    string bind;
                    if (binds.TryGetValue(cbutton, out bind))
                    {
                        ret.BindMulti(cbutton, bind);
                    }
                }
            }

            Dictionary <string, Config.AnalogBind> abinds;

            if (analogbinds.TryGetValue(def.Name, out abinds))
            {
                foreach (var cbutton in def.FloatControls)
                {
                    Config.AnalogBind bind;
                    if (abinds.TryGetValue(cbutton, out bind))
                    {
                        ret.BindFloat(cbutton, bind);
                    }
                }
            }

            return(ret);
        }
Ejemplo n.º 2
0
        private static Controller BindToDefinition(ControllerDefinition def, IDictionary <string, Dictionary <string, string> > allBinds, IDictionary <string, Dictionary <string, AnalogBind> > analogBinds)
        {
            var ret = new Controller(def);

            if (allBinds.TryGetValue(def.Name, out var binds))
            {
                foreach (var btn in def.BoolButtons)
                {
                    if (binds.TryGetValue(btn, out var bind))
                    {
                        ret.BindMulti(btn, bind);
                    }
                }
            }

            if (analogBinds.TryGetValue(def.Name, out var aBinds))
            {
                foreach (var btn in def.FloatControls)
                {
                    if (aBinds.TryGetValue(btn, out var bind))
                    {
                        ret.BindFloat(btn, bind);
                    }
                }
            }

            return(ret);
        }
Ejemplo n.º 3
0
		private Controller BindToDefinition(ControllerDefinition def, IDictionary<string, Dictionary<string, string>> allbinds, IDictionary<string, Dictionary<string, Config.AnalogBind>> analogbinds)
		{
			var ret = new Controller(def);
			Dictionary<string, string> binds;
			if (allbinds.TryGetValue(def.Name, out binds))
			{
				foreach (var cbutton in def.BoolButtons)
				{
					string bind;
					if (binds.TryGetValue(cbutton, out bind))
					{
						ret.BindMulti(cbutton, bind);
					}
				}
			}

			Dictionary<string, Config.AnalogBind> abinds;
			if (analogbinds.TryGetValue(def.Name, out abinds))
			{
				foreach (var cbutton in def.FloatControls)
				{
					Config.AnalogBind bind;
					if (abinds.TryGetValue(cbutton, out bind))
					{
						ret.BindFloat(cbutton, bind);
					}
				}
			}

			return ret;
		}
Ejemplo n.º 4
0
		private static void InitControls()
		{
			var controls = new Controller(
				new ControllerDefinition
				{
					Name = "Emulator Frontend Controls",
					BoolButtons = Global.Config.HotkeyBindings.Select(x => x.DisplayName).ToList()
				});

			foreach (var b in Global.Config.HotkeyBindings)
			{
				controls.BindMulti(b.DisplayName, b.Bindings);
			}

			Global.ClientControls = controls;
			Global.AutofireNullControls = new AutofireController(NullEmulator.NullController, Global.Emulator);
		}