//-------------------------------------------------------------------------
        public override void create(Dictionary <string, object> param)
        {
            mMapParam = param;
            mScene    = mMapParam["RenderScene"] as CRenderScene;

            if (mMapParam.ContainsKey("SourcePosition"))
            {
                mSourcePosition = (EbVector3)mMapParam["SourcePosition"];
            }

            if (mMapParam.ContainsKey("DestPosition"))
            {
                mDestPosition = (EbVector3)mMapParam["DestPosition"];
            }
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------
        public override void release()
        {
            foreach (var i in MapEtActorMirrorByGuid)
            {
                i.Value.close();
            }
            MapEtActorMirrorByGuid.Clear();

            AllSeat = null;

            if (Scene != null)
            {
                Scene.Dispose();
                Scene = null;
            }

            EbLog.Note("ClientPlayerDesktop.release()");
        }
Esempio n. 3
0
        //---------------------------------------------------------------------
        public void create(CRenderScene scene, TbDataFish vib_fish_data)
        {
            mScene        = scene;
            mVibFishData  = vib_fish_data;
            mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;

            bool has_cycle = !string.IsNullOrEmpty(mVibFishData.CycleAnimationName);

            for (int i = 0; i < mFishNumber; i++)
            {
                mFishs.Add(mScene.getRenderObjectPool().newFishStillSprite());
                if (has_cycle)
                {
                    mRedBottom = new CSpriteRedBottom();
                    mRedBottom.create(mScene, this, mVibFishData);
                }
            }

            foreach (var it in mFishs)
            {
                it.init(this, scene);
            }

            float fish_scale = ((float)mVibFishData.FishHeight / (float)mVibFishData.FishPixelHeight);

            foreach (var it in mFishs)
            {
                it.setScale(0.7f * fish_scale);
            }

            playAnimation(mVibFishData.FishAnimMove);

            if (mVibFishData.Red == TbDataFish.IsRed.YES)
            {
                mInitColor = new Color(1, 0, 0);
                resetColor(1);
            }
        }
Esempio n. 4
0
 //-------------------------------------------------------------------------
 public CRenderFish(CRenderScene render_scene)
 {
     mScene = render_scene;
 }
Esempio n. 5
0
 //-------------------------------------------------------------------------
 public CRenderBufferPower(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     mTurret.setBarrelColor(new Color(1, 0, 0));
 }
Esempio n. 6
0
 //-------------------------------------------------------------------------
 public CRenderTurret(CRenderScene render_scene)
 {
     mScene = render_scene;
 }
Esempio n. 7
0
        //-------------------------------------------------------------------------
        // 桌子通知
        void s2cPlayerDesktopNotify(DesktopNotify desktop_notify)
        {
            switch (desktop_notify.id)
            {
            case DesktopNotifyId.DesktopInit:    // 桌子初始化
            {
                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() DesktopInit");

                CoPlayer.CoPlayerLobby.hideLobby();

                clearDesktop();

                var desktop_data = EbTool.protobufDeserialize <DesktopData>(desktop_notify.data);

                DesktopConfigData = desktop_data.desktop_cfg_data;
                //UiMbPlayDesktop ui_desk = UiMgr.Instance.createUi<UiMbPlayDesktop>(_eUiLayer.Background);
                //ui_desk.setDeskInfo(this, 60f);

                byte index = 0;
                AllSeat = new SeatInfo[DesktopConfigData.seat_num];
                foreach (var i in AllSeat)
                {
                    SeatInfo seat_info = new SeatInfo();
                    seat_info.index           = index;
                    seat_info.et_playermirror = null;
                    AllSeat[index]            = seat_info;
                    index++;
                }

                EntityData me_data = desktop_data.list_actormirror.Find((EntityData entity_data) =>
                    {
                        return(entity_data.entity_guid.Equals(CoPlayer.Entity.Guid));
                    });

                _initActorMirror(me_data);

                foreach (var i in desktop_data.list_actormirror)
                {
                    if (i.entity_guid.Equals(CoPlayer.Entity.Guid))
                    {
                        continue;
                    }

                    _initActorMirror(i);
                }

                var            co_me    = MeMirror.getComponent <ClientActorMirror <DefActorMirror> >();
                byte           me_id    = co_me.Def.PropActorIdInDesktop.get();
                RenderListener listener = new RenderListener(this);
                Scene = new CRenderScene();
                //var loading = UiMgr.Instance.createUi<UiMbLoading>(_eUiLayer.Loading);
                //Scene.onSceneLoading = loading.setLoadProgress;//null;//ui_mgr.getLoading().setRateOfProgress;
                //Scene.create(mMyPlayerId, mbSingle, false, listener, "RenderSceneConfigure.json",
                //    new JsonPacketReader("Media/Fishing/FishLord/").readJsonPacketList(),
                //    new JsonPacketReader("Media/Fishing/Route/").readRouteJsonPacketList());
            }
            break;

            case DesktopNotifyId.PlayerSceneAction:    // 玩家场景操作
            {
                var vec_param = EbTool.protobufDeserialize <List <string> >(desktop_notify.data);

                if (Scene != null)
                {
                    Scene.sceneOnRecvFromLogic(vec_param);
                }
            }
            break;

            case DesktopNotifyId.PlayerSceneAoIUpdate:    // 玩家场景广播
            {
                var ev_aoi = EbTool.protobufDeserialize <_tAoIEvent>(desktop_notify.data);

                if (Scene != null && Init)
                {
                    Scene.sceneOnRecvAoIFromLogic(ev_aoi.vec_param);
                }
            }
            break;

            case DesktopNotifyId.PlayerChat:    // 玩家聊天广播
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                var msg_recv = EbTool.protobufDeserialize <ChatMsgRecv>(desktop_notify.data);

                Entity et_playermirror = null;
                MapEtActorMirrorByGuid.TryGetValue(msg_recv.et_player_guid_send, out et_playermirror);
                if (et_playermirror != null)
                {
                    var co_playermirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    co_playermirror.desktopChat(msg_recv);
                }
            }
            break;

            case DesktopNotifyId.PlayerEnter:    // 玩家进入桌子
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                EntityData et_playermirror_data = EbTool.protobufDeserialize <EntityData>(desktop_notify.data);

                if (MapEtActorMirrorByGuid.ContainsKey(et_playermirror_data.entity_guid))
                {
                    return;
                }

                var et_playermirror = EntityMgr.genEntity <EtPlayerMirror, Entity>(et_playermirror_data, Entity);
                var co_actormirror  = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                MapEtActorMirrorByGuid[et_playermirror.Guid] = et_playermirror;

                //byte seat_index = co_actormirror.Def.mPropSeatIndex.get();
                //if (isValidSeatIndex(seat_index))
                //{
                //    AllSeat[seat_index].et_playermirror = et_playermirror;
                //}

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerEnter PlayerEtGuid=" + et_playermirror.Guid);
            }
            break;

            case DesktopNotifyId.PlayerLeave:    // 玩家离开桌子
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                string player_et_guid = EbTool.protobufDeserialize <string>(desktop_notify.data);

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerLeave PlayerEtGuid=" + player_et_guid);

                Entity et_playermirror = null;
                if (MapEtActorMirrorByGuid.TryGetValue(player_et_guid, out et_playermirror))
                {
                    var co_actormirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    MapEtActorMirrorByGuid.Remove(player_et_guid);

                    foreach (var i in AllSeat)
                    {
                        if (i.et_playermirror != null && i.et_playermirror.Guid == player_et_guid)
                        {
                            i.et_playermirror = null;
                            break;
                        }
                    }

                    et_playermirror.close();
                }
            }
            break;

            case DesktopNotifyId.PlayerOb:    // 玩家Ob
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                string player_etguid = EbTool.protobufDeserialize <string>(desktop_notify.data);

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerOb PlayerEtGuid=" + player_etguid);

                Entity et_playermirror = null;
                if (MapEtActorMirrorByGuid.TryGetValue(player_etguid, out et_playermirror))
                {
                    var co_actormirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    co_actormirror.playerOb();
                }
            }
            break;

            case DesktopNotifyId.PlayerSitdown:    // 玩家坐下
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                var sitdown_data = EbTool.protobufDeserialize <PlayerSitdownData>(desktop_notify.data);

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerSitdown PlayerEtGuid=" + sitdown_data.player_etguid);

                Entity et_playermirror = null;
                if (MapEtActorMirrorByGuid.TryGetValue(sitdown_data.player_etguid, out et_playermirror))
                {
                    var co_actormirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    co_actormirror.playerSitdown(sitdown_data.seat_index, sitdown_data.stack, sitdown_data.state);
                }
            }
            break;

            case DesktopNotifyId.PlayerWaitWhile:    // 玩家暂离
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                var waitwhile_data = EbTool.protobufDeserialize <PlayerWaitWhileData>(desktop_notify.data);

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerWaitWhile PlayerEtGuid=" + waitwhile_data.player_etguid);

                Entity et_playermirror = null;
                if (MapEtActorMirrorByGuid.TryGetValue(waitwhile_data.player_etguid, out et_playermirror))
                {
                    var co_actormirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    co_actormirror.playerWaitWhile(waitwhile_data.wait_while_tm);
                }
            }
            break;

            case DesktopNotifyId.PlayerReturn:    // 玩家返回
            {
                if (string.IsNullOrEmpty(DesktopConfigData.desktop_etguid))
                {
                    return;
                }

                var return_data = EbTool.protobufDeserialize <PlayerReturnData>(desktop_notify.data);

                EbLog.Note("ClientPlayerDesktop.s2cPlayerDesktopNotify() PlayerReturn PlayerEtGuid=" + return_data.player_etguid);

                Entity et_playermirror = null;
                if (MapEtActorMirrorByGuid.TryGetValue(return_data.player_etguid, out et_playermirror))
                {
                    var co_actormirror = et_playermirror.getComponent <ClientActorMirror <DefActorMirror> >();
                    co_actormirror.playerReturn(return_data.stack, return_data.state);
                }
            }
            break;

            default:
                break;
            }
        }
Esempio n. 8
0
 //-------------------------------------------------------------------------
 public CRenderLevel(CRenderScene render_scene, string configure_filepath)
 {
     mScene = render_scene;
 }
Esempio n. 9
0
 //-------------------------------------------------------------------------
 public SpriteFishFactory(CRenderScene scene)
 {
     mScene = scene;
 }
Esempio n. 10
0
 //-------------------------------------------------------------------------
 public CRenderFishFactory(CRenderScene scene)
 {
     mScene = scene;
 }
 //-------------------------------------------------------------------------
 public void create(CRenderScene scene)
 {
     mScene = scene;
 }
Esempio n. 12
0
 //-------------------------------------------------------------------------
 public CRenderObjectPool(CRenderScene scene)
 {
     mFishSpritePool.create(scene);
     mStillSpritePool.create(scene);
 }
Esempio n. 13
0
 //-------------------------------------------------------------------------
 public CRenderBullet(CRenderScene render_scene)
 {
     mScene = render_scene;
 }
Esempio n. 14
0
 //-------------------------------------------------------------------------
 public virtual void create(CRenderScene scene, TbDataFish vib_fish_data)
 {
     mScene        = scene;
     mVibFishData  = vib_fish_data;
     mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;
 }
Esempio n. 15
0
 //-------------------------------------------------------------------------
 public CRenderBufferLock(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string animation_name)
     : base(scene, turret, name, param, animation_name)
 {
     mScene = scene;
     resetLockedFishObjId((int)param[0]);
 }
Esempio n. 16
0
 //-------------------------------------------------------------------------
 public CRenderBufferFreeze(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     //mScene.getListener().onSceneShowInfo("创建冻结buffer");
 }