コード例 #1
0
ファイル: ComBrushAt.cs プロジェクト: zhtroy/LevelEditor
 public ComBrushAt(EditorBoard board, BrushData brushData, int gridX, int gridY)
 {
     _board     = board;
     _gridX     = gridX;
     _gridY     = gridY;
     _brushData = brushData;
 }
コード例 #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);
            }
        }
コード例 #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 + ")");
            }
        }
コード例 #4
0
 void OnCurrentBrush(BrushData data)
 {
     CurrentBrush             = data;
     currentBrushImage.sprite = Resources.Load <Sprite>(LevelEditorInfo.Instance.WhichGame + "/Sprites/" + CurrentBrush.SpriteId);
 }
コード例 #5
0
ファイル: BrushView.cs プロジェクト: zhtroy/LevelEditor
 public void SetData(BrushData data)
 {
     _data        = data;
     image.sprite = Resources.Load <Sprite>(LevelEditorInfo.Instance.WhichGame + "/Sprites/" + data.SpriteId);
 }