private void TileEditorToolStripMenuItem_Click(object sender, EventArgs e) { if (tileEditor == null) { tileEditor = new TileEditor(); tileEditor.SetMemory(kernel.MemMgr); tileEditor.SetResourceChecker(kernel.ResCheckerRef); gpu.TileEditorMode = true; // Set Vicky into Tile mode previousGraphicMode = kernel.MemMgr.VICKY.ReadByte(0); kernel.MemMgr.VICKY.WriteByte(0, 0x10); // Enable borders kernel.MemMgr.VICKY.WriteByte(4, 1); CenterForm(tileEditor); tileEditor.Show(); tileEditor.FormClosed += new FormClosedEventHandler(EditorWindowClosed); // coordinate between the tile editor window and the GPU canvas this.TileClicked += new TileClickEvent(tileEditor.TileClicked_Click); } else { tileEditor.BringToFront(); } }
private void EventManager_OnTileClicked(object sender, TileClickEvent gameEvent) { var ldescr = gameEvent.IsLeftClicked ? " left" : ""; var rdescr = gameEvent.IsRightClicked ? " right" : ""; Log.Info("EventManager_OnTileClicked " + gameEvent.tile.Position.ToString() + ldescr + rdescr); }
private void TileEditorToolStripMenuItem_Click(object sender, EventArgs e) { if (tileEditor == null) { tileEditor = new TileEditor(); tileEditor.SetMemory(system.MemoryManager); system.GPU.TileEditorMode = true; //// Set Vicky into Tile mode //previousGraphicMode = system.VICKY.ReadByte(0); //system.VICKY.WriteByte(0, 0x10); //// Enable borders //system.VICKY.WriteByte(4, 1); // Set Vicky into Tile mode previousGraphicMode = FoenixSystem.Current.MemoryManager.ReadByte(MemoryMap.VICKY_BASE_ADDR); FoenixSystem.Current.MemoryManager.WriteByte(MemoryMap.VICKY_BASE_ADDR, 0x10); // Enable borders FoenixSystem.Current.MemoryManager.WriteByte(MemoryMap.VICKY_BASE_ADDR + 4, 1); tileEditor.Show(); tileEditor.FormClosed += new FormClosedEventHandler(EditorWindowClosed); // coordinate between the tile editor window and the GPU canvas this.TileClicked += new TileClickEvent(tileEditor.TileClicked_Click); } else { tileEditor.BringToFront(); } }
// When the editor window is closed, exit the TileEditorMode private void EditorWindowClosed(object sender, FormClosedEventArgs e) { gpu.TileEditorMode = false; // Restore the previous graphics mode kernel.MemMgr.VICKY.WriteByte(0, previousGraphicMode); tileEditor.Dispose(); tileEditor = null; TileClicked = null; }
private void EventManager_OnTileClicked(object sender, TileClickEvent gameEvent) { if (gameEvent.tile.Type == TileType.floor && IsReadyForSetGoal) { TrySetGoal(gameEvent.tile, (t) => t.Type == TileType.floor ? true : false); IsReadyForSetGoal = false; } if (gameEvent.tile.Type == TileType.floor && RuneForSet.HasValue()) { StartCoroutine(CastRune(0.4f, gameEvent)); } }
private IEnumerator CastRune(float castTime, TileClickEvent gameEvent) { IsCast = true; var lightning = GameManager.Pool.GetObject(PrefabNames.Lightning); lightning.transform.position = LevelManager.GetWorldPosition(gameEvent.tile.Position); yield return(new WaitForSeconds(castTime)); GameManager.Pool.ReleaseGameObject(lightning); IsCast = false; var rune = GameManager.Pool.GetObject(RuneForSet); var runescript = rune.GetComponent <RuneScript>(); runescript.Place(gameEvent.tile, LevelManager.GetWorldPosition(gameEvent.tile.Position), 10); RuneForSet = null; }
public void TileClicked(object sender, TileClickEvent tce) { OnTileClicked(sender, tce); }
public void RightMouseClick() { var tcea = new TileClickEvent(this, right: true); EventManager.Instance.TileClicked(this, tcea); }