private IEnumerator OperatePetCoroutine(int petId, PetOperationType type, int param) { using (new BlockingLayerHelper(0)) { var msg = NetManager.Instance.OperatePet(petId, (int)type, param); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { if (type == PetOperationType.EMPLOY) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300206)); } else if (type == PetOperationType.FIRE) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300205)); } else if (type == PetOperationType.RECYCLESOUL) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(270110)); } } else { Logger.Error(".....OperatePetCoroutine.......{0}.", msg.ErrorCode); } } else { Logger.Error(".....OperatePetCoroutine.......{0}.", msg.State); } } }
//操作宠物 public void OperatePet(int petId, PetOperationType type, int param = 0) { NetManager.Instance.StartCoroutine(OperatePetCoroutine(petId, type, param)); }