/// <summary> /// When previous button is pressed, reset the timer in addition to doing whatever weird shit it's doing before /// </summary> /// <param name="button"></param> void PreviousButtonPressed(DOW_Button button) { System.Action <Panel_Base> r = null; r = (Panel_Base panel) => { panelDeactivatedEvent -= r; ResetTimer(); }; panelDeactivatedEvent += r; }
IEnumerator HideButtonsAnimated() { //for(int i = 0; i < Mathf.Min(6, DOW_Buttons.Count); i++) for (int i = 0; i < DOW_Buttons.Count; i++) { DOW_Button button = DOW_Buttons[i]; Vector3 initialPos = button.GetInitialPosition(); button.AnimatePosition(new Vector3(localX, initialPos.y, initialPos.z)); yield return(new WaitForSeconds(0.1f)); } yield return(new WaitForSeconds(0.5f)); //Disable button interaction foreach (DOW_Button button in DOW_Buttons) { button.DisableButton(); } //Remove animation from the panel animator list //if (PanelAnimator.Instance.animationFunctionsStack.Contains(HideButtonsAnimated)) //{ // PanelAnimator.Instance.PopAnimation(HideButtonsAnimated); //} yield return(null); }
void ButtonClicked(DOW_Button button) { if (imageToShow) { filesPanel.ChangeImage(imageToShow); } }
protected override void ButtonClicked(DOW_Button button) { base.ButtonClicked(button); //Change the button color and disable it button.transform.Find("Image").GetChild(0).GetComponent <UnityEngine.UI.Image>().sprite = tickMark; button.DisableButton(); }
//on pressing the start button go to next sequence void StartButtonPressed(DOW_Button button) { //Debug.Log("Start button pressed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); SequenceManager.Instance.GoToNextSequence(); //Activate vuforia engine on pressing start button VuforiaManager.Instance.EnableVuforia(); }
void StartButtonPressed(DOW_Button button) { //Event that triggers when the current active panel is disabled //panelDeactivatedEvent += () => { userPanel.DisableAllButtons(); userPanel.ActivatePanel(true); }; //Deactivate the start panel button.DisableButton(); DeactivatePanel(true); }
protected override void Start() { base.Start(); steamLeakingButton = nextButton; noSteamLeakingButton = previousButton; steamLeakingButton.gameObject.SetActive(true); noSteamLeakingButton.gameObject.SetActive(true); }
void ButtonPressed(DOW_Button button) { if (button.description != null) { titleTextComponent.text = button.name; descriptionTextComponent.text = button.description; } //SetActiveTask() }
public void UnlinkPanelOnButton(DOW_Button button) { if (button) { if (button.GetLinkedPanel()) { button.UnlinkPanel(); panelDeactivatedEvent -= button.ActivateLinkedPanel; } } }
// Start is called before the first frame update protected override void Start() { base.Start(); sequenceDictionary = new Dictionary <int, DOW_Tasks_TaskButton>(); if (descriptionPanel) { titleTextComponent = descriptionPanel.transform.Find("Title").GetChild(0).GetComponent <TextMeshProUGUI>(); descriptionTextComponent = descriptionPanel.transform.Find("Description").GetChild(0).GetComponent <TextMeshProUGUI>(); } else { Debug.Log("Please feed in the description panel"); } int count = 0; foreach (DOW_Button button in DOW_Buttons) { button.ButtonPressEvent += ButtonPressed; //Converting to tasks specific button DOW_Tasks_TaskButton tb = button as DOW_Tasks_TaskButton; tasksButtons.Add(tb); tb.SetButtonSequenceIndex(count); //if(tb.taskIndex != -1) //{ //} sequenceDictionary.Add(tb.taskIndex, tb); count++; } goButton = transform.Find("Go").GetComponent <DOW_Button>(); goButton.ButtonPressEvent += GoButtonClicked; ActivateNextButton(); ActivatePreviousButton(); panelActivatedEvent += CheckTasksCompletion; //Initially, 0th task is the active task. Get the 0th task button index from the dictionary SetActiveTask(sequenceDictionary[0].GetSequenceIndex()); scrollBar.onValueChanged.AddListener((float f) => { if (f == 0) { TaskComplete(-1); } }); }
protected void ButtonPressed(DOW_Button button) { if (!activeButton) { canswitch = true; } if (canswitch) { Debug.Log("Active button: " + activeButton + "BUtton: " + button + "Previous active buttons: " + previousActiveButton); if (activeButton != button) { if (activeButton) { activeButton.AnimateSizeDelta(null); //activeButton.EnableButton(); button.AnimateSizeDelta(new Vector2(250, 190)); //button.DisableButton(); activeButton = button as UserPanelButton; } else { activeButton = button as UserPanelButton; activeButton.AnimateSizeDelta(new Vector2(250, 190)); //Disable the button so that no clicking is no more possible on this button //activeButton.DisableButton(); } Debug.Log("SDFSDFGSHDH#$Q%$%#$%@#^@%^@#$^@#4"); ChangePanel(); } else { //If the button is enabled, disable the button, or else disable the button if (button.IsEnabled()) { button.AnimateSizeDelta(null); DisablePanel(); } else { activeButton.AnimateSizeDelta(new Vector2(250, 190)); //ActivatePanel(); } } previousActiveButton = activeButton; } //if (previousActiveButton) // previousActiveButton.HidePanel(); //activeButton.ShowPanel(); }
// Start is called before the first frame update protected virtual void Start() { Debug.Log("PPE Panel"); if (itemNamesPanel.Length > 0) { for (int k = 0; k < itemNamesPanel.Length; k++) { Debug.Log("Child count in the names panel: " + itemNamesPanel[k].transform.childCount); for (int i = 0; i < itemNamesPanel[k].transform.childCount; i++) { DOW_Button button = itemNamesPanel[k].transform.GetChild(i).GetComponent <DOW_Button>(); if (button) { DOW_Buttons.Add(button); //subsrcibe to the button click event button.ButtonPressEvent += ButtonClicked; } } } } #region Next and previous button cache //Check for next and previous buttons Transform next = gameObject.transform.Find("Next"); if (next) { nextButton = next.GetComponent <DOW_Button>(); if (nextButton) { nextButton.ButtonPressEvent += NextButtonClicked; } } Transform previous = gameObject.transform.Find("Previous"); if (previous) { previousButton = previous.GetComponent <DOW_Button>(); if (previousButton) { previousButton.ButtonPressEvent += PreviousButtonClicked; } } #endregion DeactivatePanel(false); DeactivateNextButton(); //ActivatePanel(true); //HideButtons(itemNamesPanel); //ShowButtons(itemNamesPanel, true); }
void GoButtonClicked(DOW_Button button) { button.DisableButton(); if (currentIndex != indexBeforeChange) { //The sequence has been changed sequenceChanged = true; Debug.Log("Current index: " + currentIndex); //Force the AR button press that closes the current panel PanelManager.Instance.arButton.ForceButtonPress(); } }
void GoToNextSequence(DOW_Button panel) { VuforiaManager.Instance.DisableTrackerIndex(2); if (gaugeBeing != null) { gaugeBeing.Stop(); } timerPanel.GetNextButton().ButtonPressEvent -= GoToNextSequence; //Sequence complete SequenceManager.Instance.GoToNextSequence(); //TODO: The next seqeuence might need to be merged into this one }
protected virtual void PreviousButtonClicked(DOW_Button button) { if (button.GetLinkedPanel()) { panelDeactivatedEvent += button.ActivateLinkedPanel; } button.DisableButton(); DeactivatePanel(true); //Not disabling next button causes issues if (nextButton) { nextButton.DisableButton(); } }
protected override void NextButtonClicked(DOW_Button button) { //base.NextButtonClicked(button); if (currentIndex < highestStepReached) { SetActiveTask(currentIndex + 1); if (currentIndex != indexBeforeChange) { goButton.EnableButton(); } else { goButton.DisableButton(); } } }
protected virtual void ButtonClicked(DOW_Button button) { buttonsClicked++; if (buttonsClicked == DOW_Buttons.Count) { allButtonsClickedEvent?.Invoke(); } //If all the buttons are clicked, activate the next button if (buttonsClicked >= DOW_Buttons.Count) { //Reset the buttons clicked buttonsClicked = 0; ActivateNextButton(); } }
IEnumerator ShowButtonsAnimated() { //for (int i = 0; i < Mathf.Min(6, DOW_Buttons.Count); i++) for (int i = 0; i < DOW_Buttons.Count; i++) { DOW_Button button = DOW_Buttons[i]; button.AnimatePosition(button.GetInitialPosition()); //Debug.Log("Initial POsition: " + button.GetInitialPosition()); yield return(new WaitForSeconds(0.1f)); } //Enable button interaction foreach (DOW_Button button in DOW_Buttons) { button.EnableButton(); } yield return(new WaitForSeconds(0.5f)); for (int i = 0; i < itemNamesPanel.Length; i++) { if (itemNamesPanel[i].GetComponent <VerticalLayoutGroup>()) { itemNamesPanel[i].GetComponent <VerticalLayoutGroup>().enabled = true; } if (itemNamesPanel[i].transform.parent.GetComponent <ScrollRect>()) { itemNamesPanel[i].transform.parent.GetComponent <ScrollRect>().enabled = true; } } //Remove animation from the panel animator list //if (PanelAnimator.Instance.animationFunctionsStack.Contains(ShowButtonsAnimated)) //{ // PanelAnimator.Instance.PopAnimation(ShowButtonsAnimated); //} yield return(null); }
public void LinkPanelToButton(DOW_Button button, Panel_Base panel) { if (button) { if (!button.GetLinkedPanel()) { button.LinkPanel(panel, this); //panelDeactivatedEvent += button.ActivateLinkedPanel; } else { Debug.LogWarning("Panel is already linked to this button. Ignoring!"); } } else { Debug.LogError("No button lo link"); } }
protected override void PreviousButtonClicked(DOW_Button button) { //base.PreviousButtonClicked(button); if (currentIndex > 0) { SetActiveTask(currentIndex - 1); if (currentIndex != indexBeforeChange) { goButton.EnableButton(); } else { goButton.DisableButton(); } //if (!sequenceChanged) //{ // sequenceChanged = true; // PanelManager.Instance.arButton.ButtonPressEvent += SequenceChanged; //} } }
void ButtonClicked(DOW_Button button) { //Change the video clip playing to the current one filesPanel.ChangeVideo(clip); }
void SequenceChanged(DOW_Button button) { PanelManager.Instance.arButton.ButtonPressEvent -= SequenceChanged; }
void PPENextButtonClicked(DOW_Button button) { ppe_Panel.GetNextButton().ButtonPressEvent -= PPENextButtonClicked; ppe_Panel.panelDeactivatedEvent += PanelDeactivated; }
void HazardsNextButtonClicked(DOW_Button button) { hazardsPanel.GetNextButton().ButtonPressEvent -= HazardsNextButtonClicked; hazardsPanel.panelDeactivatedEvent += PanelDeactivated; }
void ChangeCurrentTask(DOW_Button button) { PanelManager.Instance.tasksPanel.ChangeActiveTask(this, sequenceIndex); }