Exemplo n.º 1
0
        public static string GetPromptImagePath(this GamepadJoystick axis, GamepadType type)
        {
            if (type == GamepadType.Unknown)
            {
                type = GamepadType.Xbox360;
            }

            string buttonName;

            switch (axis)
            {
            case GamepadJoystick.Left:
            {
                buttonName = "left_stick";
                break;
            }

            case GamepadJoystick.Right:
            {
                buttonName = "right_stick";
                break;
            }

            default:
            {
                buttonName = axis.ToString().ToLowerUnderscored();
                break;
            }
            }
            return(AssetPath.Combine(
                       "gui/prompts/" + type.ToString().ToLowerUnderscored(),
                       buttonName + ".png"
                       ));
        }
Exemplo n.º 2
0
        private static string GetPromptImagePath(this GamepadButton button, GamepadType type)
        {
            if (type == GamepadType.Unknown || type == GamepadType.XboxOne)
            {
                type = GamepadType.Xbox360;
            }
            else if (type == GamepadType.PS4)
            {
                type = GamepadType.PS3;
            }

            string buttonName;

            switch (button)
            {
            case GamepadButton.LeftStickUp:
            case GamepadButton.LeftStickDown:
            case GamepadButton.LeftStickLeft:
            case GamepadButton.LeftStickRight:
            {
                buttonName = "left_stick";
                break;
            }

            case GamepadButton.RightStickUp:
            case GamepadButton.RightStickDown:
            case GamepadButton.RightStickLeft:
            case GamepadButton.RightStickRight:
            {
                buttonName = "right_stick";
                break;
            }

            case GamepadButton.A:
            {
                switch (type)
                {
                case GamepadType.PS3:
                case GamepadType.PS4:
                {
                    buttonName = "cross";
                    break;
                }

                default:
                {
                    buttonName = "a";
                    break;
                }
                }
                break;
            }

            case GamepadButton.B:
            {
                switch (type)
                {
                case GamepadType.PS3:
                case GamepadType.PS4:
                {
                    buttonName = "circle";
                    break;
                }

                default:
                {
                    buttonName = "b";
                    break;
                }
                }
                break;
            }

            case GamepadButton.X:
            {
                switch (type)
                {
                case GamepadType.PS3:
                case GamepadType.PS4:
                {
                    buttonName = "square";
                    break;
                }

                default:
                {
                    buttonName = "x";
                    break;
                }
                }
                break;
            }

            case GamepadButton.Y:
            {
                switch (type)
                {
                case GamepadType.PS3:
                case GamepadType.PS4:
                {
                    buttonName = "triangle";
                    break;
                }

                default:
                {
                    buttonName = "y";
                    break;
                }
                }
                break;
            }

            case GamepadButton.Back:
            {
                switch (type)
                {
                case GamepadType.PS3:
                {
                    buttonName = "select";
                    break;
                }

                case GamepadType.PS4:
                {
                    buttonName = "share";
                    break;
                }

                case GamepadType.XboxOne:
                {
                    buttonName = "view";
                    break;
                }

                default:
                {
                    buttonName = "back";
                    break;
                }
                }
                break;
            }

            case GamepadButton.Start:
            {
                switch (type)
                {
                case GamepadType.PS4:
                {
                    buttonName = "options";
                    break;
                }

                case GamepadType.XboxOne:
                {
                    buttonName = "menu";
                    break;
                }

                default:
                {
                    buttonName = "start";
                    break;
                }
                }
                break;
            }

            default:
            {
                buttonName = button.ToString().ToLowerUnderscored();
                break;
            }
            }

            var path = AssetPath.Combine(
                "gui/prompts/" + type.ToString().ToLowerUnderscored(),
                buttonName + ".png"
                );

            if (Assets.Assets.Exists <Texture>(path))
            {
                return(path);
            }
            return(null);
        }