当前位置: 首页>>代码示例>>C#>>正文


C# Player.Equals方法代码示例

本文整理汇总了C#中System.Net.Player.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Equals方法的具体用法?C# Player.Equals怎么用?C# Player.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Player的用法示例。


在下文中一共展示了Player.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadByesFromFile

        public void ReadByesFromFile(int nextRound)
        {
            //read players file
            //if player already registered
            //check if his participation changed

            string tLn = "";
            string fin = workDirectory + "players.txt";
            using (StreamReader reader = new StreamReader (fin)) {
                for (int i = 0; i < 6; i++)
                    tLn = reader.ReadLine(); //trip through headers
                while ((tLn = reader.ReadLine ()) != null) {
                    String[] split = tLn.Split(new char[] {',','\t'});
                    try {
                        int pine = int.Parse (split [0]);
                        int rats = int.Parse (split [2]);
                        bool[] bull = new bool[nRounds]; //not set via input file
                        for(int k=0; k<bull.Length; k++)
                            bull[k]=true;
                        if(split.Length > 6)
                            for (int i = 6; i < split.Length; i++) {
                                if (split [i].Equals ("") == false) {
                                    try{
                                        int byeRound = int.Parse(split[i].Trim());
                                        if(byeRound > nRounds){
                                            Console.WriteLine("A bye cannot be allocated for a round which does not exist");
                                            Console.WriteLine(tLn);
                                        }
                                        else
                                            bull[byeRound-1]=false; //0 based
                                    }
                                    catch(Exception e){Console.WriteLine(e.Message);}
                                }
                            }
                        Player j = new Player (pine, split [1], rats, split [3], split [4],  bull, split[5]);
                        if (AllPlayers.Contains (j) == true) {
                            for(int ap = 0; ap<AllPlayers.Count; ap++)
                                if(j.Equals(AllPlayers[ap]))
                                    for(int i2=nextRound-1; i2<nRounds; i2++) //0 based
                                        AllPlayers[ap].SetParticipation(i2, bull[i2]);
                        }
                    } catch (Exception e) {
                        Console.WriteLine ("An exception was encountered in ReadByesFromFile" + e.Message);
                        Console.WriteLine (tLn);
                    }
                }
            }
        }
开发者ID:Lecale,项目名称:Ire,代码行数:48,代码来源:TournamentBoss.cs


注:本文中的System.Net.Player.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。