Пример #1
0
    /// <summary>
    /// 接受服务器的响应
    /// </summary>
    /// <param name="operationResponse"></param>
    public void OnOperationResponse(OperationResponse operationResponse)
    {
        LogManager.Log(operationResponse.ToStringFull());
        byte opCode  = operationResponse.OperationCode;
        byte subCode = (byte)operationResponse[80];

        //转接
        switch (opCode)
        {
        case OperationCode.AccountCode:
            AccountReceiver.OnReceive(subCode, operationResponse);
            break;

        case OperationCode.PlayerCode:
            PlayerReceiver.OnReceive(subCode, operationResponse);
            break;

        case OperationCode.SelectCode:
            SelectReceiver.OnReceive(subCode, operationResponse);
            break;

        case OperationCode.BattleCode:
            BattleReceiver.OnReceive(subCode, operationResponse);
            break;
        }
    }
Пример #2
0
        public void Test_Account()
        {
            AccountReceiver receiver = new AccountReceiver("Tuan Trung");

            ICommandAccount openAccount  = new OpenAccount(receiver);
            ICommandAccount closeAccount = new CloseAccount(receiver);

            BankApp bankApp = new BankApp
                              (
                openAccount: openAccount,
                closeAccount: closeAccount
                              );

            bankApp.OpenAccount();
            bankApp.CloseAccount();
        }
Пример #3
0
 public CloseAccount(AccountReceiver receiver)
 {
     _receiver = receiver;
 }
Пример #4
0
 public OpenAccount(AccountReceiver receiver)
 {
     _receiver = receiver;
 }