/// <summary> /// Method to run when a gear option is right clicked (info display) /// </summary> /// <param name="optionID"></param> public void GearRightClicked(string optionName) { Gear gear = GameManager.i.dataScript.GetGear(optionName); if (gear != null) { //adjust position prior to sending Vector3 position = transform.position; position.x += 25; position.y -= 50; position = Camera.main.ScreenToWorldPoint(position); //gear ModalGenericMenuDetails details = new ModalGenericMenuDetails() { /*itemID = gear.gearID,*/ itemName = gear.tag, modalLevel = 2, modalState = ModalSubState.Inventory, itemDetails = string.Format("{0}", gear.type.name), menuPos = position, listOfButtonDetails = GameManager.i.actorScript.GetGearInventoryActions(gear.name), menuType = ActionMenuType.Gear }; //activate menu GameManager.i.actionMenuScript.SetActionMenu(details); } else { Debug.LogError(string.Format("Invalid Gear (Null) for gear / optionData {0}", optionName)); } }
/// <summary> /// Mouse click -> Right: Actor Action Menu /// </summary> public void OnPointerClick(PointerEventData eventData) { GlobalSide playerSide = GameManager.i.sideScript.PlayerSide; bool proceedFlag = true; switch (eventData.button) { case PointerEventData.InputButton.Left: if (GameManager.i.guiScript.CheckIsBlocked(2) == false) { switch (type) { case ModalInventorySubState.HQ: if (GameManager.i.optionScript.isActorLeftMenu == true) { //HQ actor review TabbedUIData tabbedDetailsHq = new TabbedUIData() { side = playerSide, who = TabbedUIWho.HQ, slotID = actorSlotID, modalLevel = 2, modalState = ModalSubState.Inventory }; EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetailsHq, "InventoryInteraction.cs -> OnPointerClick"); } break; case ModalInventorySubState.ReservePool: if (GameManager.i.optionScript.isActorLeftMenu == true) { //Reserves actor review TabbedUIData tabbedDetailsReserves = new TabbedUIData() { side = playerSide, who = TabbedUIWho.Reserves, slotID = actorSlotID, modalLevel = 2, modalState = ModalSubState.Inventory }; EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetailsReserves, "InventoryInteraction.cs -> OnPointerClick"); } break; } } break; case PointerEventData.InputButton.Right: if (GameManager.i.guiScript.CheckIsBlocked(2) == false) { //Action Menu -> not valid if Resistance Plyr and player captured, etc. if (GameManager.i.playerScript.status != ActorStatus.Active) { proceedFlag = false; } if (proceedFlag == true) { switch (type) { case ModalInventorySubState.Gear: Gear gear = GameManager.i.dataScript.GetGear(optionName); if (gear != null) { //adjust position prior to sending Vector3 position = transform.position; position.x += 25; position.y -= 50; position = Camera.main.ScreenToWorldPoint(position); //gear ModalGenericMenuDetails details = new ModalGenericMenuDetails() { /*itemID = gear.gearID,*/ itemName = gear.tag, modalLevel = 2, modalState = ModalSubState.Inventory, itemDetails = string.Format("{0}", gear.type.name), menuPos = position, listOfButtonDetails = GameManager.i.actorScript.GetGearInventoryActions(gear.name), menuType = ActionMenuType.Gear }; //activate menu GameManager.i.actionMenuScript.SetActionMenu(details); } else { Debug.LogError(string.Format("Invalid Gear (Null) for gearID / optionData {0}", optionData)); } break; case ModalInventorySubState.ReservePool: if (GameManager.i.optionScript.isActorRightMenu == true) { Actor actor = GameManager.i.dataScript.GetActor(optionData); if (actor != null) { //adjust position prior to sending Vector3 position = transform.position; position.x += 25; position.y -= 50; position = Camera.main.ScreenToWorldPoint(position); //reserve actions menu ModalGenericMenuDetails details = new ModalGenericMenuDetails() { itemID = actor.actorID, itemName = actor.actorName, modalLevel = 2, modalState = ModalSubState.Inventory, itemDetails = string.Format("{0} ID {1}", actor.arc.name, actor.actorID), menuPos = position, listOfButtonDetails = GameManager.i.actorScript.GetReservePoolActions(actor.actorID), menuType = ActionMenuType.Reserve }; //activate menu GameManager.i.actionMenuScript.SetActionMenu(details); } else { Debug.LogError(string.Format("Invalid Actor (Null) for actorID / optionData {0}", optionData)); } } break; //NOTE: no default option as some SubStates, eg. HQ don't have a Right click option } } else { //player not active GameManager.i.guiScript.SetAlertMessageModalTwo(AlertType.PlayerStatus, ModalSubState.Inventory); } } break; default: Debug.LogError("Unknown InputButton"); break; } }
/// <summary> /// Mouse click -> Right: Actor Action Menu /// </summary> public void OnPointerClick(PointerEventData eventData) { GlobalSide playerSide = GameManager.i.sideScript.PlayerSide; bool proceedFlag = true; AlertType alertType = AlertType.None; switch (eventData.button) { case PointerEventData.InputButton.Left: if (GameManager.i.optionScript.isPlayerLeftMenu == true) { //player review TabbedUIData tabbedDetails = new TabbedUIData() { side = playerSide, who = TabbedUIWho.Player, slotID = 0, }; EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetails, "PlayerClickUI.cs -> OnPointerClick"); } else { GameManager.i.guiScript.SetAlertMessageModalOne(AlertType.TutorialDossierUnavailable); } break; case PointerEventData.InputButton.Right: if (GameManager.i.guiScript.CheckIsBlocked() == false) { //Action Menu -> not valid if AI is active for side if (GameManager.i.sideScript.CheckInteraction() == false) { proceedFlag = false; alertType = AlertType.SideStatus; } if (GameManager.i.playerScript.status != ActorStatus.Active) { proceedFlag = false; alertType = AlertType.PlayerStatus; } if (GameManager.i.optionScript.isPlayerRightMenu == false) { proceedFlag = false; alertType = AlertType.TutorialMenuUnavailable; } /*//Action Menu -> not valid if Player inactive * else if (GameManager.instance.playerScript.status != ActorStatus.Active) * { proceedFlag = false; alertType = AlertType.PlayerStatus; }*/ //proceed if (proceedFlag == true) { //adjust position prior to sending Vector3 position = transform.position; position.x += 25; position.y -= 50; position = Camera.main.ScreenToWorldPoint(position); //actor ModalGenericMenuDetails details = new ModalGenericMenuDetails() { itemID = 1, itemName = GameManager.i.playerScript.PlayerName, itemDetails = menuHeaderRightClick, menuPos = position, listOfButtonDetails = GameManager.i.actorScript.GetPlayerActions(), menuType = ActionMenuType.Player }; //close Player tooltip GameManager.i.tooltipPlayerScript.CloseTooltip(); //activate menu GameManager.i.actionMenuScript.SetActionMenu(details); } else { //explanatory message if (alertType != AlertType.None) { GameManager.i.guiScript.SetAlertMessageModalOne(alertType); } } } break; default: Debug.LogWarningFormat("Unknown InputButton \"{0}\"", eventData.button); break; } }
/// <summary> /// Mouse click -> Left: Dossier, Right: Actor Action Menu /// </summary> public void OnPointerClick(PointerEventData eventData) { if (GameManager.i.optionScript.isSubordinates == true) { GlobalSide playerSide = GameManager.i.sideScript.PlayerSide; bool proceedFlag = true; int data = -1; AlertType alertType = AlertType.None; //is there an actor in this slot? if (GameManager.i.dataScript.CheckActorSlotStatus(actorSlotID, playerSide) == true) { //close actor tooltip GameManager.i.tooltipActorScript.CloseTooltip("ActorClickUI.cs -> OnPointerClick"); //which button switch (eventData.button) { case PointerEventData.InputButton.Left: if (GameManager.i.optionScript.isActorLeftMenu == true) { //actor review TabbedUIData tabbedDetails = new TabbedUIData() { side = playerSide, who = TabbedUIWho.Subordinates, slotID = GameManager.i.dataScript.GetActorPosition(actorSlotID, playerSide), }; EventManager.i.PostNotification(EventType.TabbedOpen, this, tabbedDetails, "ActorClickUI.cs -> OnPointerClick"); } else { GameManager.i.guiScript.SetAlertMessageModalOne(AlertType.TutorialDossierUnavailable); } break; case PointerEventData.InputButton.Right: if (GameManager.i.guiScript.CheckIsBlocked() == false) { //Action Menu -> not valid if AI is active for side if (GameManager.i.sideScript.CheckInteraction() == false) { proceedFlag = false; alertType = AlertType.SideStatus; } //Action Menu -> not valid if Player inactive else if (GameManager.i.playerScript.status != ActorStatus.Active) { proceedFlag = false; alertType = AlertType.PlayerStatus; } else if (GameManager.i.optionScript.isActorRightMenu == false) { proceedFlag = false; alertType = AlertType.TutorialMenuUnavailable; } Actor actor = GameManager.i.dataScript.GetCurrentActor(actorSlotID, playerSide); if (actor != null) { if (actor.Status != ActorStatus.Active) { proceedFlag = false; alertType = AlertType.ActorStatus; data = actor.actorID; } //proceed if (proceedFlag == true) { //adjust position prior to sending Vector3 position = transform.position; position.x += 25; position.y -= 50; position = Camera.main.ScreenToWorldPoint(position); //actor ModalGenericMenuDetails genericDetails = new ModalGenericMenuDetails() { itemID = actor.slotID, itemName = actor.actorName, itemDetails = string.Format("{0} ID {1}", actor.arc.name, actor.actorID), menuPos = position, listOfButtonDetails = GameManager.i.actorScript.GetActorActions(actorSlotID), menuType = ActionMenuType.Actor }; //activate menu GameManager.i.actionMenuScript.SetActionMenu(genericDetails); } else { //explanatory message if (alertType != AlertType.None) { GameManager.i.guiScript.SetAlertMessageModalOne(alertType, data); } } } else { Debug.LogError(string.Format("Invalid actor (Null) for actorSlotID {0}", actorSlotID)); } } break; } } } }
/// <summary> /// Initialise and activate modal Action Menu /// </summary> /// <param name="details"></param> public void SetActionMenu(ModalGenericMenuDetails details) { //set states (done up front to prevent node tooltip reoccuring during menu display) ModalStateData package = new ModalStateData() { mainState = ModalSubState.ActionMenu }; GameManager.i.inputScript.SetModalState(package); //close all tooltips GameManager.i.guiScript.SetTooltipsOff(); //check enough actions if (GameManager.i.turnScript.CheckRemainingActions() == true) { //modalActionObject.SetActive(true); menuCanvas.gameObject.SetActive(true); //set all states to off button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); button4.gameObject.SetActive(false); button5.gameObject.SetActive(false); button6.gameObject.SetActive(false); //set up ModalActionObject itemDetails.text = string.Format("{0}{1}{2}", details.itemName, "\n", details.itemDetails); //tooltip at top of menu -> pass through data ModalMenuUI modal = itemDetails.GetComponent <ModalMenuUI>(); modal.menuType = details.menuType; switch (details.menuType) { case ActionMenuType.Node: case ActionMenuType.NodeGear: modal.nodeID = details.itemID; break; case ActionMenuType.Actor: modal.actorSlotID = details.itemID; break; case ActionMenuType.Player: break; case ActionMenuType.Gear: modal.gearName = details.itemKey; break; } //There can be a max of 6 buttons (5 plus 1 x Cancel) int counter = 0; Button tempButton; Text title; foreach (EventButtonDetails buttonDetails in details.listOfButtonDetails) { tempButton = null; title = null; counter++; //get the relevent UI elements switch (counter) { case 1: tempButton = button1; title = button1Text; break; case 2: tempButton = button2; title = button2Text; break; case 3: tempButton = button3; title = button3Text; break; case 4: tempButton = button4; title = button4Text; break; case 5: tempButton = button5; title = button5Text; break; case 6: tempButton = button6; title = button6Text; break; default: Debug.LogWarning("To many EventButtonDetails in list!\n"); break; } //set up the UI elements if (tempButton != null && title != null) { tempButton.onClick.RemoveAllListeners(); tempButton.onClick.AddListener(CloseActionMenu); tempButton.onClick.AddListener(buttonDetails.action); title.text = buttonDetails.buttonTitle; tempButton.gameObject.SetActive(true); GenericTooltipUI generic = tempButton.GetComponent <GenericTooltipUI>(); generic.tooltipHeader = buttonDetails.buttonTooltipHeader; generic.tooltipMain = buttonDetails.buttonTooltipMain; generic.tooltipDetails = buttonDetails.buttonTooltipDetail; generic.x_offset = 40; } } //convert coordinates Vector3 screenPos = Camera.main.WorldToScreenPoint(details.menuPos); //update rectTransform to get a correct height as it changes every time with the dynamic menu resizing depending on number of buttons Canvas.ForceUpdateCanvases(); rectTransform = modalMenuObject.GetComponent <RectTransform>(); //get dimensions of dynamic menu float width = rectTransform.rect.width; float height = rectTransform.rect.height; //calculate offset - height (default above) if (screenPos.y + height + offset < Screen.height) { screenPos.y += height + offset; } else { screenPos.y -= offset; } //width - default right if (screenPos.x + offset >= Screen.width) { screenPos.x -= offset + screenPos.x - Screen.width; } //go left if needed else if (screenPos.x - offset - width <= 0) { screenPos.x += offset - width; } else { screenPos.x += offset; } //set new position modalMenuObject.transform.position = screenPos; //block raycasts to gameobjects GameManager.i.guiScript.SetIsBlocked(true, details.modalLevel); modalLevel = details.modalLevel; modalState = details.modalState; Debug.LogFormat("[UI] ModalActionMenu.cs -> SetActionMenu{0}", "\n"); } else { //insufficient actions remaining -> create an outcome window to notify player ModalOutcomeDetails outcomeDetails = new ModalOutcomeDetails(); outcomeDetails.side = GameManager.i.sideScript.PlayerSide; outcomeDetails.textTop = "You have used up all your Actions for this turn"; //extra text if player is wounded if (GameManager.i.turnScript.CheckPlayerWounded() == true) { outcomeDetails.textBottom = "Maximum ONE Action allowed while WOUNDED"; } outcomeDetails.sprite = GameManager.i.spriteScript.infoSprite; outcomeDetails.modalLevel = details.modalLevel; outcomeDetails.modalState = details.modalState; EventManager.i.PostNotification(EventType.OutcomeOpen, this, outcomeDetails, "ModalActionMenu.cs -> SetActionMenu"); } }
/// <summary> /// Activate modal Main Menu. Called by InitialiseMainMenu. /// </summary> /// <param name="details"></param> private void SetMainMenu(ModalGenericMenuDetails details) { //game state -> save current state first gameState = GameManager.i.inputScript.GameState; GameManager.i.inputScript.GameState = GameState.MainMenu; //turn off node tooltip if needs be GameManager.i.guiScript.SetTooltipsOff(); //activate main menu mainMenuCanvas.gameObject.SetActive(true); //set all states to off button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); button4.gameObject.SetActive(false); button5.gameObject.SetActive(false); button6.gameObject.SetActive(false); button7.gameObject.SetActive(false); button8.gameObject.SetActive(false); button9.gameObject.SetActive(false); button10.gameObject.SetActive(false); button11.gameObject.SetActive(false); //set up ModalActionObject itemDetails.text = string.Format("{0}{1}{2}", details.itemName, "\n", details.itemDetails); /*//tooltip at top of menu -> pass through data * ModalMenuUI modal = itemDetails.GetComponent<ModalMenuUI>();*/ //There can be a max of 9 buttons int counter = 0; Button tempButton; TextMeshProUGUI title; foreach (EventButtonDetails buttonDetails in details.listOfButtonDetails) { tempButton = null; title = null; counter++; //get the relevent UI elements switch (counter) { case 1: tempButton = button1; title = button1Text; break; case 2: tempButton = button2; title = button2Text; break; case 3: tempButton = button3; title = button3Text; break; case 4: tempButton = button4; title = button4Text; break; case 5: tempButton = button5; title = button5Text; break; case 6: tempButton = button6; title = button6Text; break; case 7: tempButton = button7; title = button7Text; break; case 8: tempButton = button8; title = button8Text; break; case 9: tempButton = button9; title = button9Text; break; case 10: tempButton = button10; title = button10Text; break; case 11: tempButton = button11; title = button11Text; break; default: Debug.LogWarning("To many EventButtonDetails in list!\n"); break; } //set up the UI elements if (tempButton != null && title != null) { tempButton.onClick.RemoveAllListeners(); tempButton.onClick.AddListener(CloseMainMenu); tempButton.onClick.AddListener(buttonDetails.action); title.text = buttonDetails.buttonTitle; tempButton.gameObject.SetActive(true); GenericTooltipUI generic = tempButton.GetComponent <GenericTooltipUI>(); generic.tooltipHeader = buttonDetails.buttonTooltipHeader; generic.tooltipMain = buttonDetails.buttonTooltipMain; generic.tooltipDetails = buttonDetails.buttonTooltipDetail; generic.x_offset = 40; } } //No need to convert coordinates (already screen coords) Vector3 screenPos = details.menuPos; //update rectTransform to get a correct height as it changes every time with the dynamic menu resizing depending on number of buttons Canvas.ForceUpdateCanvases(); rectTransform = modalMenuObject.GetComponent <RectTransform>(); //get dimensions of dynamic menu float width = rectTransform.rect.width; float height = rectTransform.rect.height; //place menu in centre of given position screenPos.x -= width / 2; screenPos.y += height / 2; /*//calculate offset - height (default above) -> No Auto adjust for hitting screen boundaries (it's wonky) * if (screenPos.y + height + offset < Screen.height) * { screenPos.y += height + offset; } * else { screenPos.y -= offset; } * //width - default right * if (screenPos.x + offset >= Screen.width) * { screenPos.x -= offset + screenPos.x - Screen.width; } * //go left if needed * else if (screenPos.x - offset - width <= 0) * { screenPos.x += offset - width; } * else * { screenPos.x += offset; }*/ //set new position modalMenuObject.transform.position = screenPos; //set states ModalStateData package = new ModalStateData() { mainState = ModalSubState.MainMenu }; GameManager.i.inputScript.SetModalState(package); //block raycasts to gameobjects GameManager.i.guiScript.SetIsBlocked(true, details.modalLevel); modalLevel = details.modalLevel; modalState = details.modalState; Debug.LogFormat("[UI] ModalMainMenu.cs -> SetMainMenu{0}", "\n"); }
/// <summary> /// Initialises Main menu details and passes configuration data to SetMainMenu which then fires it up. Use this method instead of SetMainMenu to display menu (enables easy set up of buttons) /// </summary> /// <param name="detailsMain"></param> private void InitialiseMainMenu(ModalMainMenuDetails detailsMain) { //game state -> save current state first gameState = GameManager.i.inputScript.GameState; //menu ModalGenericMenuDetails details = new ModalGenericMenuDetails(); details.itemName = detailsMain.header; details.itemDetails = "2033"; float horizontalPos = 0f; float verticalPos = Screen.height / 2; //horizontal position can vary but vertical is always centred switch (detailsMain.alignHorizontal) { case AlignHorizontal.Left: horizontalPos = Screen.width / 3; break; case AlignHorizontal.Centre: horizontalPos = Screen.width / 2; break; case AlignHorizontal.Right: horizontalPos = Screen.width * 0.6666f; break; default: Debug.LogErrorFormat("Unrecognised alignHorizontal \"{0}\"", detailsMain.alignHorizontal); break; } //position details.menuPos = new Vector3(horizontalPos, verticalPos); // // - - - Configure buttons (not buttons need to be in top to bottom menu display order) // //Resume button if (detailsMain.isResume == true) { EventButtonDetails button0 = new EventButtonDetails() { buttonTitle = "Resume", buttonTooltipHeader = string.Format("{0}Resume{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Return to Game{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}HQ are wondering where you've gone{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.ResumeGame, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button0); } //Tutorial button if (detailsMain.isTutorial == true) { EventButtonDetails button1 = new EventButtonDetails() { buttonTitle = "Tutorial", buttonTooltipHeader = string.Format("{0}Tutorial{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Do the Tutorial{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}You weren't expecting to figure this out on your own, were you?{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.TutorialOptions, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button1); } //New Game button if (detailsMain.isNewGame == true) { EventButtonDetails button2 = new EventButtonDetails() { buttonTitle = "New Game", buttonTooltipHeader = string.Format("{0}New Game{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Start a new game{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}HQ are keen to get moving{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CreateNewGame, this, null, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button2); } //Load Game button if (detailsMain.isLoadGame == true) { EventButtonDetails button3 = new EventButtonDetails() { buttonTitle = "Load Game", buttonTooltipHeader = string.Format("{0}Load Game{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Load a saved game{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}HQ would like now how you manage that trick?{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.LoadGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button3); } //Save Game button if (detailsMain.isSaveGame == true) { EventButtonDetails button4 = new EventButtonDetails() { buttonTitle = "Save Game", buttonTooltipHeader = string.Format("{0}Save Game{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Save your current game{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}HQ are working on uploading memories{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.SaveGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button4); } //Options button if (detailsMain.isOptions == true) { EventButtonDetails button5 = new EventButtonDetails() { buttonTitle = "Options", buttonTooltipHeader = string.Format("{0}Options{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Game Options{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}It's good to have options{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CreateOptions, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button5); } //Feedback button if (detailsMain.isFeedback == true) { EventButtonDetails button6 = new EventButtonDetails() { buttonTitle = "Feedback", buttonTooltipHeader = string.Format("{0}Feedback{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Send Feedback on bugs or design{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}All feedback, good or bad, is much appreciated{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button6); } //Customise button if (detailsMain.isCustomise == true) { EventButtonDetails button7 = new EventButtonDetails() { buttonTitle = "Customise", buttonTooltipHeader = string.Format("{0}Customise{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Personalise the game environment in an easy to use manner{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}Who doesn't like to do things there way?{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button7); } //Credits button if (detailsMain.isCredits == true) { EventButtonDetails button8 = new EventButtonDetails() { buttonTitle = "Credits", buttonTooltipHeader = string.Format("{0}Credits{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}The cast of thousands who made this mighty game{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}Make yourself a cuppa and then sit back and roll the Credits{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button8); } //Information button if (detailsMain.isInformation == true) { EventButtonDetails button9 = new EventButtonDetails() { buttonTitle = "Information", buttonTooltipHeader = string.Format("{0}Information{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Find info on Game Mechanics and Game Design{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}Information is Power{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button9); } //Return to Main Menu button if (detailsMain.isMainMenu == true) { EventButtonDetails button10 = new EventButtonDetails() { buttonTitle = "Main Menu", buttonTooltipHeader = string.Format("{0}Main Menu{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Return to the Main Menu{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}Take a moment to recalibrate{1}", colourAlert, colourEnd) }; //depends on where you are returning from switch (GameManager.i.inputScript.GameState) { case GameState.NewInitialisation: //playGame when exiting to main menu case GameState.PlayGame: button10.action = () => { EventManager.i.PostNotification(EventType.GameReturn, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }; break; case GameState.Tutorial: button10.action = () => { EventManager.i.PostNotification(EventType.TutorialReturn, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }; break; default: Debug.LogWarningFormat("Unrecognised GameState \"{0}\"", GameManager.i.inputScript.GameState); break; } details.listOfButtonDetails.Add(button10); } //Exit to Desktop button if (detailsMain.isExit == true) { EventButtonDetails button11 = new EventButtonDetails() { buttonTitle = "EXIT to Desktop", buttonTooltipHeader = string.Format("{0}EXIT{1}", colourSide, colourEnd), buttonTooltipMain = string.Format("{0}Leave the game and exit to the desktop{1}", colourNormal, colourEnd), buttonTooltipDetail = string.Format("{0}HQ will hold the fort until you return{1}", colourAlert, colourEnd), action = () => { EventManager.i.PostNotification(EventType.ExitGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); } }; details.listOfButtonDetails.Add(button11); } //display background (default is none) GameManager.i.modalGUIScript.SetBackground(detailsMain.background); //activate menu SetMainMenu(details); }