protected override void Awake()
        {
            if (useWebSocket)
            {
                if (centralTransportFactory == null || !centralTransportFactory.CanUseWithWebGL)
                {
                    centralTransportFactory = gameObject.AddComponent <WebSocketTransportFactory>();
                }
            }
            else
            {
                if (centralTransportFactory == null)
                {
                    centralTransportFactory = gameObject.AddComponent <LiteNetLibTransportFactory>();
                }
            }
#if UNITY_STANDALONE && !CLIENT_BUILD
            CentralAppServerRegister = new CentralAppServerRegister(CentralTransportFactory.Build(), this);
            CentralAppServerRegister.onAppServerRegistered = OnAppServerRegistered;
            CentralAppServerRegister.RegisterMessageHandler(MMOMessageTypes.AppServerAddress, HandleResponseAppServerAddress);
            CentralAppServerRegister.RegisterResponseHandler <RequestSpawnMapMessage, ResponseSpawnMapMessage>(MMORequestTypes.RequestSpawnMap);
            this.InvokeInstanceDevExtMethods("OnInitCentralAppServerRegister");
            ChatNetworkManager = gameObject.AddComponent <ChatNetworkManager>();
#endif
            // Server Handlers
            ServerMailHandlers        = gameObject.GetOrAddComponent <IServerMailHandlers, MMOServerMailHandlers>();
            ServerUserHandlers        = gameObject.GetOrAddComponent <IServerUserHandlers, DefaultServerUserHandlers>();
            ServerBuildingHandlers    = gameObject.GetOrAddComponent <IServerBuildingHandlers, DefaultServerBuildingHandlers>();
            ServerCharacterHandlers   = gameObject.GetOrAddComponent <IServerCharacterHandlers, DefaultServerCharacterHandlers>();
            ServerGameMessageHandlers = gameObject.GetOrAddComponent <IServerGameMessageHandlers, DefaultServerGameMessageHandlers>();
            ServerStorageHandlers     = gameObject.GetOrAddComponent <IServerStorageHandlers, MMOServerStorageHandlers>();
            ServerPartyHandlers       = gameObject.GetOrAddComponent <IServerPartyHandlers, DefaultServerPartyHandlers>();
            ServerGuildHandlers       = gameObject.GetOrAddComponent <IServerGuildHandlers, MMOServerGuildHandlers>();
            // Server Message Handlers
            ServerCashShopMessageHandlers  = gameObject.GetOrAddComponent <IServerCashShopMessageHandlers, MMOServerCashShopMessageHandlers>();
            ServerMailMessageHandlers      = gameObject.GetOrAddComponent <IServerMailMessageHandlers, MMOServerMailMessageHandlers>();
            ServerStorageMessageHandlers   = gameObject.GetOrAddComponent <IServerStorageMessageHandlers, MMOServerStorageMessageHandlers>();
            ServerCharacterMessageHandlers = gameObject.GetOrAddComponent <IServerCharacterMessageHandlers, DefaultServerCharacterMessageHandlers>();
            ServerInventoryMessageHandlers = gameObject.GetOrAddComponent <IServerInventoryMessageHandlers, DefaultServerInventoryMessageHandlers>();
            ServerPartyMessageHandlers     = gameObject.GetOrAddComponent <IServerPartyMessageHandlers, MMOServerPartyMessageHandlers>();
            ServerGuildMessageHandlers     = gameObject.GetOrAddComponent <IServerGuildMessageHandlers, MMOServerGuildMessageHandlers>();
            ServerFriendMessageHandlers    = gameObject.GetOrAddComponent <IServerFriendMessageHandlers, MMOServerFriendMessageHandlers>();
            ServerBankMessageHandlers      = gameObject.GetOrAddComponent <IServerBankMessageHandlers, MMOServerBankMessageHandlers>();
            // Client handlers
            ClientCashShopHandlers        = gameObject.GetOrAddComponent <IClientCashShopHandlers, DefaultClientCashShopHandlers>();
            ClientMailHandlers            = gameObject.GetOrAddComponent <IClientMailHandlers, DefaultClientMailHandlers>();
            ClientStorageHandlers         = gameObject.GetOrAddComponent <IClientStorageHandlers, DefaultClientStorageHandlers>();
            ClientCharacterHandlers       = gameObject.GetOrAddComponent <IClientCharacterHandlers, DefaultClientCharacterHandlers>();
            ClientInventoryHandlers       = gameObject.GetOrAddComponent <IClientInventoryHandlers, DefaultClientInventoryHandlers>();
            ClientPartyHandlers           = gameObject.GetOrAddComponent <IClientPartyHandlers, DefaultClientPartyHandlers>();
            ClientGuildHandlers           = gameObject.GetOrAddComponent <IClientGuildHandlers, DefaultClientGuildHandlers>();
            ClientFriendHandlers          = gameObject.GetOrAddComponent <IClientFriendHandlers, DefaultClientFriendHandlers>();
            ClientBankHandlers            = gameObject.GetOrAddComponent <IClientBankHandlers, DefaultClientBankHandlers>();
            ClientOnlineCharacterHandlers = gameObject.GetOrAddComponent <IClientOnlineCharacterHandlers, DefaultClientOnlineCharacterHandlers>();
            ClientGameMessageHandlers     = gameObject.GetOrAddComponent <IClientGameMessageHandlers, DefaultClientGameMessageHandlers>();
            base.Awake();
        }
示例#2
0
 protected override void Awake()
 {
     base.Awake();
     if (useWebSocket)
     {
         if (centralTransportFactory == null || !centralTransportFactory.CanUseWithWebGL)
         {
             centralTransportFactory = gameObject.AddComponent <WebSocketTransportFactory>();
         }
     }
     else
     {
         if (centralTransportFactory == null)
         {
             centralTransportFactory = gameObject.AddComponent <LiteNetLibTransportFactory>();
         }
     }
     CentralAppServerRegister = new CentralAppServerRegister(CentralTransportFactory.Build(), this);
     this.InvokeInstanceDevExtMethods("OnInitCentralAppServerRegister");
 }
示例#3
0
 protected override void Awake()
 {
     base.Awake();
     if (useWebSocket)
     {
         if (centralTransportFactory == null || !centralTransportFactory.CanUseWithWebGL)
         {
             centralTransportFactory = gameObject.AddComponent <WebSocketTransportFactory>();
         }
     }
     else
     {
         if (centralTransportFactory == null)
         {
             centralTransportFactory = gameObject.AddComponent <LiteNetLibTransportFactory>();
         }
     }
     CentralAppServerRegister = new CentralAppServerRegister(CentralTransportFactory.Build(), this);
     CentralAppServerRegister.onAppServerRegistered = OnAppServerRegistered;
     CentralAppServerRegister.RegisterRequestHandler <RequestSpawnMapMessage, ResponseSpawnMapMessage>(MMORequestTypes.RequestSpawnMap, HandleRequestSpawnMap);
     this.InvokeInstanceDevExtMethods("OnInitCentralAppServerRegister");
 }