Пример #1
0
        public void HandleRequest(MainPack pack, LanClient client)
        {
            if (controllerDict.TryGetValue(pack.Requestcode, out BaseController controller))
            {
                string     methodName = pack.Actioncode.ToString();
                MethodInfo method     = controller.GetType().GetMethod(methodName);

                if (method == null)
                {
                    Console.WriteLine("找不到方法 {0}", methodName);
                    return;
                }


                object[] o   = new object[] { client, pack };
                object   ret = method.Invoke(controller, o);

                if (ret == null)
                {
                    return;
                }

                client.Send(ret as MainPack);
            }
            else
            {
                Console.WriteLine("找不到負責處理的 controller");
            }
        }
Пример #2
0
 public MainPack Logon(LanClient client, MainPack pack)
 {
     if (client.Logon(pack))
     {
         pack.Returncode = ReturnCode.Success;
     }
     else
     {
         pack.Returncode = ReturnCode.Fail;
     }
     return(pack);
 }
Пример #3
0
 public void HandleRequest(MainPack pack, LanClient lanClient)
 {
     controllerManager.HandleRequest(pack, lanClient);
 }