private void onTouched(Roga2dButton button) { if (this.WindowMessageInvoked != null) { int cardIndex = (int)button.Tag; WindowMessage message = new WindowMessage(WindowMessageType.CombatCardTouched, cardIndex); this.WindowMessageInvoked(message); } }
private void AddCard(int no, float x, float y) { // Symbols Roga2dButton button = new Roga2dButton(); button.LocalPriority = 0.1f; button.SetUpSprite("UI/buttons", new Vector2(32, 32), new Vector2(16, 16), new Rect(0, 0, 32, 32)); button.SetDownSprite("UI/buttons", new Vector2(32, 32), new Vector2(16, 16), new Rect(32, 0, 32, 32)); button.OnTouched = this.onTouched; button.LocalPixelPosition = new Vector2(x, y); button.Tag = no; int tx = no % 3; int ty = no / 3; Roga2dSprite sprite = new Roga2dSprite("UI/weapon", new Vector2(32, 32), new Vector2(16, 16), new Rect(64 * tx, 56 * ty, 64, 56)); sprite.LocalPriority = 0.1f; sprite.LocalPixelPosition = new Vector2(16, 16); button.AddChild(sprite); this.AddChild(button); }
private void onStepTouched(Roga2dButton button) { int stepId = (int)button.Tag; this.mapModel.MoveTo(stepId); if (StepTouched != null) { StepTouched(stepId); } }
private void addStep(int no, float x, float y) { // Steps Roga2dButton button = new Roga2dButton(); button.Tag = no; button.LocalPriority = 0.1f; button.SetUpSprite("Dungeon/symbols", new Vector2(24, 24), new Vector2(12, 12), new Rect(0, 0, 32, 32)); button.SetDownSprite("Dungeon/symbols", new Vector2(24, 24), new Vector2(12, 12), new Rect(32, 0, 32, 32)); button.OnTouched = this.onStepTouched; button.LocalPixelPosition = new Vector2(x, y); this.floor.AddChild(button); }