当前位置: 首页>>代码示例>>C#>>正文


C# MyObjectBuilderType类代码示例

本文整理汇总了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;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCraftingComponentBase.cs

示例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);
        }
开发者ID:midspace,项目名称:SEToolbox,代码行数:33,代码来源:SelectCubeModel.cs

示例3: CanStack

 public virtual bool CanStack(MyObjectBuilderType typeId, MyStringId subtypeId, MyItemFlags flags)
 {
     if (flags == Flags &&
         typeId == TypeId &&
         subtypeId == SubtypeId)
     {
         return true;
     }
     return false;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:10,代码来源:MyObjectBuilder_PhysicalObject.cs

示例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);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:13,代码来源:MySessionComponentBase.cs

示例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));
 }
开发者ID:midspace,项目名称:SEToolbox,代码行数:13,代码来源:SpaceEngineersTypes.cs

示例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;
                }
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:16,代码来源:MySessionComponentBase.cs

示例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;
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:20,代码来源:MyObjectBuilder_CubeBlock.cs

示例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;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:21,代码来源:MySessionComponentMapping.cs

示例9: SerializableDefinitionId

 public SerializableDefinitionId(MyObjectBuilderType typeId, string subtypeName)
 {
     TypeId = typeId;
     SubtypeName = subtypeName;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:5,代码来源:SerializableDefinitionId.cs

示例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;
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:13,代码来源:UpdateManager.cs

示例11: Disruption

		protected Disruption(IMyCubeGrid grid, MyObjectBuilderType[] affects)
		{
			m_logger = new Logger(GetType().Name, () => grid.DisplayName);
			m_cache = CubeGridCache.GetFor(grid);
			m_affects = affects;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:6,代码来源:Disruption.cs

示例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;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:8,代码来源:MyCraftingComponentBase.cs

示例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);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCraftingComponentBase.cs

示例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);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:34,代码来源:MyCraftingComponentBase.cs

示例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;
 }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGridConveyorSystem.cs


注:本文中的MyObjectBuilderType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。