protected override void InitUI(UIWidget layout) { var tex = EditorAssets.LoadAssetAtPath <Texture>(EditorAssets.GetResourcePath("Textures/wooden-box.png")); var shader = Shader.Find("UI/Default"); var mat = new Material(shader); EditorPreviewTexture previewTexture = new EditorPreviewTexture(); previewTexture.Image = tex; previewTexture.Position = new Rect(0, 0, 128, 128); previewTexture.Mat = mat; layout.Add(previewTexture); var fields = shader.GetType().GetFields(); var shaderKeywords = mat.shaderKeywords; if (shaderKeywords != null || shaderKeywords.Length != 0) { for (var i = 0; i < shaderKeywords.Length; i++) { var lable = new GUILabel(); lable.Text = shaderKeywords[i]; layout.Add(lable); } } }
protected override void InitSceneWidget(UIWidget layout) { Transform transform = _behaviour.transform; { layout.Add(new ArrowShape(transform.position + transform.right, transform.rotation * Quaternion.LookRotation(Vector3.right))); layout.Add(new ArrowShape(transform.position + transform.up, transform.rotation * Quaternion.LookRotation(Vector3.up))); layout.Add(new ArrowShape(transform.position + transform.forward, transform.rotation * Quaternion.LookRotation(Vector3.forward))); } }
protected override void InitUI(UIWidget layout) { UIListView listView = GetTarget <UIListView>(); UIEnumFieldWidget movementType = new UIEnumFieldWidget("MovementType", listView.movementType); movementType.OnValueChanged = (Object value) => { listView.movementType = (ScrollRect.MovementType)value; UpdateElasticity(layout, movementType); }; layout.Add(movementType); UpdateElasticity(layout, movementType); //////////////////////////////////////////////////////////// UIBooleanFieldWidget inertia = new UIBooleanFieldWidget("Inertia", listView.inertia); inertia.OnValueChanged = (Object value) => { listView.inertia = (bool)value; UpdateDecelerationRate(layout, inertia); }; layout.Add(inertia); UpdateDecelerationRate(layout, inertia); //////////////////////////////////////////////////////////// UIFloatFieldWidget scrollSensitivity = new UIFloatFieldWidget("ScrollSensitivity", listView.scrollSensitivity); scrollSensitivity.OnValueChanged = (Object value) => { listView.scrollSensitivity = (float)value; }; layout.Add(scrollSensitivity); //////////////////////////////////////////////////////////// UIEnumFieldWidget direction = new UIEnumFieldWidget("Direction", listView.Direction); direction.OnValueChanged = (Object value) => { listView.Direction = (ScrollDirection)value; }; layout.Add(direction); GUIButton btn = new GUIButton(); btn.Text = "Format"; btn.TriggerHandler = (Widget w) => { listView.FormatScrollView(); }; layout.Add(btn); }
protected override void InitUI(UIWidget layout) { string express = string.Format("*{0}*.png", _searchExpress); EditorTextField textField = new EditorTextField(); textField.Text = _searchExpress; textField.TriggerHandler = (Widget w) => { _searchExpress = textField.Text; }; layout.Add(textField); string[] allpath = EditorAssets.GetFilePaths(EditorAssets.Root, express); layout.Add(CreateImagePreviewWidget(allpath)); }
protected override void InitUI(UIWidget layout) { var tex = EditorAssets.LoadAssetAtPath <Texture>(EditorAssets.GetResourcePath("Textures/wooden-box.png")); var shader = Shader.Find("UI/Default"); var mat = new Material(shader); EditorVerticalLayout vLayout = new EditorVerticalLayout(); vLayout.Option.Height = 128; vLayout.Option.Width = 128; layout.Add(vLayout); EditorPreviewTexture previewTexture = new EditorPreviewTexture(); previewTexture.Image = tex; previewTexture.Position = new Rect(0, 0, 128, 128); previewTexture.Mat = mat; vLayout.Add(previewTexture); var textureField = new UITextureFieldWidget("Texture", tex); textureField.OnValueChanged = (object value) => { previewTexture.Image = (Texture)value; }; layout.Add(textureField); var shaderField = new UIShaderFieldWidget("Shader", shader); shaderField.OnValueChanged = (object value) => { previewTexture.Mat = new Material((Shader)value); }; layout.Add(shaderField); var matField = new UIMaterialFieldWidget("Material", mat); matField.OnValueChanged = (object value) => { previewTexture.Mat = (Material)value; }; layout.Add(matField); }
protected override void InitUI(UIWidget layout) { UITransformFieldWidget transform = new UITransformFieldWidget("GameObject", _transform); transform.OnValueChanged = (object value) => { _transform = (Transform)value; }; layout.Add(transform); UIIntFieldWidget width = new UIIntFieldWidget("width", _width); width.OnValueChanged = (object value) => { _width = (int)value; }; layout.Add(width); UIIntFieldWidget height = new UIIntFieldWidget("height", _height); height.OnValueChanged = (object value) => { _height = (int)value; }; layout.Add(height); UIIntSlideFieldWidget count = new UIIntSlideFieldWidget("count", _count); count.MinValue = 1; count.MaxValue = 100; count.OnValueChanged = (object value) => { _count = (int)value; }; layout.Add(count); GUIButton btn = new GUIButton(); btn.Text = "Create"; btn.TriggerHandler = (Widget w) => { CreateGameObject(); }; layout.Add(btn); }
protected virtual void InitUI(UIWidget layout) { object t = target; var widget = UIWidgetHelper.CreateWidget(target.GetType().Name, t); if (widget != null) { layout.Add(widget); } }
protected override void InitUI(UIWidget layout) { UIObjectFieldWidget objectField = new UIObjectFieldWidget(_config.GetType().Name, _config); objectField.OnValueChanged = (object value) => { _config = (T)value; this.Save(); }; layout.Add(objectField); layout.Add(new EditorHorizontalLine()); UITextFieldWidget saveFileField = new UITextFieldWidget("File Path :", _fullpath); saveFileField.OnValueChanged = (object value) => { _fullpath = (string)value; }; layout.Add(saveFileField); /* * GUIButton btnLoad = new GUIButton(); * btnLoad.Text = "Load"; * btnLoad.TriggerHandler = (Widget w) => * { * this.Load(); * Dirty = true; * }; * layout.Add(btnLoad); * * GUIButton btnSave = new GUIButton(); * btnSave.Text = "Save"; * btnSave.TriggerHandler = (Widget w) => * { * this.Save(); * }; * layout.Add(btnSave); */ }
protected override void InitUI(UIWidget layout) { UIText text = GetTarget <UIText>(); GUIButton btn = new GUIButton(); btn.Text = "Format"; btn.TriggerHandler = (Widget w) => { text.text = text.text; }; layout.Add(btn); }
protected override void InitSceneGUI(UIWidget layout) { EditorVerticalLayout vLayout = new EditorVerticalLayout(); { vLayout.Add(new UILabelFieldWidget("Name", _behaviour.name)); vLayout.Add(new UILabelFieldWidget("Tag", _behaviour.tag)); vLayout.Add(new UIVector3FieldWidget("Local Position", _behaviour.transform.localPosition)); vLayout.Add(new UIVector3FieldWidget("Local Rotation", _behaviour.transform.localEulerAngles)); vLayout.Add(new UIVector3FieldWidget("Local Scale", _behaviour.transform.localScale)); vLayout.Add(new UIVector3FieldWidget("World Position", _behaviour.transform.position)); vLayout.Add(new UIVector3FieldWidget("World Rotation", _behaviour.transform.eulerAngles)); vLayout.Add(new UIVector3FieldWidget("World Scale", _behaviour.transform.lossyScale)); } layout.Add(vLayout); }
protected override void InitUI(UIWidget layout) { EditorVerticalLayout vLayout = new EditorVerticalLayout(); layout.Add(vLayout); UIIntPopupFieldWidget textureType = new UIIntPopupFieldWidget("Texture Type", setting.textureType); textureType.Describes = TextureTypeString; textureType.Indexs = TextureIntArray; textureType.OnValueChanged = (object value) => { setting.textureType = (TextureImporterType)value; }; vLayout.Add(textureType); UIIntPopupFieldWidget spriteMode = new UIIntPopupFieldWidget("Sprite Mode", setting.spriteMode); spriteMode.Describes = SpriteModeString; spriteMode.Indexs = IntArray; spriteMode.OnValueChanged = (object value) => { setting.spriteMode = (SpriteImportMode)value; }; vLayout.Add(spriteMode); UIBooleanFieldWidget sRGGUITexture = new UIBooleanFieldWidget("sRGGUITexture", setting.sRGGUITexture); sRGGUITexture.OnValueChanged = (object value) => { setting.sRGGUITexture = (bool)value; }; vLayout.Add(sRGGUITexture); UIIntPopupFieldWidget alphaSource = new UIIntPopupFieldWidget("Alpha Source", setting.alphaSource); alphaSource.Describes = AlphaSourceString; alphaSource.Indexs = IntArray; alphaSource.OnValueChanged = (object value) => { setting.alphaSource = (TextureImporterAlphaSource)value; }; vLayout.Add(alphaSource); UIBooleanFieldWidget alphaIsTransparency = new UIBooleanFieldWidget("Alpha Is Transparency", setting.alphaIsTransparency); alphaIsTransparency.OnValueChanged = (object value) => { setting.alphaIsTransparency = (bool)value; }; vLayout.Add(alphaIsTransparency); UIIntPopupFieldWidget filterMode = new UIIntPopupFieldWidget("Filter Mode", setting.filterMode); filterMode.Describes = FilterModeString; filterMode.Indexs = IntArray; filterMode.OnValueChanged = (object value) => { setting.filterMode = (FilterMode)value; }; vLayout.Add(filterMode); UIIntPopupFieldWidget wrapMode = new UIIntPopupFieldWidget("Wrap Mode", setting.wrapMode); wrapMode.Describes = WrapModeString; wrapMode.Indexs = IntArray; wrapMode.OnValueChanged = (object value) => { setting.wrapMode = (TextureWrapMode)value; }; vLayout.Add(wrapMode); UIIntSlideFieldWidget anisoLevel = new UIIntSlideFieldWidget("Aniso Level", setting.anisoLevel); anisoLevel.MinValue = 0; anisoLevel.MaxValue = 9; anisoLevel.OnValueChanged = (object value) => { setting.anisoLevel = (int)value; }; vLayout.Add(anisoLevel); UIIntPopupFieldWidget maxTextureSize = new UIIntPopupFieldWidget("Max Size", setting.maxTextureSize); maxTextureSize.Describes = MaxSizeString; maxTextureSize.Indexs = SizeIntArray; maxTextureSize.OnValueChanged = (object value) => { setting.maxTextureSize = (int)value; }; vLayout.Add(maxTextureSize); UIIntPopupFieldWidget textureCompression = new UIIntPopupFieldWidget("Texture Compression", setting.textureCompression); textureCompression.Describes = FormatString; textureCompression.Indexs = IntArray; textureCompression.OnValueChanged = (object value) => { setting.textureCompression = (TextureImporterCompression)value; }; vLayout.Add(maxTextureSize); EditorHorizontalLine line = new EditorHorizontalLine(); vLayout.Add(line); GUIButton btn = new GUIButton(); btn.Text = "Format"; btn.TriggerHandler = (Widget w) => { FormatTextures(); }; vLayout.Add(btn); }
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); } }
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); }