private void Awake() { canvasGroup = modalPanel.GetComponent <CanvasGroup>(); //confirm button event ButtonInteraction buttonInteraction = buttonConfirm.GetComponent <ButtonInteraction>(); if (buttonInteraction != null) { buttonInteraction.SetButton(EventType.ConfirmTeamChoice); } else { Debug.LogError("Invalid buttonInteraction Confirm (Null)"); } //cancel button event buttonInteraction = buttonCancel.GetComponent <ButtonInteraction>(); if (buttonInteraction != null) { buttonInteraction.SetButton(EventType.CloseTeamPicker); } else { Debug.LogError("Invalid buttonInteraction Cancel (Null)"); } }
public void Start() { Debug.Assert(confirmObject != null, "Invalid confirmObject (Null)"); Debug.Assert(topText != null, "Invalid topText (Null)"); Debug.Assert(bottomText != null, "Invalid bottomText (Null)"); Debug.Assert(buttonFalse != null, "Invalid buttonLeft (Null)"); Debug.Assert(buttonTrue != null, "Invalid buttonRight (Null)"); //buttons -> interaction components ButtonInteraction interactLeft = buttonFalse.GetComponent <ButtonInteraction>(); if (interactLeft != null) { interactLeft.SetButton(EventType.ConfirmCloseLeft); } ButtonInteraction interactRight = buttonTrue.GetComponent <ButtonInteraction>(); if (interactRight != null) { interactRight.SetButton(EventType.ConfirmCloseRight); } //details empty confirmDetails = null; //register a listener EventManager.i.AddListener(EventType.ConfirmCloseLeft, OnEvent, "ModalConfirm"); EventManager.i.AddListener(EventType.ConfirmCloseRight, OnEvent, "ModalConfirm"); EventManager.i.AddListener(EventType.ConfirmOpen, OnEvent, "ModalConfirm"); }
/*private void OnCollisionExit(Collision Other) * { * if (Other.gameObject.tag == "Player" || Other.gameObject.tag == "Box") * { * if (m_activated) * { * for (int z = 0; z < m_linkedObjects.Length; z++) * { * ButtonInteraction script = m_linkedObjects[z].GetComponent<ButtonInteraction>(); * * if (script) * { * script.OnInteract(); * } * } * } * * m_activated = false; * * m_mat.color = Color.red; * } * }*/ private IEnumerator CheckCollisions() { while (true) { if (!m_hadColision) { if (m_activated) { for (int z = 0; z < m_linkedObjects.Length; z++) { ButtonInteraction script = m_linkedObjects[z].GetComponent <ButtonInteraction>(); if (script) { script.OnInteract(); } } } m_activated = false; m_mat.color = Color.red; } m_hadColision = false; yield return(new WaitForFixedUpdate()); } }
private void SubInitialiseSessionStart() { hackingDetected = string.Format("Hacking Attempt{0}<b>DETECTED</b>", "\n"); tabBottomText.text = string.Format("Hacking Status{0}<b>UNKNOWN</b>", "\n"); //tabs topTabTooltip = tabTopMouse.GetComponent <GenericTooltipUI>(); bottomTabTooltip = tabBottomMouse.GetComponent <GenericTooltipUI>(); sideTabTooltip = tabSideMouse.GetComponent <GenericTooltipUI>(); topTaskTooltip = subTopPanel.GetComponent <GenericTooltipUI>(); middleTaskTooltip = subMiddlePanel.GetComponent <GenericTooltipUI>(); bottomTaskTooltip = subBottomPanel.GetComponent <GenericTooltipUI>(); Debug.Assert(topTabTooltip != null, "Invalid topTabTooltip (Null)"); Debug.Assert(bottomTabTooltip != null, "Invalid bottomTabPanelTooltip (Null)"); Debug.Assert(sideTabTooltip != null, "Invalid sideTabTooltip (Null)"); Debug.Assert(topTaskTooltip != null, "Invalid topTaskTooltip (Null)"); Debug.Assert(middleTaskTooltip != null, "Invalid middleTaskTooltip (Null)"); Debug.Assert(bottomTaskTooltip != null, "Invalid bottomTaskTooltip (Null)"); //initialise tooltips topTaskTooltip.Initialise(); middleTaskTooltip.Initialise(); bottomTabTooltip.Initialise(); //buttons cancelInteraction = cancelButton.GetComponent <ButtonInteraction>(); proceedInteraction = proceedButton.GetComponent <ButtonInteraction>(); Debug.Assert(cancelInteraction != null, "Invalid cancelInteraction (Null)"); Debug.Assert(proceedInteraction != null, "Invalid proceedInteraction (Null)"); cancelInteraction.SetButton(EventType.AIDisplayClose); proceedInteraction.SetButton(EventType.AIDisplayPanelOpen); }
private void OnCollisionStay(Collision Other) { float angle = Vector2.Angle(Other.contacts[0].normal, Vector2.up); if (Mathf.Approximately(angle, 180.0f)) { if (Other.gameObject.tag == "Player" || Other.gameObject.tag == "Box") { m_hadColision = true; if (!m_activated) { for (int z = 0; z < m_linkedObjects.Length; z++) { ButtonInteraction script = m_linkedObjects[z].GetComponent <ButtonInteraction>(); if (script) { script.OnInteract(); } } } m_activated = true; m_mat.color = Color.green; } } }
void OnTriggerStay(Collider other) { if (other.tag == "Player") { PlayerData player = other.GetComponent <PlayerData>(); if (player) { if (player.m_pressingButton) { m_activated = !m_activated; if (m_activated) { m_mat.color = Color.green; } else { m_mat.color = Color.red; } for (int z = 0; z < m_linkedObjects.Length; z++) { ButtonInteraction script = m_linkedObjects[z].GetComponent <ButtonInteraction>(); if (script) { script.OnInteract(); } } } } } }
public ButtonInteractionPage() { this.InitializeComponent(); Interaction = new ButtonInteraction(); Interaction.Invoked += OnTargetElementInvoked; Interaction.PropertyChanged += OnInteractionPropertyChanged; targetElement.Interactions.Add(Interaction); }
public void DoesAdvertiseSupportedEvents() { if (!ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "Interactions")) { Log.Warning("UIElement.Interactions not supported on this build."); return; } RunOnUIThread.Execute(() => { var interaction = new ButtonInteraction(); var supportedEvents = interaction.GetSupportedEvents(); Verify.IsGreaterThan(supportedEvents.Count, 0); }); }
private void Interact(GameObject sceneObject, GameObject interactor) { Door door = sceneObject.GetComponent <Door>(); if (door != null) { door.Interact(); } ButtonInteraction button = sceneObject.GetComponent <ButtonInteraction>(); if (button != null) { button.Interact(interactor); } }
public void ValidateDefaultValues() { if (!ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "Interactions")) { Log.Warning("UIElement.Interactions not supported on this build."); return; } RunOnUIThread.Execute(() => { var interaction = new ButtonInteraction(); Verify.AreEqual(ButtonInteractionInvokeMode.Release, interaction.InvokeMode); Verify.AreEqual(false, interaction.IsHovering); Verify.AreEqual(false, interaction.IsPressing); }); }
private void Awake() { //close button event buttonInteraction = buttonClose.GetComponent <ButtonInteraction>(); if (buttonInteraction != null) { buttonInteraction.SetButton(EventType.CityInfoClose); } else { Debug.LogError("Invalid buttonInteraction Cancel (Null)"); } //tooltips districtTooltip = subPanelLeft.GetComponent <GenericTooltipUI>(); organisationTooltip = miniPanelBottom.GetComponent <GenericTooltipUI>(); factionTooltip = miniPanelMiddle.GetComponent <GenericTooltipUI>(); mayorTooltip = miniPanelTop.GetComponent <GenericTooltipUI>(); }
void Update() { m_Timer.Cycle(); if (m_Timer.m_completed && !m_activated) { m_activated = true; m_mat.color = Color.blue; for (int z = 0; z < m_linkedObjects.Length; z++) { ButtonInteraction script = m_linkedObjects[z].GetComponent <ButtonInteraction>(); if (script) { script.OnInteract(); } } } }
// void Awake() { // DontDestroyOnLoad(transform.gameObject); // } void Start() { //link to object scripts: startScript = GameObject.Find("MainMenu/MainCanvas/StartButton").GetComponent <ButtonInteraction>(); aboutScript = GameObject.Find("MainMenu/MainCanvas/AboutButton").GetComponent <ButtonInteraction>(); fishManagerScript = GameObject.Find("fishManager").GetComponent <fishglobal>(); //preset objects: mainMenu.SetActive(true); About.SetActive(false); startFishManager.SetActive(true); //initiate variables: started = startScript.startGame; aboutClicked = aboutScript.startGame; //set variables: reset(); //set audio: soundSource = GetComponent <AudioSource>(); }
private static void OverlayUI(GridItem slot) { InteractiveEnvirounment interaction = slot.slotInteractions; for (int i = 0; i < interaction.interactions.Count; i++) { if (interaction.interactions[i].GetType() == typeof(Combustible)) { Transform t = Instantiate(m.combustibleUIPref, slot.transform.position + new Vector3(0, i), new Quaternion(), m.canvasParent); ButtonInteraction bi = t.gameObject.GetComponent <ButtonInteraction>(); bi.interaction = interaction.interactions[i]; bi.source = slot.fillAsStructure; m.AddUIPiece(t); } else if (interaction.interactions[i].GetType() == typeof(Pickable)) { Transform t = Instantiate(m.pickableUIPref, slot.transform.position + new Vector3(0, i), new Quaternion(), m.canvasParent); ButtonInteraction bi = t.gameObject.GetComponent <ButtonInteraction>(); bi.interaction = interaction.interactions[i]; bi.weaponSource = slot.fillAsPickup; m.AddUIPiece(t); } } }
void DeactivateButton() { activeButton.onRelease(); //update button state activeButton = null; //stop pointing at this button }
private void OnTargetElementInvoked(ButtonInteraction sender, ButtonInteractionInvokedEventArgs args) { invokeCountTB.Text = string.Format("{0}", ++_invokeCount); }
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); } } }
void DeactivateButton() { active_button.onRelease(); active_button = null; }
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); } } }
void ActivateButton() { activeButton = hit.transform.gameObject.GetComponent <ButtonInteraction>(); activeButton.onHover();//update button state }
/// <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); }
private void Start() { ImportRoomPresset.CreatePressetsFromFile(); ButtonInteraction.CreateButtons(); TemporalList.AddRange(RoomPressetList); }
/// <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); }