Exemplo n.º 1
0
        public void InitNPCFormation(int levelConfigID,bool isElite)
        {
            _formation = new Formation();
            _formation.InitNPCFormation(levelConfigID, isElite);

            foreach (KeyValuePair<GeneralInfo, PositionPair> pair in _formation.FormationMap)
            {
                Label lb_General = new Label();
                lb_General.Text = pair.Key.GeneralConfig.Name;

                int r = pair.Value.RowIndex;
                int c = pair.Value.ColumnIndex;

                lb_General.TextAlign = ContentAlignment.MiddleCenter;
                tableLayoutPanel1.Controls.Add(lb_General, c, r);
                //Console.WriteLine("添加了Formation table{0}{1}, 武将{2}", r, c, lb_General.Text);
            }

            LB_TeamName.Text = _formation.TeamName;
            LB_BattlePower.Text = _formation.TeamBattlePowerPoint.ToString();
        }
Exemplo n.º 2
0
        public void InitLevelEnemy(int levelID,bool isElite)
        {
            IsEliteLevel = isElite;

            string name = DBConfigMgr.Instance.MapLevel[levelID].Name;
            if (isElite)
                name += "精英";
            this.Text = name;

            EnemyFormation = new Formation();
            EnemyFormation.InitNPCFormation(levelID,isElite);

            LevelID = levelID;
            EnemyList = EnemyFormation.NPCFormation;
            EnemyList.OrderBy(x => x.Key);

            RefreashEnemyData();
            ReComputeBattlePoint();
            GetReferBattlePoint();

            CanReComputeBattlePoint = true;
        }
Exemplo n.º 3
0
        private void AddLevelRow(int index)
        {
            Level levelConfig = DBConfigMgr.Instance.MapLevel[index];
            LevelRecord record = PlayerDataMgr.Instance.GetPlayerLevelRecords()[index];

            // 先计算好战斗力BattlePoint
            int normalRefPower = Formula.GetRefBattlePoint(levelConfig.RefLevel);
            int eliteRefPower = Formula.GetRefBattlePoint(levelConfig.EliteRefLevel);

            // 参考人数和实际人数
            int normalRefSquads = Formula.GetOnBattleSquads(levelConfig.RefLevel);
            int eliteRefSquads = Formula.GetOnBattleSquads(levelConfig.EliteRefLevel);

            Formation normalFormation = new Formation();
            normalFormation.InitNPCFormation(levelConfig.ID, false);
            int normalRealPower = normalFormation.TeamBattlePowerPoint;

            Formation eliteFormation = new Formation();
            eliteFormation.InitNPCFormation(levelConfig.ID, true);
            int eliteRealPower = eliteFormation.TeamBattlePowerPoint;

            int normalRealSquads = normalFormation.NPCFormation.Count();
            int eliteRealSquads = eliteFormation.NPCFormation.Count();
            DataGridViewRow row = new DataGridViewRow();

            DataGridViewTextBoxCell textBoxID = new DataGridViewTextBoxCell();
            textBoxID.Value = levelConfig.ID;
            row.Cells.Add(textBoxID);

            DataGridViewTextBoxCell textBoxName = new DataGridViewTextBoxCell();
            textBoxName.Value = levelConfig.Name;
            row.Cells.Add(textBoxName);

            DataGridViewTextBoxCell textBoxNormalBattleCompare = new DataGridViewTextBoxCell();
            textBoxNormalBattleCompare.Value = String.Format("{0}/{1}",normalRealPower,normalRefPower);
            row.Cells.Add(textBoxNormalBattleCompare);

            DataGridViewTextBoxCell textBoxNormalSquadsCompare = new DataGridViewTextBoxCell();
            textBoxNormalSquadsCompare.Value = String.Format("{0}/{1}", normalRealSquads, normalRefSquads);
            if (normalRefSquads != normalRealSquads)
                textBoxNormalSquadsCompare.Style.BackColor = Color.Red;
            row.Cells.Add(textBoxNormalSquadsCompare);

            DataGridViewTextBoxCell textBoxEliteBattleCompare = new DataGridViewTextBoxCell();
            textBoxEliteBattleCompare.Value = String.Format("{0}/{1}", eliteRealPower, eliteRefPower);
            row.Cells.Add(textBoxEliteBattleCompare);

            DataGridViewTextBoxCell textBoxEliteSquadsCompare = new DataGridViewTextBoxCell();
            textBoxEliteSquadsCompare.Value = String.Format("{0}/{1}", eliteRealSquads, eliteRefSquads);
            if( eliteRealSquads != eliteRefSquads)
                textBoxEliteSquadsCompare.Style.BackColor = Color.Red;
            row.Cells.Add(textBoxEliteSquadsCompare);

            DataGridViewTextBoxCell textBoxHasPlot = new DataGridViewTextBoxCell();
            string hasPlotBefore = "无";
            string hasPlotIn ="无";
            string hasPlotAfter ="无";
            if (DBConfigMgr.Instance.MapPlot.ContainsKey(index))
            {
                Plot p = DBConfigMgr.Instance.MapPlot[index];
                if (p.BeforeBattle.Length > 0)
                    hasPlotBefore = "有";

                if (p.InBattle.Length > 0)
                    hasPlotIn = "有";

                if (p.AfterBattle.Length > 0)
                    hasPlotAfter = "有";

                textBoxHasPlot.Style.ForeColor = Color.Green;
            }

            textBoxHasPlot.Value = String.Format("{0}/{1}/{2}", hasPlotBefore, hasPlotIn, hasPlotAfter);
            row.Cells.Add(textBoxHasPlot);

            DataGridViewTextBoxCell textBoxNormalRewards = new DataGridViewTextBoxCell();
            string hasRewards = "无";
            if (levelConfig.ClientShowRewards.Length > 0)
            {
                hasRewards = "有";
                textBoxNormalRewards.Style.ForeColor = Color.Green;
            }
            textBoxNormalRewards.Value = hasRewards;
            row.Cells.Add(textBoxNormalRewards);

            DataGridViewTextBoxCell textBoxEliteRewards = new DataGridViewTextBoxCell();
            hasRewards = "无";
            if (levelConfig.EliteClientShowRewards.Length > 0)
            {
                hasRewards = "有";
                textBoxEliteRewards.Style.ForeColor = Color.Green;
            }
            textBoxEliteRewards.Value = hasRewards;
            row.Cells.Add(textBoxEliteRewards);

            dataGridView2.Rows.Add(row);
        }