Exemple #1
0
 protected override void OnConnected()
 {
     PETool.LogMsg("Client OnLine.");
     SendMsg(new NetMsg {
         text = "Welcome to connect!"
     });
 }
Exemple #2
0
 protected override void OnReciveMsg(NetMsg msg)
 {
     PETool.LogMsg("Client Request:" + msg.text);
     SendMsg(new NetMsg {
         text = msg.text
     });
 }
    private void HandleReceiveMsg(NetMsg msg)
    {
        PETool.LogMsg("Client Request:" + msg.msgType + msg.text);
        switch (msg.msgType)
        {
        case MsgType.BroadcastAll:
            BroadcastAllClient(msg.text);
            break;

        case MsgType.BroadcastAllWithCurClient:
            BroadcastAllWithCurClient(msg.text, curSendClientSocket);
            break;

        case MsgType.Store:

            break;

        case MsgType.Default:

            break;

        default:
            break;
        }
    }
Exemple #4
0
    public void SndChat(MsgPack pack)
    {
        SndChat data = pack.Msg.sndChat;

        PlayerData pd = cacheSvc.GetPlayerDataBySession(pack.Session);

        //任务进度数据更新
        TaskSys.Instance.CalcTaskPrgs(pd, 6);

        GameMsg msg = new GameMsg()
        {
            cmd     = (int)CMD.PshChat,
            pshChat = new PshChat()
            {
                name = pd.name,
                chat = data.chat
            }
        };

        //广播所有在线客户端
        List <ServerSession> list = cacheSvc.GetOnlineServerSessions();

        byte[] bytes = PETool.PackNetMsg(msg);

        for (int i = 0; i < list.Count; i++)
        {
            list[i].SendMsg(bytes);
        }
    }
Exemple #5
0
    /// <summary>
    /// 初始化
    /// </summary>
    public void Init()
    {
        cacheSvc = CacheSvc.Instance;
        cfgSvc   = CfgSvc.Instance;

        PETool.LogMsg("TaskSys Init Done.");
    }
Exemple #6
0
    public void Init()
    {
        PESocket <ServerSession, NetMsg> server = new PESocket <ServerSession, NetMsg>();

        server.StartAsServer(IPConfig.srvIP, IPConfig.srvport);
        PETool.LogMsg("NetSvc init done"); //这个日志有时间
    }
Exemple #7
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     cacheSvc = CacheSvc.Instance;
     timerSvc = TimerSvc.Instance;
     TimerSvc.Instance.AddTimeTask(CalcPowerAdd, PECommon.PowerAddSpace, PETimeUnit.Minute, 0);
     PETool.LogMsg("PowerSys Init Done.");
 }
Exemple #8
0
 /// <summary>
 /// 建立连接
 /// </summary>
 protected override void OnConnected()
 {
     PETool.LogMsg("Client Connect");
     SendMsg(new NetMsg
     {
         text = "welcome to connect:"
     });
 }
    protected override void OnReciveMsg(NetMsg msg)
    {
        base.OnReciveMsg(msg);
        PETool.LogMsg("Receieved CMD:" + msg.cmd);
        MsgPack msgPack = new MsgPack(msg, this);

        NetSvc.Instance.AddMsyQue(msgPack);
    }
Exemple #10
0
        public void Init()
        {
            PESocket <ServerSession, GameMsg> server = new PESocket <ServerSession, GameMsg>();

            server.StartAsServer(SerCfg.serIP, SerCfg.serProt);

            PETool.LogMsg("NetSer Init Done");
        }
Exemple #11
0
        static void Main(string[] args)
        {
            var petool = new PETool();

            petool.Read(@"d:\hawkaoc\aoc\language.dll");
            petool.Layout();
            petool.WriteFile(@"d:\hawkaoc\aoc\`language.dll");
            Console.ReadKey();
        }
Exemple #12
0
    /// <summary>
    /// 广播所有客户端
    /// </summary>
    /// <param name="msgStr">消息内容</param>
    private void BroadcastAllClient(string msgStr)
    {
        List <ServerSession> sessionLst = ServerStart.server.GetSesstionLst();

        for (int i = 0; i < sessionLst.Count; i++)
        {
            PETool.LogMsg("Client AddressFamily sessionLst:" + sessionLst[i].GetClientSocket().RemoteEndPoint);
            sessionLst[i].SendMsg(new NetMsg
            {
                text = msgStr
            });
        }
    }
Exemple #13
0
        void patch_exes_for_large_address_support()
        {
            List <string> files_to_patch = new List <string> {
                "h2tool", "h2sapien"
            };
            PETool pe = new PETool();

            foreach (string file in files_to_patch)
            {
                if (!File.Exists(H2Ek_install_path + file + ".large_address.exe") && File.Exists(H2Ek_install_path + file + ".exe"))
                {
                    pe.Read(H2Ek_install_path + file + ".exe");
                    pe.fileHeader.Characteristics |= PECharacteristics.IMAGE_FILE_LARGE_ADDRESS_AWARE;
                    pe.UpdateHeader();
                    pe.WriteFile(H2Ek_install_path + file + ".large_address.exe");
                }
            }
        }
 protected override void OnDisConnected()
 {
     base.OnDisConnected();
     PETool.LogMsg("Client DisConnected");
 }
Exemple #15
0
 protected override void OnDisConnected()
 {
     PETool.LogMsg("Client OffLine.");
 }
Exemple #16
0
    public static void Log(string msg, LogType logType = LogType.None)
    {
        LogLevel lv = (LogLevel)logType;

        PETool.LogMsg(msg, lv);
    }
Exemple #17
0
    public static void Log(string msg = "", LogType tp = LogType.Log)
    {
        LogLevel lv = (LogLevel)tp;

        PETool.LogMsg(msg, lv);
    }
Exemple #18
0
 protected override void OnDisConnected()
 {
     PETool.LogMsg("断开服务器连接");
 }
Exemple #19
0
 protected override void OnReciveMsg(NetMsg msg)
 {
     PETool.LogMsg("Server Response:" + msg.text);
 }
Exemple #20
0
 protected override void OnReciveMsg(GameMsg msg)
 {
     PETool.LogMsg("接收到服务器的数据包,操作码为:" + ((CMD)msg.cmd).ToString());
     NetSvc.Instance.AddNetPkg(msg); // 将接收到的数据包加到消息队列里
 }
 protected override void OnConnected()
 {
     PETool.LogMsg("Connect Server Succ.");
 }
Exemple #22
0
    public static void Log(string msg, LogType _type = LogType.Log)
    {
        LogLevel lv = (LogLevel)_type;

        PETool.LogMsg(msg, lv);
    }
Exemple #23
0
 public override void Init()
 {
     PETool.LogMsg("LoginSys Init Done");
 }
Exemple #24
0
 protected override void OnReciveMsg(NetMsg msg)
 {
     PETool.LogMsg("Server Response:" + msg.text);
     MsgPool.Instance.AddMsg(msg.text);
 }
Exemple #25
0
    public static void Log(string msg = "", NETLogLevel lv = NETLogLevel.Log)
    {
        LogLevel level = (LogLevel)lv;

        PETool.LogMsg(msg, level);
    }
Exemple #26
0
    public static void Log(string msg = "", LogType logType = LogType.Log)
    {
        LogLevel level = (LogLevel)logType;

        PETool.LogMsg(msg, level);
    }
Exemple #27
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     cacheSvc = CacheSvc.Instance;
     PETool.LogMsg("BuySys Init Done.");
 }
Exemple #28
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     cacheSvc = CacheSvc.Instance;
     timerSvc = TimerSvc.Instance;
     PETool.LogMsg("LoginSys Init Done.");
 }
 protected override void OnDisConnected()
 {
     PETool.LogMsg("Server Shutdown.");
 }
Exemple #30
0
 protected override void OnConnected()
 {
     PETool.LogMsg("连接服务器成功");
 }