Exemplo n.º 1
0
		public string ToString(string format, IFormatProvider formatProvider)
		{
			bool flag = string.IsNullOrEmpty(format);
			if (flag)
			{
				format = "F1";
			}
			return UnityString.Format("({0}, {1})", new object[]
			{
				this.x.ToString(format, formatProvider),
				this.y.ToString(format, formatProvider)
			});
		}
Exemplo n.º 2
0
 public void SetHeights(int xBase, int yBase, float[,] heights)
 {
     if (heights == null)
     {
         throw new NullReferenceException();
     }
     if (((((xBase + heights.GetLength(1)) > this.heightmapWidth) || ((xBase + heights.GetLength(1)) < 0)) || (((yBase + heights.GetLength(0)) < 0) || (xBase < 0))) || ((yBase < 0) || ((yBase + heights.GetLength(0)) > this.heightmapHeight)))
     {
         object[] args = new object[] { xBase + heights.GetLength(1), yBase + heights.GetLength(0), this.heightmapWidth, this.heightmapHeight };
         throw new ArgumentException(UnityString.Format("X or Y base out of bounds. Setting up to {0}x{1} while map size is {2}x{3}", args));
     }
     this.Internal_SetHeights(xBase, yBase, heights.GetLength(1), heights.GetLength(0), heights);
 }
Exemplo n.º 3
0
        public void Use()
        {
            bool flag = this.type == EventType.Repaint || this.type == EventType.Layout;

            if (flag)
            {
                Debug.LogWarning(UnityString.Format("Event.Use() should not be called for events of type {0}", new object[]
                {
                    this.type
                }));
            }
            this.Internal_Use();
        }
Exemplo n.º 4
0
        public void SetHeights(int xBase, int yBase, float[,] heights)
        {
            if (heights == null)
            {
                throw new System.NullReferenceException();
            }
            if (xBase + heights.GetLength(1) > heightmapResolution || xBase + heights.GetLength(1) < 0 || yBase + heights.GetLength(0) < 0 || xBase < 0 || yBase < 0 || yBase + heights.GetLength(0) > heightmapResolution)
            {
                throw new System.ArgumentException(UnityString.Format("X or Y base out of bounds. Setting up to {0}x{1} while map size is {2}x{2}", xBase + heights.GetLength(1), yBase + heights.GetLength(0), heightmapResolution));
            }

            Internal_SetHeights(xBase, yBase, heights.GetLength(1), heights.GetLength(0), heights);
        }
Exemplo n.º 5
0
        public int this[int index]
        {
            get
            {
                int result;
                switch (index)
                {
                case 0:
                    result = this.x;
                    break;

                case 1:
                    result = this.y;
                    break;

                case 2:
                    result = this.z;
                    break;

                default:
                    throw new IndexOutOfRangeException(UnityString.Format("Invalid Vector3Int index addressed: {0}!", new object[]
                    {
                        index
                    }));
                }
                return(result);
            }
            set
            {
                switch (index)
                {
                case 0:
                    this.x = value;
                    break;

                case 1:
                    this.y = value;
                    break;

                case 2:
                    this.z = value;
                    break;

                default:
                    throw new IndexOutOfRangeException(UnityString.Format("Invalid Vector3Int index addressed: {0}!", new object[]
                    {
                        index
                    }));
                }
            }
        }
Exemplo n.º 6
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            bool flag = string.IsNullOrEmpty(format);

            if (flag)
            {
                format = "F1";
            }
            return(UnityString.Format("(normal:{0}, distance:{1})", new object[]
            {
                this.m_Normal.ToString(format, formatProvider),
                this.m_Distance.ToString(format, formatProvider)
            }));
        }
Exemplo n.º 7
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            bool flag = string.IsNullOrEmpty(format);

            if (flag)
            {
                format = "F1";
            }
            return(UnityString.Format("Center: {0}, Extents: {1}", new object[]
            {
                this.m_Center.ToString(format, formatProvider),
                this.m_Extents.ToString(format, formatProvider)
            }));
        }
Exemplo n.º 8
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            bool flag = string.IsNullOrEmpty(format);

            if (flag)
            {
                format = "F1";
            }
            return(UnityString.Format("Origin: {0}, Dir: {1}", new object[]
            {
                this.m_Origin.ToString(format, formatProvider),
                this.m_Direction.ToString(format, formatProvider)
            }));
        }
Exemplo n.º 9
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            bool flag = string.IsNullOrEmpty(format);

            if (flag)
            {
                format = "F3";
            }
            return(UnityString.Format("RGBA({0}, {1}, {2}, {3})", new object[]
            {
                this.r.ToString(format, formatProvider),
                this.g.ToString(format, formatProvider),
                this.b.ToString(format, formatProvider),
                this.a.ToString(format, formatProvider)
            }));
        }
Exemplo n.º 10
0
        public string ToString(string format, IFormatProvider formatProvider)
        {
            bool flag = string.IsNullOrEmpty(format);

            if (flag)
            {
                format = "F2";
            }
            return(UnityString.Format("(x:{0}, y:{1}, width:{2}, height:{3})", new object[]
            {
                this.x.ToString(format, formatProvider),
                this.y.ToString(format, formatProvider),
                this.width.ToString(format, formatProvider),
                this.height.ToString(format, formatProvider)
            }));
        }
Exemplo n.º 11
0
 public string ToString(string format, IFormatProvider formatProvider)
 {
     if (string.IsNullOrEmpty(format))
     {
         format = "F5";
     }
     if (formatProvider == null)
     {
         formatProvider = CultureInfo.InvariantCulture.NumberFormat;
     }
     return(UnityString.Format("{0}\t{1}\t{2}\t{3}\n{4}\t{5}\t{6}\t{7}\n{8}\t{9}\t{10}\t{11}\n{12}\t{13}\t{14}\t{15}\n",
                               m00.ToString(format, formatProvider), m01.ToString(format, formatProvider), m02.ToString(format, formatProvider), m03.ToString(format, formatProvider),
                               m10.ToString(format, formatProvider), m11.ToString(format, formatProvider), m12.ToString(format, formatProvider), m13.ToString(format, formatProvider),
                               m20.ToString(format, formatProvider), m21.ToString(format, formatProvider), m22.ToString(format, formatProvider), m23.ToString(format, formatProvider),
                               m30.ToString(format, formatProvider), m31.ToString(format, formatProvider), m32.ToString(format, formatProvider), m33.ToString(format, formatProvider)));
 }
Exemplo n.º 12
0
 public override string ToString()
 {
     if (this.isKey)
     {
         if (this.character == '\0')
         {
             return(UnityString.Format("Event:{0}   Character:\\0   Modifiers:{1}   KeyCode:{2}", new object[]
             {
                 this.type,
                 this.modifiers,
                 this.keyCode
             }));
         }
         return(string.Concat(new object[]
         {
             "Event:",
             this.type,
             "   Character:",
             (int)this.character,
             "   Modifiers:",
             this.modifiers,
             "   KeyCode:",
             this.keyCode
         }));
     }
     else
     {
         if (this.isMouse)
         {
             return(UnityString.Format("Event: {0}   Position: {1} Modifiers: {2}", new object[]
             {
                 this.type,
                 this.mousePosition,
                 this.modifiers
             }));
         }
         if (this.type == EventType.ExecuteCommand || this.type == EventType.ValidateCommand)
         {
             return(UnityString.Format("Event: {0}  \"{1}\"", new object[]
             {
                 this.type,
                 this.commandName
             }));
         }
         return(string.Empty + this.type);
     }
 }
Exemplo n.º 13
0
        public void SetHeightsDelayLOD(int xBase, int yBase, float[,] heights)
        {
            if (heights == null)
            {
                throw new ArgumentNullException("heights");
            }
            int length1 = heights.GetLength(0);
            int length2 = heights.GetLength(1);

            if (xBase < 0 || xBase + length2 < 0 || xBase + length2 > this.heightmapWidth)
            {
                throw new ArgumentException(UnityString.Format("X out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", (object)xBase, (object)(xBase + length2), (object)this.heightmapWidth));
            }
            if (yBase < 0 || yBase + length1 < 0 || yBase + length1 > this.heightmapHeight)
            {
                throw new ArgumentException(UnityString.Format("Y out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", (object)yBase, (object)(yBase + length1), (object)this.heightmapHeight));
            }
            this.Internal_SetHeightsDelayLOD(xBase, yBase, length2, length1, heights);
        }
Exemplo n.º 14
0
        public string ToString(string format)
        {
            string fmt = "({0}, {1}, {2})";

            object[] objArray = new object[3];
            int      index1   = 0;
            string   str1     = this.x.ToString(format);

            objArray[index1] = (object)str1;
            int    index2 = 1;
            string str2   = this.y.ToString(format);

            objArray[index2] = (object)str2;
            int    index3 = 2;
            string str3   = this.z.ToString(format);

            objArray[index3] = (object)str3;
            return(UnityString.Format(fmt, objArray));
        }
Exemplo n.º 15
0
        public int this[int index]
        {
            get
            {
                switch (index)
                {
                case 0:
                    return(this.x);

                case 1:
                    return(this.y);

                case 2:
                    return(this.z);
                }
                object[] args = new object[] { index };
                throw new IndexOutOfRangeException(UnityString.Format("Invalid Vector3Int index addressed: {0}!", args));
            }
            set
            {
                switch (index)
                {
                case 0:
                    this.x = value;
                    break;

                case 1:
                    this.y = value;
                    break;

                case 2:
                    this.z = value;
                    break;

                default:
                {
                    object[] args = new object[] { index };
                    throw new IndexOutOfRangeException(UnityString.Format("Invalid Vector3Int index addressed: {0}!", args));
                }
                }
            }
        }
Exemplo n.º 16
0
 public override string ToString()
 {
     if (isKey)
     {
         if (character == '\0')
         {
             return(UnityString.Format("Event:{0}   Character:\\0   Modifiers:{1}   KeyCode:{2}", type, modifiers, keyCode));
         }
         return("Event:" + type + "   Character:" + (int)character + "   Modifiers:" + modifiers + "   KeyCode:" + keyCode);
     }
     if (isMouse)
     {
         return(UnityString.Format("Event: {0}   Position: {1} Modifiers: {2}", type, mousePosition, modifiers));
     }
     if (type == EventType.ExecuteCommand || type == EventType.ValidateCommand)
     {
         return(UnityString.Format("Event: {0}  \"{1}\"", type, commandName));
     }
     return("" + type);
 }
Exemplo n.º 17
0
 public override string ToString()
 {
     if (this.isKey)
     {
         if ((int)this.character == 0)
         {
             return(UnityString.Format("Event:{0}   Character:\\0   Modifiers:{1}   KeyCode:{2}", (object)this.type, (object)this.modifiers, (object)this.keyCode));
         }
         return("Event:" + (object)this.type + "   Character:" + (object)(int)this.character + "   Modifiers:" + (object)this.modifiers + "   KeyCode:" + (object)this.keyCode);
     }
     if (this.isMouse)
     {
         return(UnityString.Format("Event: {0}   Position: {1} Modifiers: {2}", (object)this.type, (object)this.mousePosition, (object)this.modifiers));
     }
     if (this.type != EventType.ExecuteCommand && this.type != EventType.ValidateCommand)
     {
         return(string.Empty + (object)this.type);
     }
     return(UnityString.Format("Event: {0}  \"{1}\"", (object)this.type, (object)this.commandName));
 }
Exemplo n.º 18
0
        public void SetHeightsDelayLOD(int xBase, int yBase, float[,] heights)
        {
            if (heights == null)
            {
                throw new ArgumentNullException("heights");
            }
            int length = heights.GetLength(0);
            int width  = heights.GetLength(1);

            if (((xBase < 0) || ((xBase + width) < 0)) || ((xBase + width) > this.heightmapWidth))
            {
                object[] args = new object[] { xBase, xBase + width, this.heightmapWidth };
                throw new ArgumentException(UnityString.Format("X out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", args));
            }
            if (((yBase < 0) || ((yBase + length) < 0)) || ((yBase + length) > this.heightmapHeight))
            {
                object[] objArray2 = new object[] { yBase, yBase + length, this.heightmapHeight };
                throw new ArgumentException(UnityString.Format("Y out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", objArray2));
            }
            this.Internal_SetHeightsDelayLOD(xBase, yBase, width, length, heights);
        }
Exemplo n.º 19
0
 public override string ToString()
 {
     return(UnityString.Format("{0:F5}\t{1:F5}\t{2:F5}\t{3:F5}\n{4:F5}\t{5:F5}\t{6:F5}\t{7:F5}\n{8:F5}\t{9:F5}\t{10:F5}\t{11:F5}\n{12:F5}\t{13:F5}\t{14:F5}\t{15:F5}\n", new object[]
     {
         this.m00,
         this.m01,
         this.m02,
         this.m03,
         this.m10,
         this.m11,
         this.m12,
         this.m13,
         this.m20,
         this.m21,
         this.m22,
         this.m23,
         this.m30,
         this.m31,
         this.m32,
         this.m33
     }));
 }
Exemplo n.º 20
0
        public void SetHoles(int xBase, int yBase, bool[,] holes)
        {
            if (holes == null)
            {
                throw new ArgumentNullException("holes");
            }

            int height = holes.GetLength(0);
            int width  = holes.GetLength(1);

            if (xBase < 0 || (xBase + width) > holesResolution)
            {
                throw new ArgumentException(UnityString.Format("X out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", xBase, xBase + width, holesResolution));
            }

            if (yBase < 0 || (yBase + height) > holesResolution)
            {
                throw new ArgumentException(UnityString.Format("Y out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", yBase, yBase + height, holesResolution));
            }

            Internal_SetHoles(xBase, yBase, holes.GetLength(1), holes.GetLength(0), holes);
        }
Exemplo n.º 21
0
        public override string ToString()
        {
            string fmt = "({0:F1}, {1:F1}, {2:F1})";

            object[] objArray = new object[3];
            int      index1   = 0;
            // ISSUE: variable of a boxed type
            __Boxed <float> local1 = (ValueType)this.x;

            objArray[index1] = (object)local1;
            int index2 = 1;
            // ISSUE: variable of a boxed type
            __Boxed <float> local2 = (ValueType)this.y;

            objArray[index2] = (object)local2;
            int index3 = 2;
            // ISSUE: variable of a boxed type
            __Boxed <float> local3 = (ValueType)this.z;

            objArray[index3] = (object)local3;
            return(UnityString.Format(fmt, objArray));
        }
        public void SetSurfaceMaskDelayLOD(int xBase, int yBase, bool[,] surfaceMask)
        {
            if (surfaceMask == null)
            {
                throw new ArgumentNullException("surfaceMask");
            }

            int height = surfaceMask.GetLength(0);
            int width  = surfaceMask.GetLength(1);

            if (xBase < 0 || (xBase + width) > surfaceMaskResolution)
            {
                throw new ArgumentException(UnityString.Format("X out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", xBase, xBase + width, surfaceMaskResolution));
            }

            if (yBase < 0 || (yBase + height) > surfaceMaskResolution)
            {
                throw new ArgumentException(UnityString.Format("Y out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", yBase, yBase + height, surfaceMaskResolution));
            }

            Internal_SetSurfaceMaskDelayLOD(xBase, yBase, width, height, surfaceMask);
        }
Exemplo n.º 23
0
 public string ToString(string format)
 {
     return(UnityString.Format("{0}\t{1}\t{2}\t{3}\n{4}\t{5}\t{6}\t{7}\n{8}\t{9}\t{10}\t{11}\n{12}\t{13}\t{14}\t{15}\n", new object[]
     {
         this.m00.ToString(format),
         this.m01.ToString(format),
         this.m02.ToString(format),
         this.m03.ToString(format),
         this.m10.ToString(format),
         this.m11.ToString(format),
         this.m12.ToString(format),
         this.m13.ToString(format),
         this.m20.ToString(format),
         this.m21.ToString(format),
         this.m22.ToString(format),
         this.m23.ToString(format),
         this.m30.ToString(format),
         this.m31.ToString(format),
         this.m32.ToString(format),
         this.m33.ToString(format)
     }));
 }
        public void SetHeightsDelayLOD(int xBase, int yBase, float[,] heights)
        {
            if (heights == null)
            {
                throw new System.ArgumentNullException("heights");
            }

            int height = heights.GetLength(0);
            int width  = heights.GetLength(1);

            if (xBase < 0 || (xBase + width) < 0 || (xBase + width) > heightmapResolution)
            {
                throw new System.ArgumentException(UnityString.Format("X out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", xBase, xBase + width, heightmapResolution));
            }

            if (yBase < 0 || (yBase + height) < 0 || (yBase + height) > heightmapResolution)
            {
                throw new System.ArgumentException(UnityString.Format("Y out of bounds - trying to set {0}-{1} but the terrain ranges from 0-{2}", yBase, yBase + height, heightmapResolution));
            }

            Internal_SetHeightsDelayLOD(xBase, yBase, width, height, heights);
        }
Exemplo n.º 25
0
 public override string ToString()
 {
     if (this.isKey)
     {
         if (this.character == '\0')
         {
             object[] objArray1 = new object[] { this.type, this.modifiers, this.keyCode };
             return(UnityString.Format(@"Event:{0}   Character:\0   Modifiers:{1}   KeyCode:{2}", objArray1));
         }
         object[] objArray2 = new object[] { "Event:", this.type, "   Character:", (int)this.character, "   Modifiers:", this.modifiers, "   KeyCode:", this.keyCode };
         return(string.Concat(objArray2));
     }
     if (this.isMouse)
     {
         object[] objArray3 = new object[] { this.type, this.mousePosition, this.modifiers };
         return(UnityString.Format("Event: {0}   Position: {1} Modifiers: {2}", objArray3));
     }
     if ((this.type != EventType.ExecuteCommand) && (this.type != EventType.ValidateCommand))
     {
         return(string.Empty + this.type);
     }
     object[] args = new object[] { this.type, this.commandName };
     return(UnityString.Format("Event: {0}  \"{1}\"", args));
 }
Exemplo n.º 26
0
        public override string ToString()
        {
            string str = "";

            for (int i = 0; i < indent; i++)
            {
                str = str + " ";
            }
            object[] objArray1 = new object[12];
            objArray1[0] = str;
            object[] args = new object[] { (this.style == null) ? "NULL" : this.style.name, base.GetType(), this.rect.x, this.rect.xMax, this.rect.y, this.rect.yMax };
            objArray1[1]  = UnityString.Format("{1}-{0} (x:{2}-{3}, y:{4}-{5})", args);
            objArray1[2]  = "   -   W: ";
            objArray1[3]  = this.minWidth;
            objArray1[4]  = "-";
            objArray1[5]  = this.maxWidth;
            objArray1[6]  = (this.stretchWidth == 0) ? "" : "+";
            objArray1[7]  = ", H: ";
            objArray1[8]  = this.minHeight;
            objArray1[9]  = "-";
            objArray1[10] = this.maxHeight;
            objArray1[11] = (this.stretchHeight == 0) ? "" : "+";
            return(string.Concat(objArray1));
        }
Exemplo n.º 27
0
        public static Event KeyboardEvent(string key)
        {
            Event @event = new Event(0);

            @event.type = EventType.KeyDown;
            if (string.IsNullOrEmpty(key))
            {
                return(@event);
            }
            int  num  = 0;
            bool flag = false;

            do
            {
                flag = true;
                if (num >= key.Length)
                {
                    flag = false;
                    break;
                }
                switch (key[num])
                {
                case '&':
                    @event.modifiers |= EventModifiers.Alt;
                    num++;
                    break;

                case '^':
                    @event.modifiers |= EventModifiers.Control;
                    num++;
                    break;

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

                case '#':
                    @event.modifiers |= EventModifiers.Shift;
                    num++;
                    break;

                default:
                    flag = false;
                    break;
                }
            }while (flag);
            string text = key.Substring(num, key.Length - num).ToLower();

            switch (text)
            {
            case "[0]":
                @event.character = '0';
                @event.keyCode   = KeyCode.Keypad0;
                break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            default:
                if (text.Length != 1)
                {
                    try
                    {
                        @event.keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), text, ignoreCase: true);
                    }
                    catch (ArgumentException)
                    {
                        Debug.LogError(UnityString.Format("Unable to find key name that matches '{0}'", text));
                    }
                    break;
                }
                @event.character = text.ToLower()[0];
                @event.keyCode   = (KeyCode)@event.character;
                if (@event.modifiers != 0)
                {
                    @event.character = '\0';
                }
                break;
            }
            return(@event);
        }
Exemplo n.º 28
0
 /// <summary>
 ///   <para>Returns a nicely formatted string for this Rect.</para>
 /// </summary>
 /// <param name="format"></param>
 public string ToString(string format)
 {
     return(UnityString.Format("(x:{0}, y:{1}, width:{2}, height:{3})", (object)this.x.ToString(format), (object)this.y.ToString(format), (object)this.width.ToString(format), (object)this.height.ToString(format)));
 }
Exemplo n.º 29
0
 /// <summary>
 ///   <para>Returns a nicely formatted string for this Rect.</para>
 /// </summary>
 /// <param name="format"></param>
 public override string ToString()
 {
     return(UnityString.Format("(x:{0:F2}, y:{1:F2}, width:{2:F2}, height:{3:F2})", (object)this.x, (object)this.y, (object)this.width, (object)this.height));
 }
Exemplo n.º 30
0
 public string ToString(string format)
 {
     object[] args = new object[] { this.m_Origin.ToString(format), this.m_Direction.ToString(format) };
     return(UnityString.Format("Origin: {0}, Dir: {1}", args));
 }