Exemplo n.º 1
0
        unsafe public override void Load(FakeStruct fake)
        {
            data = *(ElementData *)fake.ip;
            var buff = fake.buffer;

            Int16[] coms = buff.GetData(data.coms) as Int16[];
            if (coms != null)
            {
                for (int i = 0; i < coms.Length; i++)
                {
                    int index = coms[i];
                    i++;
                    int type = coms[i];
                    var fs   = buff.GetData(index) as FakeStruct;
                    if (fs != null)
                    {
                        var dc = ModelManagerUI.Load(type);
                        if (dc != null)
                        {
                            dc.Load(fs);
                            components.Add(dc);
                        }
                    }
                }
            }
            Int16[] chi = fake.buffer.GetData(data.child) as Int16[];
            if (chi != null)
            {
                for (int i = 0; i < chi.Length; i++)
                {
                    var fs = buff.GetData(chi[i]) as FakeStruct;
                    if (fs != null)
                    {
                        ModelElement model = new ModelElement();
                        model.Load(fs);
                        model.SetParent(this);
                        //child.Add(model);
                        //model.parent = this;
                    }
                }
            }
            name    = buff.GetData(data.name) as string;
            tag     = buff.GetData(data.tag) as string;
            ModData = fake;
        }
Exemplo n.º 2
0
 public static ModelElement CloneModel(string asset, string name)
 {
     for (int i = 0; i < prefabs.Count; i++)
     {
         if (asset == prefabs[i].name)
         {
             var models = prefabs[i].models;
             var mod    = models.Find(name);
             if (mod != null)
             {
                 ModelElement model = new ModelElement();
                 model.Load(mod.ModData);
                 return(model);
             }
             return(null);
         }
     }
     return(null);
 }