예제 #1
0
 private void UpdateCurrentPieceInstance(PaletteItem item, Texture2D preview)
 {
     _itemSelected  = item;
     _itemPreview   = preview;
     _pieceSelected = (LevelPiece)item.GetComponent <LevelPiece>();
     Repaint();
 }
예제 #2
0
        private void ModeHandler()
        {
            switch (_selectedMode)
            {
            case Mode.Paint:
            case Mode.Edit:
            case Mode.Erase:
                Tools.current = Tool.None;
                break;

            case Mode.View:
            default:
                Tools.current = Tool.View;
                break;
            }
            // Detect Mode change
            if (_selectedMode != _currentMode)
            {
                _currentMode   = _selectedMode;
                _itemInspected = null;
                Repaint();
            }
            // Force 2D Mode!
            SceneView.currentDrawingSceneView.in2DMode = true;
        }
        private void GetSelectedItem(int index)
        {
            if (index != -1)
            {
                PaletteItem selectedItem = _categorizedItems[_categorySelected][index];

                if (ItemSelectedEvent != null)
                {
                    ItemSelectedEvent.Invoke(selectedItem, _previews[selectedItem]);
                }
            }
        }
예제 #4
0
 private void Edit(int col, int row)
 {
     // Check out of bounds
     if (!_myTarget.IsInsideGridBounds(col, row) || _myTarget.Pieces[col + row * _myTarget.TotalColumns] == null)
     {
         _itemInspected = null;
     }
     else
     {
         _itemInspected = _myTarget.Pieces[col + row * _myTarget.TotalColumns].GetComponent <PaletteItem>() as PaletteItem;
     }
     Repaint();
 }
예제 #5
0
 private void GetSelectedItem(int index)
 {
     if (index != -1)
     {
         PaletteItem selectedItem =
             _categorizedItems[_categorySelected][index];
         Debug.Log("Selected Item is: " +
                   selectedItem.itemName);
         if (ItemSelectedEvent != null)
         {
             ItemSelectedEvent(selectedItem, _previews[selectedItem]);
         }
     }
 }
예제 #6
0
 private void PaletteWindow_ItemSelectedEvent(PaletteItem item, Texture2D preview)
 {
     UpdateCurrentPieceInstance(item, preview);
 }