Example #1
0
    private void PaletteDrawOnGUI()
    {
        GUIStyle b = new GUIStyle(GUI.skin.button);

        b.normal.background = EditorGUIUtility.whiteTexture;
        Color c = GUI.color;

        for (int i = 0; i < pixelAsset.Palette.Colors.Length; i++)
        {
            int x = i % 4;
            int y = i / 4;
            GUI.color = pixelAsset.Palette.Colors[i];
            RectOffset ro = new RectOffset(1, 1, 1, 1);
            Rect       r  = new Rect(x * 16, y * 16, 16, 16);
            if (i == paletteIndex)
            {
                pixelAsset.Palette.Colors[i] = EditorGUI.ColorField(ro.Add(ro.Add(r)), GUIContent.none, pixelAsset.Palette.Colors[i], false, false, false);
            }
            else
            {
                if (GUI.Button(ro.Remove(r), EditorGUIUtility.whiteTexture, b))
                {
                    paletteIndex = i;
                }
            }
        }
    }
        private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)

        {
            SerializedProperty itemData = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);

            SerializedProperty itemText = itemData.FindPropertyRelative("m_Text");

            SerializedProperty itemImage = itemData.FindPropertyRelative("m_Image");



            RectOffset offset = new RectOffset(0, 0, -1, -3);

            rect = offset.Add(rect);

            rect.height = EditorGUIUtility.singleLineHeight;



            EditorGUI.PropertyField(rect, itemText, GUIContent.none);

            rect.y += EditorGUIUtility.singleLineHeight;

            EditorGUI.PropertyField(rect, itemImage, GUIContent.none);
        }
Example #3
0
        public override void ShowOverlay()
        {
            if (!isInstructionSelected)
            {
                debuggerWindow.ClearInstructionHighlighter();
                return;
            }

            IMGUILayoutInstruction instruction = m_LayoutInstructions[listViewState.row];

            RectOffset offset = new RectOffset();

            offset.left   = instruction.marginLeft;
            offset.right  = instruction.marginRight;
            offset.top    = instruction.marginTop;
            offset.bottom = instruction.marginBottom;

            //TODO: right now the overlay only know about padding
            //For now we just save margin into padding
            //while the overlay isn't improved.
            m_FakeMarginStyleForOverlay.padding = offset;

            Rect rect = instruction.unclippedRect;

            rect = offset.Add(rect);

            debuggerWindow.HighlightInstruction(debuggerWindow.inspected, rect, m_FakeMarginStyleForOverlay);
        }
Example #4
0
    // Update is called once per frame
    void OnGUI()
    {
        GUI.skin  = ImageSliderSkin;
        GUI.depth = _Depth;

        if (ShowImageSlider)
        {
            GUI.DrawTexture(_BackgroundPadding.Add(_ImageSliderBox.rect), SliderBackground);
            GUI.DrawTexture(_ImageSliderBox.rect, _Images [_SelectedImageIndex]);
            if (GUI.Button(_PrevButton.rect, PrevTexture))
            {
                BounceButton(ButtonType.Previous);
                if (_SelectedImageIndex > 0)
                {
                    _SelectedImageIndex--;
                }
                else
                {
                    _SelectedImageIndex = _Images.Count - 1;
                }
            }
            if (GUI.Button(_NextButton.rect, NextTexture))
            {
                BounceButton(ButtonType.Next);
                if (_SelectedImageIndex < _Images.Count - 1)
                {
                    _SelectedImageIndex++;
                }
                else
                {
                    _SelectedImageIndex = 0;
                }
            }
        }
    }
Example #5
0
    public static bool LayoutButtonWithOffset(GUIContent guiContent, float height, RectOffset offset, GUIStyle style, params GUILayoutOption[] options)
    {
        Rect r = EditorGUILayout.GetControlRect(false, height, GUI.skin.button, options);

        r = offset.Add(r);
        return(GUI.Button(r, guiContent, style));
    }
Example #6
0
        // Non-Layout event
        private void CalculateNonLayoutData()
        {
            // Background image rendering
            if (Event.current.type == EventType.Repaint && _hasBackground)
            {
                Style.Draw(
                    ContentOffset.Add(ContentRectInternal),
                    false, false, false, false
                    );
            }

            // Clipspace
            if (Clip)
            {
                GUI.BeginClip(ContainerRectInternal);
                // Clipspace changes world space to local space
                ClipWorldPositionOffset       = ContainerRectInternal.position;
                ContentRectInternal.position -= ContainerRectInternal.position;

                ContainerRectInternal.position = Vector2.zero;
            }

            // Content offset
            NextEntryPosition = ContentRectInternal.position;
        }
Example #7
0
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            // refresh the data
            GetSettingsInformation(target as Token);

            if (info == null)
            {
                return;
            }

            if (styles == null)
            {
                styles = new Styles();
            }

            //Apply padding
            RectOffset previewPadding = new RectOffset(-5, -5, -5, -5);
            Rect       paddedr        = previewPadding.Add(r);

            GUI.Label(paddedr, info.value, styles.componentName);
        }
Example #8
0
    public static Vector3 WorldOrigin(Camera camera, UIAnchor.Side side, RectOffset offset, bool halfPixel)
    {
        Vector3 vector3 = new Vector3();

        UIAnchor.Flags flag;
        vector3.z = 0f;
        Rect  rect    = offset.Add(camera.pixelRect);
        float single  = rect.xMin;
        float single1 = rect.xMax;
        float single2 = rect.yMin;
        float single3 = rect.yMax;

        UIAnchor.Side side1   = side;
        float         single4 = single;
        float         single5 = single1;
        float         single6 = single2;
        float         single7 = single3;

        if (camera.isOrthoGraphic)
        {
            flag = (!halfPixel ? UIAnchor.Flags.CameraIsOrthographic : UIAnchor.Flags.CameraIsOrthographic | UIAnchor.Flags.HalfPixelOffset);
        }
        else if (!halfPixel)
        {
            flag = (UIAnchor.Flags) 0;
        }
        else
        {
            flag = UIAnchor.Flags.HalfPixelOffset;
        }
        UIAnchor.ScreenOrigin(side1, single4, single5, single6, single7, flag, out vector3.x, out vector3.y);
        return(camera.ScreenToWorldPoint(vector3));
    }
Example #9
0
    public static void SecondField(Rect drawRect, SerializedProperty prop)
    {
        RectOffset offset = new RectOffset(-(int)EditorGUIUtility.labelWidth, 0, 0, 0);

        drawRect = offset.Add(drawRect);
        EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
        drawRect = offset.Remove(drawRect);
    }
Example #10
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var code      = property.FindPropertyRelative("m_Glyph.m_Unicode");
            var name      = property.FindPropertyRelative("m_Glyph.m_Name");
            var font      = property.FindPropertyRelative("m_Font");
            var iconStyle = new GUIStyle {
                font = (Font)font.objectReferenceValue, fontSize = 16
            };

            var offset = new RectOffset(0, 0, -1, -3);

            position        = offset.Add(position);
            position.height = EditorGUIUtility.singleLineHeight;

            float offsetH = 0;

            offsetH -= EditorGUI.PrefixLabel(new Rect(position.x + offsetH, position.y, 40, position.height), label)
                       .width;

            offsetH += 40;

            if (!string.IsNullOrEmpty(name.stringValue))
            {
                var iconLabel = new GUIContent(IconDecoder.Decode(code.stringValue));
                EditorGUI.LabelField(new Rect(position.x + offsetH, position.y, 16, position.height), iconLabel,
                                     iconStyle);

                var iconWidth = iconStyle.CalcSize(iconLabel).x;
                offsetH += iconWidth + 2f;

                EditorGUI.LabelField(
                    new Rect(position.x + offsetH, position.y, position.width - offsetH - 80, position.height),
                    name.stringValue);
            }
            else
            {
                EditorGUI.LabelField(
                    new Rect(position.x + offsetH, position.y, position.width - 70 - 56, position.height),
                    "No icon selected");
            }

            if (GUI.Button(new Rect(position.width - 74, position.y, 70, position.height), "Pick Icon"))
            {
                VectorImagePickerWindow.Show(
                    (VectorImageData)fieldInfo.GetValue(property.serializedObject.targetObject),
                    property.serializedObject.targetObject);
            }
            if (GUI.Button(new Rect(position.width - 2, position.y, 18, position.height), IconDecoder.Decode(@"\ue14c"),
                           new GUIStyle {
                font = VectorImageManager.GetIconFont(VectorImageManager.materialDesignIconsFontName)
            }))
            {
                var data = (VectorImageData)fieldInfo.GetValue(property.serializedObject.targetObject);
                data.font  = null;
                data.glyph = null;
                EditorUtility.SetDirty(property.serializedObject.targetObject);
            }
        }
Example #11
0
        private void DrawToolbar()
        {
            Rect       r      = EditorGUILayout.GetControlRect();
            RectOffset offset = new RectOffset(toolbarOffsetX, toolbarOffsetX, 0, 0);

            GUI.Box(offset.Add(r), string.Empty, EditorStyles.toolbar);

            OnToolbarGUI(r);
        }
 public void DrawWrapper(ref Rect position)
 {
     if (HasProperty() == false)
     {
         return;
     }
     GUI.Box(position, GUIContent.none, EditorStyles.helpBox);
     position = wrapperPadding.Add(position);
 }
Example #13
0
    static int Add(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        RectOffset obj  = LuaScriptMgr.GetNetObject <RectOffset>(L, 1);
        Rect       arg0 = LuaScriptMgr.GetNetObject <Rect>(L, 2);
        Rect       o    = obj.Add(arg0);

        LuaScriptMgr.PushValue(L, o);
        return(1);
    }
    void OnGUI()
    {
        Rect       btn_back_pos    = new Rect(0.0f, 0.0f, Screen.width / 3, Screen.width / 10);
        RectOffset btn_back_offset = new RectOffset((int)-Screen.width / 10, (int)Screen.width / 10, (int)-Screen.height / 40, (int)Screen.height / 40);

        btn_back_pos = btn_back_offset.Add(btn_back_pos);
        if (GUI.Button(btn_back_pos, "Menu", m_BackButtonSkin.button))
        {
            Application.LoadLevel(Utils.menu_level);
        }
    }
Example #15
0
 public override void OnPreviewGUI(Rect r, GUIStyle background)
 {
     if (Event.current.type == EventType.Repaint)
     {
         VideoClipImporter videoClipImporter = (VideoClipImporter)this.target;
         RectOffset        rectOffset        = new RectOffset(-5, -5, -5, -5);
         r        = rectOffset.Add(r);
         r.height = EditorGUIUtility.singleLineHeight;
         Rect rect  = r;
         Rect rect2 = r;
         rect.width  = 120f;
         rect2.xMin += 120f;
         rect2.width = 200f;
         this.ShowProperty(ref rect, ref rect2, "Original Size", EditorUtility.FormatBytes((long)videoClipImporter.sourceFileSize));
         this.ShowProperty(ref rect, ref rect2, "Imported Size", EditorUtility.FormatBytes((long)videoClipImporter.outputFileSize));
         int    frameCount = videoClipImporter.frameCount;
         double frameRate  = videoClipImporter.frameRate;
         string arg_FD_0;
         if (frameRate > 0.0)
         {
             arg_FD_0 = TimeSpan.FromSeconds((double)frameCount / frameRate).ToString();
         }
         else
         {
             TimeSpan timeSpan = new TimeSpan(0L);
             arg_FD_0 = timeSpan.ToString();
         }
         string text = arg_FD_0;
         if (text.IndexOf('.') != -1)
         {
             text = text.Substring(0, text.Length - 4);
         }
         this.ShowProperty(ref rect, ref rect2, "Duration", text);
         this.ShowProperty(ref rect, ref rect2, "Frames", frameCount.ToString());
         this.ShowProperty(ref rect, ref rect2, "FPS", frameRate.ToString("F2"));
         int resizeWidth  = videoClipImporter.GetResizeWidth(VideoResizeMode.OriginalSize);
         int resizeHeight = videoClipImporter.GetResizeHeight(VideoResizeMode.OriginalSize);
         this.ShowProperty(ref rect, ref rect2, "Pixels", resizeWidth + "x" + resizeHeight);
         this.ShowProperty(ref rect, ref rect2, "PAR", videoClipImporter.pixelAspectRatioNumerator + ":" + videoClipImporter.pixelAspectRatioDenominator);
         this.ShowProperty(ref rect, ref rect2, "Alpha", (!videoClipImporter.sourceHasAlpha) ? "No" : "Yes");
         ushort sourceAudioTrackCount = videoClipImporter.sourceAudioTrackCount;
         this.ShowProperty(ref rect, ref rect2, "Audio", (sourceAudioTrackCount != 0) ? ((sourceAudioTrackCount != 1) ? "" : this.GetAudioTrackDescription(videoClipImporter, 0)) : "none");
         if (sourceAudioTrackCount > 1)
         {
             rect.xMin  += 30f;
             rect.width -= 30f;
             for (ushort num = 0; num < sourceAudioTrackCount; num += 1)
             {
                 this.ShowProperty(ref rect, ref rect2, "Track #" + (int)(num + 1), this.GetAudioTrackDescription(videoClipImporter, num));
             }
         }
     }
 }
Example #16
0
    // Token: 0x06004BFB RID: 19451 RVA: 0x00129178 File Offset: 0x00127378
    public static Vector3 WorldOrigin(Camera camera, global::UIAnchor.Side side, RectOffset offset, bool halfPixel)
    {
        Vector3 vector;

        vector.z = 0f;
        Rect  rect = offset.Add(camera.pixelRect);
        float xMin = rect.xMin;
        float xMax = rect.xMax;
        float yMin = rect.yMin;
        float yMax = rect.yMax;

        global::UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, (!camera.isOrthoGraphic) ? ((!halfPixel) ? ((global::UIAnchor.Flags) 0) : global::UIAnchor.Flags.HalfPixelOffset) : ((!halfPixel) ? global::UIAnchor.Flags.CameraIsOrthographic : (global::UIAnchor.Flags.CameraIsOrthographic | global::UIAnchor.Flags.HalfPixelOffset)), out vector.x, out vector.y);
        return(camera.ScreenToWorldPoint(vector));
    }
Example #17
0
        private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(index);

            RectOffset rectOffset = new RectOffset(0, 0, -2, -2);

            rect        = rectOffset.Add(rect);
            rect.height = EditorGUIUtility.singleLineHeight;

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUI.PropertyField(rect, element, true);
            }
        }
Example #18
0
    public static Vector3 WorldOrigin(Camera camera, Side side, RectOffset offset, float depthOffset, float relativeOffsetX, float relativeOffsetY, bool halfPixel)
    {
        Vector3 vector;

        vector.z = depthOffset;
        Rect  rect = offset.Add(camera.pixelRect);
        float xMin = rect.xMin;
        float xMax = rect.xMax;
        float yMin = rect.yMin;
        float yMax = rect.yMax;

        ScreenOrigin(side, xMin, xMax, yMin, yMax, relativeOffsetX, relativeOffsetY, !camera.isOrthoGraphic ? (!halfPixel ? ((Flags)0) : Flags.HalfPixelOffset) : (!halfPixel ? Flags.CameraIsOrthographic : (Flags.CameraIsOrthographic | Flags.HalfPixelOffset)), out vector.x, out vector.y);
        return(camera.ScreenToWorldPoint(vector));
    }
Example #19
0
        private void DrawToolbar()
        {
            GUI.enabled = !EditorApplication.isCompiling;
            Rect       r      = EditorGUILayout.GetControlRect();
            RectOffset offset = new RectOffset(4, 4, 0, 0);

            GUI.Box(offset.Add(r), string.Empty, EditorStyles.toolbar);

            Rect       searchBoxRect   = new Rect(r.max.x - 200, r.min.y, 200, r.height);
            RectOffset searchBoxOffset = new RectOffset(0, 0, 2, 2);

            SearchString = EditorGUI.TextField(searchBoxOffset.Remove(searchBoxRect), SearchString, EditorStyles.toolbarTextField);
            GUI.enabled  = true;
        }
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (target == null)
            {
                return;
            }

            GameObject targetGameObject = target as GameObject;

            if (targetGameObject == null)
            {
                return;
            }

            NetworkIdentity identity = targetGameObject.GetComponent <NetworkIdentity>();

            if (identity == null)
            {
                return;
            }

            if (styles == null)
            {
                styles = new Styles();
            }


            // padding
            RectOffset previewPadding = new RectOffset(-5, -5, -5, -5);
            Rect       paddedr        = previewPadding.Add(r);

            //Centering
            float initialX = paddedr.x + 10;
            float Y        = paddedr.y + 10;

            Y = DrawNetworkIdentityInfo(identity, initialX, Y);

            Y = DrawNetworkBehaviors(identity, initialX, Y);

            Y = DrawObservers(identity, initialX, Y);

            _ = DrawOwner(identity, initialX, Y);
        }
 public override void ShowOverlay()
 {
     if (this.HasSelectedinstruction())
     {
         IMGUILayoutInstruction iMGUILayoutInstruction = this.m_LayoutInstructions[this.m_ListViewState.row];
         RectOffset             rectOffset             = new RectOffset();
         rectOffset.left   = iMGUILayoutInstruction.marginLeft;
         rectOffset.right  = iMGUILayoutInstruction.marginRight;
         rectOffset.top    = iMGUILayoutInstruction.marginTop;
         rectOffset.bottom = iMGUILayoutInstruction.marginBottom;
         this.m_FakeMargingStyleForOverlay.padding = rectOffset;
         Rect rect = iMGUILayoutInstruction.unclippedRect;
         rect = rectOffset.Add(rect);
         this.m_GuiViewDebuggerWindow.HighlightInstruction(this.m_GuiViewDebuggerWindow.m_Inspected, rect, this.m_FakeMargingStyleForOverlay);
     }
 }
        /// <summary>
        /// Targetと引数SOが参照しているものは同じだが、場合によってTargetがポインタ型の場合があるためプロパティを変更したい場合はSOの方を使用してください。
        /// </summary>
        /// <param name="position"></param>
        /// <param name="SO"></param>
        /// <param name="rowHeight"></param>
        /// <returns></returns>
        protected override (bool doApply, GUILayoutPosition nextPos) OnDrawElementsBefore(GUILayoutPosition position, SerializedObject SO, float rowHeight)
        {
            position.IncrementRow();
            var        labelPos = position.GetSplitPos(layoutPosDivideCount, 0);
            RectOffset offset   = new RectOffset((int)(labelPos.width * -0.1f), 0, 0, 0);

            labelPos = offset.Add(labelPos);
            EditorGUI.LabelField(labelPos, "Used Type");

            bool doApply          = false;
            bool enableUpdateType = true;
            //UsedUnityObjectAttributeが指定されていたら型は固定し、そうでなければ選択できるようにする
            var instance = SO.targetObject as TDictionary;

            if (Target.CurrentType == SerializedTarget.Type.SerializedProperty &&
                UsedTypeAttribute.SetTypeFromFieldInfo(Target.SerializedProperty.GetFieldInfo(), instance))
            {
                var typeNameProp = SO.FindProperty("_typeName");
                Assert.IsNotNull(typeNameProp, $"{Target.SerializedProperty.propertyPath}");
                if (typeNameProp.stringValue != instance.HasType.FullName)
                {
                    typeNameProp.stringValue = instance.HasType.FullName;
                    var typeCache = GetOrCreateTypeCahce(SO, out bool _);
                    typeCache.CurrentType = instance.HasType;
                    doApply = true;
                }
                enableUpdateType = false;
            }

            doApply |= DrawTypePopUp(SO, position, enableUpdateType);

            if (doApply)
            {
                var typeNameProp = SO.FindProperty("_typeName");
                if (typeNameProp.stringValue != _typeCache.CurrentType.FullName)
                {
                    typeNameProp.stringValue = _typeCache.CurrentType.FullName;
                    SO.FindProperty("_values").ClearArray();
                    SO.ApplyModifiedProperties();
                }

                var inst = SO.targetObject as TDictionary;
                inst.Refresh();
            }

            return(doApply, position);
        }
Example #23
0
    public static void DrawIconOverLast(Texture2D t, RectOffset o = null)
    {
        Color last = GUI.color;

        GUI.color = EditorGUIUtility.isProSkin ? Color.white : Color.grey;
        Rect  p = GUILayoutUtility.GetLastRect();
        float h = p.height;

        p.xMin  = p.xMax - h;
        p.width = h;
        if (o != null)
        {
            p = o.Add(p);
        }
        GUI.DrawTexture(p, t);
        GUI.color = last;
    }
 public override void ShowOverlay()
 {
     if (this.HasSelectedinstruction())
     {
         IMGUILayoutInstruction instruction = this.m_LayoutInstructions[base.m_ListViewState.row];
         RectOffset             offset      = new RectOffset {
             left   = instruction.marginLeft,
             right  = instruction.marginRight,
             top    = instruction.marginTop,
             bottom = instruction.marginBottom
         };
         this.m_FakeMargingStyleForOverlay.padding = offset;
         Rect unclippedRect = instruction.unclippedRect;
         unclippedRect = offset.Add(unclippedRect);
         base.m_GuiViewDebuggerWindow.HighlightInstruction(base.m_GuiViewDebuggerWindow.m_Inspected, unclippedRect, this.m_FakeMargingStyleForOverlay);
     }
 }
Example #25
0
 public override void OnPreviewGUI(Rect r, GUIStyle background)
 {
     if (Event.current.type == EventType.Repaint)
     {
         if (this.m_Styles == null)
         {
             this.m_Styles = new LayoutPropertiesPreview.Styles();
         }
         GameObject    gameObject    = this.target as GameObject;
         RectTransform rectTransform = gameObject.transform as RectTransform;
         if (!(rectTransform == null))
         {
             RectOffset rectOffset = new RectOffset(-5, -5, -5, -5);
             r        = rectOffset.Add(r);
             r.height = EditorGUIUtility.singleLineHeight;
             Rect position  = r;
             Rect position2 = r;
             Rect position3 = r;
             position.width  = 110f;
             position2.xMin += 110f;
             position2.width = 100f;
             position3.xMin += 210f;
             GUI.Label(position, "Property", this.m_Styles.headerStyle);
             GUI.Label(position2, "Value", this.m_Styles.headerStyle);
             GUI.Label(position3, "Source", this.m_Styles.headerStyle);
             position.y  += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
             position2.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
             position3.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
             ILayoutElement source = null;
             this.ShowProp(ref position, ref position2, ref position3, "Min Width", LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.minWidth, 0f, out source).ToString(), source);
             this.ShowProp(ref position, ref position2, ref position3, "Min Height", LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.minHeight, 0f, out source).ToString(), source);
             this.ShowProp(ref position, ref position2, ref position3, "Preferred Width", LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.preferredWidth, 0f, out source).ToString(), source);
             this.ShowProp(ref position, ref position2, ref position3, "Preferred Height", LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.preferredHeight, 0f, out source).ToString(), source);
             float layoutProperty = LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.flexibleWidth, 0f, out source);
             this.ShowProp(ref position, ref position2, ref position3, "Flexible Width", (layoutProperty <= 0f) ? "disabled" : ("enabled (" + layoutProperty.ToString() + ")"), source);
             layoutProperty = LayoutUtility.GetLayoutProperty(rectTransform, (ILayoutElement e) => e.flexibleHeight, 0f, out source);
             this.ShowProp(ref position, ref position2, ref position3, "Flexible Height", (layoutProperty <= 0f) ? "disabled" : ("enabled (" + layoutProperty.ToString() + ")"), source);
             if (!rectTransform.GetComponent <LayoutElement>())
             {
                 Rect position4 = new Rect(position.x, position.y + 10f, r.width, EditorGUIUtility.singleLineHeight);
                 GUI.Label(position4, "Add a LayoutElement to override values.", this.m_Styles.labelStyle);
             }
         }
     }
 }
    private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
    {
        SerializedProperty itemData   = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
        SerializedProperty itemPrefab = itemData.FindPropertyRelative("m_Prefab");
        SerializedProperty itemAmount = itemData.FindPropertyRelative("m_Amount");
        SerializedProperty itemType   = itemData.FindPropertyRelative("m_Type");

        RectOffset offset = new RectOffset(0, 0, -1, -3);

        rect        = offset.Add(rect);
        rect.height = EditorGUIUtility.singleLineHeight;

        EditorGUI.PropertyField(rect, itemPrefab, new GUIContent("Prefab"));
        rect.y += EditorGUIUtility.singleLineHeight + 2;
        EditorGUI.PropertyField(rect, itemAmount, new GUIContent("Amount"));
        rect.y += EditorGUIUtility.singleLineHeight + 2;
        EditorGUI.PropertyField(rect, itemType, new GUIContent("Type"));
    }
        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            var spline = (Bezier3DSpline)target;

            var rectOffset = new RectOffset(
                -5,
                -5,
                -5,
                -5);

            rect = rectOffset.Add(rect);

            var position1 = rect;

            position1.width = 110f;

            var position2 = rect;

            position2.xMin += 110f;
            position2.width = 110f;

            EditorGUI.LabelField(position1, "Property", CurveEditorStyles.HeaderStyle);
            EditorGUI.LabelField(position2, "Value", CurveEditorStyles.HeaderStyle);

            position1.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            position2.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            DrawProperty(
                ref position1,
                ref position2,
                "Point Count",
                spline.KnotCount.ToString());

            DrawProperty(
                ref position1,
                ref position2,
                "Total Length",
                spline.TotalLength.ToString("F"));
        }
    private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
    {
        SerializedProperty itemData   = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
        SerializedProperty itemCanUse = itemData.FindPropertyRelative("m_CanUse");
        SerializedProperty itemPrefab = itemData.FindPropertyRelative("m_Prefab");

        RectOffset offset = new RectOffset(0, 0, -1, -3);

        rect        = offset.Add(rect);
        rect.height = EditorGUIUtility.singleLineHeight;

        float width = rect.width;

        rect.width = 16f;
        EditorGUI.PropertyField(rect, itemCanUse, GUIContent.none);
        rect.x    += 16f;
        rect.width = width - 16f;
        EditorGUI.PropertyField(rect, itemPrefab, GUIContent.none);
    }
Example #29
0
        private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
        {
            if (EditorApplication.isCompiling)
            {
                return;
            }

            if (UGBIcon == null)
            {
                return;
            }

            GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;

            if (gameObject == null)
            {
                return;
            }

            var view = gameObject.GetComponent <Game>();

            if (view == null)
            {
                return;
            }

            if (!view.mTesting)
            {
                GUI.color = new Color(0.5f, 1, 0, .2f);
            }
            else
            {
                GUI.color = new Color(1, 1, 0, .2f);
            }

            GUI.Box(mOffset.Add(selectionRect), "");


            GUI.color = Color.white;
            Rect rect = new Rect(selectionRect.x + selectionRect.width - 32f, selectionRect.y - 6, 32f, 32f);

            GUI.DrawTexture(rect, UGBIcon);
        }
Example #30
0
    public static int Add(IntPtr l)
    {
        int result;

        try
        {
            RectOffset rectOffset = (RectOffset)LuaObject.checkSelf(l);
            Rect       rect;
            LuaObject.checkValueType <Rect>(l, 2, out rect);
            Rect rect2 = rectOffset.Add(rect);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, rect2);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }