public void Update()
        {
            // Update Axes

            {
                for (int axisIndex = 0; axisIndex < m_AxesKeys.Count; ++axisIndex)
                {
                    int key = m_AxesKeys[axisIndex];
                    AxisServerController serverController = null;
                    if (m_Axes.TryGetValue(key, out serverController))
                    {
                        float value = serverController.GetValue();
                        m_AxesData[key].value = value;
                    }
                }
            }

            // Update Buttons

            {
                for (int buttonIndex = 0; buttonIndex < m_ButtonsKeys.Count; ++buttonIndex)
                {
                    int key = m_ButtonsKeys[buttonIndex];
                    ButtonServerController serverController = null;
                    if (m_Buttons.TryGetValue(key, out serverController))
                    {
                        bool newValue = serverController.GetButton();
                        m_ButtonsData[key].value = newValue;
                    }
                }
            }
        }
        public void AddButton(int i_ControlId, ButtonServerController i_Controller)
        {
            if (!m_Buttons.ContainsKey(i_ControlId))
            {
                m_Buttons.Add(i_ControlId, i_Controller);
                m_ButtonsKeys.Add(i_ControlId);

                m_ButtonsData.Add(i_ControlId, new WiFiButtonData());

                m_Controllers.Add(i_Controller);
            }
        }
Exemple #3
0
        private void InternalAddButton(WiFiControlDescriptor i_Descriptor)
        {
            string controlName = i_Descriptor.controlName;

            for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex)
            {
                WiFiPlayerInput playerInput = m_Players[playerIndex];
                if (playerInput != null)
                {
                    ButtonServerController buttonServerController = new ButtonServerController(controlName, (PLAYER_NUMBER)playerIndex);
                    playerInput.AddButton(controlName, buttonServerController);
                }
            }
        }
        // Buttons

        public void AddButton(string i_ControlName, ButtonServerController i_Controller)
        {
            int hash = StringUtils.GetHashCode(i_ControlName);

            AddButton(hash, i_Controller);
        }