public override void OnInspectorGUI() { GUILayout.BeginHorizontal(); //GUILayout.Label(" Grid Tile: "); grid.baseTile = EditorGUILayout.ObjectField("Tile Object", grid.baseTile, typeof(GameObject), false) as GameObject; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" Grid Width "); grid.width = EditorGUILayout.FloatField(grid.width, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Tile Width: " + Grid.tileWidth); GUILayout.Label("Tile Height: " + Grid.tileHeight); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" Grid Height "); grid.height = EditorGUILayout.FloatField(grid.height, GUILayout.Width(50)); GUILayout.EndHorizontal(); if (GUILayout.Button("Open Grid Window", GUILayout.Width(255))) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(); window.editor = this; } SceneView.RepaintAll(); }
/// <summary> /// retrun Grid window Model json object against window Id /// </summary> /// <param name="windowNo">window number</param> /// <param name="AD_Window_ID">window Id</param> /// <returns>grid window json result</returns> public JsonResult GetGridWindow(int windowNo, int AD_Window_ID) { GridWindow wVo = null; string retJSON = ""; string retError = null; string windowCtx = ""; if (Session["ctx"] != null) { Ctx lctx = Session["ctx"] as Ctx; Ctx ctx = new Ctx(lctx.GetMap()); GridWindowVO vo = AEnv.GetMWindowVO(ctx, windowNo, AD_Window_ID, 0); if (vo != null) { wVo = new GridWindow(vo); retJSON = JsonConvert.SerializeObject(wVo, Formatting.None); } else { retError = "AccessTableNoView"; } windowCtx = JsonConvert.SerializeObject(ctx.GetMap(windowNo)); } else { retError = "SessionExpired"; } return(Json(new { result = retJSON, error = retError, wCtx = windowCtx }, JsonRequestBehavior.AllowGet)); }
private void RepaintScene() { // Repaint in new EditorWindow MapGenerator map = new MapGenerator(); map.GenerateMap(); // Repaint in new Console Debug.Log(map.ToString()); // Clear old SceneView foreach (GameObject go in mapTiles) { DestroyImmediate(go); } mapTiles.Clear(); // Repaint in new SceneView GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(mapTiles); // Clear old Map CellManager.Instance.Reset(); }
public override void OnInspectorGUI() { GUILayout.BeginHorizontal(); myGrid.myParent = (GameObject)EditorGUILayout.ObjectField("Tile parent", myGrid.myParent, typeof(Object), true); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" Grid Width "); myGrid.width = EditorGUILayout.FloatField(myGrid.width, GUILayout.Width(50)); GUILayout.Label(" Grid Height "); myGrid.height = EditorGUILayout.FloatField(myGrid.height, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" Tile to paint "); tileToPaint = EditorGUILayout.IntField(tileToPaint, GUILayout.Width(50)); GUILayout.EndHorizontal(); foreach (var gameObject in myTiles) { GUILayout.BeginHorizontal(); EditorGUILayout.TextField(gameObject.name, gameObject.name, new GUIStyle()); GUILayout.EndHorizontal(); //EditorGUI.DrawPreviewTexture(rec, AssetPreview.GetAssetPreview(gameObject)); } if (GUILayout.Button("Open Grid Window", GUILayout.Width(255))) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(); } SceneView.RepaintAll(); }
public override void OnInspectorGUI() { grid.width = CreateSlider("Width", grid.width); grid.height = CreateSlider("Height", grid.height); if (GUILayout.Button("Open Grid Window")) //executed if clicked { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(); } //Tile Prefab EditorGUI.BeginChangeCheck(); var newTilePrefab = (Transform)EditorGUILayout.ObjectField("Tile Prefab", grid.tilePrefab, typeof(Transform), false); if (EditorGUI.EndChangeCheck()) { grid.tilePrefab = newTilePrefab; Undo.RecordObject(target, "Grid changed"); } //Tile Map EditorGUI.BeginChangeCheck(); var newTileset = (TileSet_C)EditorGUILayout.ObjectField("Tileset", grid.tileset, typeof(TileSet_C), false); if (EditorGUI.EndChangeCheck()) { grid.tileset = newTileset; Undo.RecordObject(target, "Grid Changed"); } if (grid.tileset != null) { EditorGUI.BeginChangeCheck(); var names = new string[grid.tileset.prefabs.Length]; var values = new int[names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = grid.tileset.prefabs[i] != null ? grid.tileset.prefabs[i].name : ""; values[i] = i; } var index = EditorGUILayout.IntPopup("Select Tile", oldIndex, names, values); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); if (oldIndex != index) { oldIndex = index; grid.tilePrefab = grid.tileset.prefabs[index]; float width = grid.tilePrefab.GetChild(0).GetComponent <Renderer>().bounds.size.x; float height = grid.tilePrefab.GetChild(0).GetComponent <Renderer>().bounds.size.y; grid.width = width; grid.height = height; } } } }
public override void OnInspectorGUI() { mapGrid.width = slider("Width", mapGrid.width); mapGrid.height = slider("Height", mapGrid.height); if (GUILayout.Button("Grid Window")) { GridWindow gridWindow = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); gridWindow.init(); } EditorGUI.BeginChangeCheck(); var newTilePrefab = (Transform)EditorGUILayout.ObjectField("Tile Prefab", mapGrid.tilePrefab, typeof(Transform), false); if (EditorGUI.EndChangeCheck()) { mapGrid.tilePrefab = newTilePrefab; Undo.RecordObject(target, "Grid Changed"); } EditorGUI.BeginChangeCheck(); var newTileSet = (TileSet)EditorGUILayout.ObjectField("Tile Set", mapGrid.tileSet, typeof(TileSet), false); if (EditorGUI.EndChangeCheck()) { mapGrid.tileSet = newTileSet; Undo.RecordObject(target, "Grid Changed"); } if (mapGrid.tileSet != null) { EditorGUI.BeginChangeCheck(); var names = new string[mapGrid.tileSet.prefabs.Length]; var values = new int[names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = mapGrid.tileSet.prefabs[i] != null ? mapGrid.tileSet.prefabs[i].name:""; values[i] = i; } var index = EditorGUILayout.IntPopup("Select Tile", oldindex, names, values); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); if (oldindex != index) { oldindex = index; mapGrid.tilePrefab = mapGrid.tileSet.prefabs[index]; float width = mapGrid.tilePrefab.renderer.bounds.size.x; mapGrid.width = width; float height = mapGrid.tilePrefab.renderer.bounds.size.y; mapGrid.height = height; } } } }
private void DrawGlobalOptions() { string visibilityDesc = KeybindingManager.instance.GetKeybindingDescription(VISIBILTY_TOGGLE_KEYBINDING_ID); m_isGridVisible = EditorGUIExtensions.IconToggle(EditorTextures.GetTexturePath(EditorTextures.HIDDEN_ICON), EditorTextures.GetTexturePath(EditorTextures.VISIBLE_ICON), m_isGridVisible, "Hide grid " + visibilityDesc, "Show grid " + visibilityDesc); string posSnapDesc = KeybindingManager.instance.GetKeybindingDescription(POSITION_ENABLED_KEYBINDING_ID); m_isPositionSnapEnabled = EditorGUIExtensions.IconToggle(EditorTextures.GetTexturePath(EditorTextures.POSITION_SNAP_DISABLED_ICON), EditorTextures.GetTexturePath(EditorTextures.POSITION_SNAP_ENABLED_ICON), m_isPositionSnapEnabled, "Disable position snapping " + posSnapDesc, "Enable position snapping " + posSnapDesc); string rotSnapDesc = KeybindingManager.instance.GetKeybindingDescription(ROTATION_ENABLED_KEYBINDING_ID); m_isRotationSnapEnabled = EditorGUIExtensions.IconToggle(EditorTextures.GetTexturePath(EditorTextures.ROTATION_SNAP_DISABLED_ICON), EditorTextures.GetTexturePath(EditorTextures.ROTATION_SNAP_ENABLED_ICON), m_isRotationSnapEnabled, "Disable rotation snapping " + rotSnapDesc, "Enable rotation snapping " + rotSnapDesc); EditorGUILayout.BeginVertical(); { EditorGUI.BeginDisabledGroup(!m_isRotationSnapEnabled); { EditorGUIExtensions.DrawIconPrefixedField(EditorTextures.GetTexturePath(EditorTextures.ROTATION_SNAP_ANGLE_ICON), "The angle in degrees used when rotation snapping is enabled", delegate { m_gridData.rotationSnapAngle = EditorGUILayout.FloatField(m_gridData.rotationSnapAngle, GUILayout.MinWidth(MIN_FIELD_WIDTH)); m_gridData.rotationSnapAngle = Mathf.Clamp(m_gridData.rotationSnapAngle, MIN_ROTATION_SNAP_ANGLE, MAX_ROTATION_SNAP_ANGLE); // degree symbol EditorGUILayout.LabelField(('\u00B0').ToString(), GUILayout.Width(UNIT_LABEL_WIDTH)); }); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginChangeCheck(); { string tooltip = (m_gridData.edgeType == GridData.EdgeType.Infinite ? "Display distance as number of grid cells" : "Grid size (number of cells)"); EditorGUIExtensions.DrawIconPrefixedField(EditorTextures.GetTexturePath(EditorTextures.GRIDSIZE_ICON), tooltip, delegate { m_gridData.gridSize = EditorGUILayout.IntField(m_gridData.gridSize, GUILayout.MinWidth(MIN_FIELD_WIDTH)); m_gridData.gridSize = Mathf.Clamp(m_gridData.gridSize, MIN_GRID_SIZE, MAX_GRID_SIZE); EditorGUILayout.LabelField("u", GUILayout.Width(UNIT_LABEL_WIDTH)); }); } if (EditorGUI.EndChangeCheck()) { GridWindow.ResetSceneGrid(); } } EditorGUILayout.EndVertical(); }
private void SelectGridData(GridData data) { m_gridData = data; EditorPrefs.SetString(SELECTED_GRID_DATA_KEY, AssetDatabase.GetAssetPath(m_gridData)); m_planeDrawers = null; ResetDataReferences(); GridWindow.ResetSceneGrid(); }
private static void ResetWindowReference() { if (s_window == null) { s_window = EditorWindow.GetWindow <GridWindow>("Grids MX Toolbar"); s_window.LoadPrefs(); s_window.minSize = new Vector2(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT); s_window.AttachKeybindings(); } }
public SubscriptionCorrelationExample() { d_sessionOptions = new SessionOptions(); d_sessionOptions.ServerHost = "localhost"; d_sessionOptions.ServerPort = 8194; d_securityList = new List <string>(); d_securityList.Add("IBM US Equity"); d_securityList.Add("VOD LN Equity"); d_gridWindow = new GridWindow("SecurityInfo", d_securityList); }
public void Reset() { CreateSettingsAsset(); m_editorSyncedSettings.ClearPrefs(); m_editorSyncedSettings = null; GetOrCreateSyncedSettings(); m_editorSyncedSettings.Sync(); GridWindow.ResetSceneGrid(); }
public override void OnInspectorGUI() { // Create the inspector UI slider for easy visualization theGridsGameVisual.m_gridWidth = createTileSlider("Grid Width", theGridsGameVisual.m_gridWidth); theGridsGameVisual.m_gridHeight = createTileSlider("Grid Height", theGridsGameVisual.m_gridHeight); theGridsGameVisual.m_mapWidth = createTileSlider("Map Width", theGridsGameVisual.m_mapWidth, 256f, 100000); theGridsGameVisual.m_mapHeight = createTileSlider("Map Height", theGridsGameVisual.m_mapHeight, 256, 100000); if (GUILayout.Button("Open Grid Window")) { GridWindow theGridEditorWindow = EditorWindow.GetWindow <GridWindow>(); theGridEditorWindow.init(); } }
void DrawElement(Rect rect, int index, bool active, bool focused) { InterativaSystem.Models.GridLayout item = gridDatabase.gridList[index]; GUI.Label(new Rect(rect.xMin, rect.y, rect.width - 50f, rect.height), "Controller: " + item.controller.ToString()); bool b = false; if (EditorGUI.Toggle(new Rect(rect.xMax - 20f, rect.y, 50, rect.height), b)) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow), false, "Edit Grid"); window.Init(index, gridDatabase.gridList, gridDatabase); } }
static void Init() { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.title = "Grid Editor"; window.allGrids = new List <Grid>(); foreach (Grid grid in Resources.LoadAll <Grid>(GRID_PATH)) { if (grid.GetType() == typeof(Grid)) { window.allGrids.Add((Grid)grid); } } }
public override void OnInspectorGUI() { GUILayout.BeginHorizontal(); GUILayout.Label(" Grid Width"); grid.width = EditorGUILayout.FloatField(grid.width, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" Grid Height"); grid.height = EditorGUILayout.FloatField(grid.height, GUILayout.Width(50)); GUILayout.EndHorizontal(); if (GUILayout.Button("Open Grid Window", GUILayout.Width(255))) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(); } SceneView.RepaintAll(); }
void OnGUI() { if (AlignEditor.editorPath == null) { AlignEditor.editorPath = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this))); } title = "AllIn v" + AlignEditor.VERSION; ImagePosition wasPosition = AlignEditor.ButtonStyle; // v2.0 : automatic layout from ratio width/height if (this.position.width > this.position.height) { EditorGUILayout.BeginHorizontal(); this.minSize = new Vector2(292, 58); } else { // Force image above for vertical layout if (wasPosition == ImagePosition.ImageLeft) { AlignEditor.ButtonStyle = ImagePosition.ImageAbove; } this.minSize = new Vector2(52, 256); } ClassicWindow.DetectAlignAxis(); ClassicWindow.AlignButtonGUI(Selection.transforms, true); GridWindow.GridButtonGUI(Selection.transforms); CameraWindow.CameraButtonGUI(Selection.transforms); AlignEditor.SettingsButtonGUI(); if (this.position.width > this.position.height) { EditorGUILayout.EndHorizontal(); } else { AlignEditor.ButtonStyle = wasPosition; } // Restore the previous state of button style }
public override void OnInspectorGUI() { this.serializedObject.Update(); DrawPropertiesExcluding(this.serializedObject, "m_gridOrigin", "m_gridSize", "m_rotationSnapAngle", "m_xAxisProperties", "m_yAxisProperties", "m_zAxisProperties"); GridData gridData = (GridData)target; gridData.gridOrigin = GridPointField("Origin Point", gridData.gridOrigin); if (GUI.changed) { EditorUtility.SetDirty(target); this.serializedObject.ApplyModifiedProperties(); GridWindow.ResetSceneGrid(); } if (GUILayout.Button("Open Grids MX Toolbar")) { GridWindow.Open(); } }
protected void InitTileSelectGridWindow() { TileSelect = new GridWindow(UI.GetInterface(Name), null, "Tiles", TextOrientation.Center, Vector2.Zero, new Vector2(122, Game1.ScreenHeight - 21), 2, 16, true, false, false, true); int tsIndex = 0; int yC = 16; List<string> keys = new List<string>(); for (int x = 0; x < 2; x++) { for (int y = 0; y < yC; y++) { if (Map.Settings.AccessibleTiles.MajorTileKeys.Count > y + 1 + x * yC) { string key = Map.Settings.AccessibleTiles.MajorTileKeys[y + 1 + x * yC]; keys.Add(key); TileSelect.AddElement(new TextureButton(UI.GetInterface(Name), Map.Settings.AccessibleTiles.TilesByString[key].Tex, Vector2.Zero, Vector2.Zero, new Vector2(UI.BGOffset), origin, hover, pressed, false), x, y); TileSelect[tsIndex].Clicked += (sender) => { Map.CurrentBrush.Index = TileSelect[sender] + 1; RefreshActiveTiles(); }; tsIndex++; } } } TileSelect.Closed += (sender) => { CurrentTileBar.Close(); }; }
void AddElement(ReorderableList list) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow), false, "Edit Grid"); window.Init(-1, gridDatabase.gridList, gridDatabase); }
public void DrawSettingsGUI() { GetOrCreateSyncedSettings(); m_editorSyncedSettings.Update(); DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive( "m_gridWindowLayout", "m_showScrollBars", "m_showDataManagementOptions", "m_showGlobalSnappingOptions", "m_showXAxisOptions", "m_showYAxisOptions", "m_showZAxisOptions", "m_showGridMovementOptions", "m_showGridFollowOptions", "m_xAxisColor", "m_yAxisColor", "m_zAxisColor", "m_majorLineSpacing", "m_majorLineOpacity" )); SerializedProperty unfocusedStyle = m_editorSyncedSettings.GetProperty("m_unfocusedStyle"); EditorGUILayout.PropertyField(unfocusedStyle); EditorGUI.BeginDisabledGroup((GridSettings.VisualStyle)unfocusedStyle.enumValueIndex == GridSettings.VisualStyle.Off); { DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive( "m_unfocusedColor" )); } EditorGUI.EndDisabledGroup(); DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive( "m_measurementUnit" )); SerializedProperty coordinateDisplay = m_editorSyncedSettings.GetProperty("m_coordinateDisplay"); EditorGUILayout.PropertyField(coordinateDisplay); EditorGUI.BeginDisabledGroup((CoordinateDisplay)coordinateDisplay.enumValueIndex == CoordinateDisplay.Off); { DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive( "m_coordinateAnchor", "m_coordinateColor", "m_coordinateSize", "m_useAxisColorForComponents" )); } EditorGUI.EndDisabledGroup(); SerializedProperty majorLineSpacing = m_editorSyncedSettings.GetProperty("m_majorLineSpacing"); SerializedProperty majorLineOpacity = m_editorSyncedSettings.GetProperty("m_majorLineOpacity"); SerializedProperty coordinateSize = m_editorSyncedSettings.GetProperty("m_coordinateSize"); majorLineSpacing.intValue = Mathf.Clamp(majorLineSpacing.intValue, 1, int.MaxValue); majorLineOpacity.floatValue = Mathf.Clamp(majorLineOpacity.floatValue, 0f, 1f); coordinateSize.intValue = Mathf.Clamp(coordinateSize.intValue, 1, int.MaxValue); DrawReferenceLineProperties("m_planeReferenceDisplay", "m_planeReferenceStyle", "m_planeReferenceColor"); DrawReferenceLineProperties("m_axisReferenceDisplay", "m_axisReferenceStyle", "m_axisReferenceColor"); if (GUI.changed) { m_editorSyncedSettings.ApplyModifiedProperties(); GridWindow.RepaintIfOpen(); GridWindow.ResetSceneGrid(); } if (GUILayout.Button("Reset to Defaults")) { Reset(); } if (GUILayout.Button("Open Grids MX Toolbar")) { GridWindow.Open(); } }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); grid.width = createFloatSlider("Width", grid.width); grid.height = createFloatSlider("Height", grid.height); grid.isRenderGrid = createToggle("RenderGrid", grid.isRenderGrid); grid.nowLayerNumber = createIntSlider("RenderLayer", grid.nowLayerNumber); //버튼이 눌렸을때 if (GUILayout.Button("Open Grid Window")) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.Init(); } //프리팹 불러오기 EditorGUI.BeginChangeCheck(); var newTilePrefab = (Transform)EditorGUILayout.ObjectField("Tile Prefab", grid.tilePrefab, typeof(Transform), false); if (EditorGUI.EndChangeCheck()) { grid.tilePrefab = newTilePrefab; Undo.RecordObject(target, "Grid Changed"); } //타일맵 EditorGUI.BeginChangeCheck(); var newTileSet = (TileSet)EditorGUILayout.ObjectField("TileSet", grid.tileSet, typeof(TileSet), false); if (EditorGUI.EndChangeCheck()) { grid.tileSet = newTileSet; Undo.RecordObject(target, "Grid changed"); } if (grid.tileSet != null) { EditorGUI.BeginChangeCheck(); var names = new string[grid.tileSet.prefabs.Length]; var values = new int[names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = grid.tileSet.prefabs[i] != null ? grid.tileSet.prefabs[i].name : ""; values[i] = i; } var index = EditorGUILayout.IntPopup("Select Tile", oldIndex, names, values); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); if (oldIndex != index) { oldIndex = index; grid.tilePrefab = grid.tileSet.prefabs[index]; //float width = grid.tilePrefab.GetComponent<Renderer>().bounds.size.x; //float height = grid.tilePrefab.GetComponent<Renderer>().bounds.size.y; //grid.width = width; //grid.height = height; } } } }
private static void Main() { var gridWindowTest = new GridWindow { Title = "GridWindow Test (Next: Shift+Tab)", DrawBorders = true, RowDefinitions = { new GridSize(GridUnitType.Fixed, 10), new GridSize(GridUnitType.Auto, 0), new GridSize(GridUnitType.Auto, 0), }, ColumnDefinitions = { new GridSize(GridUnitType.Grow, 3), new GridSize(GridUnitType.Grow, 2), new GridSize(GridUnitType.Fixed, 15) }, Children = { new Border { FrameStyle = FrameStyle.Single, Content = new TextView { Text = "1" }, AttachedProperties = { new GridProperties { Row = 0, Column = 0, RowSpan = 3 } } }, new Border { FrameStyle = FrameStyle.Single, Content = new TextView { Text = "2" }, AttachedProperties = { new GridProperties { Row = 0, Column = 1, ColumnSpan = 2 } } }, new Border { FrameStyle = FrameStyle.Single, Content = new TextView { Text = "3" }, AttachedProperties = { new GridProperties { Row = 1, Column = 1 } } }, new Border { FrameStyle = FrameStyle.Single, Content = new TextView { Text = "4" }, AttachedProperties = { new GridProperties { Row = 2, Column = 2 } } } } }; var btn = new Button { Text = "Press me!", Height = ControlSizeType.MaxByContent }; var text = new TextView { Text = "Click count: 0", Height = ControlSizeType.MaxByContent, Name = "clkCnt" }; var clkCnt = 0; btn.Clicked += (o, e) => ((TextView)btn.ByName("clkCnt")).Text = $"Click count: {++clkCnt}"; var box = new TextBox { TextWrapping = TextWrapping.Wrap, Text = "Hello World!" }; var view = new TextView { DataContext = box, AttachedProperties = { new GridProperties { Row = 1 } } }; view.Bind(nameof(view.Text), "Text"); var tabControlTest = new ContentWindow { Title = "ContentWindow + TabControl2 Test (Prev: Shift+Tab)", Content = new TabControl { Children = { new Tab { Title = "TextView", Content = new TextView { Text = "Read-only text!\n" + LongLorem } }, new Tab { Title = "Vertical StackPanel", Content = new StackPanel { Children = { new Border { Content = new TextView { Text = "Item #1", Height = ControlSizeType.MaxByContent }, Height = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #2", Height = ControlSizeType.MaxByContent }, Height = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #3", Height = ControlSizeType.MaxByContent }, Height = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #4", Height = ControlSizeType.MaxByContent }, Height = ControlSizeType.MaxByContent } } } }, new Tab { Title = "Horizontal StackPanel", Content = new StackPanel { Orientation = StackPanelOrientation.Horizontal, Children = { new Border { Content = new TextView { Text = "Item #1", Width = ControlSizeType.MaxByContent }, Width = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #2", Width = ControlSizeType.MaxByContent }, Width = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #3", Width = ControlSizeType.MaxByContent }, Width = ControlSizeType.MaxByContent }, new Border { Content = new TextView { Text = "Item #4", Width = ControlSizeType.MaxByContent }, Width = ControlSizeType.MaxByContent } } } }, new Tab { Title = "ScrollViewer", Content = new ScrollViewer { Content = new TextView { Text = LongLorem, TextWrapping = TextWrapping.Wrap, Height = ControlSizeType.MaxByContent } } }, new Tab { Title = "TextBox + Binding", Content = new Grid { RowDefinitions = { new GridSize(GridUnitType.Grow, 1), new GridSize(GridUnitType.Grow, 1) }, Children = { box, view } } }, new Tab { Title = "Button", Content = new StackPanel { Children = { new TextView { Text = "Press that", Height = ControlSizeType.MaxByContent }, btn, text } } } }, SelectedIndex = 0 } }; Console.Windows.Add(gridWindowTest); Console.Windows.Add(tabControlTest); Console.Start(); }
static void Menu_Open_TileBuilder_Window() { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.minSize = new Vector2(750, 460); }
public Cell(int x, int y, CellType type, GridWindow window) { cellData = new CellData(x, y, type); gridWindow = window; cellColor = gridWindow.GetColorFromType(type); }
public override void OnInspectorGUI() { grid = (Grid)target; if (GUILayout.Button("Open Grid Window")) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.init(); } if (GUILayout.Button("Create New Tile Set")) { TileSetCreatorWindow window = (TileSetCreatorWindow)EditorWindow.GetWindow(typeof(TileSetCreatorWindow)); window.init(); } //Type prefab EditorGUI.BeginChangeCheck(); var newTilePrefab = (Tile)EditorGUILayout.ObjectField("Tile_Prefab", grid.tilePrefab, typeof(Tile), false); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); grid.tilePrefab = newTilePrefab; } //Tile Map EditorGUI.BeginChangeCheck(); var newTileSet = (TileSet)EditorGUILayout.ObjectField("TileSet", grid.tileSet, typeof(TileSet), false); if (EditorGUI.EndChangeCheck()) { grid.tileSet = newTileSet; Undo.RecordObject(target, "Grid Changed"); } if (grid.tileSet != null) { EditorGUI.BeginChangeCheck(); var names = new string[grid.tileSet.prefabs.Length]; var values = new int[names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = grid.tileSet.prefabs[i].prefab.name != null ? grid.tileSet.prefabs[i].prefab.name : ""; values[i] = i; } var index = EditorGUILayout.IntPopup("Select Tile", oldIndex, names, values); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); if (oldIndex != index) { oldIndex = index; grid.tilePrefab = grid.tileSet.prefabs[index]; float width = grid.tilePrefab.prefab.GetComponent <Renderer>().bounds.size.x; float height = grid.tilePrefab.prefab.GetComponent <Renderer>().bounds.size.y; grid.Width = width; grid.Height = height; } } } }
public override void OnInspectorGUI()//인스펙터에서 { //base.OnInspectorGUI(); grid.widht = createSlider("Grid Width", grid.widht); grid.height = createSlider("Grid height", grid.height); if (GUILayout.Button("Open Grid Window")) { GridWindow window = (GridWindow)EditorWindow.GetWindow(typeof(GridWindow)); window.init(); } grid.zOrder = (int)Mathf.Floor(createSlider("Order in Layer", grid.zOrder)); //타일 프리팹 EditorGUI.BeginChangeCheck(); var newTileprefap = (Transform)EditorGUILayout.ObjectField("Tile prefap", grid.tileprefab, typeof(Transform), false); if (EditorGUI.EndChangeCheck()) { grid.tileprefab = newTileprefap; Undo.RecordObject(target, "Grid Changed"); } //타일맵 EditorGUI.BeginChangeCheck(); var newTileSet = (TileSet)EditorGUILayout.ObjectField("TileSet", grid.tileSet, typeof(TileSet), false); if (EditorGUI.EndChangeCheck()) { grid.tileSet = newTileSet; Undo.RecordObject(target, "Grid Changed"); } if (grid.tileSet != null)//타일셋이 비어있지 않다면 타일셋의 목록을 만듬 { EditorGUI.BeginChangeCheck(); var names = new string[grid.tileSet.prefaps.Length]; var values = new int[names.Length]; for (int i = 0; i < names.Length; i++) { names[i] = grid.tileSet.prefaps[i] != null ? grid.tileSet.prefaps[i].name : ""; values[i] = i; } var index = EditorGUILayout.IntPopup("Select Tile", oldindex, names, values); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Grid Changed"); if (oldindex != index)//리스트에서 선택된 프리팹이 이전과 다르다면 바꾸기 { oldindex = index; grid.tileprefab = grid.tileSet.prefaps[index]; float width = grid.tileprefab.GetComponent <Renderer>().bounds.size.x; float height = grid.tileprefab.GetComponent <Renderer>().bounds.size.y; grid.widht = width; grid.height = height; } } //선택된 타일 프리뷰 GUILayout.BeginHorizontal(); GUILayout.Label("Preview"); Texture2D myTexture = AssetPreview.GetAssetPreview((Object)grid.tileprefab.gameObject); GUILayout.Label(myTexture); GUILayout.EndHorizontal(); } }
protected void InitCurrentTileBarGridWindow() { CurrentTileBar = new GridWindow(UI.GetInterface(Name), null, "Active Tile", TextOrientation.Center, Vector2.Zero, new Vector2(700, 125), 15, 2, true, true, false, false); RefreshActiveTiles(); }
private void ShowGridWindow() { var gridWindow = new GridWindow(); gridWindow.Show(); }