当前位置: 首页>>代码示例>>C#>>正文


C# Rect.RightOf方法代码示例

本文整理汇总了C#中UnityEngine.Rect.RightOf方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.RightOf方法的具体用法?C# Rect.RightOf怎么用?C# Rect.RightOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rect的用法示例。


在下文中一共展示了Rect.RightOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public void Draw(Rect bouds)
        {

            //PlatformDrawer.DrawStretchBox(bouds, CachedStyles.BreadcrumbBoxStyle, 11);
           

            bouds = bouds.Pad(15,0,0,0);

            var stepButtonRect = new Rect().Align(bouds).WithSize(75, 65);
            var continueButtonRect = stepButtonRect.RightOf(stepButtonRect);

            var stepIconRect = new Rect().WithSize(31, 31).Align(stepButtonRect).AlignVerticallyByCenter(stepButtonRect).Translate(0,7);
            var continueIconRect = new Rect().WithSize(31, 31).Align(continueButtonRect).AlignVerticallyByCenter(continueButtonRect).Translate(0, 7);

            var stepTitleRectr = new Rect().WithSize(75, 20).InnerAlignWithBottomCenter(stepButtonRect).Translate(0,-5);
            var continueTitleRectr = new Rect().WithSize(75, 20).InnerAlignWithBottomCenter(continueButtonRect).Translate(0, -5);


            PlatformDrawer.SetTooltipForRect(stepButtonRect,"Step to the next action");
            PlatformDrawer.DoButton(stepButtonRect,"", CachedStyles.WizardActionButtonStyle, DoStep);

            PlatformDrawer.SetTooltipForRect(continueButtonRect, "Continue normal execution");
            PlatformDrawer.DoButton(continueButtonRect, "", CachedStyles.WizardActionButtonStyle, DoContinue);

            PlatformDrawer.DrawImage(stepIconRect,"StepIcon",true);
            PlatformDrawer.DrawImage(continueIconRect, "PlayIcon", true);

            PlatformDrawer.DrawLabel(stepTitleRectr,"Step",CachedStyles.BreadcrumbTitleStyle,DrawingAlignment.MiddleCenter);
            PlatformDrawer.DrawLabel(continueTitleRectr, "Continue", CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleCenter);

        }
开发者ID:InvertGames,项目名称:uFrame.Editor,代码行数:31,代码来源:DebugPanelUISystem.cs

示例2: DrawActionsPanel

        //TODO WIZARDS: Add scrolling (drawer needs to be extended to support scrolling / or use native unity stuff)
        public void DrawActionsPanel(IPlatformDrawer platform, Rect bounds, List<ActionItem> actions, Action<ActionItem,Vector2> primaryAction,
            Action<ActionItem,Vector2> secondaryAction = null)
        {
            platform.DrawStretchBox(bounds, CachedStyles.WizardSubBoxStyle, 13);

            bounds = bounds.PadSides(15);
            var headerRect = new Rect(bounds.WithHeight(40));

            platform.DrawLabel(headerRect, "Actions", CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.TopCenter);

            bounds = bounds.Below(headerRect).Clip(bounds);

            var buttonSize = 100;
            var buttonsPerRow = (int)bounds.width / (int)buttonSize;
            var buttonIndex = 0;
            var padding = (bounds.width % buttonSize) / (buttonsPerRow - 1);
            var itemRect = new Rect().Align(bounds).WithSize(buttonSize, buttonSize);

            foreach (var action in actions)
            {

                platform.DrawStretchBox(itemRect, CachedStyles.WizardActionButtonStyle, 0);

                var action1 = action;
                platform.DoButton(itemRect,"",CachedStyles.ClearItemStyle, m =>
                {
                    primaryAction(action1, m);
                }, m =>
                {
                    if (secondaryAction != null)
                    {
                        secondaryAction(action1, m);
                    }
                });

                var imageRect = itemRect
                    .WithSize(41, 41)
                    .CenterInsideOf(itemRect)
                    .AlignHorisontally(itemRect)
                    .Translate(0, 10);

                var titleRect = itemRect
                    .Below(imageRect)
                    .Clip(itemRect)
                    .Pad(5, 0, 10, 0)
                    .Translate(0, -2);

                platform.DrawImage(imageRect, string.IsNullOrEmpty(action.Icon) ? "CreateEmptyDatabaseIcon" : action.Icon, true);
                platform.DrawLabel(titleRect, action.Title, CachedStyles.ListItemTitleStyle, DrawingAlignment.MiddleCenter);

                buttonIndex++;

                if (buttonIndex % buttonsPerRow == 0)
                {
                    itemRect = itemRect.Below(itemRect).AlignVertically(bounds).Translate(0, 10);
                }
                else
                {
                    itemRect = itemRect.RightOf(itemRect).Translate(padding, 0);
                }

            }
        }
开发者ID:InvertGames,项目名称:uFrame.Editor,代码行数:64,代码来源:ActionsUISystem.cs


注:本文中的UnityEngine.Rect.RightOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。