public ComBrushAt(EditorBoard board, BrushData brushData, int gridX, int gridY) { _board = board; _gridX = gridX; _gridY = gridY; _brushData = brushData; }
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); } }
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); }
public void SetData(BrushData data) { _data = data; image.sprite = Resources.Load <Sprite>(LevelEditorInfo.Instance.WhichGame + "/Sprites/" + data.SpriteId); }