コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildingObject"/> class.
 /// </summary>
 /// <param name="father">The father node.</param>
 /// <param name="type">The type of this node.</param>
 public BuildingObject(BuildingObject father, BuildingObjectType type, uint id)
 {
     this.Father = father;
     this.Type   = type;
     this.Childs = new Hashtable();
     this.Id     = id;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildingObject"/> class.
 /// </summary>
 /// <param name="father">The father node.</param>
 /// <param name="type">The type of this node.</param>
 public BuildingObject(BuildingObject father, BuildingObjectType type, uint id)
 {
     this.Father = father;
     this.Type = type;
     this.Childs = new Hashtable();
     this.Id = id;
 }
コード例 #3
0
        /// <summary>
        /// Insert a new child into child list.[Not use]
        /// </summary>
        /// <param name="child">New child</param>
        public void AddNewChild(Object child)
        {
            switch (this.Type)
            {
            case BuildingObjectType.Outside:
                this._object = child;
                break;

            case BuildingObjectType.Building:
                if (this.Childs.Contains(child.Location[0]) == false)
                {
                    BuildingObjectType childType;
                    if (child.Location[0] == "0")
                    {
                        childType = BuildingObjectType.Outside;
                    }
                    else
                    {
                        childType = BuildingObjectType.Floor;
                    }

                    BuildingObject bObj = new BuildingObject(this, childType,
                                                             (uint)System.Convert.ToInt32(child.Location[0]));
                    this.Childs.Add(child.Location[0], bObj);
                    bObj.AddNewChild(child);
                }
                else
                {
                    (this.Childs[(child.Location[0])] as BuildingObject).AddNewChild(child);
                }
                break;

            case BuildingObjectType.Floor:
                if (this.Childs.Contains(child.Location[1]) == false)
                {
                    BuildingObject bObj = new BuildingObject(this, BuildingObjectType.Room,
                                                             (uint)System.Convert.ToInt32(child.Location[1]));
                    this.Childs.Add(child.Location[1], bObj);
                    bObj.AddNewChild(child);
                }
                else
                {
                    (this.Childs[(child.Location[1])] as BuildingObject).AddNewChild(child);
                }
                break;

            case BuildingObjectType.Room:
                if (this.Childs.Contains(child.Location[2]) == false)
                {
                    BuildingObject bObj = new BuildingObject(this, BuildingObjectType.Object,
                                                             (uint)System.Convert.ToInt32(child.Location[2]));
                    this.Childs.Add(child.Location[2], bObj);
                    bObj.AddNewChild(child);
                }
                else
                {
                    // Same Name... ???
                }
                break;

            case BuildingObjectType.Object:
                this._object = child;
                break;

            default:
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Insert a new child into child list.[Not use] 
        /// </summary>
        /// <param name="child">New child</param>
        public void AddNewChild(Object child)
        {
            switch (this.Type)
            {
                case BuildingObjectType.Outside:
                    this._object = child;
                    break;
                case BuildingObjectType.Building:
                    if (this.Childs.Contains(child.Location[0]) == false)
                    {
                        BuildingObjectType childType;
                        if(child.Location[0] == "0")
                        {
                            childType = BuildingObjectType.Outside;
                        }
                        else
                        {
                            childType = BuildingObjectType.Floor;
                        }

                        BuildingObject bObj = new BuildingObject(this, childType,
                            (uint)System.Convert.ToInt32(child.Location[0]));
                        this.Childs.Add(child.Location[0], bObj);
                        bObj.AddNewChild(child);
                    }
                    else
                    {
                        (this.Childs[(child.Location[0])] as BuildingObject).AddNewChild(child);
                    }
                    break;
                case BuildingObjectType.Floor:
                    if (this.Childs.Contains(child.Location[1]) == false)
                    {
                        BuildingObject bObj = new BuildingObject(this, BuildingObjectType.Room,
                            (uint)System.Convert.ToInt32(child.Location[1]));
                        this.Childs.Add(child.Location[1], bObj);
                        bObj.AddNewChild(child);
                    }
                    else
                    {
                        (this.Childs[(child.Location[1])] as BuildingObject).AddNewChild(child);
                    }
                    break;
                case BuildingObjectType.Room:
                    if (this.Childs.Contains(child.Location[2]) == false)
                    {
                        BuildingObject bObj = new BuildingObject(this, BuildingObjectType.Object,
                            (uint)System.Convert.ToInt32(child.Location[2]));
                        this.Childs.Add(child.Location[2], bObj);
                        bObj.AddNewChild(child);
                    }
                    else
                    {
                        // Same Name... ???
                    }
                    break;
                case BuildingObjectType.Object:
                    this._object = child;
                    break;
                default:
                    break;
            }
        }