private void CreateCollaboratorGUI(GUILayoutY layout, string name, string area) { GUILabel nameLabel = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150)); GUILabel areaLabel = new GUILabel(new LocEdString(area), GUIOption.FixedWidth(220)); GUILayoutX horzLayout = layout.AddLayoutX(); horzLayout.AddSpace(10); horzLayout.AddElement(nameLabel); horzLayout.AddSpace(10); horzLayout.AddElement(areaLabel); horzLayout.AddSpace(10); }
private void CreateThirdPartyGUI(GUILayoutY layout, string name, string webURL, string licenseFile) { GUILabel label = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150)); GUIButton linkBtn = new GUIButton(new LocEdString("Website"), GUIOption.FixedWidth(50)); GUIButton licenseBtn = new GUIButton(new LocEdString("License"), GUIOption.FixedWidth(50)); string licensePath = "..\\..\\..\\License\\Third Party\\" + licenseFile; GUILayoutX horzLayout = layout.AddLayoutX(); horzLayout.AddSpace(10); horzLayout.AddElement(label); horzLayout.AddSpace(10); horzLayout.AddElement(linkBtn); horzLayout.AddSpace(5); horzLayout.AddElement(licenseBtn); horzLayout.AddSpace(10); linkBtn.OnClick += () => { System.Diagnostics.Process.Start(webURL); }; licenseBtn.OnClick += () => { System.Diagnostics.Process.Start(licensePath); }; }
private void OnInitialize() { mainLayout = GUI.AddLayoutY(); GUIContent viewIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.View), new LocEdString("View")); GUIContent moveIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Move), new LocEdString("Move")); GUIContent rotateIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Rotate), new LocEdString("Rotate")); GUIContent scaleIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Scale), new LocEdString("Scale")); GUIContent localIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Local), new LocEdString("Local")); GUIContent worldIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.World), new LocEdString("World")); GUIContent pivotIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Pivot), new LocEdString("Pivot")); GUIContent centerIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Center), new LocEdString("Center")); GUIContent moveSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.MoveSnap), new LocEdString("Move snap")); GUIContent rotateSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.RotateSnap), new LocEdString("Rotate snap")); GUIToggleGroup handlesTG = new GUIToggleGroup(); viewButton = new GUIToggle(viewIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); moveButton = new GUIToggle(moveIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); rotateButton = new GUIToggle(rotateIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); scaleButton = new GUIToggle(scaleIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); GUIToggleGroup coordModeTG = new GUIToggleGroup(); localCoordButton = new GUIToggle(localIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75)); worldCoordButton = new GUIToggle(worldIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75)); GUIToggleGroup pivotModeTG = new GUIToggleGroup(); pivotButton = new GUIToggle(pivotIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); centerButton = new GUIToggle(centerIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35)); moveSnapButton = new GUIToggle(moveSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35)); moveSnapInput = new GUIFloatField("", GUIOption.FlexibleWidth(35)); rotateSnapButton = new GUIToggle(rotateSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35)); rotateSnapInput = new GUIFloatField("", GUIOption.FlexibleWidth(35)); viewButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.View); moveButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Move); rotateButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Rotate); scaleButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Scale); localCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.Local); worldCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.World); pivotButton.OnClick += () => OnPivotModeButtonClicked(HandlePivotMode.Pivot); centerButton.OnClick += () => OnPivotModeButtonClicked(HandlePivotMode.Center); moveSnapButton.OnToggled += (bool active) => OnMoveSnapToggled(active); moveSnapInput.OnChanged += (float value) => OnMoveSnapValueChanged(value); rotateSnapButton.OnToggled += (bool active) => OnRotateSnapToggled(active); rotateSnapInput.OnChanged += (float value) => OnRotateSnapValueChanged(value); GUILayout handlesLayout = mainLayout.AddLayoutX(); handlesLayout.AddElement(viewButton); handlesLayout.AddElement(moveButton); handlesLayout.AddElement(rotateButton); handlesLayout.AddElement(scaleButton); handlesLayout.AddSpace(10); handlesLayout.AddElement(localCoordButton); handlesLayout.AddElement(worldCoordButton); handlesLayout.AddSpace(10); handlesLayout.AddElement(pivotButton); handlesLayout.AddElement(centerButton); handlesLayout.AddFlexibleSpace(); handlesLayout.AddElement(moveSnapButton); handlesLayout.AddElement(moveSnapInput); handlesLayout.AddSpace(10); handlesLayout.AddElement(rotateSnapButton); handlesLayout.AddElement(rotateSnapInput); GUIPanel mainPanel = mainLayout.AddPanel(); rtPanel = mainPanel.AddPanel(); selectionPanel = mainPanel.AddPanel(-1); GUIPanel sceneAxesPanel = mainPanel.AddPanel(-1); sceneAxesGUI = new SceneAxesGUI(this, sceneAxesPanel, HandleAxesGUISize, HandleAxesGUISize, ProjectionType.Perspective); focusCatcher = new GUIButton("", EditorStyles.Blank); focusCatcher.OnFocusGained += () => hasContentFocus = true; focusCatcher.OnFocusLost += () => hasContentFocus = false; GUIPanel focusPanel = GUI.AddPanel(-2); focusPanel.AddElement(focusCatcher); toggleProfilerOverlayKey = new VirtualButton(ToggleProfilerOverlayBinding); viewToolKey = new VirtualButton(ViewToolBinding); moveToolKey = new VirtualButton(MoveToolBinding); rotateToolKey = new VirtualButton(RotateToolBinding); scaleToolKey = new VirtualButton(ScaleToolBinding); frameKey = new VirtualButton(FrameBinding); UpdateRenderTexture(Width, Height - HeaderHeight); UpdateProfilerOverlay(); }
/// <inheritdoc/> protected override GUILayoutX CreateGUI(GUILayoutY layout) { GUILayoutX titleLayout = layout.AddLayoutX(); sizeField = new GUIIntField(new LocEdString(SeqIndex + ". ")); titleLayout.AddElement(sizeField); sizeField.OnChanged += x => { SetValue(x); MarkAsModified(); }; sizeField.OnFocusLost += ConfirmModify; sizeField.OnConfirmed += ConfirmModify; return titleLayout; }
/// <inheritdoc/> protected override GUILayoutX CreateGUI(GUILayoutY layout) { GUILayoutX titleLayout = layout.AddLayoutX(); rangeStartField = new GUIIntField(new LocEdString(SeqIndex + ". Start")); rangeEndField = new GUIIntField(new LocEdString("End")); titleLayout.AddElement(rangeStartField); titleLayout.AddElement(rangeEndField); rangeStartField.OnChanged += x => { CharRange range = GetValue<CharRange>(); range.start = x; SetValue(range); MarkAsModified(); }; rangeEndField.OnChanged += x => { CharRange range = GetValue<CharRange>(); range.end = x; SetValue(range); MarkAsModified(); }; rangeStartField.OnFocusLost += ConfirmModify; rangeStartField.OnConfirmed += ConfirmModify; rangeEndField.OnFocusLost += ConfirmModify; rangeEndField.OnConfirmed += ConfirmModify; return titleLayout; }
/// <inheritdoc/> protected override GUILayoutX CreateKeyGUI(GUILayoutY layout) { GUILayoutX titleLayout = layout.AddLayoutX(); keyField = new GUITextField(new LocEdString("Name")); titleLayout.AddElement(keyField); keyField.OnChanged += SetKey; return titleLayout; }
/// <inheritdoc/> protected override GUILayoutX CreateGUI(GUILayoutY layout) { GUILayoutX titleLayout = layout.AddLayoutX(); materialField = new GUIResourceField(typeof(Material), new LocEdString(SeqIndex + ". "), 20); titleLayout.AddElement(materialField); materialField.OnChanged += x => { Material material = Resources.Load<Material>(x); SetValue(material); MarkAsModified(); ConfirmModify(); }; return titleLayout; }
/// <inheritdoc/> protected internal override void Initialize(int index) { guiLayout = layout.AddLayoutY(index); guiTitleLayout = guiLayout.AddLayoutX(); propertyValue = property.GetValue<object>(); BuildGUI(index); }