public ManyMouse(int id)
 {
     this.id           = id;
     MouseButtons      = new bool[NUM_MOUSE_BUTTONS];
     _lastMouseButtons = new bool[NUM_MOUSE_BUTTONS];
     DeviceName        = ManyMouseWrapper.MouseDeviceName(id);
 }
Esempio n. 2
0
    void Start()
    {
        dropdown = GetComponent <TMP_Dropdown>();

        for (int i = 0; i < ManyMouseWrapper.MouseCount; i++)
        {
            mouseDevices.Add(ManyMouseWrapper.MouseDeviceName(i));
        }
        dropdown.AddOptions(mouseDevices);

        int selection;

        if (player == Player.PlayerA)
        {
            selection = PlayerPrefs.GetInt("MouseIdA", defaultSelection);
        }
        else
        {
            selection = PlayerPrefs.GetInt("MouseIdB", defaultSelection);
        }

        if (selection > ManyMouseWrapper.MouseCount)
        {
            selection = defaultSelection;
        }

        dropdown.SetValueWithoutNotify(selection);
    }
    void Start()
    {
        int numMice = ManyMouseWrapper.MouseCount;

        if (numMice > 0)
        {
            _manyMouseMice = new ManyMouse[numMice];
            for (int i = 0; i < numMice; i++)
            {
                _manyMouseMice[i] = ManyMouseWrapper.GetMouseByID(i);
                _manyMouseMice[i].EventButtonDown += EventButtonDownJoinGame;
                //you'll want to pay attention to things disconnecting.
                _manyMouseMice[i].EventMouseDisconnected += EventMouseDisconnected;
            }
        }
    }
    private ManyMouse _mouse; //This is what you'll grab input from.

    public void Init(int mouseID)
    {
        _mouseId = mouseID;
        if (ManyMouseWrapper.MouseCount > _mouseId)
        {
            _mouse = ManyMouseWrapper.GetMouseByID(_mouseId);
            Debug.Log(gameObject.name + " connected to mouse: " + _mouse.DeviceName);

            //List to mouse button events
            _mouse.EventButtonDown += EventButtonDown;
        }
        else
        {
            Debug.Log("Mouse ID " + _mouseId + " not found. Plug in an extra mouse?");
            Destroy(gameObject);
        }
    }
Esempio n. 5
0
    void SetUpCursor()
    {
        int mouseNumber;

        if (ManyMouseWrapper.MouseCount < 2)
        {
            if (player == Player.PlayerA)
            {
                mouseNumber            = 0;
                mouse                  = ManyMouseWrapper.GetMouseByID(mouseNumber);
                mouse.EventButtonDown  = delegate { };
                mouse.EventButtonUp    = delegate { };
                mouse.EventButtonDown += CloseHand;
                mouse.EventButtonUp   += OpenHand;
            }
            else
            {
                disabled = true;
            }
        }
        else
        {
            if (player == Player.PlayerA)
            {
                mouseNumber = PlayerPrefs.GetInt("MouseIdA", 0);
            }
            else
            {
                mouseNumber = PlayerPrefs.GetInt("MouseIdB", 1);
            }

            mouse = ManyMouseWrapper.GetMouseByID(mouseNumber);
            mouse.EventButtonDown  = delegate { };
            mouse.EventButtonUp    = delegate { };
            mouse.EventButtonDown += CloseHand;
            mouse.EventButtonUp   += OpenHand;
        }
    }