public override bool OnCardPlayCanceled(Interactions.NotifyCardEvent io) { if (!String.IsNullOrEmpty(io.Message)) { GameApp.Service<Services.PopupDialog>().PushMessageBox(io.Message, () => io.Respond()); return true; } return false; }
private bool OnNotified(Interactions.NotifyGameEvent interactionObj) { switch (interactionObj.Notification) { default: break; } interactionObj.Respond(); return false; }
public override void OnSelectCards(Interactions.SelectCards io) { var respond = m_playingBack.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (respond[0] == "se") { if (respond[1] == "null") { io.Respond(null); } else { CardInstance[] cards = new CardInstance[respond.Length - 1]; for (int i = 1; i < respond.Length; ++i) { cards[i - 1] = io.Candidates.First(c => c.Guid == Int32.Parse(respond[i])); } io.Respond(cards.ToIndexable()); } } else { throw new NotSupportedException(String.Format("Unrecognized verb {0}", respond[0])); } }
protected override bool OnNotified(Interactions.NotifyGameEvent interactionObj) { switch (interactionObj.Notification) { case "OnInitiativeCommandEnd": m_agents[Game.ActingPlayer.Index].OnInitiativeCommandEnd(); break; case "OnInitiativeCommandCanceled": m_agents[Game.ActingPlayer.Index].OnInitiativeCommandCanceled(); break; default: break; } interactionObj.Respond(); return false; }
private bool OnNotified(Interactions.NotifyPlayerEvent interactionObj) { switch (interactionObj.Notification) { case "OnPlayerPhaseChanged": { Console.WriteLine(">> ---Player {0}'s {1}---", interactionObj.Player.Name, interactionObj.Message); } break; case "OnPlayerLifeSubtracted": Console.WriteLine(">> Player {0} suffers {1}.", interactionObj.Player.Name, interactionObj.Message); break; default: break; } interactionObj.Respond(); return false; }
protected override bool OnNotified(Interactions.NotifyCardEvent interactionObj) { switch (interactionObj.Notification) { case "OnCardDestroyed": m_destroyedCards.Add(interactionObj.Card.Guid); break; case "OnCardPlayCanceled": if (m_agents[Game.ActingPlayer.Index].OnCardPlayCanceled(interactionObj)) { return true; } break; default: break; } interactionObj.Respond(); return false; }
private bool OnNotified(Interactions.NotifyCardEvent interactionObj) { switch (interactionObj.Notification) { case "OnCardDrawn": Console.WriteLine(">> Player {0} drew card {1}", interactionObj.Card.Owner.Name, interactionObj.Card.Model.Name); break; case "OnCardPlayed": Console.WriteLine(">> Player {0} played card {1} onto the battlefield.", interactionObj.Card.Owner.Name, interactionObj.Card.Model.Name); break; case "OnCardPlayCanceled": Console.WriteLine(">> Player {0} canceled playing card {1}: {2}", interactionObj.Card.Owner.Name, interactionObj.Card.Model.Name, interactionObj.Message); break; case "OnCardDestroyed": Console.WriteLine(">> Player {0} card {1} is Destroyed", interactionObj.Card.Owner.Name, interactionObj.Card.Model.Name); break; default: throw new ArgumentException(string.Format("Argument {0} is illegal.", interactionObj.Notification)); } interactionObj.Respond(); return false; }
public override void OnMessageBox(Interactions.MessageBox io) { var respond = m_playingBack.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (respond[0] == "me") { io.Respond((Interactions.MessageBoxButtons)Enum.Parse(typeof(Interactions.MessageBoxButtons), respond[1])); } else { throw new NotSupportedException(String.Format("Unrecognized verb {0}", respond[0])); } }
public override void OnSelectCardModel(Interactions.SelectCardModel io) { var respond = m_playingBack.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (respond[0] == "sc") { io.Respond(respond[1] == "null" ? (ICardModel)null : io.Candidates[Int32.Parse(respond[1])]); } else { throw new NotSupportedException(String.Format("Unrecognized verb {0}", respond[0])); } }
public override void OnSelectNumber(Interactions.SelectNumber io) { var respond = m_playingBack.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (respond[0] == "sn") { io.Respond(respond[1] == "null" ? (int?)null : Int32.Parse(respond[1])); } else { throw new NotSupportedException(String.Format("Unrecognized verb {0}", respond[0])); } }
protected override bool OnNotified(Interactions.NotifySpellEvent interactionObj) { interactionObj.Respond(); return false; }
public override void OnMessageBox(Interactions.MessageBox io) { // translate from Interactions.MessageBox.Button to UI.ModalDialogs.MessageBox.ButtonFlags UI.ModalDialogs.MessageBox.ButtonFlags buttons = 0; if ((io.Buttons & Interactions.MessageBoxButtons.OK) != 0) { buttons |= UI.ModalDialogs.MessageBox.ButtonFlags.OK; } if ((io.Buttons & Interactions.MessageBoxButtons.Cancel) != 0) { buttons |= UI.ModalDialogs.MessageBox.ButtonFlags.Cancel; } if ((io.Buttons & Interactions.MessageBoxButtons.Yes) != 0) { buttons |= UI.ModalDialogs.MessageBox.ButtonFlags.Yes; } if ((io.Buttons & Interactions.MessageBoxButtons.No) != 0) { buttons |= UI.ModalDialogs.MessageBox.ButtonFlags.No; } GameApp.Service<Services.PopupDialog>().PushMessageBox(io.Text, buttons, btn => { // translate back... Interactions.MessageBoxButtons ibtn; switch (btn) { case UI.ModalDialogs.MessageBox.ButtonOK: ibtn = Interactions.MessageBoxButtons.OK; break; case UI.ModalDialogs.MessageBox.ButtonCancel: ibtn = Interactions.MessageBoxButtons.Cancel; break; case UI.ModalDialogs.MessageBox.ButtonYes: ibtn = Interactions.MessageBoxButtons.Yes; break; case UI.ModalDialogs.MessageBox.ButtonNo: ibtn = Interactions.MessageBoxButtons.No; break; default: throw new ArgumentException("btn"); } io.Respond(ibtn); }); }
public override void OnSelectCardModel(Interactions.SelectCardModel io) { GameApp.Service<Services.PopupDialog>().PushCardModelSelector(io.Message, io.Candidates, card => { io.Respond(card); }); }
public override void OnSelectNumber(Interactions.SelectNumber io) { GameApp.Service<Services.PopupDialog>().PushNumberSelector(io.Message, io.Minimum, io.Maximum, (btn, value) => { io.Respond(btn == UI.ModalDialogs.NumberSelector.ButtonOK ? (int?)value : null); }); }
protected override bool OnNotified(Interactions.NotifyPlayerEvent interactionObj) { switch (interactionObj.Notification) { case "OnTurnEnded": if (m_agents[Game.ActingPlayer.Index].OnTurnEnded(interactionObj)) { return true; } break; case "OnTurnStarted": if (m_agents[Game.ActingPlayer.Index].OnTurnStarted(interactionObj)) { return true; } break; default: break; } interactionObj.Respond(); return false; }