示例#1
0
    // TODO: Look into right mouse

    /*void OnMouseOver() {
     *  if (MapMenu.activeSelf) {
     *      //Debug.Log(Input.GetMouseButton(1) + ", " + Input.GetMouseButtonDown(1) + ", " + Input.GetMouseButtonUp(1));
     *  }
     * }*/

    public void OnMouseDown()
    {
        if (tiles == null)
        {
            tiles = World.Instance.Tiles;
        }

        if (UIMenuController.IsActiveMenu(uiMapEditor))
        {
            Debug("Left: " + Input.GetMouseButton(0) + "  Right: " + Input.GetMouseButton(1));
            Debug("Should be doing something.");
            operationManager.BeginDraw();
            var   gridPos = MouseToGridAPI.GetGridCoordinate(Input.mousePosition);
            Point point   = new Point((int)gridPos.x, (int)gridPos.y);
            switch (currentTool)
            {
            case ToolType.FILL:
                Fill(point, paintCurrent.ID, tiles[Convert.ToInt32(point.x), Convert.ToInt32(point.y)]);
                MapDisplayAPI.FinishOperation();
                break;

            case ToolType.LINE:
            case ToolType.SHAPE:
                startPoint = point;
                break;

            case ToolType.BRUSH:
                previous = point;
                break;

            default:
                break;
            }
        }
    }