Beispiel #1
0
        protected virtual void HandleResponseCashShopBuy(LiteNetLibMessageHandler messageHandler)
        {
            TransportHandler           transportHandler = messageHandler.transportHandler;
            ResponseCashShopBuyMessage message          = messageHandler.ReadMessage <ResponseCashShopBuyMessage>();

            transportHandler.TriggerAck(message.ackId, message.responseCode, message);
        }
        private void ResponseCashShopBuy(AckResponseCode responseCode, BaseAckMessage message)
        {
            ResponseCashShopBuyMessage castedMessage = (ResponseCashShopBuyMessage)message;

            switch (responseCode)
            {
            case AckResponseCode.Error:
                string errorMessage = string.Empty;
                switch (castedMessage.error)
                {
                case ResponseCashShopBuyMessage.Error.UserNotFound:
                    errorMessage = LanguageManager.GetText(UILocaleKeys.UI_ERROR_USER_NOT_FOUND.ToString());
                    break;

                case ResponseCashShopBuyMessage.Error.ItemNotFound:
                    errorMessage = LanguageManager.GetText(UILocaleKeys.UI_ERROR_ITEM_NOT_FOUND.ToString());
                    break;

                case ResponseCashShopBuyMessage.Error.NotEnoughCash:
                    errorMessage = LanguageManager.GetText(UILocaleKeys.UI_ERROR_NOT_ENOUGH_CASH.ToString());
                    break;
                }
                UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_ERROR.ToString()), errorMessage);
                break;

            case AckResponseCode.Timeout:
                UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_ERROR.ToString()), LanguageManager.GetText(UILocaleKeys.UI_ERROR_CONNECTION_TIMEOUT.ToString()));
                break;

            default:
                UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_SUCCESS.ToString()), LanguageManager.GetText(UILocaleKeys.UI_SUCCESS_CASH_SHOP_BUY.ToString()));
                RefreshCashShopInfo();
                break;
            }
        }
Beispiel #3
0
        protected virtual void HandleRequestCashShopBuy(LiteNetLibMessageHandler messageHandler)
        {
            long connectionId = messageHandler.connectionId;
            RequestCashShopBuyMessage  message         = messageHandler.ReadMessage <RequestCashShopBuyMessage>();
            ResponseCashShopBuyMessage responseMessage = new ResponseCashShopBuyMessage();

            responseMessage.ackId        = message.ackId;
            responseMessage.responseCode = AckResponseCode.Error;
            responseMessage.error        = ResponseCashShopBuyMessage.Error.NotAvailable;
            ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, MsgTypes.CashShopBuy, responseMessage);
        }