protected override void InitUI(UIWidget layout) { EditorVerticalLayout innerLayout = new EditorVerticalLayout(); innerLayout.InnerSpace = 10; layout.Add(innerLayout); { EditorHorizontalLayout hLayout = new EditorHorizontalLayout(); hLayout.InnerSpace = 10; EditorPrefixLabel label = new EditorPrefixLabel(); label.Text = "Asset Path :"; hLayout.Add(label); bundleFolder.Text = "Open"; string bundles = FilePath.BundlesPath; bundleFolder.Filepath = Path.Combine(EditorAssets.Root, bundles).Replace("\\", "/"); hLayout.Add(bundleFolder); innerLayout.Add(hLayout); } { EditorHorizontalLayout hLayout = new EditorHorizontalLayout(); hLayout.InnerSpace = 10; EditorPrefixLabel label = new EditorPrefixLabel(); label.Text = "Out Path :"; hLayout.Add(label); outputFolder.Filepath = Path.Combine(EditorAssets.Root, "Output").Replace("\\", "/"); outputFolder.Text = "Open"; hLayout.Add(outputFolder); innerLayout.Add(hLayout); } { VerticalLayout vLayout = new VerticalLayout(); vLayout.InnerSpace = 10; EditorIntPopup popup = new EditorIntPopup(); popup.Text = "Choose Platform :"; popup.Value = platformIndex; popup.TriggerHandler = (Widget w) => { platformIndex = popup.Value; }; for (int i = 0; i < PlatformInfo.Count; i++) { popup.Add(new EditorIntPopup.DisplayItem(PlatformInfo[i].name, PlatformInfo[i].index)); } vLayout.Add(popup); GUIButton button = new GUIButton(); button.Text = "Pack"; button.TriggerHandler = (Widget w) => { Pack((Platform)PlatformInfo[platformIndex].value, PlatformInfo[platformIndex].name); }; vLayout.Add(button); innerLayout.Add(vLayout); } }
/// <summary> /// 创建图片预览 /// </summary> /// <param name="allpath"></param> /// <returns></returns> private Widget CreateImagePreviewWidget(string[] allpath) { EditorScrollView scrollView = new EditorScrollView(); scrollView.InnerSpace = InnerSpace; if (allpath == null || allpath.Length == 0) { return(scrollView); } var frameSize = this.position.size; float w = frameSize.x - 40; w -= InnerSpace; int count = (int)(w / (ImageSize.x + InnerSpace)); EditorHorizontalLayout hLayout = null; for (int i = 0; i < allpath.Length; i++) { if (i % count == 0) { hLayout = new EditorHorizontalLayout(); hLayout.InnerSpace = InnerSpace; scrollView.Add(hLayout); } EditorVerticalLayout vLayout = new EditorVerticalLayout(); vLayout.Option.Width = ImageSize.x; hLayout.Add(vLayout); { string fullpath = allpath[i]; string filename = fullpath.Substring(fullpath.LastIndexOf('/') + 1); GUIButton button = new GUIButton(); button.Option.Width = ImageSize.x; button.Option.Height = ImageSize.y; button.ImagePosition = ImagePosition.ImageAbove; button.ImagePath = fullpath; button.Tooltip = fullpath; button.TriggerHandler = (Widget widget) => { SetSelectImageSprite(button.ImagePath); }; vLayout.Add(button); var label = new GUILabel(); label.Option.Height = 25; label.Option.Width = ImageSize.x; label.Text = filename; label.FontSize = 10; label.Alignment = TextAnchor.MiddleCenter; vLayout.Add(label); } } return(scrollView); }
protected override void InitUI(UIWidget layout) { UIFloatFieldWidget distance = new UIFloatFieldWidget("Distance", _distance); distance.OnValueChanged = (object value) => { _distance = (float)value; }; layout.Add(distance); layout.Add(new EditorHorizontalLine()); UITextFieldWidget axis = new UITextFieldWidget("AXIS:", GetText()); layout.Add(axis); EditorHorizontalLayout hlayout1 = new EditorHorizontalLayout(); layout.Add(hlayout1); GUIButton axisX = new GUIButton(); axisX.Text = "X"; axisX.TriggerHandler = (Widget w) => { this.OrderBy(OrderAxis.X); this.SetText(axis); }; hlayout1.Add(axisX); GUIButton axisY = new GUIButton(); axisY.Text = "Y"; axisY.TriggerHandler = (Widget w) => { this.OrderBy(OrderAxis.Y); this.SetText(axis); }; hlayout1.Add(axisY); GUIButton axisZ = new GUIButton(); axisZ.Text = "Z"; axisZ.TriggerHandler = (Widget w) => { this.OrderBy(OrderAxis.Z); this.SetText(axis); }; hlayout1.Add(axisZ); EditorPrefixLabel alignment = new EditorPrefixLabel(); alignment.Text = "Alignment:"; layout.Add(alignment); EditorHorizontalLayout hlayout2 = new EditorHorizontalLayout(); layout.Add(hlayout2); GUIButton left = new GUIButton(); left.ImagePath = EditorAssets.GetResourcePath("Icons/layout_alignment_left.png"); left.TriggerHandler = (Widget w) => { this.OrderBy(TextAlignment.Left); }; hlayout2.Add(left); GUIButton center = new GUIButton(); center.ImagePath = EditorAssets.GetResourcePath("Icons/layout_alignment_center.png"); center.TriggerHandler = (Widget w) => { this.OrderBy(TextAlignment.Center); }; hlayout2.Add(center); GUIButton right = new GUIButton(); right.ImagePath = EditorAssets.GetResourcePath("Icons/layout_alignment_right.png"); right.TriggerHandler = (Widget w) => { this.OrderBy(TextAlignment.Right); }; hlayout2.Add(right); }