Beispiel #1
0
        //-------------------------------------------------------------------------
        void _s2allcAutoFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

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

            Queue <_tBullet> que_bullet = new Queue <_tBullet>();

            for (int i = 0; i < bullet_count; ++i)
            {
                _tBullet bullet;
                bullet.bullet_objid      = int.Parse(vec_param[++index]);
                bullet.turret_angle      = float.Parse(vec_param[++index]);
                bullet.turret_rate       = int.Parse(vec_param[++index]);
                bullet.locked_fish_objid = int.Parse(vec_param[++index]);
                que_bullet.Enqueue(bullet);
            }

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcAutoFire(que_bullet);
            }
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        void _s2allcEfxFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int       index              = 0;
            uint      et_player_rpcid    = uint.Parse(vec_param[++index]);
            int       bullet_vibid       = int.Parse(vec_param[++index]);
            int       bullet_objid       = int.Parse(vec_param[++index]);
            float     level_total_second = float.Parse(vec_param[++index]);
            float     turret_angle       = float.Parse(vec_param[++index]);
            int       turret_rate        = int.Parse(vec_param[++index]);
            float     posX = float.Parse(vec_param[++index]);
            float     posY = float.Parse(vec_param[++index]);
            float     posZ = float.Parse(vec_param[++index]);
            EbVector3 pos  = new EbVector3(posX, posY, posZ);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcEfxFire(bullet_vibid, bullet_objid, level_total_second, turret_angle, turret_rate, pos);
            }
        }
Beispiel #3
0
        public LinkLockedFishFeature(CRenderScene scene, CRenderTurret turret)
        {
            mCRenderTurret = turret;
            mScene         = scene;

            mLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.LinkLockedFish);

            mArrow = mScene.getRenderObjectPool().newStillSprite();
            mArrow.setScale(0.5f);
            mArrow.playAnimation("locking_line_array");
            mArrow.setColor(mCRenderTurret.getTurretColor());
            mArrow.setLayer(mLayer);

            mNumber = mScene.getRenderObjectPool().newStillSprite();
            mNumber.setScale(1f);
            mNumber.playAnimation("locking_line_target_" + mCRenderTurret.getTurretId());
            mNumber.setColor(mCRenderTurret.getTurretColor());

            mNumber.setLayer(mLayer);

            setActive(false);

#if UNITY_EDITOR
            mArrow.gameObject.name  = "TkSpriteLinkLocked_locking_line_array";
            mNumber.gameObject.name = "TkSpriteLinkLocked_locking_line_target_" + mCRenderTurret.getTurretId();
#endif
        }
Beispiel #4
0
 //-------------------------------------------------------------------------
 public CRenderBufferMgr(CRenderScene scene, CRenderTurret turret, EbVector3 position, float up_angle)
 {
     mScene      = scene;
     mTurret     = turret;
     mFisrtPoint = position;
     mUpAngle    = up_angle;
 }
Beispiel #5
0
 //-------------------------------------------------------------------------
 public void destroyAllTurret()
 {
     foreach (var i in mMapPlayerTurret)
     {
         i.Value.Dispose();
     }
     mMapPlayerTurret.Clear();
     mMyTurret = null;
 }
        //-------------------------------------------------------------------------
        public CRenderBufferRapid(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
            : base(scene, turret, name, param, prefab_name)
        {
            if (_isMe())
            {
                mScene.getProtocol().c2sBeginRapid(mScene.getMyPlayerId());
            }

            //mScene.getListener().onSceneShowInfo("开始极速发炮");
        }
Beispiel #7
0
        //-------------------------------------------------------------------------
        public void setTurret(uint et_player_rpcid, TbDataTurret.TurretType turret_type)
        {
            CRenderTurret turret = getTurret(et_player_rpcid);

            if (turret == null)
            {
                return;
            }
            turret.setTurret(turret_type);
        }
Beispiel #8
0
        //-------------------------------------------------------------------------
        public CRenderBuffer(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string animation_name)
        {
            mScene         = scene;
            mTurret        = turret;
            mName          = name;
            mParam         = param;
            mAnimationName = animation_name;

            _initCSprite(mName, "CSpriteBuffer" + mTurret.getTurretId().ToString());
        }
Beispiel #9
0
        //-------------------------------------------------------------------------
        public CRenderTurret createTurret(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)
        {
            CRenderTurret turret = new CRenderTurret(this);

            turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                          buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
            mMapPlayerTurret[scene_player.et_player_rpcid] = turret;
            return(turret);
        }
Beispiel #10
0
        //-------------------------------------------------------------------------
        void _s2allcPlayerEnter(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int           index = 0;
            _tScenePlayer scene_player;

            scene_player.et_player_rpcid = uint.Parse(vec_param[++index]);
            scene_player.nickname        = (string)vec_param[++index];
            scene_player.is_bot          = false;
            int player_gold = int.Parse(vec_param[++index]);

            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)(short.Parse(vec_param[++index]));
            int locked_fish_objid = int.Parse(vec_param[++index]);

            Dictionary <uint, CRenderTurret> map_turret = mScene.getMapTurret();

            if (map_turret.ContainsKey(scene_player.et_player_rpcid))
            {
                map_turret[scene_player.et_player_rpcid].Dispose();
                map_turret.Remove(scene_player.et_player_rpcid);
            }

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

            CRenderTurret turret = new CRenderTurret(mScene);

            turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                          buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
            map_turret[scene_player.et_player_rpcid] = turret;

            if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
            {
                mScene.setMyTurret(turret);
            }
        }
Beispiel #11
0
        //-------------------------------------------------------------------------
        // 服务端广播消息:鱼死亡
        public void s2allcFishDie(uint et_player_rpcid, int total_score,
                                  int bullet_objid, int fish_objid, int effect_fish_vibid, int current_rate)
        {
            CRenderFish fish = (CRenderFish)mBaseFishLordMgr.findBaseEntity(fish_objid);

            if (fish != null)
            {
                //fish.signDestroy();
                // 销毁鱼
                fish.dieWithTotalScore(et_player_rpcid, total_score);

                // 更新金币和筹码
                CRenderTurret turret = mScene.getTurret(et_player_rpcid);
                if (turret != null)
                {
                    //turret.setPlayerGold(gold);

                    TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(fish.FishVibId);
                    if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.Turnplate)
                    {
                        //turret.displayScoreTurnplate(total_score, fish_data.TurnplateParticle.Data);
                    }
                    else if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.Chips)
                    {
                        turret.displayChips(total_score);
                    }
                    else if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.ChipsAndTurnplate)
                    {
                        turret.displayChips(total_score);
                        //turret.displayScoreTurnplate(total_score, fish_data.TurnplateParticle.Data);
                    }
                }
            }

            // 销毁子弹
            if (mMapBullet.ContainsKey(et_player_rpcid))
            {
                Dictionary <int, CRenderBullet> m = mMapBullet[et_player_rpcid];
                if (!m.ContainsKey(bullet_objid))
                {
                    return;
                }
                m[bullet_objid].signDestroy();
            }
            else
            {
                //Debug.LogError("CRenderLevel::s2allcFishDie() not found player_id=" + player_id + " when signdestroy bullet");
            }
        }
Beispiel #12
0
        //-------------------------------------------------------------------------
        void _s2allcEndPower(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

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

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcEndPower();
            }
        }
Beispiel #13
0
        //-------------------------------------------------------------------------
        void _s2allcLockFish(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

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

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcLockFish(locked_fish_id);
            }
        }
Beispiel #14
0
        //-------------------------------------------------------------------------
        void _s2allcManualFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int   index           = 0;
            uint  et_player_rpcid = uint.Parse(vec_param[++index]);
            int   bullet_objid    = int.Parse(vec_param[++index]);
            float turret_angle    = float.Parse(vec_param[++index]);
            int   turret_rate     = int.Parse(vec_param[++index]);
            int   locked_fish_id  = int.Parse(vec_param[++index]);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcManualFire(bullet_objid, turret_angle, turret_rate, locked_fish_id);
            }
        }
Beispiel #15
0
 //-------------------------------------------------------------------------
 public CRenderBufferPower(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     mTurret.setBarrelColor(new Color(1, 0, 0));
 }
Beispiel #16
0
        //-------------------------------------------------------------------------
        void _die(uint et_player_rpcid, int total_score)
        {
            if (mIsDie)
            {
                return;
            }

            mPlayerId   = et_player_rpcid;
            mTotalScore = total_score;

            mSpriteFreeFromTimeFactor = true;

            // 播放鱼死亡时候的粒子特效
            mFishParticleMgr.fishDie();

            // 显示掉落金币数字
            if (total_score > 0)
            {
                CSpriteFishDieScore score = CSpriteFishDieScore.getScore(mScene, mMassEntity.Position, total_score, 2);//待整理
            }

            // 播放鱼死亡时触发的特效
            foreach (var it in mVibFish.Effects)
            {
                int vib_compose_id = it.Id;

                if (vib_compose_id <= 0)
                {
                    continue;
                }

                Dictionary <string, object> param = new Dictionary <string, object>();
                param.Add("SourcePosition", mMassEntity.Position);
                param.Add("SourceAngle", 0f);
                param.Add("PlayerId", et_player_rpcid);
                CRenderTurret turret = mScene.getTurret(et_player_rpcid);
                if (turret != null)
                {
                    param.Add("DestPosition", turret.getTurretPos());
                }
                else
                {
                    param.Add("DestPosition", mMassEntity.Position);
                }
                param.Add("IsFishDie", true);
                mScene.addEffect(vib_compose_id, param, EffectTypeEnum.Client);
            }

            // 处理SpriteFish
            mFishStopMove = true;

            if (mISpriteFish != null)
            {
                mISpriteFish.playDieAnimation();
            }

            if (mVibFish.Red == TbDataFish.IsRed.YES)
            {
                mScene.getLevel().addRedFishPosition(mFishObjId, Position);
            }

            signDie();
        }
Beispiel #17
0
 //-------------------------------------------------------------------------
 public CRenderBufferLock(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string animation_name)
     : base(scene, turret, name, param, animation_name)
 {
     mScene = scene;
     resetLockedFishObjId((int)param[0]);
 }
Beispiel #18
0
 //-------------------------------------------------------------------------
 public void setMyTurret(CRenderTurret my_turret)
 {
     mMyTurret = my_turret;
 }
Beispiel #19
0
        //-------------------------------------------------------------------------
        public void create(uint et_player_rpcid, int bullet_objid, int bullet_vibid, float bullet_speed,
                           int locked_fish_obj_id, EbVector3 turret_pos, float turret_angle, TbDataParticle hit_particle)
        {
            // vib
            mPlayerId        = et_player_rpcid;
            mVibBullet       = EbDataMgr.Instance.getData <TbDataBullet>(bullet_vibid);
            mPos             = turret_pos;
            mfAngle          = turret_angle;
            mBulletObjId     = bullet_objid;
            mLockedFishObjid = locked_fish_obj_id;
            //mfBulletSpeed = mVibBullet.Speed;
            mfBulletSpeed = bullet_speed;

            // sprite bullet
            CRenderTurret turret      = mScene.getTurret(mPlayerId);
            int           turret_id   = turret.getTurretId();
            string        bullet_anim = mVibBullet.Bullet0Animation;

            if (turret.isPower())
            {
                bullet_anim = mVibBullet.ColorBulletAnimation;
            }
            else
            {
                switch (turret_id)
                {
                case 1:
                    bullet_anim = mVibBullet.Bullet1Animation;
                    break;

                case 2:
                    bullet_anim = mVibBullet.Bullet2Animation;
                    break;

                case 3:
                    bullet_anim = mVibBullet.Bullet3Animation;
                    break;

                case 4:
                    bullet_anim = mVibBullet.Bullet4Animation;
                    break;

                case 5:
                    bullet_anim = mVibBullet.Bullet5Animation;
                    break;

                case 6:
                    bullet_anim = mVibBullet.Bullet6Animation;
                    break;
                }
            }
            mBulletAnim   = bullet_anim;
            mSpriteBullet = new CSpriteBullet();
            mSpriteBullet.create(mScene, this, mBulletAnim, hit_particle);
            mSpriteBullet.setTrigger(true, 200);

            mSpriteBullet.setPosition(mPos);
            mSpriteBullet.setDirection(mfAngle);
            mSpriteBullet.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Bullet));
            mSpriteBullet.setScale((float)mVibBullet.BulletHeight / (float)mVibBullet.BulletPixelHeight);
            mScene.getLevel().addBullet(this);
        }
Beispiel #20
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();
            }
        }
Beispiel #21
0
 //-------------------------------------------------------------------------
 public CRenderBufferFreeze(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     //mScene.getListener().onSceneShowInfo("创建冻结buffer");
 }