コード例 #1
0
    /* Initialize the corresponding handlers for the selected controlling mode
     *
     * The unused handler will be assigned a dummy function to
     * prevent the handling of the event.
     */
    void InitializeInputFunction()
    {
        switch (controlMode)
        {
        case ControlMode.Drag:
            _inputPositionHandler = DragPositionHandler;

            _scrollHandler = delegate(Vector2 v) { };
            foreach (Button button in controlButtons)
            {
                button.gameObject.SetActive(false);
            }
            break;

        case ControlMode.Button:
            _inputPositionHandler =
                delegate(PointerEventData pointer, TouchPhase phase) { };
            _scrollHandler = delegate(Vector2 v) { };
            break;

        case ControlMode.MouseWheel:
            _scrollHandler = ScrollDeltaHandler;

            _inputPositionHandler =
                delegate(PointerEventData pointer, TouchPhase phase) { };
            foreach (Button button in controlButtons)
            {
                button.gameObject.SetActive(false);
            }
            break;
        }
    }
コード例 #2
0
        /// <summary>
        /// Initialize the corresponding handlers for the selected controlling mode
        ///
        /// The unused handler will be assigned a dummy function to
        /// prevent the handling of the event.
        /// </summary>
        void InitializeInputFunction()
        {
            if (_limitedData && blockInputOnLimitedData)
            {
                _inputPositionHandler = delegate {  };
                _scrollHandler        = delegate {  };
                foreach (Button button in controlButtons)
                {
                    button.gameObject.SetActive(false);
                }

                return;
            }

            switch (controlMode)
            {
            case ControlMode.Drag:
                _inputPositionHandler = DragPositionHandler;

                _scrollHandler = delegate { };
                foreach (Button button in controlButtons)
                {
                    button.gameObject.SetActive(false);
                }
                break;

            case ControlMode.Button:
                _inputPositionHandler =
                    delegate { };
                _scrollHandler = delegate { };
                break;

            case ControlMode.DragAndButton:
                _inputPositionHandler = DragPositionHandler;
                _scrollHandler        = delegate { };
                break;

            case ControlMode.MouseWheel:
                _scrollHandler = ScrollDeltaHandler;

                _inputPositionHandler =
                    delegate { };
                foreach (Button button in controlButtons)
                {
                    button.gameObject.SetActive(false);
                }
                break;

            case ControlMode.DragAndWheel:
                _inputPositionHandler = DragPositionHandler;

                _scrollHandler = ScrollDeltaHandler;

                foreach (Button button in controlButtons)
                {
                    button.gameObject.SetActive(false);
                }
                break;
            }
        }