本文整理汇总了C#中UnityEngine.Rect.PixelPerfect方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.PixelPerfect方法的具体用法?C# Rect.PixelPerfect怎么用?C# Rect.PixelPerfect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rect
的用法示例。
在下文中一共展示了Rect.PixelPerfect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTagsPopup
private void DrawTagsPopup() {
if (this.showTagsPopup == false) return;
if (string.IsNullOrEmpty(this.tagCaption) == true) return;
var oldColor = GUI.color;
var tagStyles = FlowSystemEditor.GetTagStylesEdited();
var tagStyle = tagStyles[0];
tagStyle.stretchWidth = false;
tagStyle.margin = new RectOffset(0, 0, 2, 2);
var shadow = ME.Utilities.CacheStyle("FlowEditor.DrawTagsPopup.Styles", "ObjectPickerPreviewBackground");
var allTags = FlowSystem.GetTags();
if (allTags != null) {
var window = FlowSystem.GetWindow(this.showTagsPopupId);
var topOffset = 15f;
var backTopOffset = 12f;
var offset = 5f;
var count = 0;
foreach (var tag in allTags) {
if (tag.title.ToLower().Contains(this.tagCaption.ToLower()) == true && window != null && window.tags.Contains(tag.id) == false) {
++count;
}
}
if (count > 0) {
var r = this.showTagsPopupRect;
var elementHeight = r.height + tagStyle.margin.top + tagStyle.margin.bottom;
r.y += this.showTagsPopupRect.height * 2f + offset;
r.height = elementHeight * count + topOffset;
var scrollPos = -FlowSystem.GetScrollPosition();
var drawRect = new Rect(r.x - scrollPos.x, r.y - scrollPos.y - topOffset, r.width, r.height);
tagStyle.fixedWidth = drawRect.width;
GUI.BeginGroup(drawRect.PixelPerfect());
{
GUI.color = Color.black;
GUI.Label(new Rect(10f, backTopOffset, drawRect.width - 10f * 2f, drawRect.height - backTopOffset * 2f), string.Empty, shadow);
var buttonRect = new Rect(0f, topOffset, drawRect.width, elementHeight);
GUI.color = oldColor;
foreach (var tag in allTags) {
if (tag.title.ToLower().Contains(this.tagCaption.ToLower()) == true && window != null && window.tags.Contains(tag.id) == false) {
var style = tagStyles[tag.color];
if (GUI.Button(buttonRect, tag.title, style) == true) {
this.tagCaption = string.Empty;
this.showTagsPopupId = -1;
window.AddTag(tag);
}
buttonRect.y += elementHeight;
}
}
}
GUI.EndGroup();
}
}
GUI.color = oldColor;
this.Repaint();
}
示例2: OnGUI
public override void OnGUI() {
if (ABTesting.styles == null) ABTesting.styles = new Styles();
if (this.opened == true) {
var data = FlowSystem.GetData();
if (data == null) return;
const float closeSize = 50f;
var screenRect = new Rect(0f, 0f, Screen.width, Screen.height);
var settingsSize = new Vector2(350f, 500f);
var settingsRect = new Rect(screenRect.width * 0.5f - settingsSize.x * 0.5f, screenRect.height * 0.5f - settingsSize.y * 0.5f, settingsSize.x, settingsSize.y).PixelPerfect();
var settingsBackRect = new Rect(settingsRect.x - MARGIN, settingsRect.y - MARGIN, settingsRect.width + MARGIN * 2f, settingsRect.height + MARGIN * 2f).PixelPerfect();
var rectCloseButton = new Rect(settingsRect.x + settingsRect.width, settingsRect.y - closeSize * 0.5f, closeSize, closeSize).PixelPerfect();
GUI.Box(screenRect, string.Empty, ABTesting.styles.backLock);
GUI.Box(settingsBackRect, string.Empty, ABTesting.styles.dropShadow);
GUI.Box(settingsBackRect, string.Empty, ABTesting.styles.contentScreen);
GUI.Box(settingsRect, string.Empty, ABTesting.styles.layoutBack);
GUILayout.BeginArea(settingsRect.PixelPerfect());
this.tabs.selectedItem = this.selectedItem;
this.tabs.OnGUI();
GUILayout.EndArea();
if (GUI.Button(rectCloseButton, string.Empty, ABTesting.styles.closeButton) == true) {
this.flowEditor.SetEnabled();
this.opened = false;
}
}
}