Exemple #1
0
        public override void Awake()
        {
            base.Awake();

            var t = controller.transform;

            ButtonGrid            = t.GetComponent <UIGrid>("Content/ScrollView/Placeholder/ButtonList");
            TitleTemplate         = t.GetMonoILRComponent <LTActivityTitleItem>("Content/ScrollView/Placeholder/ButtonList/template");
            InsPartnerTransform   = t.FindEx("Content/ViewList");
            Template3             = t.GetMonoILRComponent <LTActivityBodyItem_Gift>("Content/ViewList/template3");
            Template4             = t.GetMonoILRComponent <LTActivityBodyItem>("Content/ViewList/template4");
            Template5             = t.GetMonoILRComponent <LTActivityBodyItem_ScoreRepeat>("Content/ViewList/template5");
            Template6             = t.GetMonoILRComponent <LTActivityBodyItem_ScoreOnce>("Content/ViewList/template6");
            Template7             = t.GetMonoILRComponent <LTActivityBodyItem_SevenDay>("Content/ViewList/template7");
            Template8             = t.GetMonoILRComponent <LTActivityBodyItem_Draw>("Content/ViewList/template8");
            Template9             = t.GetMonoILRComponent <LTActivityBodyItem_Turntable>("Content/ViewList/template9");
            Template10            = t.GetMonoILRComponent <LTActivityBodyItem_LuckyCat>("Content/ViewList/template10");
            Template11            = t.GetMonoILRComponent <LTActivityBodyItem_URPartner>("Content/ViewList/template11");
            Template12            = t.GetMonoILRComponent <LTActivityBodyItem_EquipmentWish>("Content/ViewList/template12");
            Template13            = t.GetMonoILRComponent <LTActivityBodyItem_BossChallenge>("Content/ViewList/template13");
            Template14            = t.GetMonoILRComponent <LTActivityBodyItem_SSRWish>("Content/ViewList/template14");
            Template15            = t.GetMonoILRComponent <LTActivityBodyItem_Monopoly>("Content/ViewList/template15");
            Template16            = t.GetMonoILRComponent <LTActivityBodyItem_Racing>("Content/ViewList/template16");
            controller.backButton = t.GetComponent <UIButton>("UINormalFrameBG/CancelBtn");

            progresBar = t.GetComponent <UIProgressBar>("Content/ScrollView/UIScrollBar");
            ArrowObj   = t.FindEx("Content/Arrow").gameObject;
            progresBar.onChange.Add(new EventDelegate(OnChange));
            TitleTemplate.mDMono.gameObject.CustomSetActive(false);
            Template3.mDMono.gameObject.CustomSetActive(false);
            Template4.mDMono.gameObject.CustomSetActive(false);
            Template5.mDMono.gameObject.CustomSetActive(false);
            Template6.mDMono.gameObject.CustomSetActive(false);
            Template7.mDMono.gameObject.CustomSetActive(false);
            Template8.mDMono.gameObject.CustomSetActive(false);
            Template9.mDMono.gameObject.CustomSetActive(false);
            Template10.mDMono.gameObject.CustomSetActive(false);
            Template11.mDMono.gameObject.CustomSetActive(false);
            Template12.mDMono.gameObject.CustomSetActive(false);
            Template13.mDMono.gameObject.CustomSetActive(false);
            Template14.mDMono.gameObject.CustomSetActive(false);
            Template15.mDMono.gameObject.CustomSetActive(false);
            Template16.mDMono.gameObject.CustomSetActive(false);
        }
Exemple #2
0
        public override void Show(bool isShowing)
        {
            if (!isShowing)
            {
                if (bodyItem != null && bodyItem.mDMono != null)
                {
                    GameObject.DestroyImmediate(bodyItem.mDMono.gameObject);
                }

                bodyItem = null;
                return;
            }

            for (int i = 0; i < titleitems.Count; i++)
            {
                GameObject.DestroyImmediate(titleitems[i].mDMono.gameObject);
            }

            titleitems.Clear();
            LTActivityTitleItem refreshItem = null;
            ArrayList           eventlist;

            DataLookupsCache.Instance.SearchDataByID("events.events", out eventlist);

            for (int i = 0; i < eventlist.Count; ++i)
            {
                for (int j = 0; j < eventlist.Count - i - 1; ++j)
                {
                    int bst = EB.Dot.Integer("start", eventlist[j + 1], 0);

                    if (bst > EB.Time.Now)
                    {
                        continue;
                    }

                    int ast = EB.Dot.Integer("start", eventlist[j], 0);
                    int aid = EB.Dot.Integer("priority", eventlist[j], 0);
                    int bid = EB.Dot.Integer("priority", eventlist[j + 1], 0);

                    if (EB.Time.Now < ast || bid != 0 && (aid == 0 || aid > bid))
                    {
                        var temp = eventlist[j];
                        eventlist[j]     = eventlist[j + 1];
                        eventlist[j + 1] = temp;
                    }
                }
            }

            int count = 0;

            for (int i = 0; i < eventlist.Count; ++i)
            {
                int sort_order = EB.Dot.Integer("sort_order", eventlist[i], 0);
                if (sort_order != (int)sortOrderLimit)
                {
                    continue;
                }

                int aid       = EB.Dot.Integer("activity_id", eventlist[i], 0);
                int disappear = EB.Dot.Integer("displayuntil", eventlist[i], 0);
                TimeLimitActivityTemplate activity = EventTemplateManager.Instance.GetTimeLimitActivity(aid);
                if (activity == null || EB.Time.Now >= disappear)
                {
                    continue;
                }

                string state     = EB.Dot.String("state", eventlist[i], "");
                string title     = EB.Dot.String("title", eventlist[i], "");
                string titlebg   = EB.Dot.String("titlebg", eventlist[i], "");
                string navString = EB.Dot.String("nav_string", eventlist[i], "");
                LTActivityTitleItem titleItem = InstantiateEx <LTActivityTitleItem>(TitleTemplate, TitleTemplate.mDMono.transform.parent, aid.ToString());
                titleitems.Add(titleItem);
                titleItem.Title.text   = EB.Localizer.GetString(title);
                titleItem.ActivityData = eventlist[i];
                titleItem.v_ActivityId = aid;
                titleItem.v_NavString  = navString;

                int start = EB.Dot.Integer("start", eventlist[i], 0);
                if (state.Equals("pending"))
                {
                    if (EB.Time.Now > start)
                    {
                        LTMainHudManager.Instance.UpdateEventsLoginData(delegate { });
                    }
                }
                titleItem.OpenNotice.CustomSetActive(state.Equals("pending"));
                titleItem.parent = this;

                if (currentTitle != null && currentTitle.v_ActivityId == aid && currentTitle.v_NavString == navString)
                {
                    refreshItem = titleItem;
                }

                GlobalMenuManager.Instance.LoadRemoteUITexture(titlebg, titleItem.BG);
                count++;
            }

            isMoreThenScrollView = count > 5;
            OnChange();

            ButtonGrid.Reposition();
            UpdateRedPoint();

            if (refreshItem != null)
            {
                SelectTitle(refreshItem);
            }
            else
            {
                if (titleitems.Count > 0)
                {
                    SelectTitle(titleitems[0]);
                }
                else
                {
                    this.controller.OnCancelButtonClick();
                    if (LTMainMenuHudController.Instance != null)
                    {
                        LTMainMenuHudController.Instance.RefreshEvent();
                    }
                }
            }
        }
Exemple #3
0
        private void CreateBodyItem(LTActivityTitleItem t)
        {
            object e = t.ActivityData;

            if (bodyItem != null && bodyItem.mDMono != null)
            {
                GameObject.DestroyImmediate(bodyItem.mDMono.gameObject);
            }

            int aid      = EB.Dot.Integer("activity_id", e, 0);
            int nav_type = EB.Dot.Integer("nav_type", e, 0);

            if (nav_type == 0)
            {
                Hotfix_LT.Data.TimeLimitActivityTemplate activity = Hotfix_LT.Data.EventTemplateManager.Instance.GetTimeLimitActivity(aid);
                if (activity == null)
                {
                    return;
                }
                nav_type = (int)activity.nav_type;
            }

            switch (nav_type)
            {
            case 3:
                bodyItem = InstantiateEx <LTActivityBodyItem_Gift>(Template3, InsPartnerTransform, aid.ToString());
                break;

            case 4:
                bodyItem = InstantiateEx <LTActivityBodyItem>(Template4, InsPartnerTransform, aid.ToString());
                break;

            case 5:
                bodyItem = InstantiateEx <LTActivityBodyItem_ScoreRepeat>(Template5, InsPartnerTransform, aid.ToString());
                break;

            case 6:
                bodyItem = InstantiateEx <LTActivityBodyItem_ScoreOnce>(Template6, InsPartnerTransform, aid.ToString());
                break;

            case 7:
                bodyItem = InstantiateEx <LTActivityBodyItem>(Template8, InsPartnerTransform, aid.ToString());
                bodyItem.TimeParent.localPosition    = new Vector3(400, 440, 0);                                  //400,340,0
                bodyItem.ContenPartent.localPosition = new Vector3(0, -500, 0);                                   //zero
                bodyItem.desc.width = bodyItem.desc.transform.GetChild(0).GetComponent <UIWidget>().width = 1200; //1700
                break;

            case 8:
                bodyItem = InstantiateEx <LTActivityBodyItem>(Template8, InsPartnerTransform, aid.ToString());
                bodyItem.TimeParent.localPosition    = new Vector3(-800, 440, 0);                                 //400,340,0
                bodyItem.ContenPartent.localPosition = new Vector3(0, -500, 0);                                   //zero
                bodyItem.desc.width = bodyItem.desc.transform.GetChild(0).GetComponent <UIWidget>().width = 1200; //1700
                break;

            case 9:
                bodyItem = InstantiateEx(Template7, InsPartnerTransform, aid.ToString());
                break;

            case 10:
                bodyItem = InstantiateEx(Template9, InsPartnerTransform, aid.ToString());
                break;

            case 11:
                bodyItem = InstantiateEx(Template10, InsPartnerTransform, aid.ToString());
                break;

            case 12:
                bodyItem = InstantiateEx(Template11, InsPartnerTransform, aid.ToString());
                break;

            case 13:
                bodyItem = InstantiateEx(Template12, InsPartnerTransform, aid.ToString());
                break;

            case 14:
                bodyItem = InstantiateEx(Template13, InsPartnerTransform, aid.ToString());
                break;

            case 15:
                bodyItem = InstantiateEx(Template14, InsPartnerTransform, aid.ToString());
                break;

            case 16:
                bodyItem = InstantiateEx(Template15, InsPartnerTransform, aid.ToString());
                break;

            case 17:
                bodyItem = InstantiateEx(Template16, InsPartnerTransform, aid.ToString());
                break;

            default:
                return;
            }

            string desc = EB.Dot.String("desc", e, "");
            string bg   = EB.Dot.String("bg", e, "");

            if (bodyItem.desc != null)
            {
                bodyItem.desc.text = EB.Localizer.GetString(desc);
            }
            GlobalMenuManager.Instance.LoadRemoteUITexture(bg, bodyItem.BG);

            bodyItem.title      = t;
            bodyItem.controller = controller;
            bodyItem.SetData(e);
        }
Exemple #4
0
 public override void OnDestroy()
 {
     base.OnDestroy();
     bodyItem = null;
     titleitems.Clear();
 }