public void create(CRenderScene scene, ISpriteFish sprite_fish, TbDataFish vib_fish_data) { mScene = scene; mFixedScale = (float)vib_fish_data.CycleHeight / (float)vib_fish_data.CyclePixelHeight; initFish("red_fish_bottom_bottom", EbVector3.Zero, 130, mScene.getLayerAlloter().EachFishGap / 10f * 3, sprite_fish); //initFish("red_fish_bottom_middle", EbVector3.Zero, -130, mScene.getLayerAlloter().EachFishGap / 10f * 2, sprite_fish); initFish("red_fish_bottom_sign2", EbVector3.Zero, 0, mScene.getLayerAlloter().EachFishGap / 10f, sprite_fish); setScale(mFixedScale); }
//------------------------------------------------------------------------- void _initRippleBackground() { mRippleBackgroundStillSprite = _loadRippleStillSprite(); mRippleBackgroundStillSprite.setPosition(new EbVector3(-mScene.getSceneLength() / 2, -mScene.getSceneWidth() / 2, 0)); mRippleBackgroundStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Wave)); mRippleBackgroundStillSprite.setActive(false); }
//------------------------------------------------------------------------- void _loadSeaStar(int map_id) { TbDataMap data = EbDataMgr.Instance.getData <TbDataMap>(map_id); foreach (var it in data.SeaStarParticle) { try { if (it.TbDataParticle == null || it.TbDataParticle.Id == 0) { continue; } StillParticle still_particle = mScene.getParticlemanager().newParticle(it.TbDataParticle.ParticlePrefabName); still_particle.setPosition(new EbVector3(it.PositionX, it.PositionY, 0)); still_particle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.StarFish)); mSeaStar.Add(still_particle); #if UNITY_EDITOR still_particle.gameObject.name = "TkSpriteSeaStar_" + it.TbDataParticle.ParticlePrefabName; #endif } catch (Exception e) { Debug.LogWarning(e); } } }
//------------------------------------------------------------------------- public CSpriteScoreTurnplate(CRenderScene scene, EbVector3 position, float up_angle) { mScene = scene; mPosition = position; mAngle = up_angle; mSpriteNumber = new CSpriteNumber(mScene, new CScoreDigitFactory(mScene)); mSpriteNumber.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore)); }
//------------------------------------------------------------------------- public void fishDestroy(uint et_player_rpcid, int fish_vib_id, int total_score) { List <StillParticle> particle_list = _loopBuildParticle(TbDataFish.ParticleProduceTimeEnum.FishDestroy, et_player_rpcid); foreach (var it in particle_list) { it.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Particle)); } TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(fish_vib_id); if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.Turnplate || fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.ChipsAndTurnplate) { mScene.addParticleTurnplateCaller(new ParticleTurnplateCaller(mScene, et_player_rpcid, fish_vib_id, total_score, particle_list)); } }
//------------------------------------------------------------------------- void _initTurretUnit(ref StillSprite still_sprite, string animation_name, float scale, _eLevelLayer layer) { still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.playAnimation(animation_name); still_sprite.setScale(scale); still_sprite.setLayer(mScene.getLayerAlloter().getLayer(layer)); still_sprite.setPosition(mRenderTurret.getTurretPos()); still_sprite.setDirection(mScene.getTurretHelper().getBaseAngleByTurretId(mRenderTurret.getTurretId())); still_sprite.setTag("CSpriteTurret" + mRenderTurret.getTurretId()); }
//------------------------------------------------------------------------- CSpriteFishDieScore(CRenderScene render_scene, EbVector3 pos, int score, float delay_time) { mCSpriteNumber = new CSpriteNumber(render_scene, new CScoreDigitFactory(render_scene)); mCSpriteNumber.create(score, pos, 0, getByScore(score)); mCSpriteNumber.setLayer(render_scene.getLayerAlloter().getLayer(_eLevelLayer.FishScore)); mFunDelayTime = delay_time; mIsNeedAutoDestroy = true; _initRoute(pos, 0); mNumber = score; }
//------------------------------------------------------------------------- public CSpriteBgNumber(CRenderScene scene, BgColorEnum color, int number) { mScene = scene; float number_layer = mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore); mCSpriteNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene)); mCSpriteNumber.create(number, EbVector3.Zero, 0, CSpriteNumber._eNumberSize.Small2); mCSpriteNumber.setLayer(number_layer); mNumberBackgroundCSprite = mScene.getRenderObjectPool().newStillSprite(); mNumberBackgroundCSprite.setLayer(number_layer + mScene.getLayerAlloter().EachFishGap / 100f); mNumberBackgroundCSprite.setScale(0.65f * number.ToString().Length, 0.8f); mNumberBackgroundCSprite.playAnimation(getAnimationNameByColor(color)); #if UNITY_EDITOR mNumberBackgroundCSprite.gameObject.name = "TkSpriteChips_" + getAnimationNameByColor(color); #endif }
//------------------------------------------------------------------------- void _newShockBackground(string background_name) { mShockBackgroundStillSprite = mBackgroundLoader.newBackgroundStillSprite(background_name, mScene); mShockBackgroundStillSprite.setPosition(EbVector3.Zero); mShockBackgroundStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.ShockBackground)); mShockBackgroundStillSprite.setActive(false); #if UNITY_EDITOR mShockBackgroundStillSprite.gameObject.name = "TkBackground"; #endif }
//------------------------------------------------------------------------- public void load(string prefab_name, _eLevelLayer layer) { mBgSprite = mBackgroundLoader.newBackgroundStillSprite(prefab_name, mScene); mBgSprite.setPosition(EbVector3.Zero); mBgSprite.setDirection(0); mBgSprite.setLayer(mScene.getLayerAlloter().getLayer(layer)); mBgClippedSprite = mBgSprite.gameObject.GetComponent <tk2dClippedSprite>(); #if UNITY_EDITOR mBgSprite.gameObject.name = "TkBackground"; #endif }
//------------------------------------------------------------------------- public CSpriteHeap(CRenderScene scene, int number_of_chip, int score, EbVector3 position, float up_angle, CSpriteBgNumber.BgColorEnum color) { mScene = scene; mHeapScruct.NumberOfChip = number_of_chip; mHeapScruct.Position = position; mHeapScruct.UpAngle = up_angle; mHeapScruct.Alpha = 1f; mCSpriteBgNumber = new CSpriteBgNumber(mScene, color, score); mHeapLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretChips); mHeapState = _eHeapState.Adding; }
//------------------------------------------------------------------------- public void display(int score, TbDataParticle particle_data) { if (score <= 0) { return; } mSpriteNumber.create(score, 100, mPosition, mAngle + mCurrentAngle); mStillParticle = mScene.getParticlemanager().newParticle(particle_data.ParticlePrefabName); mStillParticle.setPosition(mPosition); mStillParticle.setLooping(false); mStillParticle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScoreBg)); mIsDisplay = true; initRotate(); }
//------------------------------------------------------------------------- public CSpriteScore(CRenderScene scene, EbVector3 position, float angle, int turret_no) { mScene = scene; mSpriteNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene)); mSpriteNumber.create(0, position, angle, CSpriteNumber._eNumberSize.Small1, CSpriteNumber._eNumberAlign.Right); mSpriteNumber.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore)); mBackground = mScene.getRenderObjectPool().newStillSprite(); mBackground.playAnimation("score_panel_" + turret_no); mBackground.setScale(1, 1f); setScore(0); #if UNITY_EDITOR mBackground.gameObject.name = "TkSpriteSpriteScore_score_panel_" + turret_no; #endif }
//------------------------------------------------------------------------- void _hitFish(CRenderFish render_fish) { if (render_fish == null || render_fish.IsDie) { return; } uint et_player_rpcid = mBullet.getPlayerId(); if (mBullet.getScene().getMyPlayerId() == et_player_rpcid) { mBullet.getScene().getProtocol().c2sFishHit(et_player_rpcid, mBullet.getBulletObjId(), render_fish.FishObjId); } mBullet.signDestroy(); mIsSignDestroy = true; CRenderTurret turret = mBullet.getScene().getTurret(et_player_rpcid); if (turret == null) { return; } TbDataTurret vib_turret = turret.getVibTurret(); Dictionary <string, object> map_param = new Dictionary <string, object>(); map_param.Add("SourcePosition", getHitPosition(render_fish.Position, mBullet.getPosition())); map_param["NetColor"] = mBullet.getScene().getTurret(et_player_rpcid).getTurretColor(); map_param["PlayerId"] = et_player_rpcid; map_param["BulletHitFish"] = render_fish; TbDataBullet buttlt_data = mBullet.getBulletData(); mBullet.getScene().addEffect(buttlt_data.EffectCompose.Id, map_param, EffectTypeEnum.Client); if (!string.IsNullOrEmpty(mHitParticle.ParticlePrefabName)) { StillParticle particle = mScene.getParticlemanager().newParticle(mHitParticle.ParticlePrefabName); particle.setPosition(getHitPosition(render_fish.Position, mBullet.getPosition())); particle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishHitParticle)); } }
//------------------------------------------------------------------------- public void setBgPosition(EbVector3 position, float up_angle) { mBackground.setPosition(position); mBackground.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScoreBg)); mBackground.setDirection(up_angle); }