Пример #1
0
        public override void Initial(ModelElement mod)
        {
            Model                = mod;
            callBack             = EventCallBack.RegEvent <EventCallBack>(Model);
            callBack.Drag        = callBack.DragEnd = Draging;
            callBack.PointerDown = PointDown;
            callBack.AutoColor   = false;
            var child = mod.child;

            FillImage = mod.Find("FillImage");
            if (FillImage != null)
            {
                image = FillImage.GetComponent <ImageElement>();
            }
            Nob = mod.Find("Nob");
            var fake = mod.GetExtand() as FakeStruct;

            if (fake != null)
            {
                unsafe
                {
                    info = *(SliderInfo *)fake.ip;
                }
            }
        }
Пример #2
0
 public override void Initial(ModelElement mod)
 {
     var fill = mod.Find("FillImage");
     if (fill != null)
     {
         fill.Instantiate();
         FillImage = fill.Context;
         image = FillImage.GetComponent<Image>();
     }
     var nob = mod.Find("Nob");
     if (nob != null)
     {
         nob.Instantiate();
         Nob = nob.Context;
     }
     model = mod.Context;
     callBack = EventCallBack.RegEvent<EventCallBack>(model);
     callBack.Drag = callBack.DragEnd = Draging;
     callBack.PointerDown = PointDown;
     callBack.AutoColor = false;
     var fake = mod.GetExtand();
     if(fake!=null)
     {
         unsafe
         {
             info = *(SliderInfo*)fake.ip;
         }
     }
 }
        public override void Initial(ModelElement mod)
        {
            model = mod;
            var mask = model.Find("mask");
            var y    = mask.Find("Year");

            Year = new ScrollY();
            Year.Initial(y);
            Year.SetItemUpdate <ItemView, int>((o, e, i) => { o.Item.text = e.ToString() + unitY; });
            Year.Scroll                  = Scrolling;
            Year.ScrollEnd               = YearScrollToEnd;
            Year.ItemDockCenter          = true;
            Year.scrollType              = ScrollType.Loop;
            Year.eventCall.boxSize       = new Vector2(120, 160);
            Year.eventCall.UseAssignSize = true;

            var m = mask.Find("Month");

            Month = new ScrollY();
            Month.Initial(m);
            Month.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.text = e + unitM; });
            Month.Scroll                  = Scrolling;
            Month.ScrollEnd               = MonthScrollToEnd;
            Month.ItemDockCenter          = true;
            Month.scrollType              = ScrollType.Loop;
            Month.eventCall.boxSize       = new Vector2(120, 160);
            Month.eventCall.UseAssignSize = true;

            var d = mask.Find("Day");

            Day = new ScrollY();
            Day.Initial(d);
            Day.SetItemUpdate <ItemView, string>((o, e, i) => { o.Item.text = e + unitD; });
            Day.Scroll                  = Scrolling;
            Day.ScrollEnd               = DayScrollToEnd;
            Day.ItemDockCenter          = true;
            Day.ScrollEnd               = DayScrollToEnd;
            Day.scrollType              = ScrollType.Loop;
            Day.eventCall.boxSize       = new Vector2(120, 160);
            Day.eventCall.UseAssignSize = true;

            var fs = mod.GetExtand() as FakeStruct;

            if (fs != null)
            {
                StartYear = fs[0];
                EndYear   = fs[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);
        }