Exemple #1
0
 public void Init(MyObjectBuilder_ConstructionStockpile ob)
 {
     Items.Clear();
     if (ob.Items == null)
     {
         return;
     }
     foreach (var k in ob.Items)
     {
         AddItem(k.Id, k.Amount);
     }
 }
Exemple #2
0
        public MyObjectBuilder_ConstructionStockpile GetObjectBuilder()
        {
            MyObjectBuilder_ConstructionStockpile stockpile = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_ConstructionStockpile>();

            stockpile.Items = new MyObjectBuilder_StockpileItem[this.m_items.Count];
            for (int i = 0; i < this.m_items.Count; i++)
            {
                MyStockpileItem item = this.m_items[i];
                MyObjectBuilder_StockpileItem item2 = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_StockpileItem>();
                item2.Amount          = item.Amount;
                item2.PhysicalContent = item.Content;
                stockpile.Items[i]    = item2;
            }
            return(stockpile);
        }
Exemple #3
0
 public void Init(MyObjectBuilder_ConstructionStockpile objectBuilder)
 {
     this.m_items.Clear();
     if (objectBuilder != null)
     {
         foreach (MyObjectBuilder_StockpileItem item in objectBuilder.Items)
         {
             if (item.Amount > 0)
             {
                 MyStockpileItem item2 = new MyStockpileItem {
                     Amount  = item.Amount,
                     Content = item.PhysicalContent
                 };
                 this.m_items.Add(item2);
             }
         }
     }
 }
        public void Init(MyObjectBuilder_ConstructionStockpile objectBuilder)
        {
            m_items.Clear();

            if (objectBuilder == null)
                return;

            foreach (var item in objectBuilder.Items)
            {
                if (item.Amount > 0)
                {
                    MyStockpileItem newItem = new MyStockpileItem();
                    newItem.Amount = item.Amount;
                    newItem.Content = item.PhysicalContent;
                    m_items.Add(newItem);
                }
            }
        }
        public void Init(MyObjectBuilder_ConstructionStockpile objectBuilder)
        {
            m_items.Clear();

            if (objectBuilder == null)
            {
                return;
            }

            foreach (var item in objectBuilder.Items)
            {
                if (item.Amount > 0)
                {
                    MyStockpileItem newItem = new MyStockpileItem();
                    newItem.Amount  = item.Amount;
                    newItem.Content = item.PhysicalContent;
                    m_items.Add(newItem);
                }
            }
        }