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


C# Vessel.GetHashes方法代码示例

本文整理汇总了C#中Vessel.GetHashes方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.GetHashes方法的具体用法?C# Vessel.GetHashes怎么用?C# Vessel.GetHashes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vessel的用法示例。


在下文中一共展示了Vessel.GetHashes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveSubVesselInfo

 /// <summary>
 /// Saves all the sub-vessel information - breaking up the vessels into the smallest
 /// pieces possible.
 /// </summary>
 /// <param name="vessel">The vessel to break up</param>
 /// <param name="strength">The strength of the parameter</param>
 /// <param name="completionTime">The completion time</param>
 private void SaveSubVesselInfo(Vessel vessel, ParamStrength strength, double completionTime)
 {
     foreach (uint hash in vessel.GetHashes())
     {
         if (!dockedVesselInfo.ContainsKey(hash) ||
             dockedVesselInfo[hash].Key < strength)
         {
             dockedVesselInfo[hash] = new KeyValuePair<ParamStrength, double>(strength, completionTime);
         }
     }
 }
开发者ID:ToneStack87,项目名称:ContractConfigurator,代码行数:18,代码来源:VesselParameter.cs

示例2: VesselInfo

 public VesselInfo(Vessel v)
 {
     this.id = v.id;
     this.hash = v.GetHashes().FirstOrDefault();
 }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:5,代码来源:ContractVesselTracker.cs

示例3: OnVesselCreate

        protected virtual void OnVesselCreate(Vessel vessel)
        {
            if (IsIgnoredVesselType(vessel.vesselType) || HighLogic.LoadedScene != GameScenes.FLIGHT)
            {
                return;
            }

            LoggingUtil.LogVerbose(this, "OnVesselCreate(" + vessel.id + ")");

            // Go through the hashes to try to set the parameters for this vessel
            KeyValuePair<ParamStrength, double>? dockedInfo = null;
            foreach (uint hash in vessel.GetHashes())
            {
                if (dockedVesselInfo.ContainsKey(hash))
                {
                    if (dockedInfo == null)
                    {
                        dockedInfo = dockedVesselInfo[hash];
                    }
                    else
                    {
                        dockedInfo = dockedVesselInfo[hash].Key > dockedInfo.Value.Key ? dockedVesselInfo[hash] : dockedInfo;
                    }
                }
            }

            // Found one
            if (dockedInfo != null)
            {
                VesselInfo v = new VesselInfo(vessel.id, vessel);
                v.strength = dockedInfo.Value.Key;
                v.completionTime = dockedInfo.Value.Value;
                v.state = ParameterState.Complete;
                vesselInfo[vessel.id] = v;
            }

            CheckVessel(vessel);
        }
开发者ID:ToneStack87,项目名称:ContractConfigurator,代码行数:38,代码来源:VesselParameter.cs

示例4: OnVesselWasModified

        protected virtual void OnVesselWasModified(Vessel vessel)
        {
            LoggingUtil.LogVerbose(this, "OnVesselWasModified: " + vessel.id);
            vessel.GetHashes().Count();

            // Check for a vessel creation after a part joint break
            if (HighLogic.LoadedScene != GameScenes.FLIGHT || lastBreak == null || vessel == lastBreak)
            {
                return;
            }

            IEnumerable<uint> otherVesselHashes = lastBreak.GetHashes();
            IEnumerable<uint> vesselHashes = vessel.GetHashes();

            // OnVesselWasModified gets called twice, on the first call the vessels are still
            // connected.  Check for that case.
            if (otherVesselHashes.Contains(vesselHashes.FirstOrDefault()))
            {
                // The second call will be for the original vessel.  Swap over to check that one.
                lastBreak = vessel;
                return;
            }

            // Get the keys we will be looking at
            List<string> vesselKeys = GetAssociatedKeys(vessel).ToList();
            List<string> otherVesselKeys = GetAssociatedKeys(lastBreak).ToList();

            // Check the lists and see if we need to do a switch
            foreach (string key in vesselKeys)
            {
                // Check if we need to switch over to the newly created vessel
                VesselInfo vi = vessels[key];
                if (otherVesselHashes.Contains(vi.hash))
                {
                    LoggingUtil.LogVerbose(this, "Moving association for '" + key + "' from " + vi.id + " to " + lastBreak.id);
                    vi.id = lastBreak.id;
                    OnVesselAssociation.Fire(new GameEvents.HostTargetAction<Vessel, string>(lastBreak, key));
                }
            }
            foreach (string key in otherVesselKeys)
            {
                // Check if we need to switch over to the newly created vessel
                VesselInfo vi = vessels[key];
                if (vesselHashes.Contains(vi.hash))
                {
                    LoggingUtil.LogVerbose(this, "Moving association for '" + key + "' from " + vi.id + " to " + vessel.id);
                    vi.id = vessel.id;
                    OnVesselAssociation.Fire(new GameEvents.HostTargetAction<Vessel, string>(vessel, key));
                }
            }

            lastBreak = null;
        }
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:53,代码来源:ContractVesselTracker.cs


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