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


C# Ship.Where方法代码示例

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


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

示例1: UpdateShips

		private void UpdateShips(Ship[] ships)
		{
			this.originalShips = ships;
			this.Ships = ships.Where(x => x != null).ToArray();

			this.State.Calculate();
			this.State.Update();
		}
开发者ID:Zcynical,项目名称:KanColleViewer,代码行数:8,代码来源:Fleet.cs

示例2: Update

        /// <summary>
        /// 艦隊に編成されている艦娘の状態から、再出撃可能かどうかを判定します。
        /// </summary>
        /// <param name="ships">艦隊に編成されている艦娘。</param>
        internal void Update(Ship[] ships, Repairyard repairyard)
        {
            try
            {
                if (ships.Length == 0)
                {
                    this.ReadyTime = null;
                    this.UpdateCore();
                    if (this.CriticaledShips.Count > 0)
                    {
                        this.CriticalCleared(this, new EventArgs());
                        this.CriticaledShips.Clear();
                    }
                    return;
                }

                var reason = CanReSortieReason.NoProblem;

                if (ships.Any(s => s.IsBadlyDamaged))
                {
                    reason |= CanReSortieReason.Wounded;

                    // We only send out the event once, when the ships has reached critical from its previous state.
                    IEnumerable<Ship> CriticalShips = ships.Where(s => s.IsBadlyDamaged);
                    foreach (Ship s in CriticalShips)
                    {
                        if (this.CriticalCondition != null && !repairyard.CheckRepairing(s.Id) && (this.CriticaledShips.Count == 0 || (this.CriticaledShips.Count > 0 && !this.CriticaledShips[s.Id])))
                        {
                            this.CriticalCondition(this, new ShipCriticalConditionEventArgs(s));
                            this.CriticaledShips.Add(s.Id, true);
                        }
                    }

                    int RepairingCritShips = ships.Where(s => s.IsBadlyDamaged && repairyard.CheckRepairing(s.Id)).Count();

                    if (this.CriticalCleared != null && ships.Where(s => s.IsBadlyDamaged).Count() == RepairingCritShips)
                    {
                        this.CriticalCleared(this, new EventArgs());
                        this.CriticaledShips.Clear();
                    }
                }
                else if (this.CriticalCleared != null && this.CriticaledShips.Count > 0)
                {
                    this.CriticaledShips.Clear();
                    this.CriticalCleared(this, new EventArgs());
                }

                if (ships.Any(s => s.Fuel.Current < s.Fuel.Maximum || s.Bull.Current < s.Bull.Maximum))
                {
                    reason |= CanReSortieReason.LackForResources;
                }

                var min = ships.Min(x => x.Condition);
                if (min < 40)
                {
                    reason |= CanReSortieReason.BadCondition;

                    // コンディションの最小値が前回から変更された場合のみ、再出撃可能時刻を更新する
                    // (サーバーから来るコンディション値が 3 分に 1 回しか更新されないので、毎回カウントダウンし直すと最大 3 分くらいズレる)
                    if (min != this.minCondition)
                    {
                        this.ReadyTime = DateTimeOffset.Now.Add(TimeSpan.FromMinutes(40 - min));
                    }
                }
                else
                {
                    this.ReadyTime = null;
                }

                this.minCondition = min;
                this.Reason = reason;

                this.UpdateCore();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
开发者ID:Judaime,项目名称:KanColleViewer,代码行数:83,代码来源:FleetReSortie.cs


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