////////////////////////////////////////////////////////////////////////// public override void HoverHighlight(bool enable) { #if ACCESS_NGUI UIButton nGUIButton = GetNGUIButton(); if (nGUIButton != null) { if (enable) { nGUIButton.SetState(IsInteractable() ? UIButtonColor.State.Hover : UIButtonColor.State.Disabled, false); } else { nGUIButton.SetState(IsInteractable() ? UIButtonColor.State.Normal : UIButtonColor.State.Disabled, false); } } #else Button button = GetButton(); UI_Builder.UIB_Button ab = GetComponent <UI_Builder.UIB_Button>(); if (button != null) { var pointer = new PointerEventData(EventSystem.current); // pointer event for Execute if (enable) { if (ab != null) { ab.OnPointerEnter(pointer); } button.OnPointerEnter(pointer); } else { if (ab != null) { ab.OnPointerExit(pointer); } button.OnPointerExit(pointer); } } #endif }
public void PageActivatedHandler() { // UAP_AccessibilityManager.PauseAccessibility(true); //Debug.Break(); scroll.content.GetComponent <RectTransform>().pivot = new Vector2(0, 1); if (pageActivatedBefore) { return; } pageActivatedBefore = true; InitJsonList(); ObjPoolManager.RefreshPool(); // if (!pageActivatedBefore) // { //Make the pages first MakeLinkedPages(); // } //Make the buttons //They will be assigned to their buttons with 'Init' int traversalOrder = 0; ShowName = name.Split('-')[0]; if (ShowName == "CompanyDancers_Page") { if (OrderedByName == null) { Debug.LogWarning("Warning: There was no list to iterate through on page activated"); return; } foreach (Biography b in OrderedByName) { Name_Suffix = b.Name.Replace(" ", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref go); if (go != null) { go.name = (Name_Suffix + "_Button"); UI_Builder.UIB_Button UIB_btn = go.GetComponent <UI_Builder.UIB_Button>(); go.transform.SetParent(scroll.content.transform); //update parent for accessibility var sab = go.GetComponent <Special_AccessibleButton>(); sab.m_ManualPositionParent = go.GetComponentInParent <AccessibleUIGroupRoot>().gameObject; sab.m_ManualPositionOrder = traversalOrder; traversalOrder++; UIB_btn.SetButtonText(UIB_Utilities.SplitCamelCase(b.Name)); UIB_btn.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Page; //custom backgrounds UIB_btn.Special_Background = Resources.Load("DancerPhotos/" + b.Name.Replace(" ", "_")) as Sprite; go.GetComponent <Button>().enabled = true; go.GetComponent <UAP_BaseElement>().enabled = true; UIB_btn.Init(); } } } else { foreach (string s in listOfDancers) { Name_Suffix = s.Replace("_", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref go); if (go != null) { go.name = (Name_Suffix + "_Button"); UI_Builder.UIB_Button UIB_btn = go.GetComponent <UI_Builder.UIB_Button>(); go.transform.SetParent(scroll.content.transform); //update parent for accessibility var sab = go.GetComponent <Special_AccessibleButton>(); sab.m_ManualPositionParent = go.GetComponentInParent <AccessibleUIGroupRoot>().gameObject; sab.m_ManualPositionOrder = traversalOrder; traversalOrder++; UIB_btn.SetButtonText(UIB_Utilities.SplitCamelCase(s.Replace("_", " "))); UIB_btn.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Page; foreach (Image image in transform.GetComponentsInParent <Image>()) { } //custom backgrounds UIB_btn.Special_Background = Resources.Load("DancerPhotos/" + s.Replace("_", "_")) as Sprite; go.GetComponent <Button>().enabled = true; go.GetComponent <UAP_BaseElement>().enabled = true; //For some reason you have to do this //So that the names appear in the right order for accessibility gameObject.SetActive(false); gameObject.SetActive(true); UIB_btn.Init(); } } } scroll.GetComponent <UIB_ScrollingMenu>().playedOnce = false; scroll.GetComponent <UIB_ScrollingMenu>().Playing = false; scroll.GetComponent <UIB_ScrollingMenu>().Setup(); //create the top and bottom buffer for the scrollrect so that center selection can be highlighted var tmp = Resources.Load("UI_Buffer") as GameObject; var topBuffer = Instantiate(tmp, scroll.content.transform) as GameObject; var botBuffer = Instantiate(tmp, scroll.content.transform) as GameObject; topBuffer.GetComponent <RectTransform>().sizeDelta = new Vector2(scroll.viewport.rect.width, scroll.viewport.rect.height / 2); botBuffer.GetComponent <RectTransform>().sizeDelta = new Vector2(0, scroll.viewport.rect.height / 2); topBuffer.transform.SetAsFirstSibling(); botBuffer.transform.SetAsLastSibling(); pageActivatedBefore = true; GetComponentInParent <UIB_Page>().StartCoroutine(GetComponentInParent <UIB_Page>().ResetUAP(true)); // UAP_AccessibilityManager.PauseAccessibility(false); UAP_AccessibilityManager.Say(" "); StartCoroutine("DisableCover"); }