Esempio n. 1
0
        public override void Initial(FakeStruct mod, UIElement script, Initializer initializer)
        {
            base.Initial(mod, script, initializer);
            var trans = script.transform;

            callBack             = Enity.RegEvent <UserEvent>();
            callBack.Drag        = Draging;
            callBack.DragEnd     = DragEnd;
            callBack.PointerDown = PointDown;
            callBack.AutoColor   = false;
            var tmp = trans.Find("FillImage");

            if (tmp != null)
            {
                FillImage = tmp.GetComponent <HImage>();
            }
            tmp = trans.Find("Nob");
            Nob = tmp.GetComponent <HImage>();
            unsafe
            {
                var ex = UITransfromLoader.GetCompositeData(mod);
                if (ex != null)
                {
                    info = *(SliderInfo *)ex.ip;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="mod">模型数据</param>
        /// <param name="script">元素主体</param>
        public override void Initial(FakeStruct mod, UIElement script, Initializer initializer)
        {
            base.Initial(mod, script, initializer);
            script.SizeChanged = (o) => Order();
            var ex = UITransfromLoader.GetCompositeData(mod);

            if (ex != null)
            {
                direction      = (Direction)ex[0];
                spacing        = ex.GetFloat(1);
                FixedSize      = ex[2] == 1;
                FixedSizeRatio = ex.GetFloat(3);
                ItemOffset     = ex.GetFloat(4);
            }
        }
Esempio n. 3
0
        public override void Initial(FakeStruct mod, UIElement element, Initializer initializer)
        {
            base.Initial(mod, element, initializer);
            var txt = TextCom = element.GetComponentInChildren <HText>();

            textColor = txt.m_color;
            unsafe
            {
                if (mod != null)
                {
                    var ex = UITransfromLoader.GetEventData(mod);
                    if (ex != null)
                    {
                        TextInputData *tp = (TextInputData *)ex.ip;
                        textColor      = tp->inputColor;
                        m_tipColor     = tp->tipColor;
                        PointColor     = tp->pointColor;
                        SelectionColor = tp->selectColor;
                        CharacterLimit = tp->CharacterLimit;
                        ReadOnly       = tp->ReadyOnly;
                        contentType    = tp->contentType;
                        lineType       = tp->lineType;
                        m_TipString    = mod.buffer.GetData(tp->tipString) as string;
                        m_InputString  = mod.buffer.GetData(tp->inputString) as string;
                    }
                    else
                    {
                        m_InputString = txt.Text;
                    }
                }
                else
                {
                    m_InputString = txt.Text;
                }
            }
            FullString.FullString = m_InputString;
            InputEvent            = txt.RegEvent <InputBoxEvent>();
            InputEvent.Initial(null);
            InputEvent.input = this;
            Caret            = txt.GetComponentInChildren <HImage>();
        }
Esempio n. 4
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="fake">数据模型</param>
        /// <param name="element">元素主体</param>
        public override void Initial(FakeStruct fake, UIElement element, Initializer initializer)
        {
            base.Initial(fake, element, initializer);
            var mod = Enity.transform;

            LineLevel = mod.Find("LineLevel");
            AreaLevel = mod.Find("AreaLevel");
            LineMod   = HGUIManager.FindChild(fake, "Line");
            AreaMod   = HGUIManager.FindChild(fake, "Area");
            HGUIManager.GameBuffer.RecycleGameObject(mod.Find("Line").gameObject);
            HGUIManager.GameBuffer.RecycleGameObject(mod.Find("Area").gameObject);
            InitialFixLine();
            InitialArea();
            Enity.SizeChanged = SizeChanged;
            var ex = UITransfromLoader.GetCompositeData(fake);

            if (ex != null)
            {
                LoadFromBuffer(ex);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="mod">模型数据</param>
        /// <param name="script">主体元素</param>
        public override void Initial(FakeStruct mod, UIElement script, Initializer initializer)
        {
            base.Initial(mod, script, initializer);
            Main = script.transform;
            SetItemMod("Item");
            HGUIManager.GameBuffer.RecycleChild(script.gameObject);
            var ex = UITransfromLoader.GetCompositeData(mod);

            if (ex != null)
            {
                if (initializer != null)
                {
                    initializer.AddContextAction((trans) => {
                        var ele = trans.GetComponent <UIElement>();
                        if (ele != null)
                        {
                            Slider = ele.composite as UISlider;
                        }
                    }, ex[3]);
                }
            }
        }
Esempio n. 6
0
        internal virtual void Initial(FakeStruct mod)
        {
            if (mod == null)
            {
                collider = new UIBoxCollider();
                return;
            }
            FakeStruct fs = null;

            unsafe
            {
                fs = UITransfromLoader.GetEventData(mod);
            }
            if (fs == null)
            {
                collider = new UIBoxCollider();
            }
            else
            {
                switch ((EventColliderType)fs[0])
                {
                case EventColliderType.Circle:
                    collider = new UICircleCollider();
                    collider.Initial(fs);
                    break;

                case EventColliderType.Polygon:
                    collider = new UIPolygonCollider();
                    collider.Initial(fs);
                    break;

                default:
                    collider = new UIBoxCollider();
                    break;
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 设置项目模型
        /// </summary>
        /// <param name="name">模型名称</param>
        public void SetItemMod(string name)
        {
            if (BufferData == null)
            {
                return;
            }
            var mod = HGUIManager.FindChild(BufferData, name);

            if (mod != null)
            {
                unsafe
                {
                    ItemSize = ((UITransfromData *)mod.ip)->size;
                    var ex = UITransfromLoader.GetCompositeData(mod);
                    if (ex != null)
                    {
                        ScrollInfo *tp = (ScrollInfo *)ex.ip;
                        scrollType = tp->scrollType;
                        MinBox     = tp->minBox;
                    }
                }
            }
            ItemMod = mod;
        }
Esempio n. 8
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);
        }