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


C# ProtoCrewMember.ArchiveFlightLog方法代码示例

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


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

示例1: OnKerbalTypeChange

        private void OnKerbalTypeChange(ProtoCrewMember pcm, ProtoCrewMember.KerbalType oldType, ProtoCrewMember.KerbalType newType)
        {
            if (oldType == ProtoCrewMember.KerbalType.Applicant && newType == ProtoCrewMember.KerbalType.Crew)
            {
                // Check for correct trait
                if (!string.IsNullOrEmpty(trait) && pcm.experienceTrait.Config.Name != trait)
                {
                    return;
                }

                // Check for correct gender
                if (gender != null && pcm.gender != gender.Value)
                {
                    return;
                }

                CelestialBody homeworld = FlightGlobals.Bodies.Where(cb => cb.isHomeWorld).FirstOrDefault();

                Debug.Log("Strategia: Awarding experience to " + pcm.name);

                // Find existing entries
                int currentValue = 2;
                foreach (FlightLog.Entry entry in pcm.careerLog.Entries.Concat(pcm.flightLog.Entries).Where(e => e.type.Contains(SPECIAL_XP)))
                {
                    // Get the entry with the largest value
                    int entryValue = Convert.ToInt32(entry.type.Substring(SPECIAL_XP.Length, entry.type.Length - SPECIAL_XP.Length));
                    currentValue = Math.Max(currentValue, entryValue);
                }

                // Get the experience level
                int value = Parent.Level();
                string type = SPECIAL_XP + value.ToString();

                // Do the awarding
                pcm.flightLog.AddEntry(type, homeworld.name);
                pcm.ArchiveFlightLog();

                // Force the astronaut complex GUI to refresh so we actually see the experience
                AstronautComplex ac = UnityEngine.Object.FindObjectOfType<AstronautComplex>();
                if (ac != null)
                {
                    Debug.Log("NewKerbalExperience: CreateAvailableList");
                    MethodInfo updateListMethod = typeof(AstronautComplex).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance).
                        Where(mi => mi.Name == "CreateAvailableList").First();
                    updateListMethod.Invoke(ac, new object[] { });

                    Debug.Log("NewKerbalExperience: AddItem_Available");
                    MethodInfo addToListMethod = typeof(AstronautComplex).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance).
                        Where(mi => mi.Name == "AddItem_Available").First();
                    addToListMethod.Invoke(ac, new object[] { pcm });
                }
            }
        }
开发者ID:jrossignol,项目名称:Strategia,代码行数:53,代码来源:NewKerbalExperience.cs

示例2: TransferCareerLog

        public void TransferCareerLog(ProtoCrewMember to, ProtoCrewMember from)
        {
            // record current flightlog & reset, if applicable
            FlightLog current = null;
            if (to.flightLog.Entries.Count() > 0) {
                current = new FlightLog();
                foreach (FlightLog.Entry entry in to.flightLog.Entries)
                    current.Entries.Add(entry);
                to.flightLog = new FlightLog();
            }

            //transfer careerLog
            foreach (FlightLog flight in from.careerLog.GetFlights()) {
                foreach (FlightLog.Entry entry in flight.Entries)
                    to.flightLog.Entries.Add(entry);
                to.ArchiveFlightLog();
            }

            //rewrite flightLog, if applicable
            if (current != null)
                foreach (FlightLog.Entry entry in current.Entries)
                    to.flightLog.Entries.Add(entry);
        }
开发者ID:SpareToast,项目名称:CustomerSatisfactionProgram,代码行数:23,代码来源:CustomerManager.cs


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