Example #1
0
        //-------------------------------------------------------------------------
        //根据vib数据创建鱼的代码全部放在这里,ISpriteFish的实现类不在需要知道TbDataFish的任何事情?//
        public ISpriteFish buildSpriteFish(CRenderFish render_fish, int fish_vib_id)
        {
            TbDataFish  fish_data   = EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id);
            ISpriteFish sprite_fish = null;

            if (fish_data.Type == TbDataFish.FishType.Custom)
            {
                sprite_fish = new CSpriteCustomGroup();
            }
            else if (fish_data.Type == TbDataFish.FishType.EvenFour)
            {
                sprite_fish = new CSpriteEvenFourFish();
            }
            else if (fish_data.Type == TbDataFish.FishType.EvenFive)
            {
                sprite_fish = new CSpriteEvenFiveFish();
            }
            else
            {
                sprite_fish = new CSpriteFishGroup((int)fish_data.Type);
            }

            sprite_fish.create(mScene, fish_data);
            sprite_fish.setRenderFish(render_fish);
            sprite_fish.setTag("CSpriteFish");
            sprite_fish.setTrigger(true);
            sprite_fish.setLayer(mScene.getLayerAlloter().getFishLayer(fish_vib_id));

#if UNITY_EDITOR
            //ViDebuger.Warning("TkFish_vib_id_ " + fish_vib_id);
            sprite_fish.setGameobjectName("TkFish_vib_id_" + fish_vib_id);
#endif

            return(sprite_fish);
        }
Example #2
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, TbDataFish vib_fish_data)
        {
            mScene        = scene;
            mVibFishData  = vib_fish_data;
            mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;

            if (mVibFishData.Type == TbDataFish.FishType.Custom)
            {
                mCycle = mScene.getRenderObjectPool().newFishStillSprite();
                mCycle.init(this, scene);
                mCycle.playAnimation(mVibFishData.FishCompose.BackGroundAniName);
                mCycle.setScale((float)mVibFishData.FishCompose.BackGroundAnimationScale / 100.0f);
                foreach (var it in mVibFishData.FishCompose.FishComposes)
                {
                    if (null != it && it.Id > 0)
                    {
                        TbDataFish      fish_data   = EbDataMgr.Instance.getData <TbDataFish>(it.FishVibId);
                        FishStillSprite fish_sprite = mScene.getRenderObjectPool().newFishStillSprite();

                        fish_sprite.init(this, scene);
                        fish_sprite.playAnimation(fish_data.FishAnimMove);
                        fish_sprite.setScale(mFixFishScale * (float)fish_data.FishHeight / (float)fish_data.FishPixelHeight);

                        mFishs.Add(new FishSpriteAndOffset(
                                       fish_sprite,
                                       new EbVector3(it.OffsetX, it.OffsetY, 0),
                                       fish_data.FishAnimDie));
                    }
                }
            }
        }
Example #3
0
        //---------------------------------------------------------------------
        public override void create()
        {
            if (Done)
            {
                return;
            }

            int fish_vib_id  = int.Parse(getServerParam()[0]);
            int route_vib_id = int.Parse(getServerParam()[1]);

            TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id);

            if (null != fish_data)
            {
                float delay_time = 0;
                if (null != fish_data.ChainFish && fish_data.Type == TbDataFish.FishType.ChainFish)
                {
                    delay_time = (float)(fish_data.ChainFish.FishHeight) / fish_data.ChainFish.getSpeed();

                    for (int i = 0; i < fish_data.ChainFishNumber; i++)
                    {
                        newBaseEntity(fish_data.ChainFish.Id, route_vib_id, delay_time * i);
                    }
                }
                else
                {
                    newBaseEntity(fish_vib_id, route_vib_id, 0);
                }
            }
            setDone();
        }
Example #4
0
        //-------------------------------------------------------------------------
        protected FishStillSprite _loadFishStillSpriteByFishId(TbDataFish.FishIdAndScaleStruct fish_id_scale)
        {
            TbDataFish      fish_data   = EbDataMgr.Instance.getData <TbDataFish>(fish_id_scale.FishId);
            FishStillSprite fish_sprite = _loadFishStillSprite(fish_data.FishAnimMove);

            fish_sprite.setScale(((float)fish_id_scale.Scale / 100f) * mFixFishScale * (float)fish_data.FishHeight / (float)fish_data.FishPixelHeight);
            return(fish_sprite);
        }
Example #5
0
        //-------------------------------------------------------------------------
        public override void load(EbPropSet prop_set)
        {
            Name = prop_set.getPropString("T_Name").get();
            var prop_state = prop_set.getPropInt("I_State");

            State      = prop_state == null ? DataState.Default : (DataState)prop_state.get();
            Fish       = EbDataMgr.Instance.getData <TbDataFish>(prop_set.getPropInt("I_Fish").get());
            FishAmount = prop_set.getPropInt("I_FishAmount").get();
            ShoalType  = (_eShoalType)prop_set.getPropInt("I_ShoalType").get();
        }
Example #6
0
 //-------------------------------------------------------------------------
 public override void create(CRenderScene scene, TbDataFish vib_fish_data)
 {
     base.create(scene, vib_fish_data);
     if (mVibFishData.Type == TbDataFish.FishType.EvenFive)
     {
         //_initSprite(154f, 80f);
         _initSprite(108.89f, 108.89f, 80f);
     }
     _setBackgroundSize(0.7f);
 }
        //-------------------------------------------------------------------------
        public override void load(EbPropSet prop_set)
        {
            Name = prop_set.getPropString("T_Name").get();
            var prop_state = prop_set.getPropInt("I_State");

            State         = prop_state == null ? DataState.Default : (DataState)prop_state.get();
            NormalFish    = EbDataMgr.Instance.getData <TbDataFish>(prop_set.getPropInt("I_NormalFish").get());
            RedFish       = EbDataMgr.Instance.getData <TbDataFish>(prop_set.getPropInt("I_RedFish").get());
            RedFishDouble = EbDataMgr.Instance.getData <TbDataFish>(prop_set.getPropInt("I_RedFishDouble").get());
            LastTime      = prop_set.getPropInt("I_LastTime").get();
        }
Example #8
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");
            }
        }
Example #9
0
        //-------------------------------------------------------------------------
        public void create(int fish_vibid, int fish_objid)
        {
            mFishData  = EbDataMgr.Instance.getData <TbDataFish>(fish_vibid);
            mFishObjId = fish_objid;
            mSpeed     = mFishData.getSpeed();

            mFishType = (TbDataFish.FishType)mFishData.Type;

            mMassEntity = new MassEntity();
            mMassEntity.setSpeed(mSpeed);

            mFishCollider = mScene.getColliderMgr().newFishCollider(0, 0, 80, 80, this);//读取vib配置

            update(0);
        }
Example #10
0
        //-------------------------------------------------------------------------
        public void create(int fish_vib_id, int fish_objid)
        {
            mVibFish   = EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id);
            mFishObjId = fish_objid;

            mISpriteFish = mScene.getSpriteFishFactory().buildSpriteFish(this, fish_vib_id);

            mMassEntity = new MassEntity();
            mMassEntity.setSpeed(mVibFish.getSpeed());

            mISpriteFish.setDirection(0);

            mFishParticleMgr = new FishParticleMgr(mScene, this, fish_vib_id, mISpriteFish);
            mFishParticleMgr.fishBorn();
            mFishParticleMgr.fishMoving();
        }
Example #11
0
        //---------------------------------------------------------------------
        void createEntityParticleSystem(int fish_vib_id)
        {
            int fish_count = 1;

            TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id);

            if (fish_data.Type == TbDataFish.FishType.ChainFish)
            {
                fish_count = fish_data.ChainFishNumber;
            }

            int fish_begin_obj_id = getNextFishObjId(fish_count);
            int route_vib_id      = _getRandomRouteId((TbDataFish.FishRouteCategory)EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id).fishRouteCategory);

            List <string> server_param = new List <string>();

            server_param.Add(fish_vib_id.ToString());
            server_param.Add(route_vib_id.ToString());

            mBaseFishLordMgr.addParticleSystem(mNormalFishParticleFileName, server_param, fish_begin_obj_id);
            mScene.getProtocol().s2allcCreateFishLord(mNormalFishParticleFileName, server_param, fish_begin_obj_id);
        }
Example #12
0
        //---------------------------------------------------------------------
        public void create(CRenderScene scene, TbDataFish vib_fish_data)
        {
            mScene        = scene;
            mVibFishData  = vib_fish_data;
            mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;

            bool has_cycle = !string.IsNullOrEmpty(mVibFishData.CycleAnimationName);

            for (int i = 0; i < mFishNumber; i++)
            {
                mFishs.Add(mScene.getRenderObjectPool().newFishStillSprite());
                if (has_cycle)
                {
                    mRedBottom = new CSpriteRedBottom();
                    mRedBottom.create(mScene, this, mVibFishData);
                }
            }

            foreach (var it in mFishs)
            {
                it.init(this, scene);
            }

            float fish_scale = ((float)mVibFishData.FishHeight / (float)mVibFishData.FishPixelHeight);

            foreach (var it in mFishs)
            {
                it.setScale(0.7f * fish_scale);
            }

            playAnimation(mVibFishData.FishAnimMove);

            if (mVibFishData.Red == TbDataFish.IsRed.YES)
            {
                mInitColor = new Color(1, 0, 0);
                resetColor(1);
            }
        }
Example #13
0
 //-------------------------------------------------------------------------
 public virtual void create(CRenderScene scene, TbDataFish vib_fish_data)
 {
     mScene        = scene;
     mVibFishData  = vib_fish_data;
     mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;
 }