Instance() public static method

public static Instance ( ) : MapManager
return MapManager
Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //FileStream f = new FileStream("E:\\soul\\trunk\\MapServer\\verpack.dat",FileMode.Open);
            //byte[] ret = new byte[f.Length];
            //f.Read(ret, 0, (int)f.Length);
            //f.Close();
            //ConfigManager.Instance().GetVerPacket().InitPacket(ret);
            if (!GameServer.Start())
            {
                return;
            }
            //初始化连接dbserver
            DBServer.Instance().Init();
            //工作逻辑线程
            Thread logicThread = new Thread(new ThreadStart(ServerRun));

            logicThread.IsBackground = true;
            logicThread.Start();
            while (true)
            {
                String   sCommand = Console.ReadLine();
                String[] sArr     = sCommand.Split(' ');
                if (sArr.Length <= 0)
                {
                    continue;
                }
                sCommand = sArr[0];
                try
                {
                    if (sCommand == "quit" || sCommand == "exit")
                    {
                        break;
                    }
                    if (sCommand == "test")
                    {
                        PlayerObject       play = MapManager.Instance().GetGameMapToID(1000).GetObject(3988) as PlayerObject;
                        NetMsg.MsgUpdateSP data = new NetMsg.MsgUpdateSP();
                        data.Create(null, play.GetGamePackKeyEx());
                        data.role_id = play.GetTypeId();
                        data.value   = Convert.ToUInt32(sArr[1]);
                        data.sp      = Convert.ToUInt32(sArr[2]);
                        play.SendData(data.GetBuffer());
                    }
                }
                catch (System.Exception ex)
                {
                    Log.Instance().WriteLog(ex.Message);
                }
            }
            GameServer.Stop();
            Log.Instance().WriteLog("exit server!");

            Console.ReadLine();
        }
Exemplo n.º 2
0
        public static void LogicRun()
        {
            SocketCallBack.Instance().Run();           //玩家发过来的封包进行处理,加到数据队列
            DBServer.Instance().ProcessDBNetMsg();     //优先处理db数据库服务器发过来的消息
            SessionManager.Instance().ProcessNetMsg(); //处理玩家发过来的消息
            MapManager.Instance().Process();
            UserEngine.Instance().Run();
            ScriptTimerManager.Instance().Run(); //脚本定时器

            WorldPigeon.Instance().Run();        //魔法飞鸽
        }