示例#1
0
        private void PopulateCatalogue(CustomTreeNode treeNode, Document document, string sid)
        {
            if (m_IfcClassificationReferenceCollection == null)
            {
                m_IfcClassificationReferenceCollection = document.IfcXmlDocument.Items.OfType <IfcClassificationReference>().ToList();
            }

            var classificationReferences = m_IfcClassificationReferenceCollection.Where(item => item.ReferencedSource != null && item.ReferencedSource.Item.Ref == sid).Select(item => item);

            foreach (var classificationReference in classificationReferences)
            {
                string         nodeText = String.Format("{0} - {1}", classificationReference.Identification, classificationReference.Name);
                CustomTreeNode classificationReferenceNode = new CustomTreeNode(nodeText, classificationReference);
                // TODO: set node images, colors, ...
                treeNode.Nodes.Add(classificationReferenceNode);
                PopulateCatalogue(classificationReferenceNode, document, classificationReference.Id);
            }

            // gibt es ein propertySetTemplate zu RelatingClassification
            IEnumerable <IfcPropertySetTemplate> newPropertySetTemplates = GetIfcPropertySetTemplateCollectionRelatingClassificationId(document, sid);
            var baseObjects = new BaseObjects <IfcPropertySetTemplate>(null);

            baseObjects.AddRange(newPropertySetTemplates);
            treeNode.CcUISubObject = baseObjects;
            PopulatePropertyTemplates(treeNode, newPropertySetTemplates);
        }
示例#2
0
        // LOADS MOD
        public override void Load()
        {
            BaseObjects.Populate();

            /*
             *
             * THE ONES DONE:
             * - Crate Template
             * - Slime Template
             * - Craft Resource Template
             * - Floating Deco Template
             * - Food Template
             * - Liquid Template (Revisit to fix the coloring)
             * - Plort Template
             * - Toy Template
             * -
             *
             * TO TEST:
             * - Fashion
             * - Gordo
             * - Animal
             *
             */

            // TEST FOR PREFABS
        }
示例#3
0
        /// <summary>
        /// Called before GameContext.Start()
        /// </summary>
        static void Load()
        {
            if (isInitialized)
            {
                return;
            }
            isInitialized = true;

            BaseObjects.Populate();
            SRCallbacks.OnLoad();
            PrefabUtils.ProcessReplacements();
            KeyBindManager.ReadBinds();
            GameContext.Instance.gameObject.AddComponent <ModManager>();
            GameContext.Instance.gameObject.AddComponent <KeyBindManager.ProcessAllBindings>();
            try
            {
                SRModLoader.LoadMods();
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                ErrorGUI.CreateError($"{e.GetType().Name}: {e.Message}");
                return;
            }
            PostLoad();
        }
示例#4
0
        private void CheckCreatureMovement(Random random, int i)
        {
            bool notMoved = true;

            while (notMoved)
            {
                int moveX = random.Next(-1, 2);
                int moveY = random.Next(-1, 2);

                int newXCordinate = CreatureBaseObjects[i].XCordinate + moveX;
                int newYCordinate = CreatureBaseObjects[i].YCordinate + moveY;

                if (newXCordinate >= 0 &&
                    newXCordinate <= Size.GetLength(0) - 1 &&
                    newYCordinate >= 0 &&
                    newYCordinate <= Size.GetLength(1) - 1 &&
                    Size[newXCordinate, newYCordinate].GetType() != typeof(Rock) &&
                    Size[newXCordinate, newYCordinate].GetType() != typeof(Tree))
                {
                    if (Size[newXCordinate, newYCordinate].GetType() == typeof(Chest))
                    {
                        Chest chest = (Chest)Size[newXCordinate, newYCordinate];

                        if (chest.AttackBaseObjectBonus != null)
                        {
                            CreatureBaseObjects[i].EquipedAttackBaseObject = chest.AttackBaseObjectBonus;
                        }

                        if (chest.DefenceBaseObjectBonus != null)
                        {
                            if (!CreatureBaseObjects[i].DefenceBaseObjects.Any(d => d.Name.Contains(chest.DefenceBaseObjectBonus.Name)))
                            {
                                CreatureBaseObjects[i].DefenceBaseObjects.Add(chest.DefenceBaseObjectBonus);
                            }

                            CreatureBaseObjects[i].CalculateDefence();
                        }

                        BaseObjects.Remove(BaseObjects.Find(baseObject => baseObject.XCordinate == newXCordinate && baseObject.YCordinate == newYCordinate));
                    }
                    if (Size[newXCordinate, newYCordinate].GetType() == typeof(Lava))
                    {
                        CreatureBaseObjects[i].Life -= 1;
                        if (CreatureBaseObjects[i].Dead)
                        {
                            CreatureBaseObjects.RemoveAt(i);
                        }
                    }

                    CreatureBaseObjects[i].XCordinate += moveX;
                    CreatureBaseObjects[i].YCordinate += moveY;
                    notMoved = false;
                }
            }
        }
示例#5
0
 public virtual void Insert(object obj, int position)
 {
     if (position < ItemCount)
     {
         BaseObjects.Insert(position, obj);
         NotifyItemInserted(position);
     }
     else
     {
         Add(obj);
     }
 }
 public override void CreateObjects()
 {
     BaseObjects.Add(new Chest(null, new Boot()));
     BaseObjects.Add(new Chest(new Bow(), new Helm()));
     for (int i = 0; i < 4; i++)
     {
         BaseObjects.Add(new Rock());
     }
     for (int i = 0; i < 8; i++)
     {
         BaseObjects.Add(new Tree());
     }
 }
示例#7
0
        protected void PopulateWorld()
        {
            for (int x = 0; x < Size.GetLength(0); x++)
            {
                for (int y = 0; y < Size.GetLength(1); y++)
                {
                    if (BaseObjects.Any(baseObjects => baseObjects.XCordinate == x && baseObjects.YCordinate == y))
                    {
                        Size[x, y] = BaseObjects.Find(baseObjects => baseObjects.XCordinate == x && baseObjects.YCordinate == y);
                    }

                    if (CreatureBaseObjects.Any(creatureBaseObjects => creatureBaseObjects.XCordinate == x && creatureBaseObjects.YCordinate == y))
                    {
                        Size[x, y] = CreatureBaseObjects.Find(creatureBaseObjects => creatureBaseObjects.XCordinate == x && creatureBaseObjects.YCordinate == y);
                    }
                }
            }
        }
示例#8
0
        protected void GiveCordinates(List <WorldObject> list)
        {
            bool   notSet;
            Random random = new Random();

            foreach (var o in list)
            {
                notSet = true;
                while (notSet)
                {
                    int cordX = random.Next(Size.GetLength(0));
                    int cordY = random.Next(Size.GetLength(1));

                    if (!CreatureBaseObjects.Any(c => c.XCordinate == cordX && c.YCordinate == cordY) &&
                        !BaseObjects.Any(baseObject => baseObject.XCordinate == cordX && baseObject.YCordinate == cordY))
                    {
                        o.XCordinate = cordX;
                        o.YCordinate = cordY;

                        notSet = false;
                    }
                }
            }
        }
示例#9
0
 public virtual void Update(object obj, int position)
 {
     BaseObjects.RemoveAt(position);
     BaseObjects.Insert(position, obj);
     NotifyItemChanged(position);
 }
示例#10
0
 public virtual void Remove(int position)
 {
     BaseObjects.RemoveAt(position);
     NotifyItemRemoved(position);
 }
示例#11
0
 public virtual void Add(object obj)
 {
     BaseObjects.Add(obj);
     NotifyItemInserted(ItemCount);
 }