public Api_Result <Mem_esccort_deck> Change(int deck_rid, DeckShips deckShip) { Api_Result <Mem_esccort_deck> api_Result = new Api_Result <Mem_esccort_deck>(); Mem_esccort_deck deck = null; List <int> lastTempResult = null; deckShip.Clone(out lastTempResult); if (!Comm_UserDatas.Instance.User_EscortDeck.TryGetValue(deck_rid, out deck)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } List <int> out_ships = null; deck.Ship.Clone(out out_ships); Dictionary <int, Mem_ship> cloneShips = deck.Ship.getMemShip().ToDictionary((Mem_ship rid) => rid.Rid, (Mem_ship obj) => obj); deck.Ship.Clear(); int count = lastTempResult.Count; for (int i = 0; i < count; i++) { deck.Ship[i] = lastTempResult[i]; Comm_UserDatas.Instance.User_ship[deck.Ship[i]].BlingWaitToStop(); } out_ships.ForEach(delegate(int ship_rid) { if (!lastTempResult.Contains(ship_rid) && Comm_UserDatas.Instance.Temp_escortship.Contains(ship_rid)) { cloneShips[ship_rid].BlingWait(deck.Maparea_id, Mem_ship.BlingKind.WaitEscort); } }); if (deck.Ship.Count() > 0 && deck.Disposition_status == DispositionStatus.NONE) { deck.GoArea(deck.Maparea_id); } else if (deck.Ship.Count() == 0) { deck.EscortStop(); } else if (deck.Disposition_status == DispositionStatus.ARRIVAL && deck.GetBlingTurn() == 0 && deck.Ship.getMemShip().All((Mem_ship x) => x.GetBlingTurn() > 0)) { deck.EscortStop(); deck.GoArea(deck.Maparea_id); } api_Result.data = deck; return(api_Result); }
private void goBackEscortDeck(Mem_esccort_deck escort) { List <Mem_ship> memShip = escort.Ship.getMemShip(); memShip.ForEach(delegate(Mem_ship x) { if (!x.IsBlingShip()) { x.SubHp(this.getShipDamage(x.Nowhp)); } x.PortWithdraw(escort.Rid); }); escort.EscortStop(); escort.Ship.Clear(); }