Example #1
0
    public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
    {
        FakeStruct fs = new FakeStruct(db, 3);

        fs[0] = (int)EventColliderType.Circle;
        fs.SetFloat(1, Radius);
        fs.SetFloat(2, Ratio);
        data->eve = db.AddData(fs);
    }
Example #2
0
 public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
 {
     if (Points != null)
     {
         FakeStruct fs = new FakeStruct(db, 2);
         fs[0]     = (int)EventColliderType.Polygon;
         fs[1]     = db.AddArray <Vector2>(Points);
         data->eve = db.AddData(fs);
     }
 }
Example #3
0
    public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
    {
        FakeStruct fake = new FakeStruct(db, 5);

        fake[0] = (int)direction;
        fake.SetFloat(1, spacing);
        fake[2] = FixedSize?1:0;
        fake.SetFloat(3, FixedSizeRatio);
        fake.SetFloat(4, ItemOffset);
        data->composite = db.AddData(fake);
    }
Example #4
0
    public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
    {
        FakeStruct  fake = new FakeStruct(db, SliderInfo.ElementSize);
        SliderInfo *si   = (SliderInfo *)fake.ip;

        si->StartOffset = StartOffset;
        si->EndOffset   = EndOffset;
        si->MinScale    = MinScale;
        si->MaxScale    = MaxScale;
        si->direction   = direction;
        data->composite = db.AddData(fake);
    }
Example #5
0
    public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
    {
        FakeStruct     fake = new FakeStruct(db, TextInputData.ElementSize);
        TextInputData *sp   = (TextInputData *)fake.ip;

        sp->inputColor     = inputColor;
        sp->tipColor       = tipColor;
        sp->pointColor     = pointColor;
        sp->selectColor    = selectColor;
        sp->inputString    = db.AddData(InputString);
        sp->tipString      = db.AddData(TipString);
        sp->CharacterLimit = CharacterLimit;
        sp->ReadyOnly      = ReadyOnly;
        sp->contentType    = contentType;
        sp->lineType       = lineType;
        data->eve          = db.AddData(fake);
    }
Example #6
0
    public unsafe override void ToBufferData(DataBuffer db, UITransfromData *data)
    {
        FakeStruct  fake = new FakeStruct(db, ScrollInfo.ElementSize);
        ScrollInfo *info = (ScrollInfo *)fake.ip;

        info->minBox     = minBox;
        info->scrollType = scrollType;
        if (Slider != null)
        {
            info->Slider = Slider.GetInstanceID();
        }
        else
        {
            info->Slider = 0;
        }
        data->composite = db.AddData(fake);
    }
Example #7
0
 /// <summary>
 /// 将数据存储到FakeStrcut中
 /// </summary>
 /// <param name="data">数据缓存</param>
 /// <returns>FakeStruct数据</returns>
 public unsafe virtual void ToBufferData(DataBuffer db, UITransfromData *data)
 {
 }
Example #8
0
        /// <summary>
        ///  将到组件实体中的数据载入假结构体中
        /// </summary>
        /// <param name="com">unity组件</param>
        /// <param name="buffer">数据缓存器</param>
        /// <returns></returns>
        public unsafe override FakeStruct LoadFromObject(Component com, DataBuffer buffer)
        {
            var trans = com as Transform;

            if (trans == null)
            {
                return(null);
            }
            FakeStruct       fake = new FakeStruct(buffer, UITransfromData.ElementSize);
            UITransfromData *td   = (UITransfromData *)fake.ip;

            td->insID            = trans.GetInstanceID();
            td->localEulerAngles = trans.localEulerAngles;
            td->localPosition    = trans.localPosition;
            td->localScale       = trans.localScale;
            td->name             = buffer.AddData(trans.name);
            td->tag = buffer.AddData(trans.tag);
            var coms = com.GetComponents <Component>();

            td->type  = gameobjectBuffer.GetTypeID(coms);
            td->layer = trans.gameObject.layer;
            List <Int16> tmp = new List <short>();

            for (int i = 0; i < coms.Length; i++)
            {
                if (coms[i] is UIHelper)
                {
                    (coms[i] as UIHelper).ToBufferData(buffer, td);
                }
                else
                if (!(coms[i] is Transform))
                {
                    Int32 type = gameobjectBuffer.GetTypeIndex(coms[i]);
                    if (type >= 0)
                    {
                        var loader = gameobjectBuffer.GetDataLoader(type);
                        if (loader != null)
                        {
                            var fs = loader.LoadFromObject(coms[i], buffer);
                            tmp.Add((Int16)buffer.AddData(fs));
                        }
                        else
                        {
                            tmp.Add(0);
                        }
                        tmp.Add((Int16)type);
                        var scr = coms[i] as UIElement;
                        if (scr != null)
                        {
                            td->size  = scr.SizeDelta;
                            td->pivot = scr.Pivot;
                        }
                    }
                }
            }
            td->coms = buffer.AddData(tmp.ToArray());
            int c = trans.childCount;

            if (c > 0)
            {
                Int16[] buf = new short[c];
                for (int i = 0; i < c; i++)
                {
                    var fs = LoadFromObject(trans.GetChild(i), buffer);
                    buf[i] = (Int16)buffer.AddData(fs);
                }
                td->child = buffer.AddData(buf);
            }
            return(fake);
        }