//The implementation of the page generator for this pages submenu
    public override void MakeLinkedPages()
    {
        if (OrderedByName == null)
        {
            Debug.LogWarning("Warning: There was no list to iterate through");
            return;
        }

        var BiographyOrderedByName = (System.Linq.IOrderedEnumerable <Biography>)OrderedByName;

        foreach (Biography bioJson in BiographyOrderedByName)
        {
            Name_Suffix = bioJson.Name.Replace(" ", "");
            GameObject go = null;
            ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Bio, ref go);

            if (go != null)
            {
                go.transform.SetParent(Page_Parent.transform);
                go.name = (Name_Suffix + "_Page");

                Bio_Page bp = go.GetComponent <Bio_Page>();
                if (bp.Name.text != bioJson.Name)
                {
                    bp.SetName(bioJson.Name);
                    bp.SetTitle(bioJson.Title);
                    bp.SetImageFromAssetBundle(bioJson.Name.Replace(" ", "_").ToLower(), "hld/bios/photos");
                    bp.SetDesc(bioJson.Bio);
                }
            }
        }

        StartCoroutine(GetComponent <UIB_Page>().ResetUAP(true));
    }
示例#2
0
    //The implementation of the page generator for this pages submenu
    public override void MakeLinkedPages()
    {
        //        Debug.Log(gameObject.name + " " +"makelinkedpages");

        var ShowName = name.Split('-')[0];

        if (ShowName == "CompanyDancers_Page")
        {
            var BiographyOrderedByName = (System.Linq.IOrderedEnumerable <Biography>)OrderedByName;
            foreach (Biography bioJson in BiographyOrderedByName)
            {
                Name_Suffix = bioJson.Name.Replace(" ", "");
                GameObject go = null;
                ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Narrative, ref go);

                if (go != null)
                {
                    go.transform.SetParent(Page_Parent.transform);
                    go.name = (Name_Suffix + "_Page");
                    Narrative_Page np = go.GetComponent <Narrative_Page>();
                    np.SetupPage(bioJson.Name, bioJson.Name.Replace(" ", "_").ToLower());
                    np.SetShowName(name.Split('-')[0]);
                }
            }
        }
        else
        {
            foreach (string s in listOfDancers)
            {
                Name_Suffix = s.Replace("_", "");
                GameObject go = null;
                ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Narrative, ref go);

                if (go != null)
                {
                    go.transform.SetParent(Page_Parent.transform);
                    go.name = (Name_Suffix + "_Page");
                    Narrative_Page np = go.GetComponent <Narrative_Page>();
                    //                    Debug.Log("s:" + s.Replace("_","_").ToLower());
                    np.SetupPage(s, s.Replace("_", "_").ToLower());
                    np.SetShowName(name.Split('-')[0]);
                }
            }
        }
    }
示例#3
0
        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");
        }
示例#4
0
    /*
     * //THIS IS THE OLD PAGEACTIVEDHANDLER THAT USED THE VIDEO PLAYER
     * public void PageActivatedHandler()
     * {
     *  if (GetComponent<UIB_Page>().AssetBundleRequired) {
     *      Debug.Log("we need an asset bundle for this page");
     *  }
     *
     *  GameObject.FindWithTag("App_VideoPlayer").GetComponent<UIB_VideoPlayer>().OriginScreen = gameObject;
     *
     *  //sort alphabetically
     *  var OrderedByName = Dancers.OrderBy(x => x);
     *
     *  int i = 0;
     *  ObjPoolManager.BeginRetrieval();
     *
     *  foreach (string dancer in OrderedByName)
     *  {
     *      GameObject b = null;
     *      ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref b);
     *
     *      if (b != null)
     *      {
     *          b.name = dancer.Replace(" ", "_") + " video";
     *
     *          b.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { PlayVideoFromAssetBundle(dancer, "hld/meondisplay/"); });
     *          b.transform.SetParent(scroll.content.transform);
     *
     *          var ab = b.GetComponent<UI_Builder.UIB_Button>();
     *          ab.SetButtonText(dancer);
     *          ab.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Video;
     *
     *          ab.Init();
     *
     *          var sab = b.GetComponent<Special_AccessibleButton>();
     *          if (i == 0)
     *          {
     *              AccessibleButton = sab;
     *          }
     *
     *          sab.m_ManualPositionOrder = i;
     *          sab.m_ManualPositionParent = transform.parent.gameObject;
     *
     *          i++;
     *      }
     *      else
     *          Debug.LogError("Not enough objects in pool");
     *  }
     *  ObjPoolManager.EndRetrieval();
     *
     *  var theScroll = transform.Find("UIB_ScrollingMenu");
     *  theScroll.GetComponent<UIB_ScrollingMenu>().playedOnce=false;
     *  theScroll.GetComponent<UIB_ScrollingMenu>().Setup();
     *
     *  GameObject.FindWithTag("App_VideoPlayer").GetComponent<UIB_Page>().DeActivate();
     *
     *  StartCoroutine(GetComponent<UIB_Page>().ResetUAP(true));
     * }
     */

    //THIS IS THE NEW PAGE ACTIVASTED HANDLER
    //THIS ONE ADDS A BUTTON THAT OPENS A PAGE LINK TO THE VIDEO.
    public void PageActivatedHandler()
    {
        scroll.content.GetComponent <RectTransform>().pivot = new Vector2(0, 1);

        if (GetComponent <UIB_Page>().AssetBundleRequired)
        {
            Debug.Log("we need an asset bundle for this page");
        }

        GameObject.FindWithTag("App_VideoPlayer").GetComponent <UIB_VideoPlayer>().OriginScreen = gameObject;

        //sort alphabetically
        var OrderedByName = Dancers.OrderBy(x => x.Split(' ')[1]);

        int i = 0;

        foreach (string dancer in OrderedByName)
        {
            GameObject b = null;
            ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref b);

            if (b != null)
            {
                b.name = dancer.Replace(" ", "_") + " video";


                //b.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { PlayVideoFromAssetBundle(dancer, "hld/meondisplay/"); });
                b.transform.SetParent(scroll.content.transform);


                var ab = b.GetComponent <UIB_Button>();
                ab.SetButtonText(dancer);
                ab.Button_Opens = UIB_Button.UIB_Button_Activates.InAppUrl;
                ab.s_link       = DancerLinks[i];

                ab.Init();

                var sab = b.GetComponent <Special_AccessibleButton>();
                if (i == 0)
                {
                    AccessibleButton = sab;
                }

                sab.m_ManualPositionOrder  = i;
                sab.m_ManualPositionParent = transform.parent.gameObject;

                i++;
            }
            else
            {
                Debug.LogError("Not enough objects in pool");
            }
        }

        var theScroll = transform.Find("UIB_ScrollingMenu");

        theScroll.GetComponent <UIB_ScrollingMenu>().playedOnce = false;
        theScroll.GetComponent <UIB_ScrollingMenu>().Setup();

        GameObject.FindWithTag("App_VideoPlayer").GetComponent <UIB_Page>().DeActivate();

        StartCoroutine(GetComponent <UIB_Page>().ResetUAP(true));
    }