private void SubInitialiseAll() { tutorialCanvas.gameObject.SetActive(false); //set up lists -> listOfButtons listOfButtons.Add(button0); listOfButtons.Add(button1); listOfButtons.Add(button2); listOfButtons.Add(button3); listOfButtons.Add(button4); listOfButtons.Add(button5); listOfButtons.Add(button6); listOfButtons.Add(button7); listOfButtons.Add(button8); listOfButtons.Add(button9); //button interaction components listOfInteractions.Add(interact0); listOfInteractions.Add(interact1); listOfInteractions.Add(interact2); listOfInteractions.Add(interact3); listOfInteractions.Add(interact4); listOfInteractions.Add(interact5); listOfInteractions.Add(interact6); listOfInteractions.Add(interact7); listOfInteractions.Add(interact8); listOfInteractions.Add(interact9); //widget widget.gameObject.SetActive(true); widgetLeft.text = string.Format("{0}", GameManager.i.guiScript.tutArrowLeft); widgetRight.text = string.Format("{0}", GameManager.i.guiScript.tutArrowRight); widgetQuestion.text = string.Format("{0}", GameManager.i.guiScript.tutQuestion); //widget help widgetHelp = widget.GetComponent <GenericHelpTooltipUI>(); if (widgetHelp != null) { List <HelpData> listOfHelp = GameManager.i.helpScript.GetHelpData("tutorial_0", "tutorial_1", "tutorial_2"); widgetHelp.SetHelpTooltip(listOfHelp, -50, 0); } else { Debug.LogError("Invalid GenericHelpTooltipUI (Null) for widget"); } }
private void Awake() { reviewWaitTimerDefault = reviewWaitTime; //Review button event buttonInteractionReview = buttonReview.GetComponent <ButtonInteraction>(); if (buttonInteractionReview != null) { buttonInteractionReview.SetButton(EventType.ReviewStart); } else { Debug.LogError("Invalid buttonInteraction Review (Null)"); } //Exit button event buttonInteractionExit = buttonExit.GetComponent <ButtonInteraction>(); if (buttonInteractionExit != null) { buttonInteractionExit.SetButton(EventType.ReviewCloseUI); } else { Debug.LogError("Invalid buttonInteraction Exit (Null)"); } //help tooltips tooltipHelpOpen = buttonHelpOpen.GetComponent <GenericHelpTooltipUI>(); tooltipHelpClose = buttonHelpClose.GetComponent <GenericHelpTooltipUI>(); tooltipOutcomeLeft = outcomeLeft.GetComponent <GenericHelpTooltipUI>(); tooltipOutcomeRight = outcomeRight.GetComponent <GenericHelpTooltipUI>(); Debug.Assert(tooltipHelpOpen != null, "Invalid tooltipHelpOpen (Null)"); Debug.Assert(tooltipHelpClose != null, "Invalid tooltipHelpClose (Null)"); Debug.Assert(tooltipOutcomeLeft != null, "Invalid tooltipOutcomeLeft (Null)"); Debug.Assert(tooltipOutcomeRight != null, "Invalid tooltipOutcomeRight (Null)"); //inventory interaction & tooltip arrays set up int numOfOptions = arrayOfOptions.Length; arrayOfInteractions = new ReviewInteraction[numOfOptions]; arrayOfTooltipsSprites = new GenericTooltipUI[numOfOptions]; arrayOfTooltipsTitles = new GenericTooltipUI[numOfOptions]; arrayOfTooltipsResults = new GenericTooltipUI[numOfOptions]; for (int i = 0; i < numOfOptions; i++) { if (arrayOfOptions[i] != null) { //interaction ReviewInteraction interaction = arrayOfOptions[i].GetComponent <ReviewInteraction>(); if (interaction != null) { arrayOfInteractions[i] = interaction; //tooltip -> sprite (attached to game object to prevent tooltip component masking gameobject interaction component which is needed for click detection for menu's) GenericTooltipUI tooltipSprite = interaction.tooltipSprite.GetComponent <GenericTooltipUI>(); if (tooltipSprite != null) { arrayOfTooltipsSprites[i] = tooltipSprite; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for arrayOfReviewOptions[{0}] (Null)", i); } //tooltip -> title GenericTooltipUI tooltipTitle = interaction.tooltipTitle.GetComponent <GenericTooltipUI>(); if (tooltipTitle != null) { arrayOfTooltipsTitles[i] = tooltipTitle; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for arrayOTooltipsTitle[{0}] (Null)", i); } //tooltip -> result GenericTooltipUI tooltipResult = interaction.tooltipResult.GetComponent <GenericTooltipUI>(); if (tooltipResult != null) { arrayOfTooltipsResults[i] = tooltipResult; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for interaction.tooltipResult \"{0}\" (Null)", i); } } else { Debug.LogErrorFormat("Invalid InventoryInteraction for arrayOfInventoryOptions[{0}] (Null)", i); } } else { Debug.LogErrorFormat("Invalid arrayOfInventoryOptions[{0}] (Null)", i); } } }
private void SubInitialiseSessionStart() { maxOptions = GameManager.i.guiScript.maxPickerOptions; Debug.Assert(maxOptions == 3, "Invalid maxOptions (must be 3)"); //arrays arrayOfInteractions = new GenericInteraction[maxOptions]; arrayOfImageTooltips = new GenericTooltipUI[maxOptions]; arrayOfTextTooltips = new GenericTooltipUI[maxOptions]; //confirm button event buttonConfirmInteraction = buttonConfirm.GetComponent <ButtonInteraction>(); if (buttonConfirmInteraction != null) { buttonConfirmInteraction.SetButton(EventType.ConfirmGenericChoice); } else { Debug.LogError("Invalid buttonInteraction Confirm (Null)"); } //cancel button event buttonCancelInteraction = buttonCancel.GetComponent <ButtonInteraction>(); if (buttonCancelInteraction != null) { buttonCancelInteraction.SetButton(EventType.CancelButtonGeneric); } else { Debug.LogError("Invalid buttonInteraction Confirm (Null)"); } //help button help = buttonHelp.GetComponent <GenericHelpTooltipUI>(); if (help == null) { Debug.LogError("Invalid help script (Null)"); } //Back button event (default -> can be set dynamically using 'SetBackButton' method buttonBackInteraction = buttonBack.GetComponent <ButtonInteraction>(); if (buttonBackInteraction != null) { buttonBackInteraction.SetButton(EventType.BackButtonGeneric); } else { Debug.LogError("Invalid buttonBackInteraction (Null)"); } backReturnEvent = EventType.None; //tooltips for (int i = 0; i < maxOptions; i++) { //interaction GenericInteraction interaction = arrayOfGenericOptions[i].GetComponent <GenericInteraction>(); if (interaction != null) { arrayOfInteractions[i] = interaction; //tooltip image GenericTooltipUI tooltipImage = interaction.imageTooltip; if (tooltipImage != null) { arrayOfImageTooltips[i] = tooltipImage; } else { Debug.LogErrorFormat("Invalid tooltipImage (Null) for arrayOfInteractions[{0}]", i); } //tooltip text GenericTooltipUI tooltipText = interaction.textTooltip; if (tooltipText != null) { arrayOfTextTooltips[i] = tooltipText; } else { Debug.LogErrorFormat("Invalid tooltipText (Null) for arrayOfInteractions[{0}]", i); } } else { Debug.LogErrorFormat("Invalid interaction (Null) for arrayOfGenericOptions[{0}]", i); } } }
/// <summary> /// Session start /// </summary> private void SubInitialiseSessionStart() { //inventory interaction & tooltip arrays set up int numOfOptions = arrayOfInventoryOptions.Length; Debug.AssertFormat(numOfOptions == GameManager.i.guiScript.maxInventoryOptions, "Mismatch on Option numbers (is {0}, should be {1})", numOfOptions, GameManager.i.guiScript.maxInventoryOptions); //cancel button event buttonInteraction = buttonCancel.GetComponent <ButtonInteraction>(); if (buttonInteraction != null) { buttonInteraction.SetButton(EventType.InventoryCloseUI); } else { Debug.LogError("Invalid buttonInteraction Cancel (Null)"); } //help button help = buttonHelp.GetComponent <GenericHelpTooltipUI>(); if (help == null) { Debug.LogError("Invalid help script (Null)"); } //initialise arrays arrayOfInteractions = new InventoryInteraction[numOfOptions]; arrayOfTooltipsSprites = new GenericTooltipUI[numOfOptions]; arrayOfTooltipsStars = new GenericTooltipUI[numOfOptions]; arrayOfTooltipsCompatibility = new GenericTooltipUI[numOfOptions]; arrayOfTooltipsTexts = new GenericTooltipUI[numOfOptions]; for (int i = 0; i < numOfOptions; i++) { if (arrayOfInventoryOptions[i] != null) { //interaction InventoryInteraction interaction = arrayOfInventoryOptions[i].GetComponent <InventoryInteraction>(); if (interaction != null) { arrayOfInteractions[i] = interaction; //tooltip -> sprite (attached to game object to prevent tooltip component masking gameobject interaction component which is needed for click detection for menu's) GenericTooltipUI tooltipSprite = arrayOfInventoryOptions[i].GetComponent <GenericTooltipUI>(); if (tooltipSprite != null) { arrayOfTooltipsSprites[i] = tooltipSprite; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for arrayOfInventoryOptions[{0}] (Null)", i); } //tooltip -> stars (bottomText, optional) GenericTooltipUI tooltipStars = interaction.tooltipStars.GetComponent <GenericTooltipUI>(); if (tooltipStars != null) { arrayOfTooltipsStars[i] = tooltipStars; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for interaction.tooltipStars \"{0}\" (Null)", i); } //tooltip -> compatibility (topText, optional) GenericTooltipUI tooltipCompatibility = interaction.tooltipCompatibility.GetComponent <GenericTooltipUI>(); if (tooltipCompatibility != null) { arrayOfTooltipsCompatibility[i] = tooltipCompatibility; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for interaction.tooltipCompatibility \"{0}\" (Null)", i); } //tooltip -> texts (upperText, optional) GenericTooltipUI tooltipText = interaction.tooltipText.GetComponent <GenericTooltipUI>(); if (tooltipText != null) { arrayOfTooltipsTexts[i] = tooltipText; } else { Debug.LogErrorFormat("Invalid GenericTooltipUI for interaction.tooltipText \"{0}\" (Null)", i); } } else { Debug.LogErrorFormat("Invalid InventoryInteraction for arrayOfInventoryOptions[{0}] (Null)", i); } } else { Debug.LogErrorFormat("Invalid arrayOfInventoryOptions[{0}] (Null)", i); } } //toggle main objects inventoryCanvas.gameObject.SetActive(false); modalPanelObject.SetActive(true); modalInventoryObject.SetActive(true); modalHeaderObject.SetActive(true); }
/// <summary> /// Session Start Initialisation /// </summary> private void SubInitialiseSessionStart() { /*canvasGroup = modalOutcomeWindow.GetComponent<CanvasGroup>();*/ /*fadeInTime = GameManager.instance.tooltipScript.tooltipFade;*/ //Assignments specialTransform = panelSpecial.GetComponent <RectTransform>(); blackBarTransform = blackBar.GetComponent <RectTransform>(); highlightTransform = highlight.GetComponent <RectTransform>(); specialWidth = specialTransform.rect.width; Debug.Assert(specialTransform != null, "Invalid specialTransform (Null)"); Debug.Assert(blackBarTransform != null, "Invalid blackBarTransform (Null)"); Debug.Assert(highlightTransform != null, "Invalid highlight1Transform (Null)"); Debug.Assert(specialWidth > 0.0f, "Invalid specialWidth (Zero or less)"); helpNormal = helpButtonNormal.GetComponent <GenericHelpTooltipUI>(); if (helpNormal == null) { Debug.LogError("Invalid helpNormal (Null)"); } //button interactions interactConfirm = confirmButtonNormal.GetComponent <ButtonInteraction>(); if (interactConfirm != null) { interactConfirm.SetButton(EventType.OutcomeClose); } else { Debug.LogError("Invalid interactConfirm (Null)"); } interactShowMe = showMeButtonNormal.GetComponent <ButtonInteraction>(); if (interactShowMe != null) { interactShowMe.SetButton(EventType.OutcomeShowMe); } else { Debug.LogError("Invalid interactShowMe (Null)"); } //colours colourGood = GameManager.i.uiScript.outcomeGood; colourBad = GameManager.i.uiScript.outcomeBad; panelSpecial.color = GameManager.i.uiScript.outcomeSpecial; blackBar.color = GameManager.i.uiScript.outcomeBlackBars; //Fixed position at screen centre Vector3 screenPos = new Vector3(); screenPos.x = Screen.width / 2; screenPos.y = Screen.height / 2; //set position outcomeObject.transform.position = screenPos; //Blackbar (special outcome) blackBarTimeGrow = GameManager.i.guiScript.outcomeBarTimerGrow; blackBarTimeShrink = GameManager.i.guiScript.outcomeBarTimerShrink; blackBarSpeed = Screen.width; blackBarSize = specialTransform.sizeDelta.x; //highlights (special Outcome) highlightMax = GameManager.i.guiScript.outcomeHighlightMax; highlightTime = GameManager.i.guiScript.outcomeHighlightTimer; highlightPause = GameManager.i.guiScript.outcomeHighlightPause; highlightFade = GameManager.i.guiScript.outcomeHighlightFade; highlightMin = specialTransform.sizeDelta.x; highlightHeight = highlightTransform.sizeDelta.y; //Set Main elements outcomeObject.SetActive(true); outcomeCanvas.gameObject.SetActive(false); panelNormal.gameObject.SetActive(false); canvasSpecial.gameObject.SetActive(false); panelSpecial.gameObject.SetActive(true); }