Exemplo n.º 1
0
        //---------------------------------------------------------------------
        public override void enter()
        {
            mfCurSecond = 0.0f;

            // 切换地图
            if (mLevel.CurMapVibId == 0)
            {
                mLevel.CurMapVibId = mLevel.genRandomMap();
            }
            else if (mLevel.NextMapVibId != 0)
            {
                mLevel.CurMapVibId  = mLevel.NextMapVibId;
                mLevel.NextMapVibId = 0;
            }

            // 服务端广播关卡更新
            mScene.getProtocol().s2allcLevelUpdate(_eLevelState.Normal, mLevel.getLevelVibId(),
                                                   mLevel.CurMapVibId, mLevel.NextMapVibId, mfCurSecond, mfMaxSecond);

            if (mIsFistLevel)
            {
                mIsFistLevel = false;
            }
            else
            {
                mLevel.outFormation();
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        // 服务端响应玩家获取场景快照
        public void s2cSnapshotScene(uint et_player_rpcid)
        {
            List <string> vec_param_ret = new List <string>();

            vec_param_ret.Add(((byte)_eProtocolDesktop.s2cSnapshotScene).ToString());
            vec_param_ret.Add(et_player_rpcid.ToString());

            // 关卡信息
            CLogicLevel level = mScene.getLevel();

            vec_param_ret.Add(((byte)level.getLevelState()).ToString());
            vec_param_ret.Add(level.getLevelVibId().ToString());
            vec_param_ret.Add(level.CurMapVibId.ToString());
            vec_param_ret.Add(level.NextMapVibId.ToString());
            vec_param_ret.Add(level.getCurSecond().ToString());
            vec_param_ret.Add(level.getMaxSecond().ToString());
            vec_param_ret.Add(level.isFormation().ToString());

            // 同步房间炮台倍率信息。
            List <int> list_rate = mScene.getListTurretRate();

            vec_param_ret.Add(list_rate.Count.ToString());
            foreach (var i in list_rate)
            {
                vec_param_ret.Add(i.ToString());
            }

            // 炮台信息
            Dictionary <uint, CLogicTurret> map_turret = mScene.getMapTurret();

            vec_param_ret.Add(map_turret.Count.ToString());
            foreach (var i in map_turret)
            {
                _tScenePlayer scene_player = i.Value.getScenePlayerInfo();
                vec_param_ret.Add(scene_player.et_player_rpcid.ToString());
                vec_param_ret.Add(scene_player.nickname);
                int player_gold = mScene.getListener().onLogicSceneGetPlayerGold(scene_player.et_player_rpcid);
                vec_param_ret.Add(player_gold.ToString());
                vec_param_ret.Add(scene_player.rate.ToString());
                vec_param_ret.Add(i.Value.getTurretId().ToString());
                vec_param_ret.Add(i.Value.getBufferPower().ToString());
                vec_param_ret.Add(i.Value.getBufferFreeze().ToString());
                vec_param_ret.Add(i.Value.getBufferLongpress().ToString());
                vec_param_ret.Add(i.Value.getBufferRapid().ToString());
                vec_param_ret.Add(i.Value.getTurretAngle().ToString());
                vec_param_ret.Add(i.Value.getTurretRate().ToString());
                vec_param_ret.Add(((byte)(i.Value.getTurretType())).ToString());
                vec_param_ret.Add(i.Value.getLockFishObjId().ToString());
            }

            mScene.getListener().onLogicScene2Render(et_player_rpcid, vec_param_ret);
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------
        public override void enter()
        {
            mfCurSecond = 0.0f;

            // 切换地图
            if (mLevel.NextMapVibId == 0)
            {
                mLevel.NextMapVibId = mLevel.genRandomMap();
            }
            while (mLevel.NextMapVibId == mLevel.CurMapVibId)
            {
                mLevel.NextMapVibId = mLevel.genRandomMap();
            }

            // 清除所有鱼
            mLevel.clearAllFish();

            // 服务端广播关卡更新
            mScene.getProtocol().s2allcLevelUpdate(_eLevelState.Switch, mLevel.getLevelVibId(),
                                                   mLevel.CurMapVibId, mLevel.NextMapVibId, mfCurSecond, mfMaxSecond);
        }