public void doUpdate()
 {
     while (list_msg.Count > 0)
     {
         TMessage m     = list_msg[0];
         TimeSpan tspan = DateTime.Now - list_msg[0].time;
         if (tspan.TotalMilliseconds > timeWindow)
         {
             processMsg(m, true);
             Console.WriteLine("Remove: " + m.txt);
             list_msg.RemoveAt(0);
         }
         else
         {
             break;
         }
     }
     updateVariables();
 }
        //------------

        public void addMsg(string m0)
        {
            string m = m0.Replace("p", "P");

            if (m.Contains("P1+"))
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 1
                };
                list_msg.Add(tm);
                processMsg(tm, false);
            }
            if (m.Contains("P2+"))
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 2
                };
                list_msg.Add(tm);
                processMsg(tm, false);
            }
            if (m.Contains("P1-"))
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 3
                };
                list_msg.Add(tm);
                processMsg(tm, false);
            }
            if (m.Contains("P2-"))
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 4
                };
                list_msg.Add(tm);
                processMsg(tm, false);
            }
        }
Beispiel #3
0
        public void addMsgVS(string user0, string m0)
        {
            string m = m0.Replace("p", "P");

            m = m.Replace(" ", "");
            string user = user0.Replace("@", "");

            Console.WriteLine(user + "  testtttttt  " + m0);
            if (m == "P1+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 1
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1+++++++++++++++");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 1);
            }
            else if (m == "P2+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 2
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2+++++++++++++++");
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 2);
            }
            else if (m == "P1-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 3
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1---------------");
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -1);
            }
            else if (m == "P2-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 4
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2---------------");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -2);
            }



            //if (m.Contains("P1+"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 1 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1+++++++++++++++");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, 1);

            //}
            //if ( m.Contains("P2+"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 2 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2+++++++++++++++");
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, 2);
            //}
            //if (m.Contains("P1-"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 3 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1---------------");
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -1);
            //}
            //if (m.Contains("P2-"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 4 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2---------------");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -2);
            //}
        }
Beispiel #4
0
        //public static double getRescale(double v,
        //double min, double max, double newmin, double newmax)
        //{
        //    double rnew = newmax - newmin;
        //    double n = getNormalized(v, min, max);
        //    return 1 * rnew - newmin ;
        //}


        //public static double getNormalized(double v, double min, double max)
        //{
        //    double r = max - min;
        //    if (r > 0)
        //    {
        //        v = v - min;
        //        v = v / r; return v;
        //    }
        //    else { return 0; }
        //}



        //------------

        public void addMsg(string user0, string m0, Boolean skipP2)
        {
            string m = m0.Replace("p", "P");

            m = m.Replace(" ", "");
            string user = user0.Replace("@", "");

            Console.WriteLine(" >>" + m + "<<");
            if (m == "P1+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 1
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1+++++++++++++++");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 1);
            }
            else if (!skipP2 && m == "AutoCheer")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 2
                };
                list_msg.Add(tm);
                //Console.WriteLine("test P2+++++++++++++++");
                processMsg(tm, false);
            }
            else if (!skipP2 && m == "AutoJeer")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 3
                };
                list_msg.Add(tm);
                //Console.WriteLine("test P1---------------");
                processMsg(tm, false);
            }
            else if (m == "P2-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 4
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2---------------");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -2);
            }



            //if (m.Contains("1"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 1};
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1+++++++++++++++");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user,1);

            //}
            //if (!skipP2 && m.Contains("AutoCheer"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 2 };
            //    list_msg.Add(tm);
            //    //Console.WriteLine("test P2+++++++++++++++");
            //    processMsg(tm, false);
            //}
            //if (!skipP2 && m.Contains("AutoJeer"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 3 };
            //    list_msg.Add(tm);
            //    //Console.WriteLine("test P1---------------");
            //    processMsg(tm, false);
            //}
            //if (m.Contains("2"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 4 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2---------------");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -2);
            //}

            /*string m = m0.Replace("p", "P");
             * if (m.Contains("P1+"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 1 };
             *  list_msg.Add(tm);
             *  Console.WriteLine("test P1+++++++++++++++");
             *  //mainWin1.countExport();
             *  processMsg(tm, false);
             *
             * }
             * if (!skipP2 && m.Contains("P2+"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 2 };
             *  list_msg.Add(tm);
             *  //Console.WriteLine("test P2+++++++++++++++");
             *  processMsg(tm, false);
             * }
             * if (!skipP2 && m.Contains("P1-"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 3 };
             *  list_msg.Add(tm);
             *  //Console.WriteLine("test P1---------------");
             *  processMsg(tm, false);
             * }
             * if (m.Contains("P2-"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 4 };
             *  list_msg.Add(tm);
             *  Console.WriteLine("test P2---------------");
             *  //mainWin1.countExport();
             *  processMsg(tm, false);
             * }*/
        }