public void GetMapPointNameTest() { var id = MapPointService.GetMapPointName(4, 5, 13); Assert.IsTrue(id == "M"); }
private bool SaveBattleResult(JObject root) { try { if (m_lastStart == null) { return(false); } Debug.WriteLine("战斗结果"); EasyLogOut.Write(root.ToString(Formatting.Indented)); //地图信息 int mapAreaId = m_lastStart["api_maparea_id"].ToObject <int>(); int mapInfoId = m_lastStart["api_mapinfo_no"].ToObject <int>(); int pointId = m_lastStart["api_no"].Value <int>(); string mapId = m_lastStart["api_maparea_id"] + "-" + m_lastStart["api_mapinfo_no"]; //3-2 string shipName = root.SelectToken("api_get_ship.api_ship_name")?.ToObject <string>(); bool isBoss = m_lastStart["api_event_id"]?.Value <int>() == 5; //m_battleBossIdList.Exists(id => id == m_lastStart["api_no"].Value<int>()); //在每次Next的BossId中寻找 //地图名及敌方信息 string mapName = root.SelectToken("api_quest_name")?.ToObject <string>() + $"({mapId})"; string winRank = root.SelectToken("api_win_rank")?.ToObject <string>(); string deckName = root.SelectToken("api_enemy_info.api_deck_name")?.ToObject <string>(); string pointName = MapPointService.GetMapPointName(mapAreaId, mapInfoId, pointId); //综合建成point信息 var pointShow = (string.IsNullOrWhiteSpace(pointName) ? pointId.ToString() : pointName); string mapPointName = isBoss ? pointShow + "(Boss)" : pointShow; //string mapPointName = isBoss ? pointId + "(Boss)" : pointId.ToString(); //需要重新规划map的显示 //写出map的具体点位 使用poi的数据 dynamic json = Codeplex.Data.DynamicJson.Parse(root.ToString()); if ((int)json.api_get_flag[0] != 0) { var useItemId = (int)json.api_get_useitem.api_useitem_id; var itemmaster = ElectronicObserver.Data.KCDatabase.Instance.MasterUseItems[useItemId]; shipName = shipName == null || string.IsNullOrWhiteSpace(shipName) ? itemmaster?.Name : shipName + " + " + itemmaster?.Name; } ElectronicObserver.Data.KCDatabase db = ElectronicObserver.Data.KCDatabase.Instance; ElectronicObserver.Data.Battle.BattleManager bm = db.Battle; string fullBattleData = ElectronicObserver.Data.Battle.Detail.BattleDetailDescriptor.GetBattleDetail(bm); BattleListCell data = new BattleListCell() { Time = DateTime.Now, MapName = mapName, MapPointId = pointId, MapPointName = mapPointName, NewShipName = shipName, IsBoos = isBoss, WinRank = winRank, DeckName = deckName, FullBattleData = fullBattleData }; //输出sqlite格式 sqliteSaveList.AddData(data); ////输出Json格式 //m_battleList.Insert(0, data); //SaveData(); return(true); } catch (System.Exception ex) { EasyLogOut.Write(ex); return(false); } }