示例#1
0
        private void btn_AccountReflush_Click(object sender, EventArgs e)
        {
            CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat", true);
            List <Account> infos = CSGHelper.SelectAcountInfo();

            lstv_Account.Items.Clear();
            foreach (var info in infos)
            {
                //构建一个ListView的数据,存入数据库数据,以便添加到listView1的行数据中
                ListViewItem lt = new ListViewItem();
                //将数据库数据转变成ListView类型的一行数据
                lt.Text = info.account;
                lt.SubItems.Add(info.password);
                lt.SubItems.Add(CPlayerCtrl.GetNameByAcc(lt.Text));
                lt.SubItems.Add(info.enable);
                lt.SubItems.Add(info.privilege);
                lt.SubItems.Add(info.point);
                lt.SubItems.Add(info.ip);
                lt.SubItems.Add(info.LastLoginTime);
                lt.SubItems.Add(info.LastLogoutTime);
                //将lt数据添加到listView1控件中
                lstv_Account.Items.Add(lt);
            }
            lstv_Account.EndUpdate();
            lbl_AccountCount.Text = "帐号总数:" + infos.Count;
        }
示例#2
0
        //一键按职业给予符合等级的全技能
        private void button11_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("请确保游戏不处于运行状态!", "", MessageBoxButtons.OKCancel);

            if (dr != DialogResult.OK)//如果点击“确定”按钮
            {
                return;
            }
            //获取所有猛将、豪杰、军师、方士
            List <AccAttr> player_jobWarload = CPlayerCtrl.LoadAllWarloadIndexDesc();
            List <AccAttr> player_jobLeader  = CPlayerCtrl.LoadAllLeaderIndexDesc();
            List <AccAttr> player_jobAdvisor = CPlayerCtrl.LoadAllAdvisorIndexDesc();
            List <AccAttr> player_jobWizard  = CPlayerCtrl.LoadAllWizardIndexDesc();

            //构建按职业的List<int> skills
            List <Magic_JobLimit_Str> skill_jobWarload = CSkillCtrl.LoadAllWarloadSkillsDesc();
            List <Magic_JobLimit_Str> skill_jobLeader  = CSkillCtrl.LoadAllLeaderSkillsDesc();
            List <Magic_JobLimit_Str> skill_jobAdvisor = CSkillCtrl.LoadAllAdvisorSkillsDesc();
            List <Magic_JobLimit_Str> skill_jobWizard  = CSkillCtrl.LoadAllWizardSkillsDesc();

            CSkillCtrl.AddSubSkills(player_jobWarload, skill_jobWarload, true);
            CSkillCtrl.AddSubSkills(player_jobLeader, skill_jobLeader, true);
            CSkillCtrl.AddSubSkills(player_jobAdvisor, skill_jobAdvisor, true);
            CSkillCtrl.AddSubSkills(player_jobWizard, skill_jobWizard, true);

            CSkillCtrl.SaveSkillsData(txt_svrForder.Text + "\\DataBase\\saves\\skill.dat");
            MessageBox.Show("DONE!");
        }
示例#3
0
        private void LoadSkillMrgInfos()
        {
            CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat");
            FillPlayerLstView();

            CSkillCtrl.LoadSkillsData(txt_svrForder.Text + "\\DataBase\\saves\\skill.dat");
            FillSkillLstView();
        }
示例#4
0
        private void LoadXBMrgInfos()
        {
            //加载帐号列表
            CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat");
            FillXbAccLstView();
            xbPlayersInfoSltIndex = 0;
            //加载物品列表
            FileXbItemsView();
            xbitemDefSltIndex = 0;
            //加载虚宝模版
            LoadXbMould();

            //加载日志
            string       file = SGExHandle.GetXbLogFileName();
            FileStream   fs   = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Read);
            StreamReader sr   = new StreamReader(fs, Encoding.Default);

            lstv_xblog.Items.Clear();
            string log = "";

            while (!string.IsNullOrEmpty(log = sr.ReadLine()) && log != "")
            {
                var items = log.Split('\t');
                if (items.Length >= 16)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = items[0];
                    lvi.SubItems.Add(items[1]);
                    lvi.SubItems.Add(items[2]);
                    lvi.SubItems.Add(items[3]);
                    lvi.SubItems.Add(items[4]);
                    lvi.SubItems.Add(items[5]);
                    lvi.SubItems.Add(items[6]);
                    lvi.SubItems.Add(items[7]);
                    lvi.SubItems.Add(items[8]);
                    lvi.SubItems.Add(items[9]);
                    lvi.SubItems.Add(items[10]);
                    lvi.SubItems.Add(items[11]);
                    lvi.SubItems.Add(items[12]);
                    lvi.SubItems.Add(items[13]);
                    lvi.SubItems.Add(items[14]);
                    lvi.SubItems.Add(items[15]);
                    lvi.SubItems.Add(items[16]);
                    lstv_xblog.Items.Add(lvi);
                }
            }
            lstv_xblog.EndUpdate();  //结束数据处理,UI界面一次性绘制

            sr.Close();
            fs.Close();
        }
示例#5
0
        private void btn_AccountReflush_Click(object sender, EventArgs e)
        {
            int count = 0;

            CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat", true);
            try
            {
                string        conn_str = "Data Source = " + sql_srvAddr + "," + sql_srvPort + "; Initial Catalog = " + sqlAccountName + "; User Id = " + sql_srvUser + "; Password = "******";";
                SqlConnection con      = new SqlConnection(conn_str);
                con.Open();
                //执行con对象的函数,返回一个SqlCommand类型的对象
                SqlCommand cmd = con.CreateCommand();
                //把输入的数据拼接成sql语句,并交给cmd对象
                cmd.CommandText = "SELECT * FROM [Account_hcsg].[dbo].[game_acc]";

                //用cmd的函数执行语句,返回SqlDataReader类型的结果dr,dr就是返回的结果集(也就是数据库中查询到的表数据)
                SqlDataReader dr = cmd.ExecuteReader();
                //用dr的read函数,每执行一次,返回一个包含下一行数据的集合dr
                lstv_Account.Items.Clear();
                while (dr.Read())
                {
                    //构建一个ListView的数据,存入数据库数据,以便添加到listView1的行数据中
                    ListViewItem lt = new ListViewItem();
                    //将数据库数据转变成ListView类型的一行数据
                    lt.Text = dr["account"].ToString();
                    lt.SubItems.Add(dr["password"].ToString());
                    lt.SubItems.Add(CPlayerCtrl.GetNameByAcc(lt.Text));
                    lt.SubItems.Add(dr["enable"].ToString());
                    lt.SubItems.Add(dr["privilege"].ToString());
                    lt.SubItems.Add(dr["point"].ToString());
                    lt.SubItems.Add(dr["ip"].ToString());
                    lt.SubItems.Add(dr["LastLoginTime"].ToString());
                    lt.SubItems.Add(dr["LastLogoutTime"].ToString());
                    //将lt数据添加到listView1控件中
                    lstv_Account.Items.Add(lt);
                    //账户 密码 角色 状态 权限 代币 ip 登入时间 登出时间
                    count++;
                }
                lstv_Account.EndUpdate();
                con.Close();
            }
            catch (Exception ex)
            {
            }
            lbl_AccountCount.Text = "帐号总数:" + count.ToString();
        }
示例#6
0
        void FillWarHerosLstv()
        {
            List <HeroScore> heroScore = warHandle.GetHeroScore(true);

            lstv_gzHeros.Items.Clear();
            for (int i = 0; i < heroScore.Count; i++)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = (i + 1).ToString();
                lvi.SubItems.Add(CPlayerCtrl.GetAccByName(heroScore[i].name));
                lvi.SubItems.Add(heroScore[i].name);
                lvi.SubItems.Add(heroScore[i].score.ToString());
                lvi.SubItems.Add(heroScore[i].num.ToString());

                lstv_gzHeros.Items.Add(lvi);
            }
            lstv_gzHeros.EndUpdate();
        }
示例#7
0
        private void FillPlayerLstView()
        {
            var players = CPlayerCtrl.GetAttrList();

            this.lstv_playersInfo.Items.Clear();
            foreach (var player in players)
            {
                string _acc  = CFormat.GameStrToSimpleCN(player.Account);
                string _name = CFormat.GameStrToSimpleCN(player.Name);

                ListViewItem lvi = new ListViewItem();
                //lvi.ImageIndex = i;     //通过与imageList绑定,显示imageList中第i项图标
                lvi.Text = _acc.Replace("\t", "");
                //lvi.SubItems.Add(_id);
                lvi.SubItems.Add(_name);
                this.lstv_playersInfo.Items.Add(lvi);
            }
            this.lstv_playersInfo.EndUpdate();  //结束数据处理,UI界面一次性绘制
        }
示例#8
0
 private void btn_heroRd_Click(object sender, EventArgs e)
 {
     CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat", true);
     warHandle.BaseForlder = txt_svrForder.Text;
     FillWarHerosLstv();
 }
示例#9
0
        private void button14_Click(object sender, EventArgs e)
        {
            if (!m_Active)
            {
                MessageBox.Show("软件尚未激活! 请联系软件发布人给予激活!");
                return;
            }
            try
            {
                DialogResult dr = MessageBox.Show("请确保游戏不处于运行状态!", "", MessageBoxButtons.OKCancel);
                if (dr != DialogResult.OK)//如果点击“确定”按钮
                {
                    return;
                }

                if (cbx_skillsAll.Checked)
                {
                    if (rdb_playersAll.Checked)
                    {
                        //增加 || 删除
                        if (rdb_skillAdd.Checked)
                        {
                            CSkillCtrl.AddAllPlayersAllSkills();
                        }
                        else if (rdb_skillDel.Checked)
                        {
                            CSkillCtrl.ClearAllPlayersAllSkills();
                        }
                    }
                    else if (rdb_playersSub.Checked)
                    {
                        //players
                        List <int> players = new List <int>();
                        if (txt_handleSkills.Text != "")
                        {
                            var tmp = txt_handlePlayers.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (var item in tmp)
                            {
                                string  name = item.Split(';')[1];
                                AccAttr attr = CPlayerCtrl.GetAttrByName(name);

                                players.Add((int)attr.nIndex);
                            }
                        }

                        //增加 || 删除
                        if (rdb_skillAdd.Checked)
                        {
                            CSkillCtrl.AddPlayerAllSkills(players);
                        }
                        else if (rdb_skillDel.Checked)
                        {
                            CSkillCtrl.ClearPlayerAllSkills(players);
                        }
                    }
                }
                else
                {
                    //skills
                    List <int> skills = new List <int>();
                    if (txt_handleSkills.Text != "")
                    {
                        var tmp = txt_handleSkills.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var item in tmp)
                        {
                            int skillid = int.Parse(item.Split(';')[0]);
                            skills.Add(skillid);
                        }
                    }

                    if (rdb_playersAll.Checked)
                    {
                        //增加 || 删除
                        if (rdb_skillAdd.Checked)
                        {
                            CSkillCtrl.AddAllPlayersSkills(skills);
                        }
                        else if (rdb_skillDel.Checked)
                        {
                            CSkillCtrl.ClearAllPlayersSkills(skills);
                        }
                    }
                    else if (rdb_playersSub.Checked)
                    {
                        //players
                        List <int> players = new List <int>();
                        if (txt_handleSkills.Text != "")
                        {
                            var tmp = txt_handlePlayers.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (var item in tmp)
                            {
                                string  name = item.Split(';')[1];
                                AccAttr attr = CPlayerCtrl.GetAttrByName(name);

                                players.Add((int)attr.nIndex);
                            }
                        }

                        //增加 || 删除
                        if (rdb_skillAdd.Checked)
                        {
                            CSkillCtrl.AddSubSkills(players, skills);
                        }
                        else if (rdb_skillDel.Checked)
                        {
                            CSkillCtrl.ClearSubSkills(players, skills);
                        }
                    }
                }
                CSkillCtrl.SaveSkillsData(txt_svrForder.Text + "\\DataBase\\saves\\skill.dat");
                MessageBox.Show("DONE!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#10
0
 private void button16_Click(object sender, EventArgs e)
 {
     CPlayerCtrl.PlayersAttrListClear();
     CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat");
     FillPlayerLstView();
 }
示例#11
0
 private void btn_xbAccReLoad_Click(object sender, EventArgs e)
 {
     CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat", true);
     FillXbAccLstView();
     xbPlayersInfoSltIndex = 0;
 }