コード例 #1
0
        //-------------------------------------------------------------------------
        void _s2allcAoeFishDie(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

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

            List <int> die_fish_obj_id = new List <int>();

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

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

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

            CRenderLevel level = mScene.getLevel();

            level.s2allcAoeFishDie(et_player_rpcid, bullet_rate, die_fish_obj_id, effect_fish_vib_id_list);
        }
コード例 #2
0
        //-------------------------------------------------------------------------
        public void onFingerLongPress(Vector2 fire_goal_position)
        {
            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                return;
            }

            bool level_isrun = level.isNormal();

            if (!level_isrun)
            {
                return;
            }

            if (miHighFrequencyCount > 2)
            {
                if (!mRenderBufferMgr.hasBuffer("BufRapid"))
                {
                    List <object> param_list = new List <object>();
                    mRenderBufferMgr.addBuffer("BufRapid", param_list);
                }

                miHighFrequencyCount = 0;
            }
            else
            {
                if (!mRenderBufferMgr.hasBuffer("BufLongpress"))
                {
                    List <object> param_list = new List <object>();
                    mRenderBufferMgr.addBuffer("BufLongpress", param_list);
                }
            }
        }
コード例 #3
0
        //-------------------------------------------------------------------------
        void _s2allcCreateFishLord(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int    index          = 0;
            string lord_file_name = (string)vec_param[++index];
            int    fish_begin_id  = int.Parse(vec_param[++index]);

            int           server_param_count = int.Parse(vec_param[++index]);
            List <string> server_param       = new List <string>();

            for (int i = 0; i < server_param_count; i++)
            {
                server_param.Add(vec_param[++index]);
            }

            CRenderLevel level = mScene.getLevel();

            if (lord_file_name == "RedFish.lord")
            {
                int       red_fish_obj_id = int.Parse(server_param[server_param.Count - 1]);
                EbVector3 pos             = level.getRedFishPosition(red_fish_obj_id);

                if (pos.x < 10000)
                {
                    server_param.Add(pos.x.ToString());
                    server_param.Add(pos.y.ToString());
                }
            }
            mScene.resetRunInFormation();
            level.newFishLord(lord_file_name, server_param, fish_begin_id);
        }
コード例 #4
0
ファイル: RenderScene.cs プロジェクト: zhilianghuang/Fishing
 //-------------------------------------------------------------------------
 public void destroyLevel()
 {
     if (mLevel != null)
     {
         mLevel.Dispose();
         mLevel = null;
     }
 }
コード例 #5
0
        float mfCurSecond   = 0.0f;// 关卡当前运行总秒数

        //---------------------------------------------------------------------
        public CRenderLevelStateSwitch(CRenderScene render_scene, CRenderLevel render_level)
        {
            _defState("CRenderLevelStateSwitch", "EbFsm", 0, false);
            _bindAction("update", new EbAction(this.evUpdate));
            _bindAction("setState", new EbAction(this.evSetState));

            mScene = render_scene;
            mLevel = render_level;
        }
コード例 #6
0
        float mfCurSecond   = 0.0f;// 关卡当前运行总秒数

        //---------------------------------------------------------------------
        public CRenderLevelStateNormal(CRenderScene render_scene, CRenderLevel render_level)
        {
            _defState("CRenderLevelStateNormal", "EbFsm", 0, true);
            _bindAction("update", new EbAction(this.evUpdate));
            _bindAction("setState", new EbAction(this.evSetState));

            mScene = render_scene;
            mLevel = render_level;

            // 因为初始化的时候首先是这个状态先出来,所以在这里加载一下地图
            mLevel.getSpriteLevel().switchBackgroundMap(mLevel.CurMapVibId, 0);
        }
コード例 #7
0
ファイル: RenderScene.cs プロジェクト: zhilianghuang/Fishing
        //-------------------------------------------------------------------------
        public void createLevel(_eLevelState level_state, int level_vibid, int cur_map_vibid,
                                int next_map_vibid, float level_run_totalsecond, float level_run_maxsecond, bool level_run_in_formation)
        {
            mLevel = new CRenderLevel(this, mConfigurePath);
            mLevel.create(level_state, level_vibid, cur_map_vibid, next_map_vibid, level_run_totalsecond, level_run_maxsecond, mJsonPacketList, mRouteJsonPacketList);

            if (level_run_in_formation)
            {
                //getListener().onSceneShowMessageBox("请稍等,大鱼正在游来。。。", false, "", 10, (int)_eMessageBoxLayer.SwitchLevel, false, false);
            }

            mLevelRunInFormation = level_run_in_formation;
        }
コード例 #8
0
        //-------------------------------------------------------------------------
        public void onFingerDragMove(Vector2 fire_goal_position)
        {
            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                return;
            }

            bool level_isrun = level.isNormal();

            if (!level_isrun)
            {
                return;
            }
        }
コード例 #9
0
        //-------------------------------------------------------------------------
        public void update(float elapsed_tm)
        {
            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                return;
            }

            mfTotalSecond += elapsed_tm;

            if (mScene.getMyPlayerId() == mPlayer.et_player_rpcid && !mScene.isSingleMode())
            {
                mfIdleSecond += elapsed_tm;
                if (mfIdleSecond > 60.0f)
                {
                    mfObCountdown -= elapsed_tm;
                    if (mfObCountdown <= 0.0f)
                    {
                        mfIdleSecond  = 0.0f;
                        mfObCountdown = 60.0f;
                        mScene.getListener().onScenePlayerChange2Ob();
                    }
                    else
                    {
                        string str = "由于您一分钟没有发射炮弹 系统将在[ff0000]" + ((int)mfObCountdown).ToString() + "秒[-]后进入[00ffff]观战模式[-]";
                        //mScene.getListener().onSceneShowMessageBox(str, false, "", 1, (int)_eMessageBoxLayer.Ob, false, false);
                    }
                }
                else
                {
                    mfObCountdown = 60.0f;
                }

                if (mRenderBufferMgr.hasBuffer("BufLongpress") || mRenderBufferMgr.hasBuffer("BufRapid"))
                {
                    mfIdleSecond  = 0.0f;
                    mfObCountdown = 60.0f;
                }
            }

            mCSpriteTurretShow.update(elapsed_tm);
            mRenderBufferMgr.update(elapsed_tm);
        }
コード例 #10
0
        //-------------------------------------------------------------------------
        void _s2allcFishDie(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int  index             = 0;
            uint et_player_rpcid   = uint.Parse(vec_param[++index]);
            int  total_score       = int.Parse(vec_param[++index]);
            int  bullet_objid      = int.Parse(vec_param[++index]);
            int  fish_objid        = int.Parse(vec_param[++index]);
            int  effect_fish_vibid = int.Parse(vec_param[++index]);
            int  current_rate      = int.Parse(vec_param[++index]);

            CRenderLevel level = mScene.getLevel();

            level.s2allcFishDie(et_player_rpcid, total_score, bullet_objid, fish_objid, effect_fish_vibid, current_rate);
        }
コード例 #11
0
        //-------------------------------------------------------------------------
        void _s2allcLevelUpdate(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int          index                 = 0;
            _eLevelState level_state           = (_eLevelState)(byte.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]);

            CRenderLevel level = mScene.getLevel();

            level.setup(level_state, level_vibid, cur_map_vibid, next_map_vibid, level_run_totalsecond, level_run_maxsecond);
        }
コード例 #12
0
        //-------------------------------------------------------------------------
        public void onFingerTouch(Vector2 fire_goal_position)
        {
            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                return;
            }

            bool level_isrun = level.isNormal();

            if (!level_isrun)
            {
                return;
            }

            if (getPlayerGold() < mTurretRate)
            {
                goldNotEnough();
                return;
            }

            if (mfTotalSecond - mfLastTouchSecond < mfHighFrequencyTimeSpan)
            {
                miHighFrequencyCount++;
            }
            else
            {
                miHighFrequencyCount = 0;
            }

            if (checkWhetherFire())
            {
                int bullet_objid = genBulletObjId(1);
                doLocalFire(fire_goal_position, bullet_objid, CBulletConstant.ManualSpeed);

                mScene.getProtocol().c2sManualFire(mPlayer.et_player_rpcid, bullet_objid,
                                                   mTurretAngle, mTurretRate, _getLockedFishIdFromLockedBuffer());
            }

            mfLastTouchSecond = mfTotalSecond;
        }
コード例 #13
0
        //-------------------------------------------------------------------------
        public void onFingerUp()
        {
            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                return;
            }

            if (mRenderBufferMgr.hasBuffer("BufRapid"))
            {
                mRenderBufferMgr.removeBuffer("BufRapid");
            }

            if (mRenderBufferMgr.hasBuffer("BufLongpress"))
            {
                mRenderBufferMgr.removeBuffer("BufLongpress");
            }

            mfLastTouchSecond = mfTotalSecond;
        }
コード例 #14
0
        //-------------------------------------------------------------------------
        public override void update(float elapsed_tm)
        {
            if (canDestroy())
            {
                return;
            }

            if (mSpriteFish != null)
            {
                mSpriteFish.update(elapsed_tm);
            }

            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                signDestroy();
                return;
            }

            bool level_isrun = level.isNormal();

            if (!level_isrun)
            {
                signDestroy();
                return;
            }

            CRenderFish fish = mScene.getLevel().getFishByObjId(mLockFishObjId);

            if (fish == null || fish.IsDie || !_isInScene(fish.Position))
            {
                mLockFishObjId = -1;
                signDestroy();
                return;
            }

            mTurret.updateTurretAngle(fish.Position);
        }
コード例 #15
0
        //-------------------------------------------------------------------------
        public override void update(float elapsed_tm)
        {
            if (canDestroy())
            {
                return;
            }

            CRenderLevel level = mScene.getLevel();

            if (level == null)
            {
                signDestroy();
                return;
            }

            bool level_isrun = level.isNormal();

            if (!level_isrun)
            {
                signDestroy();
                return;
            }

            mfTotalSecond += elapsed_tm;

            bool is_me = _isMe();

            if (is_me)
            {
                // 本人发炮,子弹生产者
                if (mfTotalSecond - mfLastFireSecond > mfFireTimeSpan)
                {
                    mfLastFireSecond = mfTotalSecond;

                    if (!InputController.Instance.MouseDown)
                    {
                        signDestroy();
                        return;
                    }

                    if (mTurret.getPlayerGold() < mTurret.getTurretRate())
                    {
                        mTurret.goldNotEnough();
                        return;
                    }

                    if (mTurret.checkWhetherFire())
                    {
                        Vector2 mouse_pos    = InputController.Instance.CurrentMousePosition;
                        int     bullet_objid = mTurret.genBulletObjId(1);
                        mTurret.doLocalFire(mouse_pos, bullet_objid, CBulletConstant.AutoRapidSpeed);

                        _tBullet bullet;
                        bullet.bullet_objid      = bullet_objid;
                        bullet.turret_angle      = mTurret.getTurretAngle();
                        bullet.turret_rate       = mTurret.getTurretRate();
                        bullet.locked_fish_objid = mTurret.getLockFishObjId();
                        mQueBullet.Enqueue(bullet);
                    }

                    if (miLeftBulletObjIdNum > 0)
                    {
                        miLeftBulletObjIdNum--;
                    }
                    else
                    {
                        //signDestroy();

                        // 极速转长按
                        CRenderBufferMgr buf_mgr = mTurret.getBufferMgr();
                        buf_mgr.removeBuffer("BufRapid");
                        if (!buf_mgr.hasBuffer("BufLongpress"))
                        {
                            List <object> param_list = new List <object>();
                            buf_mgr.addBuffer("BufLongpress", param_list);
                        }
                    }
                }
            }
            else
            {
                // 他人发炮,子弹消费者
                if (mfTotalSecond - mfLastFireSecond > mfFireTimeSpan)
                {
                    mfLastFireSecond = mfTotalSecond;

                    if (mQueBullet.Count > 0)
                    {
                        _tBullet bullet = mQueBullet.Dequeue();
                        mTurret.setLockFishByFishObjId(bullet.locked_fish_objid);
                        mTurret.setTurretAngle(bullet.turret_angle);
                        mTurret.setTurretRate(bullet.turret_rate);
                        mTurret.doOtherFire(bullet.bullet_objid, CBulletConstant.AutoRapidSpeed);
                    }
                }
            }

            // 如果是本人,则按5Hz的频率进行自动发炮的网络同步
            if (is_me)
            {
                if (mfTotalSecond - mfLastSyncSecond > mfSyncTimeSpan)
                {
                    mfLastSyncSecond = mfTotalSecond;

                    mScene.getProtocol().c2sAutoFire(mTurret.getScenePlayerInfo().et_player_rpcid, mQueBullet);
                }
            }
        }