Exemplo n.º 1
0
        public void Start()
        {
            foreach (KeyValuePair <short, IJHSInterface> that in m_MessageHandlersDict)
            {
                JHSNetworkServer.RegisterHandler(that.Key, OnNetworkReceive);
            }

            JHSNetworkServer.Start();
        }
Exemplo n.º 2
0
 public void RegisterHandeler(short id, IJHSInterface handler)
 {
     if (!m_MessageHandlersDict.ContainsKey(id))
     {
         JHSNetworkServer.RegisterHandler(id, OnNetworkReceive);
         m_MessageHandlersDict[id] = handler;
     }
     else
     {
         LOG.Error("Network Handler " + id + " already exist.");
     }
 }
Exemplo n.º 3
0
    public void Connect()
    {
        JHSNetworkServer.RegisterHandler(InternalMessages.DISCONNECT, OnDisconnect);
        //    JHSNetworkServer.RegisterHandler(InternalMessages.RECIEVE, OnNetworkReceive);
        RegisterHandeler(NetworkConstants.LOGIN, new LoginHandler());
        RegisterHandeler(NetworkConstants.REGISTER, new RegisterHandler());
        RegisterHandeler(NetworkConstants.UPDATE_SITE_DATA, new UpdateSiteDataHandler());
        RegisterHandeler(NetworkConstants.GET_NEW_URL, new Ask4NewUrlHandler());
        RegisterHandeler(NetworkConstants.CHAT, new ChatHandler());
        RegisterHandeler(NetworkConstants.OPEN_CHAT, new ChatOpenHandler());
        string ListenIP   = Program.configs.GetValue <string>("HOST");
        int    ListenPort = Program.configs.GetValue <int>("PORT");
        int    password   = Program.configs.GetValue <int>("ServerPassword");
        int    Version    = Program.configs.GetValue <int>("Version");

        JHSNetworkServer.Start(ListenIP, ListenPort);
        LOG.Error("No error, server started!");
    }
Exemplo n.º 4
0
        public void InitHandlers()
        {
            JHSNetworkServer.RegisterHandler(InternalMessages.DISCONNECT, OnDisconnect);
            JHSNetworkServer.RegisterHandler(InternalMessages.RECIEVE, OnNetworkReceive);
            RegisterHandeler(NetworkConstants.LOGIN, new UserLogin());
            RegisterHandeler(NetworkConstants.BUYCOLORCHANGE, new BuyColorChange());
            RegisterHandeler(NetworkConstants.EXCHANGE, new ExchangeCurrency());
            RegisterHandeler(NetworkConstants.BUYCHARACTER, new BuySkinHandler());
            RegisterHandeler(NetworkConstants.GM, new GMComands());
            RegisterHandeler(NetworkConstants.DELETE_CHARACTER, new DeleteCharacterCommand());
            RegisterHandeler(NetworkConstants.START_SEARCH_MATCH, new SearchMatchCommand());
            RegisterHandeler(NetworkConstants.COLLECT_ACTIVE, new CollectActiveCommand());
            RegisterHandeler(NetworkConstants.REFRESH_ACTIVES, new RequestActives());
            RegisterHandeler(NetworkConstants.UPDATE_RANKINGS, new GetRankings());

            //GAME SERVER PACKETS
            RegisterHandeler(GameServerOP.PUTROLE, new CMD_GS_GIVE_REWARDS());
            RegisterHandeler(GameServerOP.GETROLE, new CMD_GETROLE());
            RegisterHandeler(GameServerOP.UPDATE_STATE, new GS_STATE());
        }