示例#1
0
 public Match(TMatch match)
 {
     Id         = match.MatchID;
     StarteTime = DateTime.Parse(match.StartTime);
     Players    = match.Users.Select(o => new User(o)).ToList();
     Court      = match.Court;
 }
示例#2
0
        static void Main(string[] args)
        {
            //IList<int> test = new List<int>() {10,8,15,46,8,16,6 };

            //Console.WriteLine(test.LastOrDefault(n => n > 10));
            //Console.ReadLine();
            //return;

            TSocket socket = new TSocket("127.0.0.1", 8807);
            TBinaryProtocol pro = new TBinaryProtocol(socket);
            TennisDataAnaliy.Client client = new TennisDataAnaliy.Client(pro);

            bool isopen = false;
            while (!isopen)
            {
                try
                {
                    socket.Open();
                    isopen = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("等待服务启动...");
                    Thread.Sleep(1000);
                }
            }

            Console.WriteLine("可以开始测试了");
            TMatch match = new TMatch();
            match.Court = new TennisCourt();
            match.Court.Width = 10970;
            match.Court.Height = 23770;
            match.MatchID = Guid.NewGuid().ToString();
            match.StartTime = DateTime.Now.ToString();
            match.Users = new List<userInfo>();
            match.Users.Add(new userInfo() {  UserID=Guid.NewGuid().ToString(), Direction=1,Hand=0});
            match.Users.Add(new userInfo() { UserID = Guid.NewGuid().ToString(), Direction = -1, Hand = 0 });
            if (client.StartMatch(match))
            {
                Console.WriteLine("开始新的比赛成功");
            }
            else
            {
                Console.WriteLine("开始比赛失败");
            }

            string path = @"E:\网球\03网球鹰眼顶级赛事版\02doc\00-项目文档\Log.txt";
            StreamReader reader = new StreamReader(path);
            while (!reader.EndOfStream)
            {
                string trace = reader.ReadLine();
                client.InsertPathToDB(trace);
            }
            Console.WriteLine("轨迹数据发送完毕");
            Console.ReadLine();
        }
示例#3
0
 internal NMatch(TMatch message)
 {
     Id       = message.MatchId.ToByteArray();
     Presence = new List <INUserPresence>();
     foreach (var item in message.Presences)
     {
         Presence.Add(new NUserPresence(item));
     }
     Self = new NUserPresence(message.Self);
 }
示例#4
0
        //Constructor  FromString( s,  Settings)
        public TGameRR(string s, TSettings Settings)
        {
            string[] a;
            string[] b;
            int      i;
            int      j;

            this.Settings = Settings;
            // Create Match to point on later
            CurrentMatch = new TMatch();
            CurrentA     = 0;
            CurrentB     = 0;
            a            = UHelpers.UHelpers.Explode(s, Units.Class.SEP_GAME);
            // Players + nPlayers
            b        = UHelpers.UHelpers.Explode(a[1], Units.Class.SEP_LIST);
            nPlayers = b.Length;
            Players  = new TPlayer[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                Players[i] = new TPlayer(b[i]);
            }
            // PointsGrid
            b          = UHelpers.UHelpers.Explode(a[2], Units.Class.SEP_LIST);
            PointsGrid = new int[nPlayers, nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    PointsGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]);
                }
            }
            // TimeGrid
            b        = UHelpers.UHelpers.Explode(a[3], Units.Class.SEP_LIST);
            TimeGrid = new int[nPlayers, nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    TimeGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]);
                }
            }
            // CountList
            b         = UHelpers.UHelpers.Explode(a[4], Units.Class.SEP_LIST);
            CountList = new int[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                CountList[i] = Convert.ToInt32(b[i]);
            }
            // TimeStarted
            TimeStarted = Convert.ToDateTime(a[5]);
        }
示例#5
0
        /// <summary>
        /// 开始比赛
        /// </summary>
        /// <param name="match"></param>
        public bool StartMatch(TMatch match)
        {
            rmode = Runmode.Match;
            if (Cmatch == null || Cmatch.Id != match.MatchID)
            {
                Cmatch = new RigourTech.Service.Match(match);
                LogText.Info("StartMatch", "*******************************************开始新比赛************************************");
            }
            else
            {
                LogText.Info("StartMatch", "*******************************************回复比赛************************************");
            }


            return(true);
        }
示例#6
0
        //Constructor  Create( Candidates,  Settings)
        public TGameRR(TPlayer[] Candidates, TSettings Settings)
        {
            int i;
            int j;

            this.Settings = Settings;
            nPlayers      = Candidates.Length;
            TimeStarted   = DateTime.MinValue; //done in GetNextMatch
            // Copy Players to own List
            Players = new TPlayer[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                Players[i]    = Candidates[i];
                Players[i].ID = i;
            }
            // Init Matrix and Counter Table
            PointsGrid = new int[nPlayers, nPlayers];
            TimeGrid   = new int[nPlayers, nPlayers];
            CountList  = new int[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    if (i == j)
                    {
                        PointsGrid[i, j] = -1;
                        TimeGrid[i, j]   = -1;
                    }
                    else
                    {
                        PointsGrid[i, j] = 0;
                        TimeGrid[i, j]   = 0;
                    }
                }
                CountList[i] = 99;
            }
            // Create Match to point on later
            CurrentMatch = new TMatch();
            CurrentA     = 0;
            CurrentB     = 0;
        }
示例#7
0
 public static SwitchSection Create(TMatch value, Action action, TResult result)
 {
     return(new SwitchSection(value, action, result));
 }
示例#8
0
 public SwitchSection(TMatch value, Action action, TResult result)
 {
     Value  = value;
     Action = action;
     Result = result;
 }
示例#9
0
 internal NMatch(TMatch message) : this(message.Match)
 {
 }