예제 #1
0
        private void _DoToolbarButton(Rect rToolBtn, ToolIcons.eToolIcon toolIcon)
        {
            int   iconPadding  = 6;
            Rect  rToolIcon    = new Rect(rToolBtn.x + iconPadding, rToolBtn.y + iconPadding, rToolBtn.size.y - 2 * iconPadding, rToolBtn.size.y - 2 * iconPadding);
            Color activeColor  = new Color(1f, 1f, 1f, 0.8f);
            Color disableColor = new Color(1f, 1f, 1f, 0.4f);

            switch (toolIcon)
            {
            case ToolIcons.eToolIcon.Pencil:
                GUI.color = s_brushMode == eBrushMode.Paint ? activeColor : disableColor;
                if (GUI.Button(rToolBtn, new GUIContent("", "Paint")))
                {
                    s_brushMode = eBrushMode.Paint;
                    MyAutoTileMap.BrushGizmo.Clear();
                    MyAutoTileMap.BrushGizmo.BrushAction = new AutoTileBrush.TileAction();
                    MyAutoTileMap.BrushGizmo.BrushAction.Push(MyAutoTileMap, 0, 0, m_tilesetComponent.SelectedTileIdx, MyAutoTileMap.BrushGizmo.SelectedLayer);
                }
                break;

            case ToolIcons.eToolIcon.Erase:
                GUI.color = s_brushMode == eBrushMode.Erase ? activeColor : disableColor;
                if (GUI.Button(rToolBtn, new GUIContent("", "Erase")))
                {
                    s_brushMode = eBrushMode.Erase;
                    MyAutoTileMap.BrushGizmo.Clear();
                    MyAutoTileMap.BrushGizmo.BrushAction = new AutoTileBrush.TileAction();
                    MyAutoTileMap.BrushGizmo.BrushAction.Push(MyAutoTileMap, 0, 0, -1, MyAutoTileMap.BrushGizmo.SelectedLayer);
                }
                break;

            case ToolIcons.eToolIcon.Undo:
                GUI.color = MyAutoTileMap.BrushGizmo.CanUndo()? activeColor : disableColor;
                if (GUI.Button(rToolBtn, new GUIContent("", " Undo Last Brush Action (Shift + Z)")))
                {
                    MyAutoTileMap.BrushGizmo.UndoAction();
                }
                break;

            case ToolIcons.eToolIcon.Redo:
                GUI.color = MyAutoTileMap.BrushGizmo.CanRedo()? activeColor : disableColor;
                if (GUI.Button(rToolBtn, new GUIContent("", " Redo Last Brush Action (Shift + Y)")))
                {
                    MyAutoTileMap.BrushGizmo.RedoAction();
                }
                break;

            case ToolIcons.eToolIcon.Info:
                GUI.color = m_displayHelpBox ? activeColor : disableColor;
                if (GUI.Button(rToolBtn, new GUIContent("", " Display Help (F1)")))
                {
                    m_displayHelpBox = !m_displayHelpBox;
                }
                break;
            }
            GUI.color = Color.white;
            GUI.DrawTexture(rToolIcon, ToolIcons.GetToolTexture(toolIcon));
        }
예제 #2
0
 private void _DoToolbarButton(Rect rToolBtn, ToolIcons.eToolIcon toolIcon)
 {
     int iconPadding = 6;
     Rect rToolIcon = new Rect(rToolBtn.x + iconPadding, rToolBtn.y + iconPadding, rToolBtn.size.y - 2 * iconPadding, rToolBtn.size.y - 2 * iconPadding);
     Color activeColor = new Color(1f, 1f, 1f, 0.8f);
     Color disableColor = new Color(1f, 1f, 1f, 0.4f);
     switch (toolIcon)
     {
         case ToolIcons.eToolIcon.Pencil:
             GUI.color = s_brushMode == eBrushMode.Paint ? activeColor : disableColor;
             if (GUI.Button(rToolBtn, new GUIContent("", "Paint")))
             {
                 s_brushMode = eBrushMode.Paint;
                 MyAutoTileMap.BrushGizmo.Clear();
                 MyAutoTileMap.BrushGizmo.BrushAction = new AutoTileBrush.TileAction();
                 MyAutoTileMap.BrushGizmo.BrushAction.Push(MyAutoTileMap, 0, 0, m_tilesetComponent.SelectedTileIdx, MyAutoTileMap.BrushGizmo.SelectedLayer);
             }
             break;
         case ToolIcons.eToolIcon.Erase:
             GUI.color = s_brushMode == eBrushMode.Erase ? activeColor : disableColor;
             if (GUI.Button(rToolBtn, new GUIContent("", "Erase")))
             {
                 s_brushMode = eBrushMode.Erase;
                 MyAutoTileMap.BrushGizmo.Clear();
                 MyAutoTileMap.BrushGizmo.BrushAction = new AutoTileBrush.TileAction();
                 MyAutoTileMap.BrushGizmo.BrushAction.Push(MyAutoTileMap, 0, 0, -1, MyAutoTileMap.BrushGizmo.SelectedLayer);
             }
             break;
         case ToolIcons.eToolIcon.Undo:
             GUI.color = MyAutoTileMap.BrushGizmo.CanUndo()? activeColor : disableColor;
             if (GUI.Button(rToolBtn, new GUIContent("", " Undo Last Brush Action (Shift + Z)")))
             {
                 MyAutoTileMap.BrushGizmo.UndoAction();
             }
             break;
         case ToolIcons.eToolIcon.Redo:
             GUI.color = MyAutoTileMap.BrushGizmo.CanRedo()? activeColor : disableColor;
             if (GUI.Button(rToolBtn, new GUIContent("", " Redo Last Brush Action (Shift + Y)")))
             {
                 MyAutoTileMap.BrushGizmo.RedoAction();
             }
             break;
         case ToolIcons.eToolIcon.Info:
             GUI.color = m_displayHelpBox ? activeColor : disableColor;
             if (GUI.Button(rToolBtn, new GUIContent("", " Display Help (F1)")))
             {
                 m_displayHelpBox = !m_displayHelpBox;
             }
             break;
     }
     GUI.color = Color.white;
     GUI.DrawTexture(rToolIcon, ToolIcons.GetToolTexture(toolIcon));
 }