예제 #1
0
 /// <summary>
 /// Creates a new object where content images for on and off states are different.
 /// </summary>
 /// <param name="imageOff">Image to assign to all off states.</param>
 /// <param name="imageOn">Image to assign to all on states.</param>
 public GUIContentImages(SpriteTexture imageOff, SpriteTexture imageOn)
 {
     normal    = imageOff;
     hover     = imageOff;
     active    = imageOff;
     focused   = imageOff;
     normalOn  = imageOn;
     hoverOn   = imageOn;
     activeOn  = imageOn;
     focusedOn = imageOn;
 }
예제 #2
0
 /// <summary>
 /// Creates a new object where content images for all states are the same.
 /// </summary>
 /// <param name="image">Image to assign to all states.</param>
 public GUIContentImages(SpriteTexture image)
 {
     normal    = image;
     hover     = image;
     active    = image;
     focused   = image;
     normalOn  = image;
     hoverOn   = image;
     activeOn  = image;
     focusedOn = image;
 }
예제 #3
0
 public GUIContentImages(SpriteTexture image)
 {
     this.normal    = image;
     this.hover     = image;
     this.active    = image;
     this.focused   = image;
     this.normalOn  = image;
     this.hoverOn   = image;
     this.activeOn  = image;
     this.focusedOn = image;
 }
예제 #4
0
        /// <summary>
        /// Draws a quad with a the provided texture displayed.
        /// </summary>
        /// <param name="texture">Texture to draw.</param>
        /// <param name="area">Position and size of the texture to draw. Position is relative to the canvas origin
        ///                    (top-left). If size is zero, the default texture size will be used.</param>
        /// <param name="color">Color to tint the drawn texture with.</param>
        /// <param name="scaleMode">Scale mode to use when sizing the texture. Only relevant if the provided quad size
        ///                         doesn't match the texture size.</param>
        /// <param name="depth">Depth at which to draw the element. Elements with higher depth will be drawn before others.
        ///                     Additionally elements of the same type (triangle or line) will be drawn in order they are
        ///                     submitted if they share the same depth.</param>
        public void DrawTexture(SpriteTexture texture, Rect2I area, Color color,
                                GUITextureScaleMode scaleMode = GUITextureScaleMode.StretchToFit, byte depth = 128)
        {
            IntPtr texturePtr = IntPtr.Zero;

            if (texture != null)
            {
                texturePtr = texture.GetCachedPtr();
            }

            Internal_DrawTexture(mCachedPtr, texturePtr, ref area, scaleMode, ref color, depth);
        }
예제 #5
0
        /// <summary>
        /// Draws a quad with a the provided texture displayed.
        /// </summary>
        /// <param name="texture">Texture to draw.</param>
        /// <param name="area">Position and size of the texture to draw. Position is relative to the canvas origin
        ///                    (top-left). If size is zero, the default texture size will be used.</param>
        /// <param name="scaleMode">Scale mode to use when sizing the texture. Only relevant if the provided quad size
        ///                         doesn't match the texture size.</param>
        public void DrawTexture(SpriteTexture texture, Rect2I area,
                                GUITextureScaleMode scaleMode = GUITextureScaleMode.StretchToFit)
        {
            IntPtr texturePtr = IntPtr.Zero;

            if (texture != null)
            {
                texturePtr = texture.GetCachedPtr();
            }

            Color color = Color.White;

            Internal_DrawTexture(mCachedPtr, texturePtr, ref area, scaleMode, ref color);
        }
예제 #6
0
 /// <summary>
 /// Creates a new object where content images for all states are the same.
 /// </summary>
 /// <param name="image">Image to assign to all states.</param>
 public GUIContentImages(SpriteTexture image)
 {
     normal = image;
     hover = image;
     active = image;
     focused = image;
     normalOn = image;
     hoverOn = image;
     activeOn = image;
     focusedOn = image;
 }
예제 #7
0
 /// <summary>
 /// Creates a new texture element.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will
 ///                       be used.</param>
 /// <param name="scale">Scale mode to use when sizing the texture.</param>
 /// <param name="transparent">Determines should the texture be rendered with transparency active.</param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified
 ///                     default element style is used.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, bool transparent, string style, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, scale, transparent, style, options);
 }
예제 #8
0
 private static extern void Internal_CreateInstance(GUITexture instance, SpriteTexture texture,
                                                    GUIImageScaleMode scale, bool transparent, string style, GUIOption[] options);
예제 #9
0
 /// <summary>
 /// Creates a new texture element with transparency active. Texture will use the default StretchToFit scaling.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will
 ///                       be used.</param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified
 ///                     default element style is used.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, string style, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, true, style, options);
 }
예제 #10
0
            /// <summary>
            /// Creates a new horizontal slider.
            /// </summary>
            /// <param name="guiTexture">GUI element to display the slider color range on.</param>
            /// <param name="guiSlider">Slider rendered on top of the texture that may be moved by the user to select a 
            ///                         color.</param>
            /// <param name="width">Width of the slider in pixels.</param>
            /// <param name="height">Height of the slider in pixels.</param>
            public ColorSlider1DHorz(GUITexture guiTexture, GUISliderH guiSlider, int width, int height)
            {
                this.width = width;
                this.height = height;
                this.guiTexture = guiTexture;
                this.guiSlider = guiSlider;

                texture = new Texture2D(width, height);
                spriteTexture = new SpriteTexture(texture);
            }
예제 #11
0
 /// <summary>
 /// Creates a new texture element with transparency active.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will 
 ///                       be used.</param>
 /// <param name="scale">Scale mode to use when sizing the texture.</param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
 ///                     default element style is used.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, string style, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, scale, true, style, options);
 }
예제 #12
0
 private static extern void Internal_CreateInstance(SpriteTexture instance,
                                                    Texture2D texture, ref Vector2 offset, ref Vector2 scale);
예제 #13
0
        /// <summary>
        /// Creates a new empty sprite texture in the specified folder.
        /// </summary>
        /// <param name="folder">Folder relative to project library to create the sprite texture in.</param>
        public static void CreateEmptySpriteTexture(string folder)
        {
            string path = Path.Combine(folder, "New Sprite Texture.asset");
            path = GetUniquePath(path);

            SpriteTexture spriteTexture = new SpriteTexture(null);
            ProjectLibrary.Create(spriteTexture, path);
        }
예제 #14
0
        /// <summary>
        /// Registers a new row in the layout. The row cannot be selected as the output field, but rather can be expanded
        /// so it displays child elements.
        /// </summary>
        /// <param name="layout">Layout to append the row GUI elements to.</param>
        /// <param name="icon">Optional icon to display next to the name. Can be null.</param>
        /// <param name="name">Name of the field.</param>
        /// <param name="so">Parent scene object of the field.</param>
        /// <param name="component">Parent component of the field. Can be null if field belongs to <see cref="SceneObject"/>.
        ///                         </param>
        /// <param name="path">Slash separated path to the field from its parent object.</param>
        /// <param name="toggleCallback">Callback to trigger when the user expands or collapses the foldout.</param>
        /// <returns>Element object storing all information about the added field.</returns>
        private Element AddFoldoutRow(GUILayout layout, SpriteTexture icon, string name, SceneObject so, Component component,
            string path, Action<Element, bool> toggleCallback)
        {
            Element element = new Element(so, component, path);

            GUILayoutY elementLayout = layout.AddLayoutY();
            GUILayoutX foldoutLayout = elementLayout.AddLayoutX();

            element.toggle = new GUIToggle("", EditorStyles.Expand);
            element.toggle.OnToggled += x => toggleCallback(element, x);

            foldoutLayout.AddSpace(PADDING);
            foldoutLayout.AddElement(element.toggle);

            if (icon != null)
            {
                GUITexture guiIcon = new GUITexture(icon, GUIOption.FixedWidth(16), GUIOption.FixedWidth(16));
                foldoutLayout.AddElement(guiIcon);
            }

            GUILabel label = new GUILabel(new LocEdString(name));
            foldoutLayout.AddElement(label);
            foldoutLayout.AddFlexibleSpace();

            element.indentLayout = elementLayout.AddLayoutX();
            element.indentLayout.AddSpace(INDENT_AMOUNT);
            element.childLayout = element.indentLayout.AddLayoutY();

            element.indentLayout.Active = false;

            return element;
        }
예제 #15
0
 private static extern void Internal_setSpriteTexture(IntPtr thisPtr, string name, SpriteTexture value);
 private static extern void Internal_create0(SpriteTexture managedInstance, ref Vector2 uvOffset, ref Vector2 uvScale, Texture texture);
예제 #17
0
 /// <summary>
 /// Creates a new texture element with transparency active. Texture will use the default StretchToFit scaling.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will 
 ///                       be used.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, true, "", options);
 }
예제 #18
0
 /// <summary>
 /// Sets the texture to display.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will 
 ///                       be used.</param>
 public void SetTexture(SpriteTexture texture)
 {
     Internal_SetTexture(mCachedPtr, texture);
 }
예제 #19
0
            /// <summary>
            /// Creates a new color box.
            /// </summary>
            /// <param name="guiTexture">GUI element to display the 2D color range on.</param>
            /// <param name="guiSliderHandle">Texture to be used for displaying the position of the currently selected 
            ///                               color.</param>
            /// <param name="width">Width of the slider in pixels.</param>
            /// <param name="height">Height of the slider in pixels.</param>
            public ColorSlider2D(GUITexture guiTexture, GUITexture guiSliderHandle, int width, int height)
            {
                this.width = width;
                this.height = height;

                this.guiTexture = guiTexture;
                this.guiSliderHandle = guiSliderHandle;

                texture = new Texture2D(width, height);
                spriteTexture = new SpriteTexture(texture);
            }
예제 #20
0
 private static extern void Internal_CreateInstance(GUITexture instance, SpriteTexture texture,
     GUIImageScaleMode scale, bool transparent, string style, GUIOption[] options);
예제 #21
0
 /// <summary>
 /// Creates a new texture element with transparency active.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will
 ///                       be used.</param>
 /// <param name="scale">Scale mode to use when sizing the texture.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, scale, true, "", options);
 }
예제 #22
0
 private static extern void Internal_SetTexture(IntPtr nativeInstance, SpriteTexture texture);
예제 #23
0
 /// <summary>
 /// Sets the texture to display.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will
 ///                       be used.</param>
 public void SetTexture(SpriteTexture texture)
 {
     Internal_SetTexture(mCachedPtr, texture);
 }
예제 #24
0
 /// <summary>
 /// Creates a new texture element.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will 
 ///                       be used.</param>
 /// <param name="scale">Scale mode to use when sizing the texture.</param>
 /// <param name="transparent">Determines should the texture be rendered with transparency active.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, bool transparent, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, scale, transparent, "", options);
 }
예제 #25
0
 private static extern void Internal_SetTexture(IntPtr nativeInstance, SpriteTexture texture);
예제 #26
0
 /// <summary>
 /// Creates a new texture element. Texture will use the default StretchToFit scaling.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will 
 ///                       be used.</param>
 /// <param name="transparent">Determines should the texture be rendered with transparency active.</param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
 ///                     default element style is used.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, bool transparent, string style, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, transparent, style, options);
 }
예제 #27
0
 /// <summary>
 /// Creates a new texture element. Texture will use the default StretchToFit scaling.
 /// </summary>
 /// <param name="texture">Texture to display. If this is null then the texture specified by the style will
 ///                       be used.</param>
 /// <param name="transparent">Determines should the texture be rendered with transparency active.</param>
 /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will
 ///                       override any similar options set by style.</param>
 public GUITexture(SpriteTexture texture, bool transparent, params GUIOption[] options)
 {
     Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, transparent, "", options);
 }
 private static extern void Internal_create(SpriteTexture managedInstance, Texture texture);
예제 #29
0
 /// <summary>
 /// Creates a new object where content images for on and off states are different.
 /// </summary>
 /// <param name="imageOff">Image to assign to all off states.</param>
 /// <param name="imageOn">Image to assign to all on states.</param>
 public GUIContentImages(SpriteTexture imageOff, SpriteTexture imageOn)
 {
     normal = imageOff;
     hover = imageOff;
     active = imageOff;
     focused = imageOff;
     normalOn = imageOn;
     hoverOn = imageOn;
     activeOn = imageOn;
     focusedOn = imageOn;
 }
예제 #30
0
 private static extern void Internal_CreateInstance(SpriteTexture instance, 
     Texture2D texture, ref Vector2 offset, ref Vector2 scale);