Exemplo n.º 1
0
        public void AddEntitySet(MCMloEntitySet set)
        {
            var instset = new MloInstanceEntitySet(set, this);
            var esets   = EntitySets?.ToList() ?? new List <MloInstanceEntitySet>();

            esets.Add(instset);
            EntitySets = esets.ToArray();
        }
Exemplo n.º 2
0
        public void UpdateDefaultEntitySets()
        {
            var list    = new List <uint>();
            var mloarch = Owner?.Archetype as MloArchetype;

            for (uint i = 0; i < mloarch.entitySets.Length; i++)
            {
                var entset = mloarch.entitySets[i];
                MloInstanceEntitySet instset = null;
                EntitySets.TryGetValue(entset._Data.name, out instset);
                if (instset != null)
                {
                    if (instset.Visible)
                    {
                        list.Add(i);
                    }
                }
            }

            defaultEntitySets = list.ToArray();
        }
Exemplo n.º 3
0
        public void CreateYmapEntities(YmapEntityDef owner, MloArchetype mloa)
        {
            Owner = owner;
            if (owner == null)
            {
                return;
            }
            if (mloa.entities == null)
            {
                return;
            }
            var ec = mloa.entities.Length;

            var entlist = new List <YmapEntityDef>();

            for (int i = 0; i < ec; i++)
            {
                YmapEntityDef e = CreateYmapEntity(owner, mloa.entities[i], i);
                entlist.Add(e);
            }

            int lasti = ec;

            var entitySets = mloa.entitySets;

            if (entitySets != null)
            {
                for (int i = 0; i < entitySets.Length; i++)
                {
                    var entitySet = entitySets[i];
                    if (entitySet.Entities != null)
                    {
                        EntitySets[entitySet._Data.name] = new MloInstanceEntitySet(entitySet, this);
                        MloInstanceEntitySet instset = EntitySets[entitySet._Data.name];
                        for (int j = 0; j < entitySet.Entities.Length; j++)
                        {
                            YmapEntityDef e = CreateYmapEntity(owner, entitySet.Entities[j], lasti);
                            EntitySets[entitySet._Data.name].Entities.Add(e);
                            e.MloEntitySet = instset;
                            lasti++;
                        }
                    }
                }
            }

            if ((defaultEntitySets != null) && (entitySets != null))
            {
                for (var i = 0; i < defaultEntitySets.Length; i++)
                {
                    uint index = defaultEntitySets[i];
                    if (index >= entitySets.Length)
                    {
                        continue;
                    }
                    MCMloEntitySet       set     = entitySets[index];
                    MloInstanceEntitySet instset = EntitySets[set._Data.name];
                    instset.Visible = true;
                }
            }

            Entities = entlist.ToArray();
        }
Exemplo n.º 4
0
        public void CreateYmapEntities()
        {
            if (Owner == null)
            {
                return;
            }
            if (MloArch?.entities == null)
            {
                return;
            }
            var ec = MloArch.entities.Length;

            var entlist = new List <YmapEntityDef>();

            for (int i = 0; i < ec; i++)
            {
                var e = CreateYmapEntity(Owner, MloArch.entities[i], i);
                entlist.Add(e);
            }

            int lasti = ec;

            var entitySets = MloArch.entitySets;

            if (entitySets != null)
            {
                EntitySets = new MloInstanceEntitySet[entitySets.Length];
                for (int i = 0; i < entitySets.Length; i++)
                {
                    var entitySet = entitySets[i];
                    var instset   = new MloInstanceEntitySet(entitySet, this);
                    if (entitySet.Entities != null)
                    {
                        for (int j = 0; j < entitySet.Entities.Length; j++)
                        {
                            var e = CreateYmapEntity(Owner, entitySet.Entities[j], lasti);
                            instset.Entities.Add(e);
                            e.MloEntitySet = instset;
                            lasti++;
                        }
                    }
                    EntitySets[i] = instset;
                }
            }

            if ((defaultEntitySets != null) && (EntitySets != null))
            {
                for (var i = 0; i < defaultEntitySets.Length; i++)
                {
                    uint index = defaultEntitySets[i];
                    if (index >= EntitySets.Length)
                    {
                        continue;
                    }
                    var instset = EntitySets[index];
                    instset.Visible = true;
                }
            }

            Entities = entlist.ToArray();
        }