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

            foreach (var i in mMapPlayerTurret)
            {
                i.Value.Dispose();
            }
            mMapPlayerTurret.Clear();

            if (mSceneBox != null)
            {
                mSceneBox = null;
            }

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

            if (mColliderMgr != null)
            {
                mColliderMgr.destroy();
                mColliderMgr = null;
            }
        }
コード例 #2
0
ファイル: LogicScene.cs プロジェクト: zhilianghuang/Fishing
        //---------------------------------------------------------------------
        public void create(int default_level_vibid, float level_rate, bool single, bool fish_mustdie,
                           ILogicListener listener, float pumping_rate, List <int> list_turret_rate,
                           List <JsonPacket> json_packet_list, List <RouteJsonPacket> route_json_packet_list)
        {
            mProtocol       = new CLogicProtocol(this);
            mSceneBox       = new CSceneBox();
            mListener       = listener;
            mbSingle        = single;
            mfPumpingRate   = pumping_rate;
            mbFishMustDie   = fish_mustdie;
            mListTurretRate = list_turret_rate;

            // 初始化关卡
            if (default_level_vibid != -1)
            {
                mLevel = new CLogicLevel(this);
                mLevel.create(default_level_vibid, level_rate, json_packet_list, route_json_packet_list);
            }

            // 初始化特效管理器
            mEffectMgr = new CEffectMgr();
            mEffectMgr.regEffectFactory(new EffectSpreadFishFactory());
            mEffectMgr.regEffectFactory(new EffectTimeStopFactory());
            mEffectMgr.regEffectFactory(new LogicEffectLightingChainFactory());
            mEffectMgr.regEffectFactory(new LogicEffectFullScreenBombFactory());
            mEffectMgr.regEffectFactory(new LogicEffectAOEFactory());

            mColliderMgr = new TagColliderMgr();
        }
コード例 #3
0
        //---------------------------------------------------------------------
        public CLogicLevelStateNormal(CLogicScene logic_scene, CLogicLevel logic_level)
        {
            _defState("CLogicLevelStateNormal", "EbFsm", 0, true);
            _bindAction("update", new EbAction(this.evUpdate));

            mScene = logic_scene;
            mLevel = logic_level;
        }
コード例 #4
0
        const float mfMaxSecond = 3.5f; // 关卡最大运行总秒数

        //---------------------------------------------------------------------
        public CLogicLevelStateSwitch(CLogicScene logic_scene, CLogicLevel logic_level)
        {
            _defState("CLogicLevelStateSwitch", "EbFsm", 0, false);
            _bindAction("update", new EbAction(this.evUpdate));

            mScene = logic_scene;
            mLevel = logic_level;
        }
コード例 #5
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);
        }