private void Start() { battleChat = GetComponent <BattleChat>(); editorToolScripts[0].desc = ConsumableManager.Instance.Get("build_tool"); editorToolScripts[1].desc = ConsumableManager.Instance.Get("line_tool"); editorToolScripts[2].desc = ConsumableManager.Instance.Get("replace_tool"); editorTool = new EditorTool[editorToolScripts.Length]; for (int i = 0; i < editorToolScripts.Length; i++) { Item i2 = null; long num = MyInfoManager.Instance.HaveFunction(editorToolScripts[i].desc.name); if (num >= 0) { i2 = MyInfoManager.Instance.GetItemBySequence(num); } if (editorToolScripts[i].desc.name == "build_tool") { editorTool[i] = new BuildTool(editorToolScripts[i], battleChat); } else if (editorToolScripts[i].desc.name == "line_tool") { editorTool[i] = new LineTool(editorToolScripts[i], i2, dummy, battleChat); } else if (editorToolScripts[i].desc.name == "replace_tool") { editorTool[i] = new ReplaceTool(editorToolScripts[i], i2, battleChat); } } editorTool[0].Activate(activate: true); }
private void GlobalInputHack() { Event e = Event.current; if (e.type == EventType.KeyDown) { if (e.keyCode == KeyCode.D) { DrawTool.GetBrush().Rotate(); Parent.Repaint(); Repaint(); } if (e.keyCode == KeyCode.Alpha1) { DrawTool = new PaintTool(this, DrawTool.GetBrush()); Repaint(); } if (e.keyCode == KeyCode.Alpha2) { DrawTool = new FillTool(this, DrawTool.GetBrush() as NormalBrush); Repaint(); } if (e.keyCode == KeyCode.Alpha3) { DrawTool = new ReplaceTool(this, DrawTool.GetBrush() as NormalBrush); Repaint(); } var brush = DrawTool.GetBrush(); if (DrawTool is PaintTool && brush is NormalBrush) { if (e.keyCode == KeyCode.A) { //_brushWindow.BrushSizeAdd(-1); } if (e.keyCode == KeyCode.S) { //_brushWindow.BrushSizeAdd(1); } } if (e.keyCode == KeyCode.Alpha3) { _drawTileSetWindow.SetBrush(-1); } } }
private void OnSelectEntry(GameObject prefab) { ReplaceTool.ReplaceSelectedObjects(Selection.gameObjects, prefab); }
public override void ToolBar() { base.ToolBar(); GUILayout.Box("Misc", EditorStyles.toolbarDropDown); Rect miscRect = GUILayoutUtility.GetLastRect(); if (MyGUI.ButtonMouseDown(miscRect)) { var misc = PopupWindow.ShowAtPosition <MiscPopup>(new Rect(miscRect.x, miscRect.y + miscRect.height, 120f, 60)); misc.Setup(TilerMap); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUI.enabled = TilerMapEditFunctions.Undo.IsUndo(); if (GUILayout.Button("<", EditorStyles.toolbarButton)) { TilerMapEditFunctions.Undo.PerformUndo(); Repaint(); } GUI.enabled = TilerMapEditFunctions.Undo.IsRedo(); if (GUILayout.Button(">", EditorStyles.toolbarButton)) { TilerMapEditFunctions.Undo.PerformRedo(); Repaint(); } GUI.enabled = true; EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (MyGUI.HasToggledPositive(DrawTool is PaintTool, "P", EditorStyles.toolbarButton)) { DrawTool = new PaintTool(this, DrawTool.GetBrush() as NormalBrush); Repaint(); } if (MyGUI.HasToggledPositive(DrawTool is FillTool, "F", EditorStyles.toolbarButton)) { DrawTool = new FillTool(this, DrawTool.GetBrush() as NormalBrush); Repaint(); } if (MyGUI.HasToggledPositive(DrawTool is ReplaceTool, "R", EditorStyles.toolbarButton)) { DrawTool = new ReplaceTool(this, DrawTool.GetBrush() as NormalBrush); Repaint(); } EditorGUILayout.Space(); if (GUILayout.Button("O", EditorStyles.toolbarButton)) { var p = _camera.transform.position; p.x = 0; p.z = 0; _camera.transform.position = p; } EditorGUILayout.Space(); //var currentIndex = _mapIndex; //_mapIndex = EditorGUILayout.Popup(_mapIndex, _mapNames, EditorStyles.toolbarPopup); //options = new[] { "CanJump", "CanShoot", "CanSwim" }; //flags = EditorGUILayout.MaskField("Layers", 1, options, EditorStyles.toolbarPopup); GUILayout.Box("Layers", EditorStyles.toolbarDropDown); Rect last = GUILayoutUtility.GetLastRect(); if (MyGUI.ButtonMouseDown(last)) { var height = 20 * _tilerMaps.Count + 20;// +25; var lp = PopupWindow.ShowAtPosition <LayerPopup>(new Rect(last.x, last.y + last.height, 150f, height)); lp.Setup(_mapIndex, _mapMask, _tilerMaps, SetMapChange, SetMapMask, Save); GUIUtility.ExitGUI(); } /*if (currentIndex != _mapIndex) * { * Save(); * SetMap(_mapIndex); * }*/ }