Beispiel #1
0
        //---------------------------------------------------------------------
        // Client->Cell的请求
        async Task <MethodData> ICellPlayer.c2sRequest(MethodData method_data)
        {
            var        co_player = EtPlayer.getComponent <CellPlayer <DefPlayer> >();
            MethodData result    = await co_player.c2sRequest(method_data);

            return(result);
        }
Beispiel #2
0
        //---------------------------------------------------------------------
        // Cell->Cell的请求
        Task ICellPlayer.s2sDesktop2Player(List <string> vec_param)
        {
            if (EtPlayer == null)
            {
                return(TaskDone.Done);
            }

            var co_playerdesktop = EtPlayer.getComponent <CellPlayerDesktop <DefPlayerDesktop> >();

            return(co_playerdesktop.s2sDesktop2Player(vec_param));
        }
Beispiel #3
0
        //---------------------------------------------------------------------
        async Task ICellPlayer.unsubPlayer(ICellPlayerObserver sub)
        {
            bool is_sub = Subscribers.IsSubscribed(sub);

            if (is_sub)
            {
                Subscribers.Unsubscribe(sub);
            }

            // 通知EtPlayer服务端:客户端断开了
            if (Subscribers.Count == 0 && EtPlayer != null)
            {
                var co_player = EtPlayer.getComponent <CellPlayer <DefPlayer> >();
                await co_player.c2sClientDeattach();

                DeactivateOnIdle();
            }
        }
Beispiel #4
0
        //---------------------------------------------------------------------
        Task ICellPlayer.subPlayer(ICellPlayerObserver sub, IPEndPoint remote_endpoint)
        {
            if (Subscribers.Count > 0)
            {
                Logger.Info("subPlayer() 重复登陆,踢出前一帐号 Subscribers.Count={0}", Subscribers.Count);

                AccountNotify account_notify;
                account_notify.id   = AccountNotifyId.Logout;
                account_notify.data = EbTool.protobufSerialize <ProtocolResult>(ProtocolResult.LogoutNewLogin);

                MethodData notify_data = new MethodData();
                notify_data.method_id = MethodType.s2cAccountNotify;
                notify_data.param1    = EbTool.protobufSerialize <AccountNotify>(account_notify);
                Subscribers.Notify((s) => s.s2cNotify(notify_data));
            }

            Subscribers.Subscribe(sub);

            var co_player = EtPlayer.getComponent <CellPlayer <DefPlayer> >();

            co_player.c2sClientAttach(remote_endpoint);

            return(TaskDone.Done);
        }