Ejemplo n.º 1
0
        public async Task <__ServerGModule__MatchService__JoinMatchReq.Callback> rpc_join_match_async(global::System.String uid, global::System.Int32 match_type, 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__MatchService__JoinMatchReq.Callback>();
#endif
#else
            var t        = new TaskCompletionSource <__ServerGModule__MatchService__JoinMatchReq.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__MatchService__JoinMatchReq.Callback();
                    cbMsg.code = code;
                    callback?.Invoke(cbMsg.code);
                    t.TrySetResult(cbMsg);
                };
                var protoCode = ProtocolCode.__SERVERGMODULE__MATCHSERVICE__JOIN_MATCH_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[] { uid, match_type, _cb, context });
                }
                else
                {
                    Global.Host.GetActor(this.toActorId).CallMethodWithParams(protoCode, new object[] { uid, match_type, _cb });
                }
            }
            else
            {
                Action <__ServerGModule__MatchService__JoinMatchReq.Callback> _cb = (cbMsg) =>
                {
                    callback?.Invoke(cbMsg.code);
                    t.TrySetResult(cbMsg);
                };
                await Task.Run(() => {
                    var msg = new __ServerGModule__MatchService__JoinMatchReq()
                    {
                        uid        = uid,
                        match_type = match_type
                    };
                    var cb = new Action <byte[]>((cbData) => {
                        var cbMsg = cbData == null ? new __ServerGModule__MatchService__JoinMatchReq.Callback() : global::Fenix.Common.Utils.RpcUtil.Deserialize <__ServerGModule__MatchService__JoinMatchReq.Callback>(cbData);
                        _cb?.Invoke(cbMsg);
                    });
                    this.CallRemoteMethod(ProtocolCode.__SERVERGMODULE__MATCHSERVICE__JOIN_MATCH_REQ, msg, cb);
                });
            }
#endif
            return(await t.Task);
        }
Ejemplo n.º 2
0
        public void SERVER_API__ServerGModule__MatchService__join_match(IMessage msg, Action <IMessage> cb)
        {
            var _msg = (__ServerGModule__MatchService__JoinMatchReq)msg;

            this.JoinMatch(_msg.uid, _msg.match_type, (code) =>
            {
                var cbMsg  = new __ServerGModule__MatchService__JoinMatchReq.Callback();
                cbMsg.code = code;
                cb.Invoke(cbMsg);
            });
        }
Ejemplo n.º 3
0
        public void SERVER_API__ServerGModule__MatchService__join_match(IMessage msg, Action <IMessage> cb)
        {
#if ENABLE_IL2CPP || !DEBUG || RUNTIME
            var _msg = (__ServerGModule__MatchService__JoinMatchReq)msg;
            this.JoinMatch(_msg.uid, _msg.match_type, (code) =>
            {
                var cbMsg  = new __ServerGModule__MatchService__JoinMatchReq.Callback();
                cbMsg.code = code;
                cb.Invoke(cbMsg);
            });
#else
            dynamic _msg = msg;
            self.JoinMatch(_msg.uid, _msg.match_type, (global::System.Action <global::Shared.Protocol.ErrCode>)((code) =>
            {
                dynamic cbMsg = new __ServerGModule__MatchService__JoinMatchReq.Callback();
                cbMsg.code    = code;
                cb.Invoke(cbMsg);
            }));
#endif
        }