Пример #1
0
        private void OnGUI()
        {
            float num = 10f;

            GUI.Label(new Rect(10f, num, 300f, num + 22f), "Last Input Type: " + playerActions.LastInputType);
            num += 22f;
            GUI.Label(new Rect(10f, num, 300f, num + 22f), "Last Device Class: " + playerActions.LastDeviceClass);
            num += 22f;
            GUI.Label(new Rect(10f, num, 300f, num + 22f), "Last Device Style: " + playerActions.LastDeviceStyle);
            num += 22f;
            int count = playerActions.Actions.Count;

            for (int i = 0; i < count; i++)
            {
                PlayerAction playerAction = playerActions.Actions[i];
                string       text         = playerAction.Name;
                if (playerAction.IsListeningForBinding)
                {
                    text += " (Listening)";
                }
                text = text + " = " + playerAction.Value;
                GUI.Label(new Rect(10f, num, 500f, num + 22f), text);
                num += 22f;
                int count2 = playerAction.Bindings.Count;
                for (int j = 0; j < count2; j++)
                {
                    BindingSource bindingSource = playerAction.Bindings[j];
                    GUI.Label(new Rect(75f, num, 300f, num + 22f), bindingSource.DeviceName + ": " + bindingSource.Name);
                    if (GUI.Button(new Rect(20f, num + 3f, 20f, 17f), "-"))
                    {
                        playerAction.RemoveBinding(bindingSource);
                    }
                    if (GUI.Button(new Rect(45f, num + 3f, 20f, 17f), "+"))
                    {
                        playerAction.ListenForBindingReplacing(bindingSource);
                    }
                    num += 22f;
                }
                if (GUI.Button(new Rect(20f, num + 3f, 20f, 17f), "+"))
                {
                    playerAction.ListenForBinding();
                }
                if (GUI.Button(new Rect(50f, num + 3f, 50f, 17f), "Reset"))
                {
                    playerAction.ResetBindings();
                }
                num += 25f;
            }
            if (GUI.Button(new Rect(20f, num + 3f, 50f, 22f), "Load"))
            {
                LoadBindings();
            }
            if (GUI.Button(new Rect(80f, num + 3f, 50f, 22f), "Save"))
            {
                SaveBindings();
            }
            if (GUI.Button(new Rect(140f, num + 3f, 50f, 22f), "Reset"))
            {
                playerActions.Reset();
            }
        }
Пример #2
0
        void OnGUI()
        {
            const float h = 22.0f;
            var         y = 10.0f;

            GUI.Label(new Rect(10, y, 300, y + h), "Last Input Type: " + playerInput.LastInputType.ToString());
            y += h;

            var actionCount = playerInput.Actions.Count;

            for (int i = 0; i < actionCount; i++)
            {
                var action = playerInput.Actions[i];

                var name = action.Name;
                if (action.IsListeningForBinding)
                {
                    name += " (Listening)";
                }
                GUI.Label(new Rect(10, y, 300, y + h), name);
                y += h;

                var bindingCount = action.Bindings.Count;
                for (int j = 0; j < bindingCount; j++)
                {
                    var binding = action.Bindings[j];

                    GUI.Label(new Rect(45, y, 300, y + h), binding.DeviceName + ": " + binding.Name);
                    if (GUI.Button(new Rect(20, y + 3.0f, 20, h - 5.0f), "-"))
                    {
                        action.RemoveBinding(binding);
                    }
                    y += h;
                }

                if (GUI.Button(new Rect(20, y + 3.0f, 20, h - 5.0f), "+"))
                {
                    action.ListenForBinding();
                }

                if (GUI.Button(new Rect(50, y + 3.0f, 50, h - 5.0f), "Reset"))
                {
                    action.ResetBindings();
                }

                y += 25.0f;
            }

            if (GUI.Button(new Rect(20, y + 3.0f, 50, h), "Load"))
            {
                LoadBindings();
            }

            if (GUI.Button(new Rect(80, y + 3.0f, 50, h), "Save"))
            {
                SaveBindings();
            }

            if (GUI.Button(new Rect(140, y + 3.0f, 50, h), "Reset"))
            {
                playerInput.Reset();
            }
        }
Пример #3
0
        void OnGUI()
        {
            const float h = 22.0f;
            var         y = 10.0f;

            GUI.Label(new Rect(10, y, 300, y + h), "Last Input Type: " + playerActions.LastInputType);
            y += h;

            //GUI.Label( new Rect( 10, y, 300, y + h ), "Active Device: " + playerActions.ActiveDevice.Name );
            //y += h;

            GUI.Label(new Rect(10, y, 300, y + h), "Last Device Class: " + playerActions.LastDeviceClass);
            y += h;

            GUI.Label(new Rect(10, y, 300, y + h), "Last Device Style: " + playerActions.LastDeviceStyle);
            y += h;

            var actionCount = playerActions.Actions.Count;

            for (var i = 0; i < actionCount; i++)
            {
                var action = playerActions.Actions[i];

                var name = action.Name;
                if (action.IsListeningForBinding)
                {
                    name += " (Listening)";
                }

                name += " = " + action.Value;
                //name += " via " + action.ActiveDevice.Name;
                //name += ", class: " + action.LastDeviceClass;
                //name += ", style: " + action.LastDeviceStyle;
                GUI.Label(new Rect(10, y, 500, y + h), name);
                y += h;

                var bindingCount = action.Bindings.Count;
                for (var j = 0; j < bindingCount; j++)
                {
                    var binding = action.Bindings[j];

                    GUI.Label(new Rect(75, y, 300, y + h), binding.DeviceName + ": " + binding.Name);

                    if (GUI.Button(new Rect(20, y + 3.0f, 20, h - 5.0f), "-"))
                    {
                        action.RemoveBinding(binding);
                    }

                    if (GUI.Button(new Rect(45, y + 3.0f, 20, h - 5.0f), "+"))
                    {
                        action.ListenForBindingReplacing(binding);
                    }

                    y += h;
                }

                if (GUI.Button(new Rect(20, y + 3.0f, 20, h - 5.0f), "+"))
                {
                    action.ListenForBinding();
                }

                if (GUI.Button(new Rect(50, y + 3.0f, 50, h - 5.0f), "Reset"))
                {
                    action.ResetBindings();
                }

                y += 25.0f;
            }

            if (GUI.Button(new Rect(20, y + 3.0f, 50, h), "Load"))
            {
                LoadBindings();
            }

            if (GUI.Button(new Rect(80, y + 3.0f, 50, h), "Save"))
            {
                SaveBindings();
            }

            if (GUI.Button(new Rect(140, y + 3.0f, 50, h), "Reset"))
            {
                playerActions.Reset();
            }
        }