/// <summary> /// Creates a Decision Popup Component from a game event /// </summary> /// <param name="locationX"></param> /// <param name="locationY"></param> /// <param name="gameEvent"></param> public MultiDecisionComponent(int locationX, int locationY, GameMultiEvent gameEvent) { this.locationX = locationX; this.locationY = locationY; this.visible = true; this.currentEvent = gameEvent; PerformDrag(0, 0); }
/// <summary> /// Generates the particular Game Multi Event for character creation /// </summary> /// <returns></returns> public static GameMultiEvent GenerateCharacterCreation() { var book = SpriteManager.GetSprite(InterfaceSpriteName.BOOK); GameMultiEvent gme = new GameMultiEvent(); gme.EventName = "GENERATE_CHARACTER"; gme.Image = book; gme.Title = "The Avatar is born"; gme.Text = "And thus, world was done\nHumans forget their maker.\nAvatar will come"; List<MultiEventChoice> choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "GEN", Text = "Little is known about their early life", }); choices.Add(new MultiEventChoice() { ChoiceName = "RANDOM", Text = "Nothing is known about their early life" }); gme.Choices = choices.ToArray(); GameMultiEvent next = new GameMultiEvent(); gme.Choices[0].NextChoice = next; next.Image = book; next.Title = "The form of the Avatar"; next.Text = "Avatar takes form\nAs a human has been born\nA perfect human"; choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "MALE", Text = "The Male form was Chosen" }); choices.Add(new MultiEventChoice() { ChoiceName = "FEMALE", Text = "The Female form was Chosen" } ); next.Choices = choices.ToArray(); next = new GameMultiEvent(); foreach (var choice in choices) { choice.NextChoice = next; } next.Image = book; next.Title = "The Family of the Avatar"; next.Text = "Common Family\nFew riches,little greatness\nCommon Beginnings"; choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "MERCHANTS", Text = "A family of Merchants" }); choices.Add(new MultiEventChoice() { ChoiceName = "CLERICS", Text = "A family of Clerics" }); choices.Add(new MultiEventChoice() { ChoiceName = "EXPLORERS", Text = "A family of Explorers" }); next.Choices = choices.ToArray(); next = new GameMultiEvent(); foreach (var choice in choices) { choice.NextChoice = next; } next.Image = book; next.Title = "The Avatar's Nature"; next.Text = "And Avatar grew.\nA special little human\nAnd brilliance was theirs"; choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "INTEL", Text = "As the Wisdom of Dragon's was theirs" }); choices.Add(new MultiEventChoice() { ChoiceName = "AGIL", Text = "As Grace and Speed was theirs" }); choices.Add(new MultiEventChoice() { ChoiceName = "CHAR", Text = "As a tongue of gold was theirs" }); choices.Add(new MultiEventChoice() { ChoiceName = "BRAWN", Text = "As the strenght of many men was theirs" }); next.Choices = choices.ToArray(); next = new GameMultiEvent(); foreach (var choice in choices) { choice.NextChoice = next; } next.Image = book; next.Title = "The Avatar fights"; next.Text = "And Avatar Grew\nIn militia was drafted\nExcelled amongst other men"; choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "LEADER", Text = "as the Leader of men" }); choices.Add(new MultiEventChoice() { ChoiceName = "HEALING", Text = "as their healer" }); choices.Add(new MultiEventChoice() { ChoiceName = "PERSUATION", Text = "as their persuader" }); next.Choices = choices.ToArray(); next = new GameMultiEvent(); foreach (var choice in choices) { choice.NextChoice = next; } next.Image = book; next.Title = "And it begins"; next.EventName = "GENERATE_CHARACTER"; next.Text = "True god spoke to them\nAnd they left their parents' house\nWith blessing and gift"; choices = new List<MultiEventChoice>(); choices.Add(new MultiEventChoice() { ChoiceName = "SWORD", Text = "A sword to smite the nonbelievers" }); choices.Add(new MultiEventChoice() { ChoiceName = "ARMOUR", Text = "Armour to protect against the heretic" }); choices.Add(new MultiEventChoice() { ChoiceName = "MONEY", Text = "Money to sway the hearts of lesser men" }); next.Choices = choices.ToArray(); //Give them the items everyone starts with InventoryItemManager iim = new InventoryItemManager(); var food = iim.GetItemsWithAMaxValue("SUPPLY", 150); foreach (var foodItem in food) { GameState.PlayerCharacter.Inventory.Inventory.Add(InventoryCategory.SUPPLY, foodItem as InventoryItem); (foodItem as InventoryItem).InInventory = true; } return gme; }
public bool HandleClick(int x, int y, Objects.Enums.MouseActionEnum mouseAction, out DRObjects.Enums.ActionType? actionType, out InternalActionEnum? internalActionType, out object[] args, out MapItem item, out DRObjects.MapCoordinate coord, out bool destroy) { Point point = new Point(x, y); item = null; actionType = null; args = null; coord = null; destroy = false; internalActionType = null; if (!Visible) { return false; } if (mouseAction != Objects.Enums.MouseActionEnum.LEFT_CLICK) { return true; } //Did the user click on one of the choices? foreach (var decision in this.currentEvent.Choices) { if (decision.Rect.Contains(point)) { //Decision has been made choicesMade.Add(decision.ChoiceName); //Do we have a next choice? if (decision.NextChoice != null) { //Change the current choice this.currentEvent = decision.NextChoice; this.PerformDrag(0, 0); //force recreation } else { //terminate! Send back that its a multidecision, and the event name and the choices made internalActionType = InternalActionEnum.MULTIDECISION; args = new object[] { this.currentEvent.EventName, this.choicesMade }; destroy = true; } } } //Not handled. But if it's modal, we expect it to catch all handling if (IsModal()) { return true; } else { return false; } }