public static void ScrollView(Rect area, string title, ref SerializableVector2 scrollpos, Action code, int padding = 20, params GUILayoutOption[] options) { Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack); Drawing.DrawRect(MenuUtilities.Inline(area), MenuComponent._OutlineBorderLightGray); Rect inlined = MenuUtilities.Inline(area, 2); Drawing.DrawRect(inlined, MenuComponent._FillLightBlack); Color lastColor = _MenuTabStyle.normal.textColor; int lastFontSize = _MenuTabStyle.fontSize; _MenuTabStyle.normal.textColor = _MenuTabStyle.onNormal.textColor; _MenuTabStyle.fontSize = 15; Drawing.DrawRect(new Rect(inlined.x, inlined.y, inlined.width, _MenuTabStyle.CalcSize(new GUIContent(title)).y + 2), MenuComponent._OutlineBorderLightGray); GUILayout.BeginArea(inlined); { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); GUILayout.Label(title, _MenuTabStyle); _MenuTabStyle.normal.textColor = lastColor; _MenuTabStyle.fontSize = lastFontSize; GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); GUILayout.Space(2); Rect rects; Rect inner; GUILayout.BeginHorizontal(); { scrollpos = GUILayout.BeginScrollView(scrollpos.ToVector2(), false, true); { GUILayout.BeginHorizontal(); { GUILayout.Space(padding); GUILayout.BeginVertical(GUILayout.MinHeight(inlined.height)); { try { code(); } catch (Exception e) { DebugUtilities.Log($"SCROLLVIEW EXCEPTION: {e}"); } } GUILayout.EndVertical(); inner = GUILayoutUtility.GetLastRect(); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); rects = GUILayoutUtility.GetLastRect(); GUILayout.Space(1); } GUILayout.EndHorizontal(); GUILayout.Space(1); Drawing.DrawRect(new Rect(rects.x + rects.width - 16, rects.y, 16, rects.height), MenuComponent._FillLightBlack); if (inner.height - rects.height > 0) { VerticalSlider(new Rect(rects.x + 4, rects.y + 8, 12, rects.height - 14), 0, inner.height - rects.height, ref scrollpos.y); } } GUILayout.EndArea(); }
// Token: 0x06000238 RID: 568 RVA: 0x00015B20 File Offset: 0x00013D20 public static void ScrollView(Rect area, string title, ref SerializableVector2 scrollpos, Action code, int padding = 20, params GUILayoutOption[] options) { Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack, null); Drawing.DrawRect(MenuUtilities.Inline(area, 1), MenuComponent._OutlineBorderLightGray, null); Rect rect = MenuUtilities.Inline(area, 2); Drawing.DrawRect(rect, MenuComponent._FillLightBlack, null); Color textColor = Prefab._MenuTabStyle.normal.textColor; int fontSize = Prefab._MenuTabStyle.fontSize; Prefab._MenuTabStyle.normal.textColor = Prefab._MenuTabStyle.onNormal.textColor; Prefab._MenuTabStyle.fontSize = 15; Drawing.DrawRect(new Rect(rect.x, rect.y, rect.width, Prefab._MenuTabStyle.CalcSize(new GUIContent(title)).y + 2f), MenuComponent._OutlineBorderLightGray, null); GUILayout.BeginArea(rect); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.Label(title, Prefab._MenuTabStyle, Array.Empty <GUILayoutOption>()); Prefab._MenuTabStyle.normal.textColor = textColor; Prefab._MenuTabStyle.fontSize = fontSize; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(2f); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); scrollpos = GUILayout.BeginScrollView(scrollpos.ToVector2(), false, true, Array.Empty <GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Space((float)padding); GUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.MinHeight(rect.height) }); try { code(); } catch (Exception ex) { } GUILayout.EndVertical(); Rect lastRect = GUILayoutUtility.GetLastRect(); GUILayout.EndHorizontal(); GUILayout.EndScrollView(); Rect lastRect2 = GUILayoutUtility.GetLastRect(); GUILayout.Space(1f); GUILayout.EndHorizontal(); GUILayout.Space(1f); Drawing.DrawRect(new Rect(lastRect2.x + lastRect2.width - 16f, lastRect2.y, 16f, lastRect2.height), MenuComponent._FillLightBlack, null); bool flag = lastRect.height - lastRect2.height > 0f; bool flag2 = flag; if (flag2) { Prefab.VerticalSlider(new Rect(lastRect2.x + 4f, lastRect2.y + 8f, 12f, lastRect2.height - 14f), 0f, lastRect.height - lastRect2.height, ref scrollpos.y); } GUILayout.EndArea(); }
public Line GetLine() { //Debug.Log (point1); Line line = new Line(); Point linePoint1 = new Point(); Point linePoint2 = new Point(); line.point1 = linePoint1; line.point2 = linePoint2; line.point1.coords = point1.ToVector2(); line.point2.coords = point2.ToVector2(); return(line); }
public object LoadAsset(AssetInfo assetInfo, IAssetStore assetStore) { var fileStream = _fileSystem.GetFile(assetInfo.AssetFilePath).OpenRead(); var assetData = AssetData.Load(fileStream); var spriteAssetContent = assetData.ReadJsonContent <SpriteAssetContent>(); var textureAssetId = new AssetId(spriteAssetContent.TextureAssetId); return(new Sprite( sourceTexture: assetStore.GetAsset <ITexture>(textureAssetId), sourceUV: SerializableVector2.ToVector2(spriteAssetContent.SourceUV), sourceDimensions: SerializableVector2.ToVector2(spriteAssetContent.SourceDimensions), pivot: SerializableVector2.ToVector2(spriteAssetContent.Pivot), pixelsPerUnit: spriteAssetContent.PixelsPerUnit)); }
public void ToVector2() { // Arrange var serializable = new SerializableVector2 { X = 1, Y = 2 }; // Act var actual = SerializableVector2.ToVector2(serializable); // Assert Assert.That(actual.X, Is.EqualTo(1)); Assert.That(actual.Y, Is.EqualTo(2)); }