本文整理汇总了C#中Sandbox.Definitions.MyBlueprintDefinitionBase类的典型用法代码示例。如果您正苦于以下问题:C# MyBlueprintDefinitionBase类的具体用法?C# MyBlueprintDefinitionBase怎么用?C# MyBlueprintDefinitionBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MyBlueprintDefinitionBase类属于Sandbox.Definitions命名空间,在下文中一共展示了MyBlueprintDefinitionBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyRepairBlueprintToProduce
public MyRepairBlueprintToProduce(MyFixedPoint amount, MyBlueprintDefinitionBase blueprint, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId) : base(amount, blueprint)
{
System.Diagnostics.Debug.Assert(Blueprint is MyRepairBlueprintDefinition, "MyRepairBlueprintToProduce class should be used together with blueprints type of MyRepairBlueprintDefinition only!");
InventoryItemId = inventoryItemId;
InventoryItemType = inventoryItemType;
InventoryItemSubtypeId = inventoryItemSubtypeId;
}
示例2: PostprocessAddSubblueprint
private void PostprocessAddSubblueprint(MyBlueprintDefinitionBase blueprint, MyFixedPoint blueprintAmount)
{
for (int i = 0; i < blueprint.Prerequisites.Length; ++i)
{
Item prerequisite = blueprint.Prerequisites[i];
prerequisite.Amount *= blueprintAmount;
AddToItemList(m_tmpPrerequisiteList, prerequisite);
}
for (int i = 0; i < blueprint.Results.Length; ++i)
{
Item result = blueprint.Results[i];
result.Amount *= blueprintAmount;
AddToItemList(m_tmpResultList, result);
}
}
示例3: InsertQueueItemRequest
public void InsertQueueItemRequest(int idx, MyBlueprintDefinitionBase blueprint, MyFixedPoint amount)
{
if (MyFakes.ENABLE_PRODUCTION_SYNC)
{
if (Sync.IsServer)
{
InsertQueueItem(idx, blueprint, amount);
SyncObject.AddQueueItemAnnounce(blueprint, amount, idx);
}
else
SyncObject.AddQueueItemRequest(blueprint, amount, idx);
}
else
{
InsertQueueItem(idx, blueprint, amount);
}
}
示例4: InsertQueueItem
protected override void InsertQueueItem(int idx, MyBlueprintDefinitionBase blueprint, MyFixedPoint amount)
{
if (idx == 0)
{
var queueItem = TryGetFirstQueueItem();
if (queueItem.HasValue && queueItem.Value.Blueprint != blueprint)
CurrentProgress = 0f;
}
base.InsertQueueItem(idx, blueprint, amount);
}
示例5: CheckInventoryContents
private bool CheckInventoryContents(MyInventory inventory, MyBlueprintDefinitionBase.Item item, MyFixedPoint amountMultiplier)
{
return inventory.ContainItems(item.Amount * amountMultiplier, item.Id);
}
示例6: CheckInventoryCapacity
private bool CheckInventoryCapacity(MyInventory inventory, MyBlueprintDefinitionBase.Item item, MyFixedPoint amountMultiplier)
{
return inventory.CanItemsBeAdded(item.Amount * amountMultiplier, item.Id);
}
示例7: FinishDisassembling
private void FinishDisassembling(MyBlueprintDefinitionBase blueprint)
{
if (RepeatEnabled && Sync.IsServer) OutputInventory.ContentsChanged -= OutputInventory_ContentsChanged;
foreach (var res in blueprint.Results)
{
OutputInventory.RemoveItemsOfType(res.Amount, res.Id);
}
if (RepeatEnabled && Sync.IsServer) OutputInventory.ContentsChanged += OutputInventory_ContentsChanged;
var amountMult = (MyFixedPoint)(1.0f / MySession.Static.AssemblerEfficiencyMultiplier);
for (int i = 0; i < blueprint.Prerequisites.Length; ++i)
{
var item = blueprint.Prerequisites[i];
var itemOb = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(item.Id.TypeId, item.Id.SubtypeName);
InputInventory.AddItems(item.Amount * amountMult, itemOb);
}
}
示例8: calculateBlueprintProductionTime
private float calculateBlueprintProductionTime(MyBlueprintDefinitionBase currentBlueprint)
{
return currentBlueprint.BaseProductionTimeInSeconds * 1000 / (MySession.Static.AssemblerSpeedMultiplier * ((MyAssemblerDefinition)BlockDefinition).AssemblySpeed + UpgradeValues["Productivity"]);
}
示例9: RemoveItemToProduce
public void RemoveItemToProduce(MyFixedPoint amount, MyBlueprintDefinitionBase blueprint, long senderEntityId, int itemId = -1)
{
SerializableDefinitionId blueprintId = blueprint.Id;
MyMultiplayer.RaiseEvent(this, x => x.RemoveItemToProduce_Request, amount, blueprintId, senderEntityId, itemId);
}
示例10: AddItemToRepair
public void AddItemToRepair(MyFixedPoint amount, MyBlueprintDefinitionBase blueprint, long senderEntityId, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId)
{
SerializableDefinitionId blueprintId = blueprint.Id;
MyMultiplayer.RaiseEvent(this, x => x.AddItemToRepair_Request, amount, blueprintId, senderEntityId, inventoryItemId, inventoryItemType, inventoryItemSubtypeId);
}
示例11: CanUseBlueprint
public bool CanUseBlueprint(MyBlueprintDefinitionBase blueprint)
{
System.Diagnostics.Debug.Assert(blueprint != null, "Passing blueprint as null argument!");
foreach (var blueprintClass in m_blueprintClasses)
if (blueprintClass.ContainsBlueprint(blueprint)) return true;
return false;
}
示例12: MyBlueprintToProduce
public MyBlueprintToProduce(MyFixedPoint amount, MyBlueprintDefinitionBase blueprint)
{
Amount = amount;
Blueprint = blueprint;
}
示例13: OnBlueprintProduced
protected void OnBlueprintProduced(MyBlueprintDefinitionBase blueprint, MyFixedPoint amount)
{
SerializableDefinitionId blueprintId = blueprint.Id;
MyMultiplayer.RaiseEvent(this, x => x.OnBlueprintProduced_Implementation, blueprintId, amount);
}
示例14: RaiseEvent_MissingRequiredItem
protected void RaiseEvent_MissingRequiredItem(MyBlueprintDefinitionBase blueprint, MyBlueprintDefinitionBase.Item missingItem)
{
MyMultiplayer.RaiseEvent(this, x => x.MissingRequiredItem_Implementation, (SerializableDefinitionId)blueprint.Id, (SerializableDefinitionId)missingItem.Id);
}
示例15: InsertQueueItem
protected virtual void InsertQueueItem(int idx, MyBlueprintDefinitionBase blueprint, MyFixedPoint amount)
{
Debug.Assert(idx <= m_queue.Count);
Debug.Assert(CanUseBlueprint(blueprint));
Debug.Assert(amount > 0);
QueueItem item = new QueueItem();
item.Amount = amount;
item.Blueprint = blueprint;
if (CanUseBlueprint(item.Blueprint))
{
if (m_queue.IsValidIndex(idx) && m_queue[idx].Blueprint == item.Blueprint)
{
// Increase amount if there is same kind of item at this index.
item.Amount += m_queue[idx].Amount;
item.ItemId = m_queue[idx].ItemId;
m_queue[idx] = item;
}
else if (m_queue.Count > 0 && (idx >= m_queue.Count || idx == -1) && m_queue[m_queue.Count - 1].Blueprint == item.Blueprint)
{
// Add to the last item in the queue if it is the same.
item.Amount += m_queue[m_queue.Count - 1].Amount;
item.ItemId = m_queue[m_queue.Count - 1].ItemId;
m_queue[m_queue.Count - 1] = item;
}
else
{
if (idx == -1)
idx = m_queue.Count;
// Reset timer when adding first item. Otherwise we might produce it faster than possible.
if (m_queue.Count == 0)
m_lastUpdateTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;
// Put new item into the queue with given amount and type.
item.ItemId = NextItemId;
m_queue.Insert(idx, item);
}
UpdatePower();
OnQueueChanged();
}
}