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); }
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; } }
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 }
protected override void OnAppMsgReceived(AppMessageBase message) { switch (message.Type) { case AppMsgType.ItemChangingRequest: OnItemChangingMsg(message as AppChangingItemsMessage); break; } }
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 }
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); }
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; } }
private void OnMessageRecived(AppMessageBase message) { switch (message.Type) { case AppMsgType.LoginAnswer: OnLoginCallback(message as LoginAnswerMessage); break; case AppMsgType.RegistrationAnswer: OnRegistrationCallback(message as RegistrationAnswerMessage); break; } }
private void OnAppMessageReceived(AppMessageBase message) { switch (message.Type) { case AppMsgType.UpdatePlayerDataAnswer: OnUpdatePlayerData(message as AppUpdatePlayerDataAnswerMessage); break; case AppMsgType.Logout: Terminate(true); break; } }
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; } }
public void Send(AppMessageBase message) { message.ConnectionId = _currentClient.connection.connectionId; _currentClient.Send((short)message.Type, message); }
public void Send(AppMessageBase message) { NetworkServer.SendToClient(message.ConnectionId, (short)message.Type, message); }
protected abstract void OnAppMsgReceived(AppMessageBase message);
protected override void OnAppMsgReceived(AppMessageBase message) { }
private void OnAppMsgReceived(AppMessageBase message) { ShowMsg(message.Type.ToString(), message.ConnectionId, "blue"); }