public async Task <__ServerGModule__LoginService__CreateAccountReq.Callback> rpc_create_account_async(global::System.String username, global::System.String password, global::System.Action <global::Shared.Protocol.ErrCode> callback = null) #endif { #if FENIX_CODEGEN #if !RUNTIME var t = new TaskCompletionSource <dynamic>(); #else var t = new TaskCompletionSource <__ServerGModule__LoginService__CreateAccountReq.Callback>(); #endif #else var t = new TaskCompletionSource <__ServerGModule__LoginService__CreateAccountReq.Callback>(); var toHostId = Global.IdManager.GetHostIdByActorId(this.toActorId, this.isClient); if (this.FromHostId == toHostId) { global::System.Action <global::Shared.Protocol.ErrCode> _cb = (code) => { var cbMsg = new __ServerGModule__LoginService__CreateAccountReq.Callback(); cbMsg.code = code; callback?.Invoke(cbMsg.code); t.TrySetResult(cbMsg); }; var protoCode = ProtocolCode.__SERVERGMODULE__LOGINSERVICE__CREATE_ACCOUNT_REQ; if (Math.Abs(protoCode) < OpCode.CALL_ACTOR_METHOD) { var peer = Global.NetManager.GetRemotePeerById(this.FromHostId, this.NetType); var context = new RpcContext(null, peer); Global.Host.CallMethodWithParams(protoCode, new object[] { username, password, _cb, context }); } else { Global.Host.GetActor(this.toActorId).CallMethodWithParams(protoCode, new object[] { username, password, _cb }); } } else { Action <__ServerGModule__LoginService__CreateAccountReq.Callback> _cb = (cbMsg) => { callback?.Invoke(cbMsg.code); t.TrySetResult(cbMsg); }; await Task.Run(() => { var msg = new __ServerGModule__LoginService__CreateAccountReq() { username = username, password = password }; var cb = new Action <byte[]>((cbData) => { var cbMsg = cbData == null ? new __ServerGModule__LoginService__CreateAccountReq.Callback() : global::Fenix.Common.Utils.RpcUtil.Deserialize <__ServerGModule__LoginService__CreateAccountReq.Callback>(cbData); _cb?.Invoke(cbMsg); }); this.CallRemoteMethod(ProtocolCode.__SERVERGMODULE__LOGINSERVICE__CREATE_ACCOUNT_REQ, msg, cb); }); } #endif return(await t.Task); }
public void SERVER_API__ServerGModule__LoginService__create_account(IMessage msg, Action <IMessage> cb) { var _msg = (__ServerGModule__LoginService__CreateAccountReq)msg; this.CreateAccount(_msg.username, _msg.password, (code) => { var cbMsg = new __ServerGModule__LoginService__CreateAccountReq.Callback(); cbMsg.code = code; cb.Invoke(cbMsg); }); }
public void SERVER_API__ServerGModule__LoginService__create_account(IMessage msg, Action <IMessage> cb) { #if ENABLE_IL2CPP || !DEBUG || RUNTIME var _msg = (__ServerGModule__LoginService__CreateAccountReq)msg; this.CreateAccount(_msg.username, _msg.password, (code) => { var cbMsg = new __ServerGModule__LoginService__CreateAccountReq.Callback(); cbMsg.code = code; cb.Invoke(cbMsg); }); #else dynamic _msg = msg; self.CreateAccount(_msg.username, _msg.password, (global::System.Action <global::Shared.Protocol.ErrCode>)((code) => { dynamic cbMsg = new __ServerGModule__LoginService__CreateAccountReq.Callback(); cbMsg.code = code; cb.Invoke(cbMsg); })); #endif }