Format() public static method

public static Format ( string fmt ) : string
fmt string
return string
Exemplo n.º 1
0
 public override string ToString()
 {
     return(UnityString.Format("(normal:({0:F1}, {1:F1}, {2:F1}), distance:{3:F1})", m_Normal.x, m_Normal.y, m_Normal.z, m_Distance));
 }
Exemplo n.º 2
0
 public override string ToString()
 {
     object[] args = new object[] { this.x, this.y, this.z };
     return(UnityString.Format("({0:F1}, {1:F1}, {2:F1})", args));
 }
Exemplo n.º 3
0
 public override string ToString()
 {
     object[] args = new object[] { this.left, this.right, this.top, this.bottom };
     return(UnityString.Format("RectOffset (l:{0} r:{1} t:{2} b:{3})", args));
 }
Exemplo n.º 4
0
 public string ToString(string format)
 {
     return(UnityString.Format("Center: {0}, Extents: {1}", m_Center.ToString(format), m_Extents.ToString(format)));
 }
Exemplo n.º 5
0
 public override string ToString()
 {
     object[] args = new object[] { this.m_Center, this.m_Extents };
     return(UnityString.Format("Center: {0}, Extents: {1}", args));
 }
Exemplo n.º 6
0
 /// <summary>
 /// <para>Returns a nicely formatted string of this color.</para>
 /// </summary>
 /// <param name="format"></param>
 public string ToString(string format)
 {
     object[] args = new object[] { this.r.ToString(format), this.g.ToString(format), this.b.ToString(format), this.a.ToString(format) };
     return(UnityString.Format("RGBA({0}, {1}, {2}, {3})", args));
 }
Exemplo n.º 7
0
 /// <summary>
 ///   <para>Returns a nicely formatted string for this vector.</para>
 /// </summary>
 /// <param name="format"></param>
 public string ToString(string format)
 {
     return(UnityString.Format("({0}, {1}, {2})", (object)this.x.ToString(format), (object)this.y.ToString(format), (object)this.z.ToString(format)));
 }
Exemplo n.º 8
0
        public static Event KeyboardEvent(string key)
        {
            Event @event = new Event(0);

            @event.type = EventType.KeyDown;
            Event result;

            if (string.IsNullOrEmpty(key))
            {
                result = @event;
            }
            else
            {
                int  num = 0;
                bool flag;
                do
                {
                    flag = true;
                    if (num >= key.Length)
                    {
                        break;
                    }
                    char c = key[num];
                    switch (c)
                    {
                    case '#':
                        @event.modifiers |= EventModifiers.Shift;
                        num++;
                        goto IL_D0;

                    case '$':
IL_5F:
                        if (c != '^')
                        {
                            flag = false;
                            goto IL_D0;
                        }
                        @event.modifiers |= EventModifiers.Control;
                        num++;
                        goto IL_D0;

                    case '%':
                        @event.modifiers |= EventModifiers.Command;
                        num++;
                        goto IL_D0;

                    case '&':
                        @event.modifiers |= EventModifiers.Alt;
                        num++;
                        goto IL_D0;
                    }
                    goto IL_5F;
                    IL_D0 :;
                }while (flag);
                string text = key.Substring(num, key.Length - num).ToLower();
                switch (text)
                {
                case "[0]":
                    @event.character = '0';
                    @event.keyCode   = KeyCode.Keypad0;
                    goto IL_A83;

                case "[1]":
                    @event.character = '1';
                    @event.keyCode   = KeyCode.Keypad1;
                    goto IL_A83;

                case "[2]":
                    @event.character = '2';
                    @event.keyCode   = KeyCode.Keypad2;
                    goto IL_A83;

                case "[3]":
                    @event.character = '3';
                    @event.keyCode   = KeyCode.Keypad3;
                    goto IL_A83;

                case "[4]":
                    @event.character = '4';
                    @event.keyCode   = KeyCode.Keypad4;
                    goto IL_A83;

                case "[5]":
                    @event.character = '5';
                    @event.keyCode   = KeyCode.Keypad5;
                    goto IL_A83;

                case "[6]":
                    @event.character = '6';
                    @event.keyCode   = KeyCode.Keypad6;
                    goto IL_A83;

                case "[7]":
                    @event.character = '7';
                    @event.keyCode   = KeyCode.Keypad7;
                    goto IL_A83;

                case "[8]":
                    @event.character = '8';
                    @event.keyCode   = KeyCode.Keypad8;
                    goto IL_A83;

                case "[9]":
                    @event.character = '9';
                    @event.keyCode   = KeyCode.Keypad9;
                    goto IL_A83;

                case "[.]":
                    @event.character = '.';
                    @event.keyCode   = KeyCode.KeypadPeriod;
                    goto IL_A83;

                case "[/]":
                    @event.character = '/';
                    @event.keyCode   = KeyCode.KeypadDivide;
                    goto IL_A83;

                case "[-]":
                    @event.character = '-';
                    @event.keyCode   = KeyCode.KeypadMinus;
                    goto IL_A83;

                case "[+]":
                    @event.character = '+';
                    @event.keyCode   = KeyCode.KeypadPlus;
                    goto IL_A83;

                case "[=]":
                    @event.character = '=';
                    @event.keyCode   = KeyCode.KeypadEquals;
                    goto IL_A83;

                case "[equals]":
                    @event.character = '=';
                    @event.keyCode   = KeyCode.KeypadEquals;
                    goto IL_A83;

                case "[enter]":
                    @event.character = '\n';
                    @event.keyCode   = KeyCode.KeypadEnter;
                    goto IL_A83;

                case "up":
                    @event.keyCode    = KeyCode.UpArrow;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "down":
                    @event.keyCode    = KeyCode.DownArrow;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "left":
                    @event.keyCode    = KeyCode.LeftArrow;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "right":
                    @event.keyCode    = KeyCode.RightArrow;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "insert":
                    @event.keyCode    = KeyCode.Insert;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "home":
                    @event.keyCode    = KeyCode.Home;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "end":
                    @event.keyCode    = KeyCode.End;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "pgup":
                    @event.keyCode    = KeyCode.PageDown;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "page up":
                    @event.keyCode    = KeyCode.PageUp;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "pgdown":
                    @event.keyCode    = KeyCode.PageUp;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "page down":
                    @event.keyCode    = KeyCode.PageDown;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "backspace":
                    @event.keyCode    = KeyCode.Backspace;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "delete":
                    @event.keyCode    = KeyCode.Delete;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "tab":
                    @event.keyCode = KeyCode.Tab;
                    goto IL_A83;

                case "f1":
                    @event.keyCode    = KeyCode.F1;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f2":
                    @event.keyCode    = KeyCode.F2;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f3":
                    @event.keyCode    = KeyCode.F3;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f4":
                    @event.keyCode    = KeyCode.F4;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f5":
                    @event.keyCode    = KeyCode.F5;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f6":
                    @event.keyCode    = KeyCode.F6;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f7":
                    @event.keyCode    = KeyCode.F7;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f8":
                    @event.keyCode    = KeyCode.F8;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f9":
                    @event.keyCode    = KeyCode.F9;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f10":
                    @event.keyCode    = KeyCode.F10;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f11":
                    @event.keyCode    = KeyCode.F11;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f12":
                    @event.keyCode    = KeyCode.F12;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f13":
                    @event.keyCode    = KeyCode.F13;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f14":
                    @event.keyCode    = KeyCode.F14;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "f15":
                    @event.keyCode    = KeyCode.F15;
                    @event.modifiers |= EventModifiers.FunctionKey;
                    goto IL_A83;

                case "[esc]":
                    @event.keyCode = KeyCode.Escape;
                    goto IL_A83;

                case "return":
                    @event.character  = '\n';
                    @event.keyCode    = KeyCode.Return;
                    @event.modifiers &= ~EventModifiers.FunctionKey;
                    goto IL_A83;

                case "space":
                    @event.keyCode    = KeyCode.Space;
                    @event.character  = ' ';
                    @event.modifiers &= ~EventModifiers.FunctionKey;
                    goto IL_A83;
                }
                if (text.Length != 1)
                {
                    try
                    {
                        @event.keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), text, true);
                    }
                    catch (ArgumentException)
                    {
                        Debug.LogError(UnityString.Format("Unable to find key name that matches '{0}'", new object[]
                        {
                            text
                        }));
                    }
                }
                else
                {
                    @event.character = text.ToLower()[0];
                    @event.keyCode   = (KeyCode)@event.character;
                    if (@event.modifiers != EventModifiers.None)
                    {
                        @event.character = '\0';
                    }
                }
IL_A83:
                result = @event;
            }
            return(result);
        }
Exemplo n.º 9
0
 public string ToString(string format, IFormatProvider formatProvider)
 {
     return(UnityString.Format("RectOffset (l:{0} r:{1} t:{2} b:{3})", left.ToString(format, formatProvider), right.ToString(format, formatProvider), top.ToString(format, formatProvider), bottom.ToString(format, formatProvider)));
 }
Exemplo n.º 10
0
 /// *listonly*
 public override string ToString()
 {
     return(UnityString.Format("({0:F1}, {1:F1})", x, y));
 }
Exemplo n.º 11
0
        // Create a keyboard event.
        public static Event KeyboardEvent(string key)
        {
            Event evt = new Event(0)
            {
                type = EventType.KeyDown
            };

            if (string.IsNullOrEmpty(key))
            {
                return(evt);
            }
            int  startIdx = 0;
            bool found    = false;

            do
            {
                found = true;
                if (startIdx >= key.Length)
                {
                    found = false; break;
                }
                switch (key[startIdx])
                {
                case '&':     // Alt
                    evt.modifiers |= EventModifiers.Alt; startIdx++;
                    break;

                case '^':     // Ctrl
                    evt.modifiers |= EventModifiers.Control; startIdx++;
                    break;

                case '%':
                    evt.modifiers |= EventModifiers.Command; startIdx++;
                    break;

                case '#':
                    evt.modifiers |= EventModifiers.Shift; startIdx++;
                    break;

                default:
                    found = false;
                    break;
                }
            }while (found);
            string subStr = key.Substring(startIdx, key.Length - startIdx).ToLowerInvariant();

            switch (subStr)
            {
            case "[0]":         evt.character = '0'; evt.keyCode = KeyCode.Keypad0; break;

            case "[1]":         evt.character = '1'; evt.keyCode = KeyCode.Keypad1; break;

            case "[2]":         evt.character = '2'; evt.keyCode = KeyCode.Keypad2; break;

            case "[3]":         evt.character = '3'; evt.keyCode = KeyCode.Keypad3; break;

            case "[4]":         evt.character = '4'; evt.keyCode = KeyCode.Keypad4; break;

            case "[5]":         evt.character = '5'; evt.keyCode = KeyCode.Keypad5; break;

            case "[6]":         evt.character = '6'; evt.keyCode = KeyCode.Keypad6; break;

            case "[7]":         evt.character = '7'; evt.keyCode = KeyCode.Keypad7; break;

            case "[8]":         evt.character = '8'; evt.keyCode = KeyCode.Keypad8; break;

            case "[9]":         evt.character = '9'; evt.keyCode = KeyCode.Keypad9; break;

            case "[.]":         evt.character = '.'; evt.keyCode = KeyCode.KeypadPeriod; break;

            case "[/]":         evt.character = '/'; evt.keyCode = KeyCode.KeypadDivide; break;

            case "[-]":         evt.character = '-'; evt.keyCode = KeyCode.KeypadMinus; break;

            case "[+]":         evt.character = '+'; evt.keyCode = KeyCode.KeypadPlus; break;

            case "[=]":         evt.character = '='; evt.keyCode = KeyCode.KeypadEquals; break;

            case "[equals]":    evt.character = '='; evt.keyCode = KeyCode.KeypadEquals; break;

            case "[enter]":     evt.character = '\n'; evt.keyCode = KeyCode.KeypadEnter; break;

            case "up":          evt.keyCode = KeyCode.UpArrow; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "down":        evt.keyCode = KeyCode.DownArrow; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "left":        evt.keyCode = KeyCode.LeftArrow; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "right":       evt.keyCode = KeyCode.RightArrow; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "insert":      evt.keyCode = KeyCode.Insert; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "home":        evt.keyCode = KeyCode.Home; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "end":         evt.keyCode = KeyCode.End; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "pgup":        evt.keyCode = KeyCode.PageDown; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "page up":     evt.keyCode = KeyCode.PageUp; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "pgdown":      evt.keyCode = KeyCode.PageUp; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "page down":   evt.keyCode = KeyCode.PageDown; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "backspace":   evt.keyCode = KeyCode.Backspace; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "delete":      evt.keyCode = KeyCode.Delete; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "tab":         evt.keyCode = KeyCode.Tab; break;

            case "f1":          evt.keyCode = KeyCode.F1; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f2":          evt.keyCode = KeyCode.F2; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f3":          evt.keyCode = KeyCode.F3; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f4":          evt.keyCode = KeyCode.F4; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f5":          evt.keyCode = KeyCode.F5; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f6":          evt.keyCode = KeyCode.F6; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f7":          evt.keyCode = KeyCode.F7; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f8":          evt.keyCode = KeyCode.F8; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f9":          evt.keyCode = KeyCode.F9; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f10":         evt.keyCode = KeyCode.F10; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f11":         evt.keyCode = KeyCode.F11; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f12":         evt.keyCode = KeyCode.F12; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f13":         evt.keyCode = KeyCode.F13; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f14":         evt.keyCode = KeyCode.F14; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "f15":         evt.keyCode = KeyCode.F15; evt.modifiers |= EventModifiers.FunctionKey; break;

            case "[esc]":       evt.keyCode = KeyCode.Escape; break;

            case "return":      evt.character = '\n'; evt.keyCode = KeyCode.Return; evt.modifiers &= ~EventModifiers.FunctionKey; break;

            case "space":       evt.keyCode = KeyCode.Space; evt.character = ' '; evt.modifiers &= ~EventModifiers.FunctionKey; break;

            default:
                if (subStr.Length != 1)
                {
                    try
                    {
                        evt.keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), subStr, true);
                    }
                    catch (ArgumentException)
                    {
                        Debug.LogError(UnityString.Format("Unable to find key name that matches '{0}'", subStr));
                    }
                }
                else
                {
                    evt.character = subStr.ToLower()[0];
                    evt.keyCode   = (KeyCode)evt.character;
                    if (evt.modifiers != 0)
                    {
                        evt.character = (char)0;
                    }
                }
                break;
            }
            return(evt);
        }
Exemplo n.º 12
0
 public override string ToString()
 {
     return(UnityString.Format("GUIStyle '{0}'", name));
 }
Exemplo n.º 13
0
 public string ToString(string format)
 {
     object[] args = new object[] { this.x.ToString(format), this.y.ToString(format), this.z.ToString(format), this.w.ToString(format) };
     return(UnityString.Format("({0}, {1}, {2}, {3})", args));
 }
Exemplo n.º 14
0
 public string ToString(string format)
 {
     return(UnityString.Format("(normal:({0}, {1}, {2}), distance:{3})", m_Normal.x.ToString(format), m_Normal.y.ToString(format), m_Normal.z.ToString(format), m_Distance.ToString(format)));
 }
Exemplo n.º 15
0
 public string ToString(string format, IFormatProvider formatProvider)
 {
     return(UnityString.Format("({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider)));
 }
Exemplo n.º 16
0
 public override string ToString()
 {
     object[] args = new object[] { this.x, this.y, this.width, this.height };
     return(UnityString.Format("(x:{0:F2}, y:{1:F2}, width:{2:F2}, height:{3:F2})", args));
 }
Exemplo n.º 17
0
 /// <summary>
 /// <para>Returns a nicely formatted string of this color.</para>
 /// </summary>
 /// <param name="format"></param>
 public override string ToString()
 {
     object[] args = new object[] { this.r, this.g, this.b, this.a };
     return(UnityString.Format("RGBA({0}, {1}, {2}, {3})", args));
 }
Exemplo n.º 18
0
 public string ToString(string format)
 {
     object[] args = new object[] { this.x.ToString(format), this.y.ToString(format), this.width.ToString(format), this.height.ToString(format) };
     return(UnityString.Format("(x:{0}, y:{1}, width:{2}, height:{3})", args));
 }
Exemplo n.º 19
0
 /// <summary>
 ///   <para>Returns a nicely formatted string for this vector.</para>
 /// </summary>
 /// <param name="format"></param>
 public override string ToString()
 {
     return(UnityString.Format("({0:F1}, {1:F1}, {2:F1})", (object)this.x, (object)this.y, (object)this.z));
 }
Exemplo n.º 20
0
 public override string ToString()
 {
     return(UnityString.Format("({0}, {1}, {2})", x, y, z));
 }
Exemplo n.º 21
0
 public override string ToString()
 {
     return(UnityString.Format("Center: {0}, Extents: {1}", m_Center, m_Extents));
 }
Exemplo n.º 22
0
 public string ToString(string format)
 {
     return(UnityString.Format("({0}, {1}, {2})", x.ToString(format), y.ToString(format), z.ToString(format)));
 }
Exemplo n.º 23
0
 public override string ToString()
 {
     object[] args = new object[] { this.name };
     return(UnityString.Format("GUIStyle '{0}'", args));
 }
Exemplo n.º 24
0
 /// <summary>
 ///   <para>Returns a nicely formatted string of this color.</para>
 /// </summary>
 /// <param name="format"></param>
 public override string ToString()
 {
     return(UnityString.Format("RGBA({0:F3}, {1:F3}, {2:F3}, {3:F3})", (object)this.r, (object)this.g, (object)this.b, (object)this.a));
 }
Exemplo n.º 25
0
 public string ToString(string format)
 {
     object[] args = new object[] { this.m_Center.ToString(format), this.m_Extents.ToString(format) };
     return(UnityString.Format("Center: {0}, Extents: {1}", args));
 }
Exemplo n.º 26
0
 /// <summary>
 ///   <para>Returns a nicely formatted string of this color.</para>
 /// </summary>
 /// <param name="format"></param>
 public string ToString(string format)
 {
     return(UnityString.Format("RGBA({0}, {1}, {2}, {3})", (object)this.r.ToString(format), (object)this.g.ToString(format), (object)this.b.ToString(format), (object)this.a.ToString(format)));
 }
Exemplo n.º 27
0
 public string ToString(string format)
 {
     object[] args = new object[] { this.x.ToString(format, CultureInfo.InvariantCulture.NumberFormat), this.y.ToString(format, CultureInfo.InvariantCulture.NumberFormat), this.z.ToString(format, CultureInfo.InvariantCulture.NumberFormat) };
     return(UnityString.Format("({0}, {1}, {2})", args));
 }
Exemplo n.º 28
0
 /// <summary>
 ///   <para>Returns a nicely formatted string of the resolution.</para>
 /// </summary>
 /// <returns>
 ///   <para>A string with the format "width x height @ refreshRateHz".</para>
 /// </returns>
 public override string ToString()
 {
     return(UnityString.Format("{0} x {1} @ {2}Hz", (object)this.m_Width, (object)this.m_Height, (object)this.m_RefreshRate));
 }
Exemplo n.º 29
0
 public string ToString(string format, IFormatProvider formatProvider)
 {
     return(UnityString.Format("Position: {0}, Size: {1}", m_Position.ToString(format, formatProvider), m_Size.ToString(format, formatProvider)));
 }
Exemplo n.º 30
0
 public override string ToString()
 {
     return(UnityString.Format("Position: {0}, Size: {1}", m_Position, m_Size));
 }