Ejemplo n.º 1
0
    private GameObject GetKeyBindingDisplay(InputMethod controller, Vector2 pos, InputMethod.KeyBinding key)
    {
        if (controller.IsAxis(key))
        {
            string rawstrval = controller.GetRawKeyVal(key);
            return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "btn" + rawstrval, buttonsSheet[GetSheetIdxFromAxisVal(rawstrval)], false, renderLayer));
        }
        int rawval = int.Parse(controller.GetRawKeyVal(key));

        if (rawval < 350)
        {
            KeyCode val = (KeyCode)rawval;
            switch (val)
            {
            case KeyCode.UpArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "up", buttonsSheet[3], false, renderLayer));

            case KeyCode.DownArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "down", buttonsSheet[2], false, renderLayer));

            case KeyCode.LeftArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "left", buttonsSheet[0], false, renderLayer));

            case KeyCode.RightArrow: return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "right", buttonsSheet[1], false, renderLayer));

            default: return(GetMeshText(pos, controller.GetFriendlyKeyName(key), f).gameObject);
            }
        }
        return(GetGameObject(pos + new Vector2(0.05f, 0.0f), "btn" + rawval, buttonsSheet[GetSheetIdxFromKeyCode(rawval)], false, renderLayer));
    }
Ejemplo n.º 2
0
    public void ChangeKey(int y, int newVal, bool player1)
    {
        if (player1)
        {
            InputVal newInput           = new InputVal_Key((KeyCode)newVal);
            InputMethod.KeyBinding oldK = PD.controller.GetKeyInUse(newInput);
            if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3)
            {
                PD.controller.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal());
            }
            else
            {
                InputVal oldInput = PD.controller.GetInputVal(keyOrdering[y]);
                PD.controller.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal());

                PD.controller.ChangeKey(oldK, oldInput);
                PD.SetKeyBinding(0, (int)oldK, oldInput.GetRawVal());
                int idx = System.Array.IndexOf(keyOrdering, oldK);
                if (idx >= 0)
                {
                    UndoQuestion(idx, true);
                }
            }
        }
        else
        {
            InputVal newInput           = new InputVal_Key((KeyCode)newVal);
            InputMethod.KeyBinding oldK = fakePlayer2.GetKeyInUse(newInput);
            if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3)
            {
                fakePlayer2.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal());
            }
            else
            {
                InputVal oldInput = fakePlayer2.GetInputVal(keyOrdering[y]);
                fakePlayer2.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal());

                fakePlayer2.ChangeKey(oldK, oldInput);
                PD.SetKeyBinding(1, (int)oldK, oldInput.GetRawVal());
                int idx = System.Array.IndexOf(keyOrdering, oldK);
                if (idx >= 0)
                {
                    UndoQuestion(idx, false);
                }
            }
        }
        UndoQuestion(y, player1);
    }
Ejemplo n.º 3
0
 public string GetBinding(InputMethod.KeyBinding key, int player, bool usingGamepad)
 {
     if (usingGamepad)
     {
         if (player == 0)
         {
             return(controlBindingsGamepadP1[(int)key]);
         }
         return(controlBindingsGamepadP2[(int)key]);
     }
     else
     {
         if (player == 0)
         {
             return(controlBindingsP1[(int)key]);
         }
         return(controlBindingsP2[(int)key]);
     }
 }
Ejemplo n.º 4
0
 public string GetP2InputName(InputMethod.KeyBinding binding)
 {
     return(GetInputVal(saveInfo.controlBindingsP2[(int)binding]).GetName());
 }
Ejemplo n.º 5
0
 public bool IsAxis(InputMethod.KeyBinding bind)
 {
     return(bindings[bind] is InputVal_Axis);
 }
Ejemplo n.º 6
0
 public string GetRawVal(InputMethod.KeyBinding bind)
 {
     return(bindings[bind].GetRawVal());
 }
Ejemplo n.º 7
0
 public string GetName(InputMethod.KeyBinding bind)
 {
     return(bindings[bind].GetName());
 }
Ejemplo n.º 8
0
 public bool IsPress(InputMethod.KeyBinding bind)
 {
     return(bindings[bind].KeyPress());
 }
Ejemplo n.º 9
0
 public bool IsDown(InputMethod.KeyBinding bind)
 {
     return(bindings[bind].KeyDown());
 }