本文整理汇总了C#中UnityEngine.Rect.RightHalf方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.RightHalf方法的具体用法?C# Rect.RightHalf怎么用?C# Rect.RightHalf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rect
的用法示例。
在下文中一共展示了Rect.RightHalf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGraphManagementWizard
private void DrawGraphManagementWizard(Rect obj)
{
var listRect = obj.RightHalf().PadSides(2);
var controlRect = obj.LeftHalf().BottomHalf().PadSides(2);
var actionRect = obj.LeftHalf().TopHalf().PadSides(2);
var actions = new List<ActionItem>();
Signal<IQueryGraphsActions>(_=>_.QueryGraphsAction(actions));
DrawGraphsList(listRect, Repository.AllOf<IGraphData>()
.OrderBy(_ => WorkspaceService.CurrentWorkspace != null && !WorkspaceService.CurrentWorkspace.Graphs.Contains(_))
.ThenBy(_=>_.Name)
.ToList());
Signal<IDrawActionsPanel>(_=>_.DrawActionsPanel(PlatformDrawer,actionRect,actions, (i, m) =>
{
SelectedAction = i;
}));
if (SelectedAction != null)
{
Signal<IDrawActionDialog>(_=>_.DrawActionDialog(PlatformDrawer,controlRect,SelectedAction, () =>
{
SelectedAction = null;
}));
}
var closeButtonBounds = new Rect().WithSize(80, 30).InnerAlignWithBottomRight(listRect.PadSides(15));
PlatformDrawer.DoButton(closeButtonBounds, "Close", ElementDesignerStyles.ButtonStyle, () => EnableGraphManagementhWizard = false);
}
示例2: DrawDatabasesWizard
public void DrawDatabasesWizard(Rect bounds)
{
// platform.DrawStretchBox(bounds, CachedStyles.WizardBoxStyle, 13);
var actions = new List<ActionItem>();
var items = new List<DatabasesListItem>();
var databasesActionsBounds = bounds.LeftHalf().TopHalf().PadSides(2);
var databasesListBounds = bounds.RightHalf().PadSides(2);
var databasesActionInspectorBounds = bounds.LeftHalf().BottomHalf().PadSides(2);
var closeButtonBounds = new Rect().WithSize(80, 30).InnerAlignWithBottomRight(databasesListBounds.PadSides(15));
Signal<IQueryDatabasesActions>(_ => _.QueryDatabasesActions(actions));
Signal<IQueryDatabasesListItems>(_ => _.QueryDatabasesListItems(items));
Signal<IDrawActionsPanel>(_ => _.DrawActionsPanel(Drawer, databasesActionsBounds, actions,(a,m)=> SelectedItem = a));
Signal<IDrawActionDialog>(_ => _.DrawActionDialog(Drawer, databasesActionInspectorBounds,SelectedItem,()=> SelectedItem = null));
Signal<IDrawDatabasesList>(_ => _.DrawDatabasesList(Drawer, databasesListBounds, items));
Drawer.DoButton(closeButtonBounds, "Close", ElementDesignerStyles.DarkButtonStyle, () => EnableWizard = false);
}
示例3: DrawInspector
public virtual void DrawInspector(Rect rect, PropertyFieldViewModel d, GUIStyle labelStyle)
{
var colorCache = GUI.color;
GUI.color = Color.white;
var labelArea = rect.LeftHalf();
var fieldArea = rect.RightHalf();
var labelWidtho = GUILayout.Width(140);
if (d.InspectorType == InspectorType.GraphItems)
{
var item = d.CachedValue as IGraphItem;
var text = "--Select--";
if (item != null)
{
text = item.Label;
}
//GUILayout.BeginHorizontal();
if (GUI.Button(rect, d.Label + ": " + text, ElementDesignerStyles.ButtonStyle))
{
var type = d.Type;
var items = InvertGraphEditor.CurrentDiagramViewModel.CurrentRepository.AllOf<IGraphItem>().Where(p => type.IsAssignableFrom(p.GetType()));
var menu = new SelectionMenu();
menu.AddItem(new SelectionMenuItem(string.Empty,"[None]", () =>
{
InvertApplication.Execute(() =>
{
d.Setter(d.DataObject, null);
});
}));
foreach (var graphItem in items)
{
var graphItem1 = graphItem;
menu.AddItem(new SelectionMenuItem(graphItem1, () =>
{
InvertApplication.Execute(() =>
{
d.Setter(d.DataObject, graphItem1);
});
}));
}
InvertApplication.SignalEvent<IShowSelectionMenu>(_ => _.ShowSelectionMenu(menu));
//
// InvertGraphEditor.WindowManager.InitItemWindow(items,
//
// },true);
}
SetTooltipForRect(rect, d.InspectorTip);
GUI.color = colorCache;
//GUILayout.EndHorizontal();
return;
}
if (d.Type == typeof(string))
{
if (d.InspectorType == InspectorType.TextArea)
{
labelArea = rect.WithHeight(17).InnerAlignWithUpperRight(rect);
fieldArea = rect.Below(labelArea).Clip(rect).PadSides(2);
EditorGUI.LabelField(labelArea, d.Name, labelStyle);
SetTooltipForRect(rect, d.InspectorTip);
EditorGUI.BeginChangeCheck();
d.CachedValue = EditorGUI.TextArea(fieldArea, (string)d.CachedValue, TextWrappingTextArea);
if (EditorGUI.EndChangeCheck())
{
d.Setter(d.DataObject, d.CachedValue);
}
if (Event.current.isKey && Event.current.keyCode == KeyCode.Return)
{
InvertApplication.Execute(() =>
{
});
}
}
else if (d.InspectorType == InspectorType.TypeSelection)
{
if (GUI.Button(rect, (string)d.CachedValue))
{
d.NodeViewModel.Select();
// TODO 2.0 Open Selection?
}
SetTooltipForRect(rect, d.InspectorTip);
}
else
{
EditorGUI.BeginChangeCheck();
//.........这里部分代码省略.........
示例4: DrawBreadcrumbs
public void DrawBreadcrumbs(IPlatformDrawer platform, float y)
{
var navPanelRect = new Rect(4, y, 60, 30f);
var breadcrumbsRect = new Rect(64, y, Bounds.width-44, 30f);
platform.DrawRect(Bounds.WithOrigin(0,y).WithHeight(30), InvertGraphEditor.Settings.BackgroundColor);
var back = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.LeftHalf());
platform.DoButton(back, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
() =>
{
InvertApplication.Execute(new NavigateBackCommand());
});
platform.DrawImage(back.PadSides(4), "BackIcon", true);
var forward = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.RightHalf());
platform.DoButton(forward, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
() =>
{
InvertApplication.Execute(new NavigateForwardCommand());
});
platform.DrawImage(forward.PadSides(4),"ForwardIcon",true);
//var color = new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.8f, InvertGraphEditor.Settings.BackgroundColor.g * 0.8f, InvertGraphEditor.Settings.BackgroundColor.b * 0.8f, 1f);
//platform.DrawRect(rect, color);
// var lineRect = new Rect(rect);
// lineRect.height = 2;
// lineRect.y = y + 38f;
// platform.DrawRect(lineRect, new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.6f, InvertGraphEditor.Settings.BackgroundColor.g * 0.6f, InvertGraphEditor.Settings.BackgroundColor.b * 0.6f, 1f));
//
//
// var first = true;
// if (_cachedPaths != null)
// foreach (var item in _cachedPaths)
// {
// var item1 = item;
// platform.DoButton(new Rect(x, rect.y + 20 - (item.Value.y / 2), item.Value.x, item.Value.y), first ? item.Key.Name : "< " + item.Key.Name, first ? CachedStyles.GraphTitleLabel : CachedStyles.ItemTextEditingStyle,
// () =>
// {
// InvertApplication.Execute(new LambdaCommand(() =>
// {
// DiagramViewModel.GraphData.PopToFilter(item1.Key);
// }));
// });
// x += item.Value.x + 15;
// first = false;
// }
var x = 1f;
var styles = DiagramViewModel.NavigationViewModel.BreadcrumbsStyle;
var iconsTine = new Color(1, 1, 1, 0.5f);
foreach (var usitem in DiagramViewModel.NavigationViewModel.Breadcrubs.ToArray())
{
var item = usitem;
var textSize = platform.CalculateTextSize(usitem.Title, CachedStyles.BreadcrumbTitleStyle);
float buttonContentPadding = 5;
float buttonIconsPadding= 5;
bool useSpecIcon = !string.IsNullOrEmpty(item.SpecializedIcon);
var buttonWidth = textSize.x + buttonContentPadding*2 + 8;
if (!string.IsNullOrEmpty(item.Icon)) buttonWidth += buttonIconsPadding + 16;
if (useSpecIcon) buttonWidth += buttonIconsPadding + 16;
var buttonRect = new Rect()
.AlignAndScale(breadcrumbsRect)
.WithWidth(buttonWidth)
.PadSides(3)
.Translate(x, 0);
var icon1Rect = new Rect()
.WithSize(16, 16)
.AlignTopRight(buttonRect)
.AlignHorisonallyByCenter(buttonRect)
.Translate(-buttonContentPadding, 0);
var icon2Rect = new Rect()
.WithSize(16, 16)
.Align(buttonRect)
.AlignHorisonallyByCenter(buttonRect)
.Translate(buttonContentPadding, 0);
var textRect = new Rect()
.WithSize(textSize.x, textSize.y)
.Align(useSpecIcon ? icon2Rect : buttonRect)
.AlignHorisonallyByCenter(buttonRect)
.Translate(useSpecIcon ? buttonIconsPadding + 16 : buttonContentPadding, -1);
var dotRect = new Rect()
.WithSize(16, 16)
.RightOf(buttonRect)
.AlignHorisonallyByCenter(buttonRect)
.Translate(-3,0);
platform.DoButton(buttonRect, "", item.State == NavigationItemState.Current ? CachedStyles.BreadcrumbBoxActiveStyle : CachedStyles.BreadcrumbBoxStyle, item.NavigationAction);
platform.DrawLabel(textRect, item.Title, CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleCenter);
platform.DrawImage(icon1Rect, styles.GetIcon(item.Icon,iconsTine), true);
//.........这里部分代码省略.........
示例5: DrawWorkspacesWizard
public void DrawWorkspacesWizard( Rect bounds)
{
var actions = new List<ActionItem>();
var items = new List<WorkspacesListItem>();
var databasesActionsBounds = bounds.LeftHalf().TopHalf().PadSides(2);
var databasesListBounds = bounds.RightHalf().PadSides(2);
var databasesActionInspectorBounds = bounds.LeftHalf().BottomHalf().PadSides(2);
var closeButtonBounds = new Rect().WithSize(80, 30).InnerAlignWithBottomRight(databasesListBounds.PadSides(15));
Signal<IQueryWorkspacesActions>(_ => _.QueryWorkspacesActions(actions));
Signal<IQueryWorkspacesListItems>(_ => _.QueryWorkspacesListItems(items));
Signal<IDrawActionsPanel>(_ => _.DrawActionsPanel(Drawer, databasesActionsBounds, actions, (a, m) => SelectedAction = a));
Signal<IDrawActionDialog>(_ => _.DrawActionDialog(Drawer, databasesActionInspectorBounds, SelectedAction, () => SelectedAction = null));
Signal<IDrawWorkspacesList>(_ => _.DrawWorkspacesList(Drawer, databasesListBounds, items));
Drawer.DoButton(closeButtonBounds, "Close", ElementDesignerStyles.DarkButtonStyle, () =>
{
if (WorkspaceService.CurrentWorkspace == null)
{
Signal<INotify>(_ => _.Notify("You need to select or create a Workspace!", NotificationIcon.Info));
}
else
{
EnableWizard = false;
}
});
}