Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 3
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;
		}