Example #1
0
        //-------------------------------------------------------------------------
        public void create(int turret_id, ref _tScenePlayer scene_player, int player_gold,
                           bool buffer_power, bool buffer_freeze, bool buffer_longpress, bool buffer_rapid, int turret_rate, float turret_angle, int locked_fish_objid
                           , TbDataTurret.TurretType turret_type)
        {
            mTurretId    = turret_id;
            mPlayer      = scene_player;
            mTurretAngle = turret_angle;

            mTurretType      = turret_type;
            mTurretDataTable = new TurretDataTable();

            _setTurretRate(turret_rate);

            CTurretHelper turret_helper = mScene.getTurretHelper();

            mTurretPos = turret_helper.getPositionByOffset(turret_id,
                                                           mScene.getRenderConfigure().TurretOffset);
            mBaseAngle   = turret_helper.getBaseAngleByTurretId(turret_id);
            mTurretColor = turret_helper.getBaseColorByTurretId(turret_id).convert();

            float scene_length = mScene.getSceneLength();
            float scene_width  = mScene.getSceneWidth();

            mCSpriteTurretShow = new CSpriteTurretShow();
            mCSpriteTurretShow.create(mScene, this);

            _displayTurretRate();

            mRenderBufferMgr = new CRenderBufferMgr(mScene, this,
                                                    turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretBufferOffset), mBaseAngle);
            setLockFishByFishObjId(locked_fish_objid);

            if (buffer_power)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufPower", param_list);
            }

            if (buffer_freeze)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufFreeze", param_list);
            }

            if (buffer_longpress)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufLongpress", param_list);
            }

            if (buffer_rapid)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufRapid", param_list);
            }

            mScene.getListener().onSceneTurretCreated(mTurretId);
        }
        //---------------------------------------------------------------------
        public override void enter()
        {
            IRenderListener listener = mScene.getListener();

            if (listener != null)
            {
                //listener.onSceneShowMessageBox("进入新关卡", false, "", 2, (int)_eMessageBoxLayer.EnterNewLevel);
            }
        }
Example #3
0
        //-------------------------------------------------------------------------
        public void update(float elapsed_tm)
        {
            mfTotalSecond += elapsed_tm;
            if (mfTotalSecond - mfLastUpdateSecond > mfUpdateTimeSpan)
            {
                mfLastUpdateSecond = mfTotalSecond;

                List <string> vec_param = new List <string>();
                vec_param.Add(((byte)_eProtocolDesktop.c2sRenderUpdate).ToString());
                vec_param.Add(mQueProtocol.Count.ToString());
                while (mQueProtocol.Count > 0)
                {
                    List <string> l = mQueProtocol.Dequeue();
                    vec_param.Add(l.Count.ToString());
                    vec_param.AddRange(l);
                }

                mScene.getListener().onSceneRender2Logic(vec_param);
            }
        }
Example #4
0
        //-----------------------------------------------------------------------------
        public string evUpdate(IEbEvent ev)
        {
            EbEvent1 <float> e          = (EbEvent1 <float>)ev;
            float            elapsed_tm = e.param1;

            mfCurSecond += elapsed_tm;

            IRenderListener listener = mScene.getListener();

            if (listener != null)
            {
                listener.onSceneShowMessageBox("鱼潮来临!!!", false, "", 1, (int)0, false, false);//_eMessageBoxLayer.SwitchLevel
            }

            return("");
        }