Esempio n. 1
0
        //-------------------------------------------------------------------------
        void _s2cSnapshotScene(List <string> vec_param)
        {
            EbLog.Note("CRenderProtocol._s2cSnapshotScene()");

            mScene.setInit();

            int  index           = 0;
            uint et_player_rpcid = uint.Parse(vec_param[++index]);

            if (et_player_rpcid != mScene.getMyPlayerId())
            {
                return;
            }

            _eLevelState level_state           = (_eLevelState)(short.Parse(vec_param[++index]));
            int          level_vibid           = int.Parse(vec_param[++index]);
            int          cur_map_vibid         = int.Parse(vec_param[++index]);
            int          next_map_vibid        = int.Parse(vec_param[++index]);
            float        level_run_totalsecond = float.Parse(vec_param[++index]);
            float        level_run_maxsecond   = float.Parse(vec_param[++index]);

            bool level_run_in_formation = bool.Parse(vec_param[++index]);

            mScene.destroyLevel();
            mScene.createLevel(level_state, level_vibid, cur_map_vibid, next_map_vibid, level_run_totalsecond, level_run_maxsecond, level_run_in_formation);

            mScene.destroyAllTurret();

            int        rate_list_count = int.Parse(vec_param[++index]);
            List <int> list_rate       = new List <int>(rate_list_count);

            for (int i = 0; i < rate_list_count; ++i)
            {
                list_rate.Add(int.Parse(vec_param[++index]));
            }

            mScene.setRateList(list_rate);

            int turret_count = int.Parse(vec_param[++index]);

            List <CRenderTurret> turret_list = new List <CRenderTurret>();

            for (int i = 0; i < turret_count; ++i)
            {
                _tScenePlayer scene_player;
                scene_player.et_player_rpcid = uint.Parse(vec_param[++index]);
                scene_player.nickname        = (string)vec_param[++index];
                int player_gold = int.Parse(vec_param[++index]);
                scene_player.is_bot = false;
                scene_player.rate   = float.Parse(vec_param[++index]);
                int   turret_id        = int.Parse(vec_param[++index]);
                bool  buffer_power     = bool.Parse(vec_param[++index]);
                bool  buffer_freeze    = bool.Parse(vec_param[++index]);
                bool  buffer_longpress = bool.Parse(vec_param[++index]);
                bool  buffer_rapid     = bool.Parse(vec_param[++index]);
                float turret_angle     = float.Parse(vec_param[++index]);
                int   turret_rate      = int.Parse(vec_param[++index]);
                TbDataTurret.TurretType turret_type = (TbDataTurret.TurretType)(byte.Parse(vec_param[++index]));
                int locked_fish_objid = int.Parse(vec_param[++index]);

                CRenderTurret turret = mScene.createTurret(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                                                           buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);

                turret_list.Add(turret);

                if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
                {
                    mScene.setMyTurret(turret);
                }
            }

            // 通知场景初始化完成
            mScene.getListener().onSceneSnapshot();

            foreach (var turret in turret_list)
            {
                turret.displayScore();
            }
        }