Beispiel #1
0
        internal void Update(RawRepairDock rpRawData)
        {
            State = rpRawData.State;

            if (State == RepairDockState.Repairing)
            {
                Ship = KanColleGame.Current.Port.Ships[rpRawData.ShipID];

                if ((Ship.State & ShipState.RepairingInAnchorage) == ShipState.RepairingInAnchorage)
                {
                    Ship.OwnerFleet.AnchorageRepair.RemoveShipIfExists(Ship);
                }

                Ship.OwnerRepairDock = this;
                Ship.State          |= ShipState.Repairing;
                Ship.OwnerFleet?.Update();

                TimeToComplete = DateTimeUtil.UnixEpoch.AddMilliseconds(rpRawData.TimeToComplete);

                if (PendingToUpdateMaterials)
                {
                    var rMaterials = KanColleGame.Current.Port.Materials;

                    rMaterials.Fuel    -= rpRawData.FuelConsumption;
                    rMaterials.Bullet  -= rpRawData.BulletConsumption;
                    rMaterials.Steel   -= rpRawData.SteelConsumption;
                    rMaterials.Bauxite -= rpRawData.BauxiteConsumption;

                    PendingToUpdateMaterials = false;
                }
            }
            else
            {
                if (Ship != null)
                {
                    Ship.OwnerRepairDock = null;
                    Ship.Repair(true);
                    Ship = null;
                }
                TimeToComplete = null;
            }
        }
Beispiel #2
0
        internal RepairDock(RawRepairDock rpRawData)
        {
            ID = rpRawData.ID;

            Update(rpRawData);
        }