コード例 #1
0
ファイル: CellDesktop.cs プロジェクト: zhilianghuang/Fishing
    //-------------------------------------------------------------------------
    public override void update(float elapsed_tm)
    {
        if (LogicScene != null)
        {
            LogicScene.update(elapsed_tm);
        }

        // 更新座位上所有玩家
        foreach (var i in AllSeat)
        {
            if (i.et_playermirror != null)
            {
                i.et_playermirror.update(elapsed_tm);
            }
        }

        while (QueAoIEvent.Count > 0)
        {
            var ev_aoi = QueAoIEvent.Dequeue();

            DesktopNotify desktop_notify;
            desktop_notify.id   = DesktopNotifyId.PlayerSceneAoIUpdate;
            desktop_notify.data = EbTool.protobufSerialize <_tAoIEvent>(ev_aoi);

            StreamData sd = new StreamData();
            sd.event_id = StreamEventId.DesktopStreamEvent;
            sd.param1   = desktop_notify;
            var grain_desktop = Entity.getUserData <GrainCellDesktop>();
            grain_desktop.AsyncStream.OnNextAsync(sd);
        }
    }
コード例 #2
0
 public void ExitScene()
 {
     if (m_logicScene != null)
     {
         m_logicScene.Release();
     }
     m_logicScene = null;
 }
コード例 #3
0
 public void CreateScene()
 {
     if (m_logicScene != null)
     {
         this.ExitScene();
     }
     m_logicScene = new LogicScene();
 }
コード例 #4
0
ファイル: CellDesktop.cs プロジェクト: zhilianghuang/Fishing
    //-------------------------------------------------------------------------
    public override void release()
    {
        if (LogicScene != null)
        {
            LogicScene.Dispose();
            LogicScene = null;
        }

        AllSeat = null;
    }
コード例 #5
0
ファイル: CellDesktop.cs プロジェクト: zhilianghuang/Fishing
    //---------------------------------------------------------------------
    // 玩家操作请求
    public Task s2sPlayerActionRequest(string player_etguid, List <string> vec_param)
    {
        LogicScene.sceneOnRecvFromRender(vec_param);

        return(TaskDone.Done);
    }
コード例 #6
0
ファイル: CellDesktop.cs プロジェクト: zhilianghuang/Fishing
    //-------------------------------------------------------------------------
    // 玩家进入桌子
    public Task <DesktopData> s2sPlayerEnter(DesktopRequestPlayerEnter request_enter, EntityData etdata_playermirror)
    {
        byte seat_index = request_enter.seat_index;

        if (getPlayerCountInSeat() >= DesktopConfigData.seat_num)
        {
            // 没有空座位了,观战
            seat_index = 255;
        }

        if (!isValidSeatIndex(seat_index))
        {
            // 座位索引范围不合法,重新分配空座位
            foreach (var i in AllSeat)
            {
                if (i.et_playermirror == null)
                {
                    seat_index = i.index;
                    break;
                }
            }
        }

        if (isValidSeatIndex(seat_index) && AllSeat[seat_index].et_playermirror != null)
        {
            // 座位上已经有人坐了,重新分配空座位
            foreach (var i in AllSeat)
            {
                if (i.et_playermirror == null)
                {
                    seat_index = i.index;
                    break;
                }
            }
        }

        var et_playermirror = EntityMgr.genEntity <EtPlayerMirror, Entity>(etdata_playermirror, Entity);
        var co_actormirror  = et_playermirror.getComponent <CellActorMirror <DefActorMirror> >();
        var co_ai           = et_playermirror.getComponent <CellActorMirrorAi <DefActorMirrorAi> >();

        byte actorid_indesktop = _genPlayerId();

        co_actormirror.Def.PropActorIdInDesktop.set(actorid_indesktop);

        EbLog.Note("CellDesktop.s2sPlayerEnter() PlayerEtGuid=" + et_playermirror.Guid);

        MapAllPlayer1[actorid_indesktop]   = et_playermirror;
        MapAllPlayer[et_playermirror.Guid] = et_playermirror;
        if (isValidSeatIndex(seat_index))
        {
            AllSeat[seat_index].et_playermirror = et_playermirror;
        }

        co_actormirror.onEnterDesktop(seat_index);

        // 更新DesktopInfo
        refreshDesktopInfo();

        // 广播玩家进入桌子
        DesktopNotify desktop_notify;

        desktop_notify.id   = DesktopNotifyId.PlayerEnter;
        desktop_notify.data = EbTool.protobufSerialize <EntityData>(et_playermirror.genEntityData4All());

        StreamData sd = new StreamData();

        sd.event_id = StreamEventId.DesktopStreamEvent;
        sd.param1   = desktop_notify;
        var grain_desktop = Entity.getUserData <GrainCellDesktop>();

        grain_desktop.AsyncStream.OnNextAsync(sd);

        // 通知场景玩家坐下
        LogicScene.scenePlayerEnter(actorid_indesktop, 1, "aabb", false, -1, TbDataTurret.TurretType.NormalTurret);
        float player_rate = 1.0f;// mEtDesktopPumping.getPlayerUpgradeRate();// 抽水率

        LogicScene.scenePlayerRateChanged(1, player_rate);

        DesktopData desktop_data = _getDesktopData();

        return(Task.FromResult(desktop_data));
    }