Beispiel #1
0
        public override TtabItemMotiveItem Clone(TtabItemMotiveGroup parent)
        {
            TtabItemSingleMotiveItem clone = new TtabItemSingleMotiveItem(parent);

            this.CopyTo(clone, false);
            return(clone);
        }
Beispiel #2
0
        public TtabItemMotiveGroup Clone(TtabItemMotiveTable parent)
        {
            TtabItemMotiveGroup clone = new TtabItemMotiveGroup(parent, count, type);

            this.CopyTo(clone);
            return(clone);
        }
Beispiel #3
0
            /// <summary>
            /// Creates a deep copy of the TtabItemMotiveItemArrayList
            /// </summary>
            public TtabItemMotiveItemArrayList Clone(TtabItemMotiveGroup parent)
            {
                TtabItemMotiveItemArrayList clone = new TtabItemMotiveItemArrayList();

                foreach (TtabItemMotiveItem item in this)
                {
                    clone.Add(item.Clone(parent));
                }
                return(clone);
            }
Beispiel #4
0
        public int Add(TtabItemMotiveGroup item)
        {
            //if (items.Count >= 0x08) // we don't really know...
            //return -1;

            item.Parent = this;
            int result = items.Add(item);

            if (result >= 0 && Wrapper != null)
            {
                Wrapper.OnWrapperChanged(this, new EventArgs());
            }
            return(result);
        }
Beispiel #5
0
        private void Unserialize(System.IO.BinaryReader reader)
        {
            int nrGroups = 0;

            if (counts != null)
            {
                nrGroups = counts.Length;
            }
            else
            {
                nrGroups = reader.ReadInt32();
            }
            if (items.Capacity < nrGroups)
            {
                items = new TtabItemMotiveGroupArrayList(new TtabItemMotiveGroup[nrGroups]);
            }

            for (int i = 0; i < nrGroups; i++)
            {
                items[i] = new TtabItemMotiveGroup(this, counts != null ? counts[i] : 0, type, reader);
            }
        }
Beispiel #6
0
        public TtabItemMotiveTable(TtabItem parent, int[] counts, TtabItemMotiveTableType type)
        {
            this.parent = parent;
            this.counts = counts;
            this.type   = type;

            int nrGroups = 0;

            if (counts != null)
            {
                nrGroups = counts.Length;
            }
            else
            {
                nrGroups = type == TtabItemMotiveTableType.Human ? 5 : 8;
            }

            items = new TtabItemMotiveGroupArrayList(new TtabItemMotiveGroup[nrGroups]);
            for (int i = 0; i < nrGroups; i++)
            {
                items[i] = new TtabItemMotiveGroup(this, counts != null ? counts[i] : -1, type);
            }
        }
Beispiel #7
0
 public void Remove(TtabItemMotiveGroup item)
 {
     this.RemoveAt(items.IndexOf(item));
 }
Beispiel #8
0
 public TtabItemSingleMotiveItem(TtabItemMotiveGroup parent, System.IO.BinaryReader reader) : base(parent, reader)
 {
 }
Beispiel #9
0
 public TtabItemSingleMotiveItem(TtabItemMotiveGroup parent) : base(parent)
 {
 }
Beispiel #10
0
        // All covered by ICollection
        #endregion

        public TtabItemAnimalMotiveItem(TtabItemMotiveGroup parent) : base(parent)
        {
        }
Beispiel #11
0
 public abstract TtabItemMotiveItem Clone(TtabItemMotiveGroup parent);
Beispiel #12
0
 public TtabItemMotiveItem(TtabItemMotiveGroup parent, System.IO.BinaryReader reader)
     : this(parent) { Unserialize(reader); }
Beispiel #13
0
 public TtabItemMotiveItem(TtabItemMotiveGroup parent)
 {
     this.parent = parent;
 }
Beispiel #14
0
 private void CopyTo(TtabItemMotiveGroup target)
 {
     target.items = items == null ? null : items.Clone(target);
 }