• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyStringHash类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MyStringHash的典型用法代码示例。如果您正苦于以下问题:C# MyStringHash类的具体用法?C# MyStringHash怎么用?C# MyStringHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyStringHash类属于命名空间,在下文中一共展示了MyStringHash类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

		public void Init(MyStringHash sourceGroup, List<MyResourceSourceInfo> sourceResourceData)
		{
			Group = sourceGroup;

			var resourceData = sourceResourceData;
			bool hasResourceData = resourceData != null && resourceData.Count != 0;
			int resourceCount = hasResourceData ? resourceData.Count : 1;
		    Enabled = true;

			if(resourceCount != m_allocatedTypeCount)
				AllocateData(resourceCount);

			int resourceIndexCounter = 0;
			if (!hasResourceData)
			{
				m_resourceTypeToIndex.Add(MyResourceDistributorComponent.ElectricityId, resourceIndexCounter++);
				m_resourceIds.Add(MyResourceDistributorComponent.ElectricityId);
			} 
			else
			{
				foreach (var resourceInfo in resourceData)
				{
					m_resourceTypeToIndex.Add(resourceInfo.ResourceTypeId, resourceIndexCounter++);
					m_resourceIds.Add(resourceInfo.ResourceTypeId);
				    m_dataPerType[resourceIndexCounter - 1].DefinedOutput = resourceInfo.DefinedOutput;
					SetOutputByType(resourceInfo.ResourceTypeId, 0f);
					SetMaxOutputByType(resourceInfo.ResourceTypeId, m_dataPerType[GetTypeIndex(resourceInfo.ResourceTypeId)].DefinedOutput);
                    SetProductionEnabledByType(resourceInfo.ResourceTypeId, true);
				    m_dataPerType[resourceIndexCounter - 1].ProductionToCapacityMultiplier = (resourceInfo.ProductionToCapacityMultiplier != 0f ? resourceInfo.ProductionToCapacityMultiplier : 1f);

					if(resourceInfo.IsInfiniteCapacity)
						SetRemainingCapacityByType(resourceInfo.ResourceTypeId, float.PositiveInfinity);
				}
			}
		}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:35,代码来源:MyResourceSourceComponent.cs


示例2: Init

        public virtual void Init(MyObjectBuilder_Base objectBuilder)
        {
            var builder = (MyObjectBuilder_EntityStat) objectBuilder;

            MyEntityStatDefinition definition;
            MyDefinitionManager.Static.TryGetDefinition<MyEntityStatDefinition>(new MyDefinitionId(builder.TypeId, builder.SubtypeId), out definition);

            Debug.Assert(definition != null);
            StatDefinition = definition;

            System.Diagnostics.Debug.Assert(!float.IsNaN(definition.MaxValue) && !float.IsNaN(definition.MinValue) && !float.IsNaN(definition.DefaultValue), "Invalid values in stat definition!");

            m_maxValue = definition.MaxValue;
            m_minValue = definition.MinValue;
            m_currentValue = builder.Value * m_maxValue;
            m_defaultValue = definition.DefaultValue;
            
            m_lastSyncValue = m_currentValue;
            m_statId = MyStringHash.GetOrCompute(definition.Name);

            m_regenAmountMultiplier = builder.StatRegenAmountMultiplier;
            m_regenAmountMultiplierDuration = builder.StatRegenAmountMultiplierDuration;
            m_regenAmountMultiplierTimeStart = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            m_regenAmountMultiplierTimeAlive = 0;
            m_regenAmountMultiplierActive = m_regenAmountMultiplierDuration > 0;

            ClearEffects();
            if (builder.Effects != null)
            {
                foreach (var effectBuilder in builder.Effects)
                {
                    AddEffect(effectBuilder);
                }
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:35,代码来源:MyEntityStat.cs


示例3: HandleAddDecal

        /// <param name="damage">Not used for now but could be used as a multiplier instead of random decal size</param>
        public static void HandleAddDecal(IMyEntity entity, MyHitInfo hitInfo, MyStringHash source = default(MyStringHash), object customdata = null, float damage = -1)
        {
            IMyDecalProxy proxy = entity as IMyDecalProxy;
            if (proxy != null)
            {
                AddDecal(proxy, ref hitInfo, damage, source, customdata);
                return;
            }

            MyCubeGrid grid = entity as MyCubeGrid;
            if (grid != null)
            {
                var block = grid.GetTargetedBlock(hitInfo.Position);
                if (block != null)
                {
                    var compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                    if (compoundBlock == null)
                        proxy = block;
                    else
                        proxy = compoundBlock;
                }
            }

            if (proxy == null)
                return;

            AddDecal(proxy, ref hitInfo, damage, source, customdata);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:29,代码来源:MyDecals.cs


示例4: HandleAddDecal

        /// <param name="damage">Not used for now but could be used as a multiplier instead of random decal size</param>
        public static void HandleAddDecal(IMyEntity entity, MyHitInfo hitInfo, MyStringHash source = default(MyStringHash), float damage = -1)
        {
            if (entity == null)
                DebugNullEntity();

            IMyDecalProxy proxy = entity as IMyDecalProxy;
            if (proxy != null)
            {
                AddDecal(proxy, ref hitInfo, damage, source);
                return;
            }

            MyCubeGrid grid = entity.GetTopMostParent() as MyCubeGrid;
            if (grid != null)
            {
                var block = grid.GetTargetedBlock(hitInfo.Position);
                if (block != null)
                {
                    var compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                    if (compoundBlock == null)
                        proxy = block;
                    else
                        proxy = compoundBlock;
                }
            }

            if (proxy != null)
                AddDecal(proxy, ref hitInfo, damage, source);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:30,代码来源:MyDecals.cs


示例5: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var ob = builder as MyObjectBuilder_PhysicalItemDefinition;
            MyDebug.AssertDebug(ob != null);
            this.Size = ob.Size;
            this.Mass = ob.Mass;
            this.Model = ob.Model;
            this.Models = ob.Models;
            this.Volume = ob.Volume.HasValue? ob.Volume.Value / 1000f : ob.Size.Volume;
            if (string.IsNullOrEmpty(ob.IconSymbol))
                this.IconSymbol = null;
            else
                this.IconSymbol = MyStringId.GetOrCompute(ob.IconSymbol);
            PhysicalMaterial = MyStringHash.GetOrCompute(ob.PhysicalMaterial);
            VoxelMaterial = MyStringHash.GetOrCompute(ob.VoxelMaterial);
            CanSpawnFromScreen = ob.CanSpawnFromScreen;
            RotateOnSpawnX = ob.RotateOnSpawnX;
            RotateOnSpawnY = ob.RotateOnSpawnY;
            RotateOnSpawnZ = ob.RotateOnSpawnZ;
            Health = ob.Health;
            if (ob.DestroyedPieceId.HasValue)
            {
                DestroyedPieceId = ob.DestroyedPieceId.Value;
            }
            DestroyedPieces = ob.DestroyedPieces;
            if (ob.ExtraInventoryTooltipLine != null)
                ExtraInventoryTooltipLine = new StringBuilder().Append(Environment.NewLine).Append(ob.ExtraInventoryTooltipLine);
            else
                ExtraInventoryTooltipLine = new StringBuilder();
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:32,代码来源:MyPhysicalItemDefinition.cs


示例6: MyModelInstanceData

 public MyModelInstanceData(MyStringHash subtypeId, MyInstanceFlagsEnum flags, float maxViewDistance, BoundingBox modelBox)
 {
     SubtypeId = subtypeId;
     Flags = flags;
     MaxViewDistance = maxViewDistance;
     ModelBox = modelBox;
 }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:7,代码来源:MyEnvironmentSector.cs


示例7: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var thrustBuilder = builder as MyObjectBuilder_ThrustDefinition;
            MyDebug.AssertDebug(thrustBuilder != null, "Initializing thrust definition using wrong object builder.");

	        ResourceSinkGroup = MyStringHash.GetOrCompute(thrustBuilder.ResourceSinkGroup);
            FuelConverter = thrustBuilder.FuelConverter;
			SlowdownFactor = thrustBuilder.SlowdownFactor;
            ForceMagnitude = thrustBuilder.ForceMagnitude;
            MaxPowerConsumption = thrustBuilder.MaxPowerConsumption;
            MinPowerConsumption = thrustBuilder.MinPowerConsumption;
            FlameDamageLengthScale = thrustBuilder.FlameDamageLengthScale;
            FlameDamage = thrustBuilder.FlameDamage;
            FlameLengthScale = thrustBuilder.FlameLengthScale;
            FlameFullColor = thrustBuilder.FlameFullColor;
            FlameIdleColor = thrustBuilder.FlameIdleColor;
            FlamePointMaterial = thrustBuilder.FlamePointMaterial;
            FlameLengthMaterial = thrustBuilder.FlameLengthMaterial;
            FlameGlareMaterial = thrustBuilder.FlameGlareMaterial;
            FlameVisibilityDistance = thrustBuilder.FlameVisibilityDistance;
            FlameGlareSize = thrustBuilder.FlameGlareSize;
            FlameGlareQuerySize = thrustBuilder.FlameGlareQuerySize;

            EffectivenessAtMinInfluence = thrustBuilder.EffectivenessAtMinInfluence;
            EffectivenessAtMaxInfluence = thrustBuilder.EffectivenessAtMaxInfluence;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:28,代码来源:MyThrustDefinition.cs


示例8: Init

        public virtual void Init(MyObjectBuilder_Base objectBuilder)
        {
            var builder = (MyObjectBuilder_EntityStat) objectBuilder;

            MyEntityStatDefinition definition;
            MyDefinitionManager.Static.TryGetDefinition<MyEntityStatDefinition>(new MyDefinitionId(builder.TypeId, builder.SubtypeId), out definition);

            Debug.Assert(definition != null);
            StatDefinition = definition;

            m_maxValue = builder.MaxValue * 100.0f;
            m_minValue = 0.0f;
            m_currentValue = builder.Value * m_maxValue;
            
            m_lastSyncValue = m_currentValue;
            m_statId = MyStringHash.GetOrCompute(definition.Name);

            if (builder.Effects != null)
            {
                foreach (var effectBuilder in builder.Effects)
                {
                    AddEffect(effectBuilder);
                }
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:25,代码来源:MyEntityStat.cs


示例9: DoDamage

        public override void DoDamage(float damage, int itemInstanceId, Vector3D position, Vector3 normal, MyStringHash type)
        {
            MyEnvironmentItemData itemData = m_itemsData[itemInstanceId];
            MyDefinitionId id = new MyDefinitionId(Definition.ItemDefinitionType, itemData.SubtypeId);
            var itemDefinition = (MyTreeDefinition)MyDefinitionManager.Static.GetEnvironmentItemDefinition(id);


            int effectId;
            if (itemDefinition.CutEffect != null && MyParticlesLibrary.GetParticleEffectsID(itemDefinition.CutEffect, out effectId))
            {
                MyParticleEffect effect;
                if (MyParticlesManager.TryCreateParticleEffect(effectId, out effect))
                {
                    effect.WorldMatrix = MatrixD.CreateWorld(position, Vector3.CalculatePerpendicularVector(normal), normal);
                }
            }

            if (!Sync.IsServer)
            {
                return;
            }

            MyCutTreeInfo cutTreeInfo = default(MyCutTreeInfo);
            int index = -1;
            for (int i = 0; i < m_cutTreeInfos.Count; ++i)
            {
                cutTreeInfo = m_cutTreeInfos[i];
                if (itemInstanceId == cutTreeInfo.ItemInstanceId)
                {
                    index = i;
                    break;
                }
            }

            if (index == -1)            
            {
                cutTreeInfo = new MyCutTreeInfo();
                cutTreeInfo.ItemInstanceId = itemInstanceId;

                cutTreeInfo.MaxPoints = cutTreeInfo.HitPoints = itemDefinition.HitPoints;

                index = m_cutTreeInfos.Count;
                m_cutTreeInfos.Add(cutTreeInfo);
            }

            cutTreeInfo.LastHit = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            cutTreeInfo.HitPoints -= damage;

            if (cutTreeInfo.Progress >= 1)
            {
                CutTree(itemInstanceId, position, normal, type == MyDamageType.Drill ? 1.0f : 4.0f);
                m_cutTreeInfos.RemoveAtFast(index);
            }
            else
            {
                m_cutTreeInfos[index] = cutTreeInfo;
            }

            return;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:60,代码来源:MyTrees.cs


示例10: 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


示例11: MyDamageInformation

 public MyDamageInformation(bool isDeformation, float amount, MyStringHash type, long attackerId)
 {
     IsDeformation = isDeformation;
     Amount = amount;
     Type = type;
     AttackerId = attackerId;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyDamageInformation.cs


示例12: GetInventory

        public static MyInventoryBase GetInventory(this MyEntity entity, MyStringHash inventoryId)
        {
            MyInventoryBase inventory = null;

            inventory = entity.Components.Get<MyInventoryBase>();
            if (inventory != null)
            {
                if (inventoryId.Equals(MyStringHash.GetOrCompute(inventory.InventoryId.ToString())))
                {
                    return inventory;
                }
            }

            if (inventory is MyInventoryAggregate)
            {
                var aggregate = inventory as MyInventoryAggregate;
                m_tmpList.Clear();
                aggregate.GetComponentsFlattened(m_tmpList);
                foreach (var component in m_tmpList)
                {
                    var componentInventory = component as MyInventoryBase;
                    if (inventoryId.Equals(MyStringHash.GetOrCompute(componentInventory.InventoryId.ToString())))
                    {
                        return componentInventory;
                    }
                }
            }

            return null;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyInventoryBaseExtensions.cs


示例13: Init

	    public void Init(MyStringHash sourceGroup, MyResourceSourceInfo sourceResourceData)
	    {
            MyUtils.Init(ref m_singleHelperList);
	        m_singleHelperList.Add(sourceResourceData);
            Init(sourceGroup, m_singleHelperList);
            m_singleHelperList.Clear();
	    }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyResourceSourceComponent.cs


示例14: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            MyDebug.AssertDebug(builder is MyObjectBuilder_ProductionBlockDefinition);
            var obDefinition = builder as MyObjectBuilder_ProductionBlockDefinition;

            this.InventoryMaxVolume = obDefinition.InventoryMaxVolume;
            this.InventorySize = obDefinition.InventorySize;
	        ResourceSinkGroup = MyStringHash.GetOrCompute(obDefinition.ResourceSinkGroup);
            this.StandbyPowerConsumption = obDefinition.StandbyPowerConsumption;
            this.OperationalPowerConsumption = obDefinition.OperationalPowerConsumption;

            System.Diagnostics.Debug.Assert(obDefinition.BlueprintClasses != null, "Production block has no blueprint classes specified");
            if (obDefinition.BlueprintClasses == null)
                InitializeLegacyBlueprintClasses(obDefinition);

            BlueprintClasses = new List<MyBlueprintClassDefinition>();
            for (int i = 0; i < obDefinition.BlueprintClasses.Length; ++i)
            {
                var className = obDefinition.BlueprintClasses[i];
                var classDef = MyDefinitionManager.Static.GetBlueprintClass(className);
                System.Diagnostics.Debug.Assert(classDef != null, "Production block references non-existent blueprint class");
                if (classDef == null) continue;

                BlueprintClasses.Add(classDef);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MyProductionBlockDefinition.cs


示例15: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);
            var ob = builder as MyObjectBuilder_OreDetectorDefinition;
	        ResourceSinkGroup = MyStringHash.GetOrCompute(ob.ResourceSinkGroup);
            MaximumRange = ob.MaximumRange;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyOreDetectorDefinition.cs


示例16: AddItemDefinition

        public void AddItemDefinition(MyStringHash definition)
        {
            Debug.Assert(!m_itemDefinitions.Contains(definition));
            if (m_itemDefinitions.Contains(definition)) return;

            m_itemDefinitions.Add(definition);
            m_definitionList.Add(definition);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:8,代码来源:MyEnvironmentItemsDefinition.cs


示例17: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var obRemote = builder as MyObjectBuilder_RemoteControlDefinition;
            MyDebug.AssertDebug(obRemote != null, "Initializing remote control using wrong definition");
	        ResourceSinkGroup = MyStringHash.GetOrCompute(obRemote.ResourceSinkGroup);
            RequiredPowerInput = obRemote.RequiredPowerInput;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:9,代码来源:MyRemoteControlDefinition.cs


示例18: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var obProjector = builder as MyObjectBuilder_ProjectorDefinition;
            MyDebug.AssertDebug(obProjector != null, "Initializing camera definition using wrong object builder.!");
	        ResourceSinkGroup = MyStringHash.GetOrCompute(obProjector.ResourceSinkGroup);
            RequiredPowerInput = obProjector.RequiredPowerInput;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyProjectorDefinition.cs


示例19: Init

		protected override void Init(MyObjectBuilder_DefinitionBase builder)
		{
			base.Init(builder);

			var antennaBuilder = (MyObjectBuilder_RadioAntennaDefinition)builder;
			Debug.Assert(antennaBuilder != null);

			ResourceSinkGroup = MyStringHash.GetOrCompute(antennaBuilder.ResourceSinkGroup);
		}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyRadioAntennaDefinition.cs


示例20: Init

		protected override void Init(MyObjectBuilder_DefinitionBase builder)
		{
			base.Init(builder);

			var soundBlockBuilder = (MyObjectBuilder_SoundBlockDefinition)builder;
			Debug.Assert(soundBlockBuilder != null);

			ResourceSinkGroup = MyStringHash.GetOrCompute(soundBlockBuilder.ResourceSinkGroup);
		}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:9,代码来源:MySoundBlockDefinition.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyStringId类代码示例发布时间:2022-05-24
下一篇:
C# MyStorageDataTypeFlags类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap