/// <summary> /// 配置一只Camp /// </summary> /// <param name="camp"></param> private void constructCamp(ref GKBattleWrapper.Camp camp,int generalID,int soldierID,int generalLv,int soldierLv) { GKBattleWrapper.CampSlot slot1 = new GKBattleWrapper.CampSlot(); slot1.GeneralID = generalID; slot1.GeneralLevel = generalLv; slot1.Position = 3; slot1.SoldierID = soldierID; slot1.SoldierLevel = soldierLv; slot1.SoldierCount = 10; camp.AddSlot(slot1); }
private void doGroupSimulate(List<int> testGroup, int player, GKBattleWrapper.Camp camp1,int lv, out int win,out int lose,out float time) { win = 0; lose = 0; time = 0.0f; int testCount = (int)NUD_TestCount.Value; bool needDetailInfo = CB_DetailInfo.Checked; foreach (int opponent in testGroup) { if (player != opponent) { //Console.WriteLine(String.Format("Opponent:{0}", opponent)); GKBattleWrapper.Camp camp2 = new GKBattleWrapper.Camp(); constructCamp(ref camp2, opponent, DBConfigMgr.Instance.MapGeneral[opponent].InitialSoldier, lv, lv); for (int j = 1; j <= testCount; j++) { GKBattleWrapper.BattleResult result = engine.calc(camp1, camp2); //GKBattleWrapper.BattleResult result2 = engine.calc(camp2, camp1); int ret = result.whowin == 0 ? win++ : lose++; time += result.time; //ret = result2.whowin == 0 ? lose++ : win++; } if (needDetailInfo) { string resultText = String.Format("{0} 对 {1} 的战绩是 {2}胜 {3}负 ({4}%)", DBConfigMgr.Instance.MapGeneral[player].Name, DBConfigMgr.Instance.MapGeneral[opponent].Name, win, lose, Math.Round(win * 1.0 / (win + lose), 2) * 100); this.Invoke(new Action<string>(this.updateNotificationThread), resultText); } } } }