private void SendDmarketDataUpdateAnswer(AppMessageBase sender)
        {
            var answer = new AppLoadDMarketAnswerMessage();

            answer.Responce.Inventory = GetInventory(sender.ConnectionId);
            SendAnswer(answer, sender);
        }
        private bool IsCanMakeDMarketOperation(AppMessageBase message)
        {
            var answer = new AppChangingItemsAnswerMessage();

            if (String.IsNullOrEmpty(Model.MarketToken))
            {
                answer.Error = NetMsgErrorType.DMarketError;
                answer.Response.ErrorText = "Market token is empty";
                SendAnswer(answer, message);
                return(false);
            }
            var itemOperationMsg = message as AppChangingItemsMessage;

            if (itemOperationMsg != null)
            {
                var playerInfo = GetPlayer(message.ConnectionId);
                if (playerInfo == null)
                {
                    var error = new Error();
                    error.ErrorMessage = string.Format("Cannot find player {0}. " +
                                                       "Need reload game", Model.ConIdToUserName[message.ConnectionId]);
                    error.ErrorCode = ErrorCode.AssetNotFound;
                    OnItemOperationError(itemOperationMsg, error);
                    return(false);
                }
            }
            return(true);
        }
예제 #3
0
        protected override void OnAppMsgReceived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.GetGameTokenRequest:
                OnGetGameTokenMsg(message as AppGetGameTokenMessage);
                break;

            case AppMsgType.UpdateMarketToken:
                OnAddMarketTokenMsg(message as AppUpdateMarketTokenMessage);
                break;

            case AppMsgType.LoadDMarketDataRequest:
                OnLoadDMarketDataMsg(message as AppLoadDMarketDataMessage);
                break;

            case AppMsgType.LoadInventoryBasicIntegration:
                OnLoadInventoryBasicIntegration(message as InventoryBasicIntegrationMessage);
                break;

            case AppMsgType.UnloadInventoryBasicIntegration:
                OnLeaveInventory(message as UnloadInventoryBasicIntegrationMessage);
                break;
            }
        }
예제 #4
0
 public void Send(AppMessageBase message)
 {
     NetworkServer.SendToClient(message.ConnectionId, (short)message.Type, message);
     #if NETWORK_DEBUG
     DevLogger.Log("SendAppMessage: " + message.Type + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(message, Newtonsoft.Json.Formatting.Indented));
     #endif
 }
예제 #5
0
 protected override void OnAppMsgReceived(AppMessageBase message)
 {
     switch (message.Type)
     {
     case AppMsgType.ItemChangingRequest:
         OnItemChangingMsg(message as AppChangingItemsMessage);
         break;
     }
 }
예제 #6
0
        public void Send(AppMessageBase message)
        {
            message.ConnectionId = _currentClient.connection.connectionId;
            _currentClient.Send((short)message.Type, message);

            #if NETWORK_DEBUG
            DevLogger.Log("Send AppMessageBase: " + message.Type + " body: \n" + Newtonsoft.Json.JsonConvert.SerializeObject(message, Newtonsoft.Json.Formatting.Indented));
            #endif
        }
예제 #7
0
        protected void SendAnswer(AppServerAnswerMessageBase answer,
                                  AppMessageBase senderMessage)
        {
            answer.ConnectionId = senderMessage.ConnectionId;
            var logString = "Server send to {0} app answer type {1} with error {2}";

            DevLogger.Log(string.Format(logString, answer.ConnectionId,
                                        answer.Type, answer.Error), TankGameLogChannel.Network);
            Server.Send(answer);
        }
예제 #8
0
        private void OnAppMessageReceive(NetworkMessage msg)
        {
            AppMessageBase appMessage = NetworkingUtil.ReadAppMessage(msg);

            #if NETWORK_DEBUG
            DevLogger.Log("OnAppMessageReceive received: " + appMessage.Type + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(appMessage, Newtonsoft.Json.Formatting.Indented));
            #endif

            AppMsgReceived.SafeRaise(appMessage);
        }
        protected override void OnAppMsgReceived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.ItemChangingRequest:
                OnItemChangingMsg(message as AppChangingItemsMessage);
                break;

            case AppMsgType.DMarketTransactionCompleted:
                OnDMarketTransaction(message as AppDMarketTransactionMessage);
                break;
            }
        }
예제 #10
0
        private void OnMessageRecived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.LoginAnswer:
                OnLoginCallback(message as LoginAnswerMessage);
                break;

            case AppMsgType.RegistrationAnswer:
                OnRegistrationCallback(message as RegistrationAnswerMessage);
                break;
            }
        }
예제 #11
0
        private void OnAppMessageReceived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.UpdatePlayerDataAnswer:
                OnUpdatePlayerData(message as AppUpdatePlayerDataAnswerMessage);
                break;

            case AppMsgType.Logout:
                Terminate(true);
                break;
            }
        }
예제 #12
0
        protected override void OnAppMsgReceived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.Login:
                OnLoginReceived(message as LoginMessage);
                break;

            case AppMsgType.Registration:
                OnRegistrationReceived(message as RegistrationMessage);
                break;

            case AppMsgType.Logout:
                OnLogoutReceived(message as LogoutMessage);
                break;
            }
        }
        protected override void OnAppMsgReceived(AppMessageBase message)
        {
            switch (message.Type)
            {
            case AppMsgType.GetGameTokenRequest:
                OnGetGameTokenMsg(message as AppGetGameTokenMessage);
                break;

            case AppMsgType.UpdateMarketToken:
                OnAddMarketTokenMsg(message as AppUpdateMarketTokenMessage);
                break;

            case AppMsgType.ItemChangingRequest:
                OnItemChangingMsg(message as AppChangingItemsMessage);
                break;

            case AppMsgType.LoadDMarketDataRequest:
                OnLoadDMarketDataMsg(message as AppLoadDMarketDataMessage);
                break;
            }
        }
예제 #14
0
 public void Send(AppMessageBase message)
 {
     message.ConnectionId = _currentClient.connection.connectionId;
     _currentClient.Send((short)message.Type, message);
 }
예제 #15
0
 public void Send(AppMessageBase message)
 {
     NetworkServer.SendToClient(message.ConnectionId, (short)message.Type, message);
 }
예제 #16
0
 protected abstract void OnAppMsgReceived(AppMessageBase message);
 protected override void OnAppMsgReceived(AppMessageBase message)
 {
 }
예제 #18
0
 private void OnAppMsgReceived(AppMessageBase message)
 {
     ShowMsg(message.Type.ToString(), message.ConnectionId, "blue");
 }