Esempio n. 1
0
        public override void Initial(FakeStruct mod, UIElement element, Initializer initializer)
        {
            base.Initial(mod, element, initializer);
            var mui = Enity.GetComponent <UIElement>();

            mui.userEvent.CutRect = true;
            var mask = Enity.transform;

            Year = mask.Find("Year").GetComponent <UIElement>().composite as ScrollY;
            Year.SetItemUpdate <ItemView, int>((o, e, i) => { o.Item.Text = e.ToString(); });
            Year.Scroll         = Scrolling;
            Year.ScrollEnd      = YearScrollToEnd;
            Year.ItemDockCenter = true;
            Year.scrollType     = ScrollType.Loop;

            Month = mask.Find("Month").GetComponent <UIElement>().composite as ScrollY;
            Month.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.Text = e; });
            Month.Scroll         = Scrolling;
            Month.ScrollEnd      = MonthScrollToEnd;
            Month.ItemDockCenter = true;
            Month.scrollType     = ScrollType.Loop;

            Day = mask.Find("Day").GetComponent <UIElement>().composite as ScrollY;
            Day.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.Text = e; });
            Day.Scroll         = Scrolling;
            Day.ScrollEnd      = DayScrollToEnd;
            Day.ItemDockCenter = true;
            Day.ScrollEnd      = DayScrollToEnd;
            Day.scrollType     = ScrollType.Loop;

            var ex = UITransfromLoader.GetCompositeData(mod);

            if (ex != null)
            {
                StartYear = ex[0];
                EndYear   = ex[1];
                if (EndYear < StartYear)
                {
                    EndYear = StartYear;
                }
            }

            year  = StartYear;
            month = 1;
            day   = 1;
            int len = EndYear - StartYear;

            ys = new int[len];
            int s = StartYear;

            for (int i = 0; i < len; i++)
            {
                ys[i] = s; s++;
            }
            Year.BindingData = ys;
            Year.Refresh();
            ms = new string[12];
            for (int i = 0; i < 12; i++)
            {
                ms[i] = (i + 1).ToString();
            }
            Month.BindingData = ms;
            Month.Refresh();
            Days = new List <string>();
            for (int i = 0; i < 31; i++)
            {
                Days.Add((i + 1).ToString());
            }
            Day.BindingData = Days;
            Day.Refresh();
            UpdateItems(Year);
            UpdateItems(Month);
            UpdateItems(Day);
        }