/// <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; } }
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(); }
public CloseAccount(AccountReceiver receiver) { _receiver = receiver; }
public OpenAccount(AccountReceiver receiver) { _receiver = receiver; }