示例#1
0
 public override void Initial(FakeStruct fake, UIElement script, UIInitializer initializer)
 {
     base.Initial(fake, script, initializer);
     callBack             = script.RegEvent <UserEvent>(new UICircleCollider());
     callBack.Drag        = Draging;
     callBack.DragEnd     = DragEnd;
     callBack.PointerDown = PointDown;
     _r = Enity.SizeDelta.x * 0.5f;
     if (_r <= 0)
     {
         _r = 0.01f;
     }
     _s  = _r * _r;
     Nob = Enity.Find("Nob");
 }
示例#2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="fake">数据模型</param>
        /// <param name="element">元素主体</param>
        public override void Initial(FakeStruct fake, UIElement element, UIInitializer initializer)
        {
            base.Initial(fake, element, initializer);
            LineLevel = Enity.Find("LineLevel");
            AreaLevel = Enity.Find("AreaLevel");
            LineMod   = HGUIManager.FindChild(fake, "Line");
            AreaMod   = HGUIManager.FindChild(fake, "Area");
            HGUIManager.RecycleUI(Enity.Find("Line"));
            HGUIManager.RecycleUI(Enity.Find("Area"));
            InitialFixLine();
            InitialArea();
            Enity.SizeChanged = SizeChanged;
            var ex = UIElementLoader.GetCompositeData(fake);

            if (ex != null)
            {
                LoadFromBuffer(ex);
            }
        }
示例#3
0
        public override void Initial(FakeStruct mod, UIElement script, UIInitializer initializer)
        {
            base.Initial(mod, script, initializer);
            Label          = Enity.Find("Label") as HText;
            callBack       = Enity.RegEvent <UserEvent>();
            callBack.Click = Show;
            var scroll = Enity.Find("Scroll");

            if (scroll != null)
            {
                scroll.activeSelf = false;
                m_scroll          = scroll.composite as ScrollY;
                if (m_scroll != null)
                {
                    m_scroll.SetItemUpdate <PopItemMod, object>(ItemUpdate);
                    m_scroll.eventCall.LostFocus   = LostFocus;
                    m_scroll.eventCall.DataContext = this;
                }
            }
        }
示例#4
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="fake">数据模型</param>
        /// <param name="script">元素主体</param>
        public override void Initial(FakeStruct fake, UIElement script, UIInitializer initializer)
        {
            base.Initial(fake, script, initializer);
            Size                  = Enity.m_sizeDelta;
            eventCall             = Enity.RegEvent <UserEvent>();
            eventCall.PointerDown = (o, e) => { UpdateVelocity = false; };
            eventCall.Drag        = (o, e, s) =>
            {
                Size = Enity.m_sizeDelta;
                Scrolling(o, s);
            };
            eventCall.DragEnd    = OnDragEnd;
            eventCall.ForceEvent = true;
            eventCall.AutoColor  = false;

            eventCall.CutRect = true;
            Content           = Enity.Find("Content");
            if (Content != null)
            {
                Move(Vector2.zero);
            }
        }
示例#5
0
        public override void Initial(FakeStruct mod, UIElement element, UIInitializer initializer)
        {
            base.Initial(mod, element, initializer);
            var mui = Enity;

            mui.userEvent.CutRect = true;
            Year = Enity.Find("Year").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 = Enity.Find("Month").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 = Enity.Find("Day").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 = UIElementLoader.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);
        }