Example #1
0
        private void Charge(kcsapi_charge source)
        {
            Fleet fleet = null;	// 補給した艦が所属している艦隊。艦隊をまたいで補給はできないので、必ず 1 つに絞れる

            foreach (var ship in source.api_ship)
            {
                var target = this.Ships[ship.api_id];
                if (target == null) continue;

                target.Charge(ship.api_fuel, ship.api_bull, ship.api_onslot);

                if (fleet == null)
                {
                    fleet = this.GetFleet(target.Id);
                }
            }

            if (fleet != null)
            {
                fleet.State.Update();
                fleet.State.Calculate();
            }
        }
Example #2
0
        private void Charge(kcsapi_charge charge)
        {
            if (charge == null) return;

            foreach (var ship in charge.api_ship)
            {
                var target = this.Ships[ship.api_id];
                if (target == null) continue;

                target.Charge(ship.api_fuel, ship.api_bull, ship.api_onslot);
            }

            foreach (var f in Fleets.Values) f.UpdateShips();
        }