Exemple #1
0
 public ComBrushAt(EditorBoard board, BrushData brushData, int gridX, int gridY)
 {
     _board     = board;
     _gridX     = gridX;
     _gridY     = gridY;
     _brushData = brushData;
 }
Exemple #2
0
        public void Update(JSONNode data)
        {
            name     = data.GetString(NAME);
            spriteId = data.GetString(SPRITE_ID);

            var collection = data.GetCollection(BRUSHES);

            brushes = new List <BrushData>();
            foreach (JSONNode item in collection)
            {
                BrushData b = new BrushData();
                b.Update(item);
                brushes.Add(b);
            }
        }
Exemple #3
0
        void OnBrushIndex(int idx)
        {
            Debug.Log("I'm brushed " + idx);
            BrushData brushData = brushList.CurrentBrush;

            if (brushData == null)
            {
                Debug.LogWarning("没有选择画刷");
                return;
            }

            int      gridX    = _coord.GetGridX(idx);
            int      gridY    = _coord.GetGridY(idx);
            ICommand brushCom = new ComBrushAt(_board, brushData, gridX, gridY);

            if (brushCom.Execute())
            {
                _comList.Add(brushCom);
            }
            else
            {
                Debug.LogWarning("can't place brush at this position: (" + gridX + "," + gridY + ")");
            }
        }
 void OnCurrentBrush(BrushData data)
 {
     CurrentBrush             = data;
     currentBrushImage.sprite = Resources.Load <Sprite>(LevelEditorInfo.Instance.WhichGame + "/Sprites/" + CurrentBrush.SpriteId);
 }
Exemple #5
0
 public void SetData(BrushData data)
 {
     _data        = data;
     image.sprite = Resources.Load <Sprite>(LevelEditorInfo.Instance.WhichGame + "/Sprites/" + data.SpriteId);
 }