예제 #1
0
		private void LST_BlueprintConfig_Details_Prerequisites_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (LST_BlueprintConfig_Details_Prerequisites.SelectedIndex < 0) return;

			m_currentlySelecting = true;

			int blueprintIndex = LST_BlueprintConfig.SelectedIndex;
			int prereqIndex = LST_BlueprintConfig_Details_Prerequisites.SelectedIndex;

			BlueprintsDefinition blueprint = m_blueprintsDefinitionsManager.DefinitionOf(blueprintIndex);
			//BlueprintItemDefinition prereq = blueprint.Prerequisites[prereqIndex];

			SerializableDefinitionId selectedItem = new SerializableDefinitionId(MyObjectBuilderType.Parse(prereq.TypeId), prereq.SubTypeId);
			CMB_BlueprintConfig_Details_Prerequisites_TypeId.SelectedItem = selectedItem;
			TXT_BlueprintConfig_Details_Prerequisites_Amount.Text = prereq.Amount.ToString(m_numberFormatInfo);

			m_currentlySelecting = false;
			BTN_BlueprintConfig_Details_Prerequisites_Apply.Enabled = false;
		}
 public ProductionQueueItem(MyObjectBuilder_ProductionBlock.QueueItem q)
 {
     Amount = q.Amount;
     Id = q.Id;
     ItemId = q.ItemId.GetValueOrDefault(0);
 }
예제 #3
0
		private void BTN_BlueprintConfig_Details_Result_New_Click(object sender, EventArgs e)
		{
			SerializableDefinitionId selectedItem = new SerializableDefinitionId(new MyObjectBuilderType(typeof(MyObjectBuilder_Ore)), "Stone");
			MyObjectBuilder_BlueprintDefinition temp = new MyObjectBuilder_BlueprintDefinition();
			temp.BaseProductionTimeInSeconds = 1;
			//temp.Prerequisites = new MyObjectBuilder_BlueprintDefinition.Item[1];
			//temp.Prerequisites[0] = new MyObjectBuilder_BlueprintDefinition.Item();
			temp.Prerequisites[0].TypeId = selectedItem.TypeId.ToString();
			temp.Prerequisites[0].SubtypeId = selectedItem.SubtypeName;
			temp.Prerequisites[0].Amount = "1";
			temp.Result = new MyObjectBuilder_BlueprintDefinition.Item();
			temp.Result.Amount = "1";
			temp.Result.TypeId = selectedItem.TypeId.ToString();
			temp.Result.SubtypeId = selectedItem.SubtypeName;
			BlueprintsDefinition blueprint = m_blueprintsDefinitionsManager.NewEntry(temp);
			if (blueprint == null)
			{
				MessageBox.Show(this, "Failed to create new entry");
				return;
			}

			FillBlueprintConfigurationListBox(false);

			LST_BlueprintConfig.SelectedIndex = LST_BlueprintConfig.Items.Count - 1;
		}
예제 #4
0
        private bool FindMatchingItem()
        {
            bool foundMatchingItem = false;
            if (!foundMatchingItem)
            {
                foreach (var item in m_physicalItemsManager.Definitions)
                {
                    if (item.Id.TypeId == PhysicalContent.TypeId && item.Id.SubtypeId == PhysicalContent.SubtypeName)
                    {
                        m_itemId = item.Id;
                        m_itemMass = item.Mass;
                        m_itemVolume = item.Volume;

                        foundMatchingItem = true;
                        break;
                    }
                }
            }
            if (!foundMatchingItem)
            {
                foreach (var item in m_componentsManager.Definitions)
                {
                    if (item.Id.TypeId == PhysicalContent.TypeId && item.Id.SubtypeId == PhysicalContent.SubtypeName)
                    {
                        m_itemId = item.Id;
                        m_itemMass = item.Mass;
                        m_itemVolume = item.Volume;

                        foundMatchingItem = true;
                        break;
                    }
                }
            }
            if (!foundMatchingItem)
            {
                foreach (var item in m_ammoManager.Definitions)
                {
                    if (item.Id.TypeId == PhysicalContent.TypeId && item.Id.SubtypeId == PhysicalContent.SubtypeName)
                    {
                        m_itemId = item.Id;
                        m_itemMass = item.Mass;
                        m_itemVolume = item.Volume;

                        foundMatchingItem = true;
                        break;
                    }
                }
            }

            return foundMatchingItem;
        }
 public ProductionQueueItem(decimal amount, SerializableDefinitionId id, uint itemId)
 {
     Amount = amount;
     Id = id;
     ItemId = itemId;
 }
예제 #6
0
        public InventoryItemEntity NewEntry()
        {
            MyObjectBuilder_InventoryItem defaults = new MyObjectBuilder_InventoryItem();
            SerializableDefinitionId itemTypeId = new SerializableDefinitionId(typeof(MyObjectBuilder_Ore), "Stone");
            defaults.PhysicalContent = (MyObjectBuilder_PhysicalObject)MyObjectBuilder_PhysicalObject.CreateNewObject(itemTypeId);
            defaults.Amount = 1;

            InventoryItemEntity newItem = m_itemManager.NewEntry<InventoryItemEntity>(defaults);
            newItem.ItemId = NextItemId;
            NextItemId = NextItemId + 1;

            RefreshInventory();

            return newItem;
        }
 static bool DoChangeListId(long EntityId, SerializableDefinitionId id, bool add)
 {
     MyEntity entity;
     MyEntities.TryGetEntityById(EntityId, out entity);
     if (entity != null)
     {
         return ((MyConveyorSorter)entity).DoChangeListId(id,add);
     }
     return false;
 }
 public void ChangeListId(SerializableDefinitionId id, bool add)
 {
     ListChangeIdMsg msg=new ListChangeIdMsg();
     msg.EntityId=m_Parent.EntityId;
     msg.Id=id;
     msg.Add=add;
     if (!Sync.IsServer)
         Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
     else
         if (m_Parent.DoChangeListId(id,add))
             Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
 }
 internal bool DoChangeListId(SerializableDefinitionId id, bool add)
 {
     if (add)
         m_inventoryConstraint.Add(id);
     else
         m_inventoryConstraint.Remove(id);
     if (m_allowCurrentListUpdate)
         currentList.UpdateVisual();
     return true;
 }
예제 #10
0
 void ChangeListId(SerializableDefinitionId id, bool wasAdded)
 {
     if (!Sync.MultiplayerActive)
         DoChangeListId(id, wasAdded);
     else
         m_sync.ChangeListId(id, wasAdded);
 }