Beispiel #1
0
    public bool IsPressed(GuiButtonTypeTEMP key)
    {
        bool result   = false;
        bool isFinded = isPressed.TryGetValue(key, out result);

        return(isFinded && result);
    }
Beispiel #2
0
    void Button_OnUp(UiButton button, PointerEventData data)
    {
        GuiButtonTypeTEMP key = GuiButtonTypeTEMP.None;

        if (button == upButton)
        {
            key = GuiButtonTypeTEMP.Up;
        }
        else if (button == downButton)
        {
            key = (GuiButtonTypeTEMP.Down);
        }
        else if (button == leftButton)
        {
            key = (GuiButtonTypeTEMP.Left);
        }
        else if (button == rightButton)
        {
            key = (GuiButtonTypeTEMP.Right);
        }
        else if (button == resetButton)
        {
            key = (GuiButtonTypeTEMP.Reset);
        }
        else if (button == disconnectButton)
        {
            key = (GuiButtonTypeTEMP.Disconnect);
        }

        if (key != GuiButtonTypeTEMP.None)
        {
            isPressed.Remove(key);
            isPressed.Add(key, false);
        }

        OnUp?.Invoke(key);
    }