本文整理汇总了C#中MyObjectBuilderType类的典型用法代码示例。如果您正苦于以下问题:C# MyObjectBuilderType类的具体用法?C# MyObjectBuilderType怎么用?C# MyObjectBuilderType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyObjectBuilderType类属于命名空间,在下文中一共展示了MyObjectBuilderType类的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: Load
public void Load(MyCubeSize cubeSize, MyObjectBuilderType typeId, string subTypeId)
{
CubeList.Clear();
var list = new SortedList<string, ComponentItemModel>();
var contentPath = ToolboxUpdater.GetApplicationContentPath();
var cubeDefinitions = SpaceEngineersCore.Resources.CubeBlockDefinitions.Where(c => c.CubeSize == cubeSize);
foreach (var cubeDefinition in cubeDefinitions)
{
var c = new ComponentItemModel
{
Name = cubeDefinition.DisplayNameText,
TypeId = cubeDefinition.Id.TypeId,
TypeIdString = cubeDefinition.Id.TypeId.ToString(),
SubtypeId = cubeDefinition.Id.SubtypeName,
TextureFile = (cubeDefinition.Icons == null || cubeDefinition.Icons.First() == null) ? null : SpaceEngineersCore.GetDataPathOrDefault(cubeDefinition.Icons.First(), Path.Combine(contentPath, cubeDefinition.Icons.First())),
Time = TimeSpan.FromSeconds(cubeDefinition.MaxIntegrity / cubeDefinition.IntegrityPointsPerSec),
Accessible = cubeDefinition.Public,
Mass = SpaceEngineersApi.FetchCubeBlockMass(cubeDefinition.Id.TypeId, cubeDefinition.CubeSize, cubeDefinition.Id.SubtypeName),
CubeSize = cubeDefinition.CubeSize,
Size = new BindableSize3DIModel(cubeDefinition.Size),
};
list.Add(c.FriendlyName + c.TypeIdString + c.SubtypeId, c);
}
foreach (var kvp in list)
{
CubeList.Add(kvp.Value);
}
CubeItem = CubeList.FirstOrDefault(c => c.TypeId == typeId && c.SubtypeId == subTypeId);
}
示例3: CanStack
public virtual bool CanStack(MyObjectBuilderType typeId, MyStringId subtypeId, MyItemFlags flags)
{
if (flags == Flags &&
typeId == TypeId &&
subtypeId == SubtypeId)
{
return true;
}
return false;
}
示例4: MySessionComponentBase
public MySessionComponentBase()
{
var type = GetType();
var attr = (MySessionComponentDescriptor)Attribute.GetCustomAttribute(type, typeof(MySessionComponentDescriptor), false);
DebugName = type.Name;
Priority = attr.Priority;
UpdateOrder = attr.UpdateOrder;
ObjectBuilderType = attr.ObjectBuilderType;
if (ObjectBuilderType != MyObjectBuilderType.Invalid)
MySessionComponentMapping.Map(GetType(), ObjectBuilderType);
}
示例5: SpaceEngineersTypes
static SpaceEngineersTypes()
{
AmmoMagazine = new MyObjectBuilderType(typeof(MyObjectBuilder_AmmoMagazine));
PhysicalGunObject = new MyObjectBuilderType(typeof(MyObjectBuilder_PhysicalGunObject));
OxygenContainerObject = new MyObjectBuilderType(typeof(MyObjectBuilder_OxygenContainerObject));
Ore = new MyObjectBuilderType(typeof(MyObjectBuilder_Ore));
Ingot = new MyObjectBuilderType(typeof(MyObjectBuilder_Ingot));
Component = new MyObjectBuilderType(typeof(MyObjectBuilder_Component));
VoxelMaterialDefinition = new MyObjectBuilderType(typeof(MyObjectBuilder_VoxelMaterialDefinition));
MedicalRoom = new MyObjectBuilderType(typeof(MyObjectBuilder_MedicalRoom));
Cockpit = new MyObjectBuilderType(typeof(MyObjectBuilder_Cockpit));
Thrust = new MyObjectBuilderType(typeof(MyObjectBuilder_Thrust));
}
示例6: MySessionComponentDescriptor
public MySessionComponentDescriptor(MyUpdateOrder updateOrder, int priority, Type obType)
{
UpdateOrder = updateOrder;
Priority = priority;
ObjectBuilderType = obType;
if (obType != null)
{
Debug.Assert(typeof(MyObjectBuilder_SessionComponent).IsAssignableFrom(obType), obType.FullName);
if (!typeof(MyObjectBuilder_SessionComponent).IsAssignableFrom(obType))
{
ObjectBuilderType = MyObjectBuilderType.Invalid;
}
}
}
示例7: Upgrade
public static MyObjectBuilder_CubeBlock Upgrade(MyObjectBuilder_CubeBlock cubeBlock, MyObjectBuilderType newType, string newSubType)
{
var upgraded = MyObjectBuilderSerializer.CreateNewObject(newType, newSubType) as MyObjectBuilder_CubeBlock;
if (upgraded == null)
{
Debug.Fail("Cannot upgrade cube block, upgraded block is not derived from " + typeof(MyObjectBuilder_CubeBlock).Name);
return null;
}
upgraded.EntityId = cubeBlock.EntityId;
upgraded.Min = cubeBlock.Min;
upgraded.m_orientation = cubeBlock.m_orientation;
upgraded.IntegrityPercent = cubeBlock.IntegrityPercent;
upgraded.BuildPercent = cubeBlock.BuildPercent;
upgraded.BlockOrientation = cubeBlock.BlockOrientation;
upgraded.ConstructionInventory = cubeBlock.ConstructionInventory;
upgraded.ColorMaskHSV = cubeBlock.ColorMaskHSV;
return upgraded;
}
示例8: Map
public static bool Map(Type type, MyObjectBuilderType objectBuilderType)
{
Debug.Assert(type.IsSubclassOf(typeof(MySessionComponentBase)), "Type is not derived from session component");
Debug.Assert(!m_objectBuilderTypeByType.ContainsKey(type), "Session component type is already mapped");
Debug.Assert(!m_typeByObjectBuilderType.ContainsKey(objectBuilderType), "Session object builder is already mapped");
if (!type.IsSubclassOf(typeof(MySessionComponentBase)))
return false;
if (!m_objectBuilderTypeByType.ContainsKey(type))
m_objectBuilderTypeByType.Add(type, objectBuilderType);
else
return false;
if (!m_typeByObjectBuilderType.ContainsKey(objectBuilderType))
m_typeByObjectBuilderType.Add(objectBuilderType, type);
else
return false;
return true;
}
示例9: SerializableDefinitionId
public SerializableDefinitionId(MyObjectBuilderType typeId, string subtypeName)
{
TypeId = typeId;
SubtypeName = subtypeName;
}
示例10: BlockScriptConstructor
/// <summary>
/// Gets the constructor list mapped to a MyObjectBuilderType
/// </summary>
private List<Action<IMyCubeBlock>> BlockScriptConstructor(MyObjectBuilderType objBuildType)
{
List<Action<IMyCubeBlock>> scripts;
if (!AllBlockScriptConstructors.TryGetValue(objBuildType, out scripts))
{
scripts = new List<Action<IMyCubeBlock>>();
AllBlockScriptConstructors.Add(objBuildType, scripts);
}
return scripts;
}
示例11: Disruption
protected Disruption(IMyCubeGrid grid, MyObjectBuilderType[] affects)
{
m_logger = new Logger(GetType().Name, () => grid.DisplayName);
m_cache = CubeGridCache.GetFor(grid);
m_affects = affects;
}
示例12: TryGetItemToRepair
public MyRepairBlueprintToProduce TryGetItemToRepair(uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId)
{
return m_itemsToProduce.Find(x =>
(x is MyRepairBlueprintToProduce) &&
(x as MyRepairBlueprintToProduce).InventoryItemId == inventoryItemId &&
(x as MyRepairBlueprintToProduce).InventoryItemType == inventoryItemType &&
(x as MyRepairBlueprintToProduce).InventoryItemSubtypeId == inventoryItemSubtypeId) as MyRepairBlueprintToProduce;
}
示例13: AddItemToRepair_Request
private void AddItemToRepair_Request(MyFixedPoint amount, SerializableDefinitionId blueprintId, long senderEntityId, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId)
{
if (IsLocked && senderEntityId != m_lockedByEntityId)
return;
MyMultiplayer.RaiseEvent(this, x => x.AddItemToRepair_Implementation, amount, blueprintId, inventoryItemId, inventoryItemType, inventoryItemSubtypeId);
}
示例14: AddItemToRepair_Implementation
private void AddItemToRepair_Implementation(MyFixedPoint amount, SerializableDefinitionId blueprintId, uint inventoryItemId, MyObjectBuilderType inventoryItemType, MyStringHash inventoryItemSubtypeId)
{
System.Diagnostics.Debug.Assert(amount > 0, "Adding zero or negative amount!");
MyBlueprintDefinitionBase blueprint = MyDefinitionManager.Static.GetBlueprintDefinition(blueprintId);
if (blueprint == null)
{
System.Diagnostics.Debug.Fail("Couldn't find blueprint definition for: " + blueprintId);
return;
}
Predicate<MyBlueprintToProduce> condition = x => (x is MyRepairBlueprintToProduce) &&
(x as MyRepairBlueprintToProduce).Blueprint == blueprint &&
(x as MyRepairBlueprintToProduce).InventoryItemId == inventoryItemId &&
(x as MyRepairBlueprintToProduce).InventoryItemType == inventoryItemType &&
(x as MyRepairBlueprintToProduce).InventoryItemSubtypeId == inventoryItemSubtypeId;
MyRepairBlueprintToProduce itemToProduce = m_itemsToProduce.Find(condition) as MyRepairBlueprintToProduce;
if (itemToProduce != null)
{
itemToProduce.Amount = itemToProduce.Amount + amount;
}
else
{
itemToProduce = new MyRepairBlueprintToProduce(amount, blueprint, inventoryItemId, inventoryItemType, inventoryItemSubtypeId);
m_itemsToProduce.Add(itemToProduce);
}
var handler = ProductionChanged;
if (handler != null)
{
handler(this, itemToProduce);
}
}
示例15: PullAllRequest
public static bool PullAllRequest(IMyConveyorEndpointBlock start, MyInventory destinationInventory, long playerId, MyObjectBuilderType? typeId = null)
{
SetTraversalPlayerId(playerId);
m_tmpRequestedItemSet.Set(typeId);
bool ret = ItemPullAll(start, destinationInventory);
m_tmpRequestedItemSet.Clear();
return ret;
}