博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
win8 开发之旅(19) --足球游戏揭秘5
阅读量:4981 次
发布时间:2019-06-12

本文共 10346 字,大约阅读时间需要 34 分钟。

今天,我们揭秘一下Group,GameConfig,PlayersConfig这几个类。 这几个虽然是添头类,但缺少了他,游戏,嗨,真的运行不了。那,请掀起盖头来吧!

①Group——有足球知识的基础的人,都明白这是干嘛的,这是一个分组情况的类。这是中国球迷最避讳一个词,每次大赛小赛一出来,总是看到国足被分入了死亡之组,哎怎么总被分入死亡之组了,这个类在游戏中的作用如图所示:

相应源代码如下所示:

View Code
///     /// 当前的组别 A组 B组 C组    ///     public class Group    {        ///         /// A,B,C,D............        ///         public string GroupID { get; set; }    }

②GameConfig——比赛的信息纯粹用这个类来存储,用这个泛型信息来储存,因此有个Game的泛型数组,对于Game这个实体类,我们以后再说。  再有将所有的信息加载的方法。他的具体信息如图所示。 当你选择巴西的时候,就用linq语句查询出来。

相应源代码如下所示:

View Code
public  class GameConfig    {        ///         /// 队伍的键值对        ///         Dictionary
teamsDictionary = new Dictionary
(); ///
/// 加载比赛的列表 /// ///
public void LoadGameTable(List
gameTable) { //键值对的信息 teamsDictionary = GameHelper.Instance.TeamsDictionary; /// 南非vs 墨西哥 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/11/2010"), teamsDictionary["RSA"], teamsDictionary["MEX"], "Soccer City", "JohannesBurg")); ///乌拉圭vs 法国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/11/2010"), teamsDictionary["URU"], teamsDictionary["FRA"], "Cape Town Stadium", "Cape Town")); //南非vs乌拉圭 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/16/2010"), teamsDictionary["RSA"], teamsDictionary["URU"], "Loftus Versfeld Stadium", "Pretoria ")); //法国vs墨西哥 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/17/2010"), teamsDictionary["FRA"], teamsDictionary["MEX"], "Peter Mokaba Stadium", "Polokwane ")); //墨西哥vs乌拉圭 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/22/2010"), teamsDictionary["MEX"], teamsDictionary["URU"], "Royal Bafokeng Stadium", "RustenBurg")); //法国vs南非 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/22/2010"), teamsDictionary["FRA"], teamsDictionary["RSA"], "Free State Stadium", "Bloemfontein ")); //韩国vs希腊 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/12/2010"), teamsDictionary["KOR"], teamsDictionary["GRE"], "Nelson Mandela Bay Stadium", "Port Elizabeth")); //阿根廷vs尼日利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/12/2010"), teamsDictionary["ARG"], teamsDictionary["NGA"], "Ellis Park Stadium", "JohannesBurg")); //阿根廷vs韩国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/17/2010"), teamsDictionary["ARG"], teamsDictionary["KOR"], "Soccer City", "JohannesBurg")); //法国vs尼日利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/17/2010"), teamsDictionary["GRE"], teamsDictionary["NGA"], "Free State Stadium", "Bloemfontein ")); //尼日利亚vs韩国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/22/2010"), teamsDictionary["NGA"], teamsDictionary["KOR"], "Moses Mabhida Stadium", "Durban")); //希腊vs阿根廷 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/22/2010"), teamsDictionary["GRE"], teamsDictionary["ARG"], "Peter Mokaba Stadium", "Polokwane ")); //英格兰vs美国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/12/2010"), teamsDictionary["ENG"], teamsDictionary["USA"], "Royal Bafokeng Stadium", "RustenBurg")); //阿尔及利亚vs斯洛文尼亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/13/2010"), teamsDictionary["ALG"], teamsDictionary["SVN"], "Peter Mokaba Stadium", "Polokwane ")); //斯洛文尼亚vs美国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/18/2010"), teamsDictionary["SVN"], teamsDictionary["USA"], "Ellis Park Stadium", "JohannesBurg")); //英格兰vs阿尔及利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/18/2010"), teamsDictionary["ENG"], teamsDictionary["ALG"], "Cape Town Stadium", "Cape Town")); //斯洛文尼亚vs英格兰 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/23/2010"), teamsDictionary["SVN"], teamsDictionary["ENG"], "Nelson Mandela Bay Stadium", "Port Elizabeth")); //美国vs阿尔及利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/23/2010"), teamsDictionary["USA"], teamsDictionary["ALG"], "Loftus Versfeld Stadium", "Pretoria ")); //塞尔维亚vs加纳 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/13/2010"), teamsDictionary["SRB"], teamsDictionary["GHA"], "Loftus Versfeld Stadium", "Pretoria ")); //德国vs澳大利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/13/2010"), teamsDictionary["GER"], teamsDictionary["AUS"], "Moses Mabhida Stadium", "Durban")); //德国vs塞尔维亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/18/2010"), teamsDictionary["GER"], teamsDictionary["SRB"], "Nelson Mandela Bay Stadium", "Port Elizabeth")); //加纳vs澳大利亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/19/2010"), teamsDictionary["GHA"], teamsDictionary["AUS"], "Royal Bafokeng Stadium", "RustenBurg")); //加纳vs德国 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/23/2010"), teamsDictionary["GHA"], teamsDictionary["GER"], "Soccer City", "JohannesBurg")); //澳大利亚vs塞尔维亚 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/23/2010"), teamsDictionary["AUS"], teamsDictionary["SRB"], "Mbombela Stadium", "Nelspruit")); //荷兰vs丹麦 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/14/2010"), teamsDictionary["NED"], teamsDictionary["DEN"], "Soccer City", "JohannesBurg")); //日本vs喀麦隆 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/14/2010"), teamsDictionary["JPN"], teamsDictionary["CMR"], "Free State Stadium", "Bloemfontein ")); //荷兰vs日本 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/19/2010"), teamsDictionary["NED"], teamsDictionary["JPN"], "Moses Mabhida Stadium", "Durban")); //喀麦隆vs丹麦 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/19/2010"), teamsDictionary["CMR"], teamsDictionary["DEN"], "Loftus Versfeld Stadium", "Pretoria ")); //丹麦vs日本 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/24/2010"), teamsDictionary["DEN"], teamsDictionary["JPN"], "Royal Bafokeng Stadium", "RustenBurg")); //喀麦隆vs荷兰 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/24/2010"), teamsDictionary["CMR"], teamsDictionary["NED"], "Cape Town Stadium", "Cape Town")); //喀麦隆vs巴拉圭 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/14/2010"), teamsDictionary["CMR"], teamsDictionary["PAR"], "Cape Town Stadium", "Cape Town")); //新西兰vs斯洛伐克 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/15/2010"), teamsDictionary["NZL"], teamsDictionary["SVK"], "Royal Bafokeng Stadium", "RustenBurg")); //巴拉圭vs斯洛伐克 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/20/2010"), teamsDictionary["SVK"], teamsDictionary["PAR"], "Free State Stadium", "Bloemfontein ")); //意大利vs新西兰 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/20/2010"), teamsDictionary["ITA"], teamsDictionary["NZL"], "Mbombela Stadium", "Nelspruit")); //斯洛伐克vs意大利 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/24/2010"), teamsDictionary["SVK"], teamsDictionary["ITA"], "Ellis Park Stadium", "JohannesBurg")); //巴拉圭vs新西兰 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/24/2010"), teamsDictionary["PAR"], teamsDictionary["NZL"], "Peter Mokaba Stadium", "Polokwane ")); //巴西vs朝鲜 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/15/2010"), teamsDictionary["BRA"], teamsDictionary["PRK"], "Ellis Park Stadium", "JohannesBurg")); //葡萄牙vs科特迪瓦 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/15/2010"), teamsDictionary["POR"], teamsDictionary["CIV"], "Soccer City", "JohannesBurg")); //巴西vs科特迪瓦 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/20/2010"), teamsDictionary["BRA"], teamsDictionary["CIV"], "Soccer City", "JohannesBurg")); //巴西vs葡萄牙 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/25/2010"), teamsDictionary["BRA"], teamsDictionary["POR"], "Nelson Mandela Bay Stadium", "Port Elizabeth")); //葡萄牙vs朝鲜 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/21/2010"), teamsDictionary["POR"], teamsDictionary["PRK"], "Cape Town Stadium", "Cape Town")); //葡萄牙vs巴西 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/25/2010"), teamsDictionary["POR"], teamsDictionary["BRA"], "Moses Mabhida Stadium", "Durban")); //朝鲜vs巴西 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/25/2010"), teamsDictionary["PRK"], teamsDictionary["BRA"], "Mbombela Stadium", "Nelspruit")); //洪都拉斯vs智利 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/16/2010"), teamsDictionary["HON"], teamsDictionary["CHI"], "Mbombela Stadium", "Nelspruit")); //西班牙vs瑞士 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/16/2010"), teamsDictionary["ESP"], teamsDictionary["SUI"], "Moses Mabhida Stadium", "Durban")); //智利vs瑞士 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/21/2010"), teamsDictionary["CHI"], teamsDictionary["SUI"], "Nelson Mandela Bay Stadium", "Port Elizabeth")); //瑞士vs洪都拉斯 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/21/2010"), teamsDictionary["ESP"], teamsDictionary["HON"], "Ellis Park Stadium", "JohannesBurg")); //智利vs西班牙 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/25/2010"), teamsDictionary["CHI"], teamsDictionary["ESP"], "Loftus Versfeld Stadium", "Pretoria ")); //瑞士vs洪都拉斯 gameTable.Add(new Game("GRP", Convert.ToDateTime("06/25/2010"), teamsDictionary["SUI"], teamsDictionary["HON"], "Free State Stadium", "Bloemfontein ")); } }

③PlayConfig——比赛运动员的信息纯粹用这个类来存储,用这个泛型信息来储存,因此有个Player的泛型数组,对于Player这个实体类,我们以后再说。  再有将所有的信息加载的方法。他的具体信息如图所示。 当你选择巴西的时候,加载相应的运动员的信息的时候,就用linq语句查询出来。

相应源代码如下所示:

View Code

这是一个头简单的方法,一般做法,应该是建立一个文件在从中读取(自动建立),这就是为什么,大多数we玩家,你有可能卸载了相应的文件,只要文件夹不删除话,球员比赛信息都存在的缘故吧!。

好了,今天内容,很简单,望大家多讨论,后面还有这个游戏的核心类的介绍。游戏的源代码地址:

转载于:https://www.cnblogs.com/manuosex/archive/2012/11/21/2780939.html

你可能感兴趣的文章
ad如何从PCB中导出元件封装库
查看>>
常见安卓渠道分类
查看>>
华为如何打造智能终端的有趣灵魂?(上)
查看>>
Strapi 安装易错位置
查看>>
ASP.net:保护你的DLL和Code不被别人使用
查看>>
WPF下实现listview大图标效果
查看>>
CF219C hoosing Capital for Treeland
查看>>
Java中static成员变量、成员变量、static代码块、代码块、构造方法的执行顺序
查看>>
JVM内存占用情况深入分析
查看>>
C语言不透明结构体实现
查看>>
cognos安装教程
查看>>
POJ1611
查看>>
个人书单
查看>>
MySql下载地址
查看>>
springmvc学习笔记---idea创建springmvc项目
查看>>
SQL Server 大数据量插入和索引关系
查看>>
无旋Treap - BZOJ1014火星人 & 可持久化版文艺平衡树
查看>>
【微信小游戏实战】零基础制作《欢乐停车场》一、游戏设计
查看>>
【uoj#315/bzoj4943】[NOI2017]蚯蚓排队 Hash
查看>>
Docker容器部署tomcat出现中文乱码
查看>>