當前位置: 首頁>>代碼示例>>C#>>正文


C# Rect.AddHeight方法代碼示例

本文整理匯總了C#中UnityEngine.Rect.AddHeight方法的典型用法代碼示例。如果您正苦於以下問題:C# Rect.AddHeight方法的具體用法?C# Rect.AddHeight怎麽用?C# Rect.AddHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Rect的用法示例。


在下文中一共展示了Rect.AddHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawActionDialog

        public void DrawActionDialog(IPlatformDrawer platform, Rect bounds, ActionItem item, Action cancel = null)
        {
            if (item == null) return;

            platform.DrawStretchBox(bounds, CachedStyles.WizardSubBoxStyle, 13);

            bounds = bounds.PadSides(15);

            var descriptionHeight = string.IsNullOrEmpty(item.Description) ? 50 : platform.CalculateTextHeight(item.Description, CachedStyles.BreadcrumbTitleStyle, bounds.width) + 60;

            var headerRect = bounds.WithHeight(40);
            var iconRect = bounds.WithSize(41, 41);
            
            var descriptionRect = headerRect.Below(headerRect).Translate(0,-22).WithHeight(descriptionHeight);
            var inspectorRect = bounds.Below(descriptionRect).Clip(bounds);
            var executeButtonRect = new Rect()
                .WithSize(100, 30)
                .InnerAlignWithBottomRight(bounds);

            if (!_inspectors.ContainsKey(item))
            {
                var uFrameMiniInspector = new uFrameMiniInspector(item.Command);
                _inspectors.Add(item, uFrameMiniInspector);
            }
            var inspector = _inspectors[item];
            var inspectorHeight = inspector.Height;


            _scrollPosition = GUI.BeginScrollView(bounds.AddHeight(-30).AddWidth(15), _scrollPosition,
                bounds.WithHeight(headerRect.height + iconRect.height + descriptionRect.height + inspectorHeight));

            platform.DrawLabel(headerRect, item.Title, CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.MiddleCenter);
            platform.DrawImage(iconRect, string.IsNullOrEmpty(item.Icon) ? "CreateEmptyDatabaseIcon" : item.Icon, true);
            platform.DrawLabel(descriptionRect, item.Description, CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleLeft);

            inspector.Draw(descriptionRect.WithHeight(inspectorHeight).Pad(0,0,10,0).Below(descriptionRect));

            //Draw generic inspector


                GUI.EndScrollView();
            if ( cancel != null)
            {
                platform.DoButton(executeButtonRect.InnerAlignWithBottomLeft(bounds), "Cancel", ElementDesignerStyles.DarkButtonStyle, cancel);
            }

            platform.DoButton(executeButtonRect, string.IsNullOrEmpty(item.Verb) ? "Create" : item.Verb, ElementDesignerStyles.DarkButtonStyle, () =>
            {
                InvertApplication.Execute(item.Command);
            });
        }
開發者ID:InvertGames,項目名稱:uFrame.Editor,代碼行數:51,代碼來源:ActionsUISystem.cs

示例2: DrawNavigationHistory

        public void DrawNavigationHistory(Rect rect)
        {
            GUIHelpers.IsInsepctor = false;
            if (Drawer == null) return;
            if (_updateRequired)
            {
                UpdateItems();
                _updateRequired = false;
            }

            Drawer.DrawStretchBox(rect, CachedStyles.WizardListItemBoxStyle, 10);


            if (!NavHistoryItems.Any())
            {
                var textRect = rect;
                var cacheColor = GUI.color;
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.4f);
                Drawer.DrawLabel(textRect, "No History", CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.MiddleCenter);
                GUI.color = cacheColor;
                return;
            }


            var clearButton = new Rect().WithSize(80, 33).InnerAlignWithBottomRight(rect).PadSides(5);
            Drawer.DoButton(clearButton, "Clear", ElementDesignerStyles.ButtonStyle,
                m =>
                {
                    Execute(new LambdaCommand("Clear Navigation History", () =>
                    {
                        Repository.RemoveAll<NavHistoryItem>();
                    }));
                });

            if (NavHistoryTree == null) return;
            if (NavHistoryTree.IsDirty) NavHistoryTree.Refresh();

            Signal<IDrawTreeView>(_ => _.DrawTreeView(rect.AddHeight(-28).PadSides(5), NavHistoryTree, (m, i) =>
            {

                               var bp = i as NavHistoryItem;
                if (bp != null)
                {
                    Execute(new NavigateByHistoryItemCommand()
                    {
                        Item = bp,
                    });
                }
            }));

        }
開發者ID:InvertGames,項目名稱:uFrame.Editor,代碼行數:51,代碼來源:NavigationHistoryUISystem.cs


注:本文中的UnityEngine.Rect.AddHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。