Exemplo n.º 1
0
        void ParseConfig(ConfigNode node)
        {
            name = "";
            if (node.HasValue("name"))
            {
                name = node.GetValue("name");
            }

            foreach (ConfigNode n in node.nodes)
            {
                switch (n.name)
                {
                case "AxisRecipe":
                    var ar = new AxisRecipe(n);
                    if (ar.axis < axisRecipes.Length)
                    {
                        axisRecipes[ar.axis] = ar;
                    }
                    break;

                case "AxisBinding":
                    var ab = new AxisBinding(this, n);
                    axisBindings.Add(ab);
                    break;

                case "ButtonBinding":
                    var bb = new ButtonBinding(this, n);
                    buttonBindings.Add(bb);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        bool Balanced(AxisRecipe recipe)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Balanced");
            GUILayout.FlexibleSpace();
            bool val = GUILayout.Toggle(recipe.balanced, "");

            GUILayout.EndHorizontal();
            return(val);
        }
Exemplo n.º 3
0
        void init(Device dev)
        {
            axisBindings   = new List <AxisBinding> ();
            buttonBindings = new List <ButtonBinding> ();
            axisRecipes    = new AxisRecipe[dev.num_axes];

            if (defaultRecipe == null)
            {
                defaultRecipe = new AxisRecipe();
            }
            for (int i = 0; i < axisRecipes.Length; i++)
            {
                axisRecipes[i] = defaultRecipe;
            }

            rawDevice = dev.rawDevice;
        }
Exemplo n.º 4
0
        int Maxzone(AxisRecipe recipe)
        {
            if (string.IsNullOrEmpty(maxzoneField.text))
            {
                maxzoneField.text = recipe.maxzone.ToString();
            }
            GUILayout.BeginHorizontal();
            GUILayout.Label("Maxzone");
            GUILayout.FlexibleSpace();
            int val = recipe.maxzone;

            if (maxzoneField.HandleInput(numericWidth))
            {
                float fval;
                float.TryParse(maxzoneField.text, out fval);
                val = (int)fval;
            }
            GUILayout.EndHorizontal();
            return(val);
        }
Exemplo n.º 5
0
        public float AxisValue(int index, bool invert)
        {
            AxisRecipe recipe = axisRecipes[index];

            return(recipe.Process(ref rawDevice.axes[index], invert));
        }