示例#1
0
    public static void Main(string[] args)
    {
        Scene   scene   = new Scene();
        ServNet servNet = new ServNet();

        servNet.proto = new ProtocolBytes();
        servNet.Start("127.0.0.1", 1234);
        RoomMgr roomMgr = new RoomMgr();

        Console.ReadLine();
        while (true)
        {
            string str = Console.ReadLine();
            switch (str)
            {
            case "quit":
                servNet.Close();
                return;

            case "print":
                servNet.Print();
                break;
            }
        }
    }
        public static void Main(string[] args)
        {
            CreatMysql mysql = new CreatMysql(); //实例化创建数据库类

            mysql.CreatDatabase();               //创建数据库
            mysql.CreatTable();                  //创建表
            RoomMgr roomMgr = new RoomMgr();
            DataMgr dataMgr = new DataMgr();
            ServNet servNet = new ServNet();

            servNet.proto = new ProtocolBytes();
            servNet.Start("172.16.220.76", 7788);
            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    servNet.Close();
                    return;

                case "print":
                    servNet.Print();
                    break;
                }
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            DataMgr dataMgr = new DataMgr();
            ServNet ser     = new ServNet();

            ser.proto = new ProtocolBytes();
            ser.Start("127.0.0.1", 1234);
            Scene scene = new Scene();

            Player player = new Player("Lee", null);

            player.data       = new PlayerData();
            player.data.score = 100;

            DataMgr.instance.SavePlayer(player);

            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    ser.Close();
                    return;

                case "print":
                    ser.Print();
                    break;
                }
            }
        }
示例#4
0
        public static void Main(string[] args)
        {
            RoomMgr       roomMgr       = new RoomMgr();
            Scene         scene         = new Scene();
            MatchingQueue maching_queue = new MatchingQueue();
            //DataMgr dataMgr = new DataMgr ();//管理数据的类,先暂时去除
            ServNet servNet = new ServNet();

            servNet.proto = new ProtocolBytes();
            servNet.Start("127.0.0.1", 1234);

            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    servNet.Close();
                    return;

                case "print":
                    servNet.Print();
                    break;
                }
            }
        }
        public static void Main(string[] args)
        {
            RoomMgr roomMgr = new RoomMgr();
            DataMgr dataMgr = new DataMgr();
            ServNet servNet = new ServNet();

            servNet.proto = new ProtocolBytes();
            string ip   = System.Configuration.ConfigurationManager.AppSettings["Listen_ip"];
            int    port = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Listen_port"]);

            servNet.Start(ip, port);

            while (true)
            {
                //string str = Console.ReadLine();
                string str = "";
                if (Console.In is System.IO.StreamReader)
                {
                    str = Console.ReadLine();
                }
                else
                {
                    Thread.Sleep(10000);
                }
                //Thread.Sleep(10000);
                switch (str)
                {
                case "quit":
                    servNet.Close();
                    return;

                case "print":
                    servNet.Print();
                    break;
                }
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            LandMgr landMgr = new LandMgr();
            DataMgr dataMgr = new DataMgr();
            ServNet servNet = new ServNet();

            servNet.proto = new ProtocolBytes();
            servNet.Start("192.168.1.107", 1234);

            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    servNet.Close();
                    return;

                case "print":
                    servNet.Print();
                    break;
                }
            }
        }
示例#7
0
    public static void Main(string[] args)
    {
        //DataMgr dataMgr = new DataMgr();
        ////注册
        //bool ret = dataMgr.Register("hxt", "123456");
        //if (ret)
        //    Console.WriteLine("注册成功");
        //else
        //    Console.WriteLine("注册失败");
        ////创建玩家
        //ret = dataMgr.CreatePlayer("hxt");
        //if (ret)
        //    Console.WriteLine("创建玩家成功");
        //else
        //    Console.WriteLine("创建玩家失败");
        ////获取玩家数据
        //PlayerData pd = dataMgr.GetPlayerData("hxt");
        //if (pd != null)
        //    Console.WriteLine("获取玩家成功 分数是 " + pd.score);
        //else
        //    Console.WriteLine("获取玩家数据失败 ");
        ////更改玩家数据
        //pd.score += 10;
        ////保存数据
        //Player p = new Player();
        //p.id = "hxt";
        //p.data = pd;
        //ret = dataMgr.SavePlayer(p);
        //if (ret)
        //    Console.WriteLine("更改保存玩家数据成功");
        //else
        //    Console.WriteLine("更改保存玩家数据失败");
        ////重新读取
        //pd = dataMgr.GetPlayerData("hxt");
        //if (pd != null)
        //    Console.WriteLine("获取玩家成功 分数是 " + pd.score);
        //else
        //Console.WriteLine("重新获取玩家数据失败");

        DataMgr dataMgr = new DataMgr();
        ServNet servNet = new ServNet();
        Scene   scene   = new Scene();
        RoomMgr roomMgr = new RoomMgr();

        servNet.proto = new ProtocolBytes();
        servNet.Start("127.0.0.1", 1234);

        while (true)
        {
            string str = Console.ReadLine();
            switch (str)
            {
            case "quit":
                servNet.Close();
                return;

            case "print":
                servNet.Print();
                break;
            }
        }
    }
示例#8
0
文件: Program.cs 项目: qifan71/Serv
        static void Main(string[] args)
        {
            //DataMgr dataMgr = new DataMgr();
            ////注册
            //bool ret = dataMgr.Register("WSHC", "123");
            //if (ret)
            //{
            //    Console.WriteLine("注册成功");
            //}
            //else
            //{
            //    Console.WriteLine("注册失败");
            //}
            ////创建玩家
            //ret = dataMgr.CreatePlayer("WSHC");
            //if (ret)
            //{
            //    Console.WriteLine("创建玩家成功");
            //}
            //else
            //{
            //    Console.WriteLine("创建玩家失败");
            //}
            ////获取玩家数据
            //PlayerData pd = dataMgr.GetPlayerData("WSHL");
            //if (pd!=null)
            //{
            //    Console.WriteLine("获取玩家数据成功 分数是 "+pd.score);
            //}
            //else
            //{
            //    Console.WriteLine("获取玩家数据失败");
            //}
            ////更改玩家数据
            //pd.score += 10;
            ////保存数据
            //Player p = new Player();
            //p.id = "WSHL";
            //p.data = pd;
            //dataMgr.Saveplayer(p);
            ////重新获取
            //pd = dataMgr.GetPlayerData("WSHL");
            //if (pd != null)
            //{
            //    Console.WriteLine("获取玩家数据成功 分数是 " + pd.score);
            //}
            //else
            //{
            //    Console.WriteLine("重新获取玩家数据失败");
            //}
            //Console.ReadLine();
            DataMgr dataMgr = new DataMgr();//只有实例化的对象才能使用单例模式(此框架中,其他实现instance的方式不同,情况不同)
            ServNet servNet = new ServNet();

            servNet.proto = new ProtocolBytes();
            servNet.Start("127.0.0.1", 1234);
            //创建场景实例
            Scene scene = new Scene();

            while (true)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                case "quit":
                    servNet.Close();
                    return;

                case "print":
                    servNet.Print();
                    break;

                default:
                    break;
                }
            }
            Console.ReadLine();
        }