Beispiel #1
0
 public void ProcessDelayOver(NetFishDeadTime[] fishList, CatchedData cd)
 {
     if (fishList == null)
     {
         return;
     }
     for (int i = 0; i < fishList.Length; ++i)
     {
         NetFishDeadTime dt  = fishList[i];
         CatchFishData   cfd = SceneRuntime.FishMgr.FindFish(dt.FishID);
         if (cfd.IsValidFishType() == false)
         {
             continue;
         }
         SceneRuntime.PlayerMgr.UpdatePlayerGold(cd.ClientSeat,
                                                 SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
         cd.FishList.Add(cfd);
         if (cfd.FishObj != null)
         {
             SceneRuntime.FishMgr.DestroyFish(cfd.FishObj, false);
         }
     }
     SceneRuntime.ComputeGoldNum(cd);
     //SceneRuntime.SceneModel.CatchFish(cd);
 }
Beispiel #2
0
        public void UseSkillLock(NetCmdPack pack)
        {
            NetCmdSkillLock cmd = (NetCmdSkillLock)pack.cmd;
            //客户端可以使用锁定技能
            //...
            byte clientSeat = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (clientSeat == SceneRuntime.PlayerMgr.MyClientSeat)
            {
                IEvent   evt       = new GF.Event(EventMsg.UPDATE_USERITEM);
                object[] parameter =
                {
                    SkillSetting.SkillDataList[(byte)SkillType.SKILL_LOCK].CDTime,
                    SkillType.SKILL_LOCK
                };
                evt.parameter = parameter;
                EventManager.Instance.DispatchEvent(evt);

                //SceneRuntime.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_LOCK].CDTime, SkillType.SKILL_LOCK);
                SceneRuntime.PlayerMgr.MySelf.Launcher.OnClickAutoShotCancel(null);
                SceneRuntime.PlayerMgr.SetLocked(true);
            }
            else
            {
                SceneRuntime.PlayerMgr.ShowOtherUserLocked(clientSeat);
            }
        }
Beispiel #3
0
        public void ShowDiamond(CatchedData cd, Fish fish)
        {
            GoldEffectData ged = new GoldEffectData();

            ged.GameObj = Initobj(m_DiamondObj);


            ged.GameObj.transform.position = UIManager.Instance.WordToScenePoint(fish.Position) + (new Vector3(Utility.RandFloat(), Utility.RandFloat(), 0) * 0.45f);

            /*ged.m_Tween.m_Pos = ged.GameObj.transform.GetComponent<TweenPosition>();
             * ged.m_Tween.m_Sclae = ged.GameObj.transform.GetComponent<TweenScale>();*/
            ged.m_Tween.m_Pos   = ged.GameObj.transform.GetComponents <DOTweenAnimation>()[0];
            ged.m_Tween.m_Sclae = ged.GameObj.transform.GetComponents <DOTweenAnimation>()[1];
            ged.ScaleGoldTR(1.0f, 0.6f);
            ged.m_DelayTime = 2;
            ged.GoldNum     = 1;
            ged.PlayTween(true);
            ged.m_Tween.m_Pos.enabled = false;
            ged.ScaleGoldTR(1.0f, fish.IsBossFish() ? 1.0f : 0.6f);

            Vector3 vecGoldEndpos = Vector3.one;

            vecGoldEndpos = SceneRuntime.GetLauncherGoldIconPos(cd.ClientSeat);
            DOTween.To(() => ged.GameObj.transform.position, x => ged.GameObj.transform.position = x, vecGoldEndpos, 2);
            ged.m_vecpathend = SceneRuntime.GetLauncherGoldIconPos(cd.ClientSeat);
            m_diamondList.Add(ged);
        }
Beispiel #4
0
        private void ShowCombo(byte clientSeat, ushort ComboCount, bool bCRI /*是否必杀*/)
        {
            if (m_PlayerList[clientSeat].ComboEft == null)
            {
                SceneComboEft combo = new SceneComboEft();
                combo.Pos = SceneRuntime.GetLauncherGoldIconPos(clientSeat);
                if (m_MyClientSeat == clientSeat)
                {
                    combo.IsMySelf = true;
                }
                else
                {
                    combo.IsMySelf = false;
                }

                combo.Init(m_ComboObj);

                m_PlayerList[clientSeat].ComboEft = combo;
            }
            m_PlayerList[clientSeat].ComboEft.ShowCombo(ComboCount, bCRI);


            if (clientSeat == m_MyClientSeat)
            {
                //PlayerRole.Instance.RoleGameData.OnHandleRoleCombo(ComboCount);
            }
        }
Beispiel #5
0
        public void LaunchBullet(NetCmdPack pack)
        {
            NetCmdBullet cmd = (NetCmdBullet)pack.cmd;
            byte         clientSeat, id;

            SceneRuntime.BuuletIDToSeat(cmd.BulletID, out clientSeat, out id);
            if (GetPlayer(clientSeat) == null)
            {
                return;
            }
            ScenePlayer sp = GetPlayer(clientSeat);

            if (sp.Launcher.LauncherType != cmd.LauncherType)
            {
                sp.Launcher.ChangeLauncher(cmd.LauncherType, true);
            }
            if (sp == null)
            {
                LogMgr.Log("不存在的玩家座位:" + clientSeat);
                return;
            }
            float elapsedTime = (Utility.GetTickCount() - pack.tick) * 0.001f + SceneRuntime.NetDelayTime;
            short degree      = SceneRuntime.AngleInversion(cmd.Degree);

            SceneRuntime.BulletMgr.LaunchBullet(cmd.BulletID, sp.Launcher.LauncherType, sp.RateIndex, degree,
                                                elapsedTime, cmd.ReboundCount, cmd.LockFishID);
            sp.Launcher.LauncherBullet(cmd.Energy);

            // SceneRuntime.SceneModel.LaunchBullet(clientSeat, sp.Launcher.LauncherType, sp.RateIndex);
            int gold = LauncherSetting.LauncherDataList[sp.Launcher.LauncherType].Consume
                       * BulletSetting.BulletRate[sp.RateIndex];

            ConsumeGold(clientSeat, gold, sp);
        }
Beispiel #6
0
        public void ChangeRate(NetCmdPack pack)
        {
            NetCmdChangeRate cmd        = (NetCmdChangeRate)pack.cmd;
            byte             clientSeat = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (GetPlayer(clientSeat) == null)
            {
                return;
            }
            byte OldRate = GetPlayer(clientSeat).RateIndex;

            GetPlayer(clientSeat).RateIndex = cmd.RateIndex;
            //Debug.Log(cmd.RateIndex);
            GetPlayer(clientSeat).Launcher.ChangeRate(cmd.RateIndex, cmd.IsCanUseRate);

            //如果是自己切换倍率我们就清掉连击状态
            if (clientSeat == m_MyClientSeat)
            {
                if (m_PlayerList[clientSeat].ComboEft != null)
                {
                    if (m_PlayerList[clientSeat].ComboEft.LifeTime >= 0.1f)
                    {
                        m_PlayerList[clientSeat].ComboEft.LifeTime = 0;
                    }
                }
            }
            //因为玩家切换倍率 我们触发一个事件
            tagGameRateChangeEvent pEvent = new tagGameRateChangeEvent(GetPlayer(clientSeat).Player.playerData.ID,
                                                                       OldRate, cmd.RateIndex);
            //MsgEventHandle.HandleMsg(pEvent);
        }
Beispiel #7
0
        public void SendCheckPos()
        {
            if (++SendInterval < 60 * 6)
            {
                return;
            }
            SendInterval = 0;

            NetCmdCheckBulletPos pp = new NetCmdCheckBulletPos();

            pp.SetCmdType(NetCmdType.CMD_CHECK_BULLET_POS);
            List <CheckBulletPos> pl = new List <CheckBulletPos>();

            for (int i = 0; i < m_PlayerBullets.Length; ++i)
            {
                PlayerBullets pb = m_PlayerBullets[i];
                foreach (Bullet bullet in pb.BulletList.Values)
                {
                    CheckBulletPos bb = new CheckBulletPos();
                    bb.Pos = new NetCmdVector3(bullet.Position.x, bullet.Position.y, bullet.Position.z);
                    bb.ID  = bullet.ServerID;
                    pl.Add(bb);
                }
            }
            pp.Count   = (ushort)pl.Count;
            pp.Bullets = pl.ToArray();
            SceneRuntime.Send <NetCmdCheckBulletPos>(pp);
        }
Beispiel #8
0
        public void LaunchLaser(byte clientSeat, short degree)
        {
            if (m_bMyself)
            {
                m_bLauncherXPSkill = false;
                ClearXPSkillEft();
                m_EnergyPoolLogic[LauncherType].LaserCDState = true;
                m_EnergyPoolLogic[LauncherType].Rollback     = true;
                m_EnergyPoolLogic[LauncherType].PlayRollbackPoolUI(1000);
                m_EnergyPoolUI.fillAmount = m_EnergyPoolLogic[LauncherType].FillAmount;
            }

            Vector3 startPos;
            Vector3 dir;

            degree = SceneRuntime.AngleInversion(degree);
            SceneRuntime.GetBulletPosAndDir(clientSeat, degree, out dir, out startPos);
            if (!m_bMyself)
            {
                Vector2 direction = new Vector2(dir.x, dir.y);
                Direction = direction;
                UpdatOtherAngle();
            }
            SceneRuntime.LauncherEftMgr.PlayXPSkillMuzzleEft(m_GunBarrel.BaseTransform, LauncherType, startPos,
                                                             m_LauncherSetting.LaserCDTime);
            SceneRuntime.LauncherEftMgr.PlayLaserEft(m_GunBarrel.BaseTransform, LauncherType, clientSeat, Direction,
                                                     startPos, m_Angle);
            // SceneRuntime.LauncherEftMgr.RemoveAtEffect();
        }
Beispiel #9
0
        //切换到指定类型 的炮
        public void ChangeDestLauncher(byte launcherType)
        {
            NetCmdChangeLauncherType ncb = new NetCmdChangeLauncherType();

            ncb.SetCmdType(NetCmdType.CMD_CHANGE_LAUNCHER_TYPE);
            ncb.Seat         = SceneRuntime.ClientToServerSeat(m_PlayerMgr.MyClientSeat);
            ncb.LauncherType = launcherType;
            Send <NetCmdChangeLauncherType>(ncb);
        }
Beispiel #10
0
        public void LaunchBullet(ushort bulletID, byte launcherType, byte rateIndex, short angle, float time,
                                 byte reboundCount, ushort lockfishid /*, byte collidCount = 0, float pauseTime = 0, float speedScaling = 0*/)
        {
            byte clientSeat, id;

            SceneRuntime.BuuletIDToSeat(bulletID, out clientSeat, out id);
            Bullet  bullet = new Bullet();
            Vector3 startpos;
            Vector3 dir;
            float   volume  = 1;
            float   curtime = Time.time;

            byte[] type = { 9, 9, 10, 11, 12 };
            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == SceneRuntime.PlayerMgr.MySelf)
            {
                volume   = 1;
                lastTime = curtime;
                //AudioManager.Instance.PlayOrdianryMusic((Audio.OrdianryMusic) type[launcherType], false, false, volume);
            }
            else
            {
                volume = 0.30f;
                if ((lastTime + 0.1f) < curtime)
                {
                    /*AudioManager.Instance.PlayOrdianryMusic((Audio.OrdianryMusic) type[launcherType], false, false,
                     *  volume);*/
                }
            }
            SceneRuntime.GetBulletPosAndDir(clientSeat, angle, out dir, out startpos);
            SceneRuntime.PlayerMgr.ChangeLauncherAngle(dir, clientSeat); //改变炮台角度
            bullet.Init(clientSeat, id, launcherType, rateIndex, startpos, dir, reboundCount, lockfishid);
            bullet.InitAngle(Utility.ShortToFlaot(angle));
            //bullet.SetCollidData(collidCount, pauseTime, speedScaling);
            PlayerBullets pb = m_PlayerBullets[clientSeat];

            if (pb != null)
            {
                Bullet findBullet;
                if (pb.BulletList.TryGetValue(id, out findBullet))
                {
                    Debug.Log("相同的子弹ID:" + id);
                    findBullet.Destroy();
                    pb.BulletList.Remove(id);
                }
                if (time > 0)
                {
                    bullet.Update(time);
                }
                pb.BulletList.Add(id, bullet);
            }
        }
Beispiel #11
0
        public void Update(float delta)
        {
            // -------------------------------------
            if (Input.GetMouseButtonDown(0) && SceneRuntime.HandleClickEvent == false && m_bAutoLocked)
            {
                ushort fishid = SceneRuntime.FishMgr.GetFishIDByScreenPoint(Input.mousePosition);
                //m_bAutoLocked = fishid != 0;
                m_LockedFishID = fishid;
            }
            // -------------------------------------
            if (m_LockedFishID != 0)
            {
                Vector3 startScrPoint  = SceneRuntime.GetLauncherScrStartPos(MyClientSeat);
                Vector3 startViewPoint = SceneRuntime.GetLauncherViewStartPos(MyClientSeat);
                Fish    fish           = SceneRuntime.FishMgr.FindFishByID(m_LockedFishID);

                if (fish == null || fish.IsDelay || fish.Catched || Utility.IsInScreen(fish.ScreenPos) == false ||
                    BuYuUtils.CheckLauncherAngle(fish, startScrPoint, startViewPoint) == false)
                {
                    m_LockedFishID = 0;
                }
            }
            else if (m_bAutoLocked)
            {
                //if(Utility.GetTickCount() - m_LockInterval > 0)
                {
                    Vector3 startScrPoint  = SceneRuntime.GetLauncherScrStartPos(MyClientSeat);
                    Vector3 startViewPoint = SceneRuntime.GetLauncherViewStartPos(MyClientSeat);
                    m_LockInterval = Utility.GetTickCount();
                    m_LockedFishID = SceneRuntime.FishMgr.GetFishBySortGold(startScrPoint, startViewPoint);
                }
            }

            //SceneRuntime.LogicUI.UpdateLockedUI();

            for (int i = 0; i < ConstValue.PLAYER_MAX_NUM; ++i)
            {
                if (m_PlayerList[i] == null)
                {
                    continue;
                }
                ScenePlayer sp = m_PlayerList[i];
                sp.Launcher.Update(delta);
                if (sp.ComboEft != null && sp.ComboEft.m_BaseWndObject != null)
                {
                    if (sp.ComboEft.m_BaseWndObject.activeSelf != true)
                    {
                        continue;
                    }
                    if (sp.ComboEft.Updata(delta) == false)
                    {
                        sp.ComboEft.m_BaseWndObject.SetActive(false);
                    }
                }
            }
        }
Beispiel #12
0
        public void PlayXPSkillMuzzleEft(Transform parent, byte type, Vector3 pos, float life)
        {
            GameObject go = GameObject.Instantiate(m_SkillMuzzleObj[type]) as GameObject;

            go.transform.SetParent(parent, false);
            go.transform.position = SceneRuntime.WorldToNGUI(pos);
            m_XPSkillMuzzleEft    = new GlobalEffectData(go, 0, life);
            GlobalEffectMgr.Instance.AddEffect(m_XPSkillMuzzleEft);
            GlobalEffectMgr.SetEffectOnUI(go);
            //m_EffectList.Add(go);
        }
Beispiel #13
0
        //清场动画
        public void ClearScene(NetCmdPack pack)
        {
            byte clearType   = ((NetCmdClearScene)pack.cmd).ClearType;
            bool leftToRight = clearType == 0;
            bool bNotDelay   = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;

            if (bNotDelay == false || clearType == 2)
            {
                SceneRuntime.FishMgr.ClearAllFish();
                return;
            }
            SceneRuntime.SceneModel.SetClearScene();
            //GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_ClearFish);
            ushort           id     = leftToRight ? (ushort)8 : (ushort)7;
            GameObject       effect = SceneRuntime.EffectMgr.GetSkillEffect(id);
            GlobalEffectData gfd    = new GlobalEffectData(effect, 0, 4.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            if (leftToRight)
            {
                PathManager.Instance.BoLang.SetWorldMatrix(Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(0, Vector3.up), Vector3.one));
            }
            else
            {
                PathManager.Instance.BoLang.SetWorldMatrix(Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(180, Vector3.up), Vector3.one));
            }
            SceneRuntime.FishMgr.BackupFishList();

            if (SceneRuntime.FishMgr.BackFishList != null)
            {
                foreach (Fish fish in SceneRuntime.FishMgr.BackFishList)
                {
                    if (fish.Delay || fish.Catched)
                    {
                        continue;
                    }

                    GameObject effectobj = SceneRuntime.EffectMgr.GetSkillEffect(9);
                    float      z         = SceneRuntime.ComputeZScaling(fish, 1.0f);
                    float      scl       = z * fish.Scaling * 1.0f;
                    effectobj.transform.localScale = new Vector3(scl, scl, scl);
                    GlobalEffectData gfdf = new GlobalEffectData(fish, effectobj, 0, 4.0f, null, scl);
                    float            y    = FishResManager.Instance.GetFishData(fish.FishType).Size.y;
                    gfdf.Offset = new Vector3(0, y * 0.65f * z * fish.Scaling, 0);
                    GlobalEffectMgr.Instance.AddEffect(gfdf);
                    fish.ExtraData = gfdf;
                    FishOptTimer fot = new FishOptTimer(gfd, PathManager.Instance.BoLang, leftToRight);
                    fish.ClearOpt();
                    fish.AddOpt(fot);
                }
            }
        }
Beispiel #14
0
        public void ShowBossFishSpecailEft(CatchedData cd, Fish fish)
        {
            GameObject go = GameObject.Instantiate(m_BossFishSpecailEftObj) as GameObject;

            go.transform.SetParent(SceneBoot.Instance.UIPanelTransform, false);
            go.transform.position = SceneRuntime.WorldToNGUI(fish.Position);
            GlobalEffectData bossFishEft = new GlobalEffectData(go, 0, 5);

            GlobalEffectMgr.Instance.AddEffect(bossFishEft);
            // GlobalEffectMgr.SetEffectOnUI(go);

            //sceneModel.Instance.PlayBack(BackAnimType.BACK_ANIM_BOSS);
        }
Beispiel #15
0
        void ShowGoldEndLargen(byte clientSeat)
        {
            if (MatchJudge.IsMatch())
            {
                return;
            }
            Vector3 pos = SceneRuntime.GetLauncherGoldIconPos(clientSeat);

            if (m_EndLargenGold.m_GameObj == null && m_EndLargenGold.m_LifeTime <= 0.03f)
            {
                m_EndLargenGold.m_GameObj = Initobj(m_LargenGoldObj);
                m_EndLargenGold.Init();
                m_EndLargenGold.m_TrnasGold.position = pos;
            }
        }
Beispiel #16
0
        public void ResetPlayerData(LinkRoomData jrd, bool bFirst)
        {
            byte serverSeat         = jrd.Seat;
            byte serverLauncherType = jrd.LauncherType;

            SceneBoot.Instance.SwapBackgroundImage(jrd.BackgroundImage);
            m_RoomType      = jrd.RoomID;
            m_RoomRateIndex = FishConfig.Instance.m_TableInfo.m_TableConfig[m_RoomType].MinRate; // ExtraSetting.RoomDataList[m_RoomType].RoomRateIdx;
                                                                                                 //管理器初始化

            /*if (bFirst || SceneRuntime.BackgroundIndex != jrd.BackgroundImage)
             * {
             *  m_EffectMgr.ClearBackEffect();
             *  m_EffectMgr.LoadBackEffect(jrd.BackgroundImage);
             * }*/
            SceneRuntime.Inversion       = serverSeat > 1;
            SceneRuntime.BackgroundIndex = jrd.BackgroundImage;
            m_PlayerMgr.MyClientSeat     = SceneRuntime.ServerToClientSeat(serverSeat);
            PlayerMgr.ClearAllPlayer();

            //加入自己
            bool launcherValid;
            byte clientLauncherType;

            SceneRuntime.CheckLauncherValid(
                serverLauncherType,
                out clientLauncherType,
                out launcherValid);
            //获取自己的消息
            RoleMe pMe = PlayerRole.Instance.RoleInfo.RoleMe;

            pMe.SetSeat(serverSeat);
            PlayerExtraData pPlayer = new PlayerExtraData();

            pPlayer.playerData.GoldNum =
                (int)PlayerRole.Instance.GetPlayerGlobelBySeat(pMe.GetSeat());
            pPlayer.playerData.ID     = pMe.GetUserID();
            pPlayer.playerData.ImgCrc = pMe.GetFaceID();
            pPlayer.playerData.Level  = (byte)pMe.GetLevel();
            pPlayer.playerData.Name   = pMe.GetNickName();
            m_PlayerMgr.PlayerJoin(pPlayer,
                                   m_PlayerMgr.MyClientSeat,
                                   jrd.RateIndex,
                                   clientLauncherType,
                                   launcherValid);
            m_PlayerMgr.UpdateEnergy(jrd.Energy);
        }
Beispiel #17
0
        public void Shutdown()
        {
            //GlobalHallUIMgr.Instance.CloseHead();
            m_FishMgr.Shutdown();
            m_BulletMgr.Shutdown();
            m_PlayerMgr.Shutdown();
            m_EffectMgr.Shutdown();
            m_LauncherEffectMgr.ShutDown();
            m_ChestMgr.ShutDown();

            /*m_BtnsMgr.ShutDown();
            *  m_NewGide.ShutDown();*/
            // GlobalHallUIMgr.Instance.ShutDowNotic();
            GlobalEffectMgr.Instance.Clear();
            SceneRuntime.Shutdown();
            PlayerRole.Instance.OnUserLeaveTable();
        }
Beispiel #18
0
        public void OnLaunchBullet(IEvent iEvent)
        {
            NetCmdPack pack = iEvent.parameter as NetCmdPack;

            if (pack != null)
            {
                NetCmdBullet cmd = (NetCmdBullet)pack.cmd;
                byte         clientSeat, id;
                SceneRuntime.BuuletIDToSeat(cmd.BulletID, out clientSeat, out id);
                if (clientSeat == SceneRuntime.MyClientSeat)
                {
                    /*uint time = Utility.GetTickCount() - bulletTick;
                     * SceneMain.Instance.bulletTime.AddTime(time);*/
                }
                m_PlayerMgr.LaunchBullet(pack);
            }
        }
Beispiel #19
0
        private void UpdateRootPos()
        {
            Vector3 pos;
            Vector3 scrPos   = new Vector3(Screen.width, Screen.height, 0);
            Vector3 worldPos = scrPos; //SceneBoot.Instance.UICamera.ScreenToWorldPoint(scrPos);
            float   x        = Screen.width / 4;
            float   x1       = Screen.width / 3;

            switch (m_Seat)
            {
            case 0:
                //pos = new Vector3(x, Camera.main.rect.yMin*Screen.height, 0);
                pos = new Vector3(x, 0, 0);
                break;

            case 1:
                pos = new Vector3(x1 * 2, Camera.main.rect.yMin * Screen.height, 0);
                break;

            case 2:
                pos = new Vector3(x1 * 2, Camera.main.rect.yMax * Screen.height, 0);
                break;

            case 3:
                pos = new Vector3(x, Camera.main.rect.yMax * Screen.height, 0);
                break;

            default:
                pos = Vector3.zero;
                break;
            }

            m_TransformHandle.position = pos;//SceneObjMgr.Instance.UICamera.ScreenToWorldPoint(pos);
            // new Vector3(-1, 0, 0);
            LauncherPos = new Vector2(m_TransformHandle.position.x, m_TransformHandle.position.y);
            //Transform goldIcon = m_TransformHandle.FindChild("UserScore/Image");
            Transform goldIcon = m_TransformHandle.FindChild("UserScore/Image");

            SceneRuntime.InitGoldPosMapping(m_Seat, goldIcon.position);
            // m_GlodPos = m_GlodTransform.position;
            //m_GunPivot = Camera.main.ScreenToWorldPoint( m_GunBarrel.GunPivot);
            m_GunPivot = m_TransformHandle.position;//m_GunBarrel.GunPivot;
        }
Beispiel #20
0
        public void CheckFishPos()
        {
            if (m_FishNum == 0 || ++SendInterval < 120)
            {
                return;
            }
            SendInterval = 0;

            List <CheckFishPos> list = new List <CheckFishPos>();

            foreach (Fish fish in m_FishList.Values)
            {
                if (fish.Delay)
                {
                    continue;
                }
                CheckFishPos ncf = new CheckFishPos();
                ncf.FishID = fish.FishID;
                ncf.Time   = fish.Time;
                ncf.Pos    = Utility.ToNetCmdVec3(fish.Position);
                ncf.Rot    = Utility.ToNetCmdVec4(fish.Rotation);
                ncf.Speed  = fish.Speed;
                list.Add(ncf);

                if (list.Count > 50)
                {
                    NetCmdCheckFishPos cmd = new NetCmdCheckFishPos();
                    cmd.Fish    = list.ToArray();
                    cmd.FishNum = (ushort)cmd.Fish.Length;
                    cmd.SetCmdType(NetCmdType.CMD_CHECK_FISH_POS);
                    SceneRuntime.Send <NetCmdCheckFishPos>(cmd);
                    list.Clear();
                }
            }
            {
                NetCmdCheckFishPos cmd = new NetCmdCheckFishPos();
                cmd.Fish    = list.ToArray();
                cmd.FishNum = (ushort)cmd.Fish.Length;
                cmd.SetCmdType(NetCmdType.CMD_CHECK_FISH_POS);
                SceneRuntime.Send <NetCmdCheckFishPos>(cmd);
            }
        }
Beispiel #21
0
        public void OnPlayerJoin(IEvent iEvent)
        {
            Debug.Log("CMD_PLAYER_JOIN");
            NetCmdPack       pack = iEvent.parameter as NetCmdPack;
            NetCmdPlayerJoin ncp  = (NetCmdPlayerJoin)pack.cmd;
            PlayerExtraData  pd   = new PlayerExtraData();

            pd.playerData.ID      = ncp.PlayerInfo.ID;
            pd.playerData.GoldNum = ncp.PlayerInfo.GoldNum;
            pd.playerData.ImgCrc  = ncp.PlayerInfo.ImgCrc;
            pd.playerData.Level   = ncp.PlayerInfo.Lvl;
            pd.playerData.Name    = ncp.PlayerInfo.Name;
            byte clientSeat = SceneRuntime.ServerToClientSeat(ncp.Seat);
            bool launcherValid;
            byte clientLauncherType;

            SceneRuntime.CheckLauncherValid(ncp.LauncherType, out clientLauncherType, out launcherValid);
            //PlayerManager.Instance.PlayerJoin(pd, clientSeat, ncp.rateIndex, clientLauncherType, launcherValid);
            m_PlayerMgr.PlayerJoin(pd, clientSeat, ncp.rateIndex, clientLauncherType, launcherValid);
        }
Beispiel #22
0
        public override bool Update(float delta, Fish fish, out bool bRemove)
        {
            float x = Camera.main.WorldToScreenPoint(fish.Position).x;

            if (m_LeftToRight)
            {
                x /= Screen.width;
            }
            else
            {
                x = (Screen.width - x) / Screen.width;
            }

            float delay = x * 1.5f + 1.1f;

            if (delay <= m_Timer.LifeTime || m_Timer.IsEnd)
            {
                fish.StopLaugh(false);
                if (fish.ExtraData != null)
                {
                    GlobalEffectData gfd = (GlobalEffectData)fish.ExtraData;
                    fish.ExtraData = null;
                    gfd.Life       = 0;
                }
                float transRot = -Utility.Range(100, 200);
                float pathRot  = -Utility.Range(300, 500);
                float speed    = Utility.Range(15, 20) * SceneRuntime.ComputeZScaling(fish, 1.0f);

                FishOptPath fop = new FishOptPath(PathManager.Instance.BoLang, transRot, pathRot, speed, 0, fish.Position, true);
                fop.SetDeadData(0, false, null);
                fish.AddOpt(fop);
                bRemove = true;
            }
            else
            {
                bRemove = false;
            }
            return(true);
        }
Beispiel #23
0
        //单个金币
        public void ShowUnLockRateReward(Vector3 pos)
        {
            for (int i = 0; i < 3; i++)
            {
                GoldEffectData ged = new GoldEffectData();
                ged.GameObj = Initobj(m_GoldObj);
                ged.GameObj.transform.position = pos + ((new Vector3(Utility.RandFloat(), Utility.RandFloat(), 0)) * 0.15f);

                /*ged.m_Tween.m_Pos = ged.GameObj.transform.GetComponent<TweenPosition>();
                 * ged.m_Tween.m_Sclae = ged.GameObj.transform.GetComponent<TweenScale>();*/
                ged.m_Tween.m_Pos   = ged.GameObj.transform.GetComponents <DOTweenAnimation>()[0];
                ged.m_Tween.m_Sclae = ged.GameObj.transform.GetComponents <DOTweenAnimation>()[1];
                ged.ScaleGoldTR(0.6f, 0.6f);
                ged.m_DelayTime = 0;
                ged.GoldNum     = 1;
                ged.PlayTween(true);
                ged.m_vecpathend = SceneRuntime.GetLauncherGoldIconPos(SceneRuntime.SceneModel.PlayerMgr.MySelf.ClientSeat);
                m_UnlockRateList.Add(ged);
            }
            //  if (SceneRuntime.PlayerMgr.GetPlayer(ged.catchedData.ClientSeat) == SceneRuntime.PlayerMgr.MySelf)
            //   GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_GoldJump);
        }
Beispiel #24
0
        public System.Collections.IEnumerator MainInitProcedure()
        {
            StartInit();
            while (m_roomDate == null)
            {
                yield return(new WaitForEndOfFrame());
            }
            //异步加载
            m_FishMgr           = new SceneFishMgr();
            m_BulletMgr         = new SceneBulletMgr();
            m_PlayerMgr         = new ScenePlayerMgr();
            m_EffectMgr         = new SceneEffectMgr();
            m_LauncherEffectMgr = new LauncherEffectMgr();
            m_ChestMgr          = new SceneChestMgr();

            m_FishMgr.Init(); yield return(new WaitForEndOfFrame());

            m_BulletMgr.Init(); yield return(new WaitForEndOfFrame());

            m_LauncherEffectMgr.Init(); yield return(new WaitForEndOfFrame());

            m_PlayerMgr.Init(); yield return(new WaitForEndOfFrame());

            m_EffectMgr.Init(); yield return(new WaitForEndOfFrame());

            m_ChestMgr.Init(); yield return(new WaitForEndOfFrame());

            SceneRuntime.Init(this);
            ResetScene(true);

            while (PathManager.Instance.IsInitOK == false)
            {
                yield return(new WaitForEndOfFrame());
            }
            SubStartCount();
            EndInit();
            isUpdate = true;
            yield break;
        }
Beispiel #25
0
        public void ChangeLauncher(NetCmdPack pack)
        {
            //GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_ChangeGun, false, true);
            NetCmdChangeLauncher ncc = (NetCmdChangeLauncher)pack.cmd;
            bool launcherValid;
            byte clientLauncherType;
            byte clientSeat = SceneRuntime.ServerToClientSeat(ncc.Seat);

            if (GetPlayer(clientSeat) == null)
            {
                return;
            }
            SceneRuntime.CheckLauncherValid(ncc.LauncherType, out clientLauncherType, out launcherValid);
            m_PlayerList[clientSeat].Launcher.ChangeLauncher(clientLauncherType, launcherValid);

            //change launcherType;
            if (m_MyClientSeat == clientSeat)
            {
                /*SceneRuntime.LogicUI.UpateLaunchData();
                 * SceneRuntime.LogicUI.UpdateSkillState();*/
                ModelManager.Instance.Get <SkillModel>().UpdateSkillState(ncc);
            }
        }
Beispiel #26
0
        public void LaunchSyncBullet(NetCmdPack pack)
        {
            NetCmdSyncBullet cmd         = (NetCmdSyncBullet)pack.cmd;
            float            elapsedTime = (Utility.GetTickCount() - pack.tick) * 0.001f + SceneRuntime.NetDelayTime;

            for (int i = 0; i < cmd.Bullets.Length; ++i)
            {
                SyncBulletData data = cmd.Bullets[i];
                byte           clientSeat, id;
                SceneRuntime.BuuletIDToSeat(data.BulletID, out clientSeat, out id);
                ScenePlayer sp = GetPlayer(clientSeat);
                if (sp == null)
                {
                    //LogMgr.Log("不存在的玩家座位:" + clientSeat);
                    return;
                }
                short degree = SceneRuntime.AngleInversion(data.Degree);
                SceneRuntime.BulletMgr.LaunchBullet(data.BulletID, data.BulletType, data.RateIdx, degree,
                                                    data.Time * 0.001f + elapsedTime, data.ReboundCount, data.LockFishID
                                                    /*, data.CollideCount, data.PauseTime * 0.001f, data.SpeedScaling * 0.001f*/);
                //int gold = LauncherSetting.LauncherDataList[data.BulletType].Consume * BulletSetting.BulletRate[data.RateIdx];
                //ConsumeGold(clientSeat, gold, sp);
            }
        }
Beispiel #27
0
        public void FishCatched(NetCmdPack pack)
        {
            Debug.Log("FishCatched");
            NetCmdCatched cmd = (NetCmdCatched)pack.cmd;
            byte          clientSeat;
            byte          id;

            SceneRuntime.BuuletIDToSeat(cmd.BulletID, out clientSeat, out id);
            CatchBulletData cbd = SceneRuntime.BulletMgr.GetBullet(clientSeat, id);

            if (cbd.IsValid() == false)
            {
                return;
            }
            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }
            bool        bNotDelay = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            CatchedData cd        = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_BULLET;
            cd.ClientSeat = clientSeat;
            cd.FishList   = new List <CatchFishData>();
            ushort lockfishid = 0;

            if (cbd.BulletObj != null)
            {
                if (cbd.BulletObj.LauncherType == 4)
                {
                    lockfishid = cbd.BulletObj.LockedFishID;
                }
                cd.SubType   = cbd.BulletObj.LauncherType;
                cd.RateIndex = cbd.BulletObj.RateIndex;
            }
            else
            {
                cd.SubType   = cbd.LauncherType;
                cd.RateIndex = cbd.RateIndex;
            }

            if (bNotDelay == false)
            {
                ProcessDelayOver(cmd.Fishs, cd);
                return;
            }

            CatchLithingList cll = null;
            BlendData        bd  = new BlendData(Color.red, 0.6f, 0, 0, 0.4f);

            if (cmd.Fishs != null)
            {
                for (int i = 0; i < cmd.Fishs.Length; ++i)
                {
                    NetFishCatched nfc = cmd.Fishs[i];
                    CatchFishData  cfd = SceneRuntime.FishMgr.FindFish(nfc.FishID);
                    if (cfd.IsValidFishType() == false)
                    {
                        continue;
                    }
                    Fish fish = cfd.FishObj;
                    if (fish != null && fish.FishID == lockfishid)
                    {
                        cbd.BulletObj.ClearLockFishID();//只有穿透子弹才需要清空锁定,其他子弹发生碰撞就销毁了。
                    }
                    switch ((FishCatchEventType)nfc.CatchEvent)
                    {
                    case FishCatchEventType.CATCH_EVENT_EFFECT:
                        if (fish == null || fish.Catched)
                        {
                            continue;
                        }

                        if (fish.HasOpt == false)
                        {
                            FishOptReduction ff = new FishOptReduction(1.0f, new ReductionData(1.0f, 0, 0, 0.5f), 0, bd);
                            fish.AddOpt(ff);
                        }
                        break;

                    case FishCatchEventType.CATCH_EVENT_ATTACK:
                        if (fish == null || fish.Catched)
                        {
                            continue;
                        }
                        FishOptReduction ff1 = new FishOptReduction(0.5f, new ReductionData(0.5f, 0, 0, 0.5f), 0, bd);
                        fish.AddOpt(ff1);
                        if (FishResManager.Instance.GetFishData(fish.FishType).ClipLength[(int)FishClipType.CLIP_GONGJI] != 0)
                        {
                            FishOptAction foa = new FishOptAction(FishClipType.CLIP_GONGJI, 1.5f);
                            fish.AddOpt(foa);
                        }
                        break;

                    case FishCatchEventType.CATCH_EVENT_CATCHED:
                        if (fish != null)
                        {
                            FishOptReduction deadRed = new FishOptReduction(1.0f, new ReductionData(0, 0, 1.0f, 0), 0, bd);
                            FishOptAction    fod     = new FishOptAction(FishClipType.CLIP_SIWANG, 1.0f);
                            fod.SetDeadData(0, false, cd);
                            fish.ClearOpt();
                            fish.AddOpt(fod);
                            fish.AddOpt(deadRed);
                            fish.SetCatched(clientSeat);

                            fish.SetDropReward(nfc.nReward);
                        }
                        else
                        {
                            SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        }
                        cd.FishList.Add(cfd);
                        break;

                    case FishCatchEventType.CATCH_EVENT_CATCHED_LIGHTING_MAIN:
                        if (fish != null)
                        {
                            FishOptReduction deadRed = new FishOptReduction(1.0f, new ReductionData(0, 0, 2.0f, 0), 0, null);
                            FishOptAction    fod     = new FishOptAction(FishClipType.CLIP_SIWANG, 1.0f);
                            fod.SetDeadData(1, false, cd);
                            fish.ClearOpt();
                            fish.AddOpt(fod);
                            fish.AddOpt(deadRed);
                            fish.SetCatched(clientSeat);
                            fish.SetDropReward(nfc.nReward);
                            if (cll == null)
                            {
                                cll = new CatchLithingList();
                            }
                            cll.AddMainFish(fish);
                        }
                        else
                        {
                            SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        }
                        cd.FishList.Add(cfd);
                        break;

                    case FishCatchEventType.CATCH_EVENT_CATCHED_LIGHTING:
                        if (fish != null)
                        {
                            FishOptReduction deadRed = new FishOptReduction(1.0f, new ReductionData(0, 0, 2.0f, 0), 0, null);
                            FishOptAction    fod     = new FishOptAction(FishClipType.CLIP_SIWANG, 1.0f);
                            fod.SetDeadData(1, false, cd);
                            fish.ClearOpt();
                            fish.AddOpt(fod);
                            fish.AddOpt(deadRed);
                            fish.SetCatched(clientSeat);
                            fish.SetDropReward(nfc.nReward);

                            CatchFishData cfd2 = SceneRuntime.FishMgr.FindFish(nfc.LightingFishID);
                            if (cfd2.IsValidFishType())
                            {
                                if (cll == null)
                                {
                                    cll = new CatchLithingList();
                                }
                                cll.AddSubFish(cfd2.FishObj, fish);
                            }
                        }
                        else
                        {
                            SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        }
                        cd.FishList.Add(cfd);
                        break;
                    }
                }
            }
            if (cd.FishList.Count > 0)
            {
                SceneRuntime.ComputeGoldNum(cd);
                SceneRuntime.SceneModel.CatchFish(cd);
            }

            SceneRuntime.PlayerMgr.FishCatch(clientSeat, cmd.Combo);
            if (cbd.BulletObj != null)
            {
                cbd.BulletObj.GoldNum += cd.GoldNum;
                SceneRuntime.EffectMgr.PlayFishNet(cbd.BulletObj.Position, cd.SubType);
            }
            if (cd.SubType != 4)
            {
                SceneRuntime.BulletMgr.RemoveBullet(clientSeat, id);
            }

            if (cll != null)
            {
                ProcessLightingData(cll);
            }
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("子弹:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("子弹:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }
Beispiel #28
0
        public void UseSkillDisaster(NetCmdPack pack)
        {
            NetCmdSkillDisaster cmd = (NetCmdSkillDisaster)pack.cmd;
            bool bNotDelay          = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            byte clientSeat         = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }

            CatchedData cd = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_SKILL;
            cd.SubType    = (byte)SkillType.SKILL_DISASTER;
            cd.FishList   = new List <CatchFishData>();
            cd.ClientSeat = clientSeat;
            cd.RateIndex  = SceneRuntime.PlayerMgr.GetPlayer(cd.ClientSeat).RateIndex;

            RecordSkill(SkillType.SKILL_DISASTER, clientSeat);
            if (bNotDelay == false)
            {
                ProcessDelayOver(cmd.FishID, cd);
                return;
            }
            CatchLithingList cll = null;

            SceneRuntime.PlayerMgr.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].CDTime);
            //SceneRuntime.SceneModel.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].CDTime, SkillType.SKILL_DISASTER);
            GameObject       effect = SceneRuntime.EffectMgr.GetSkillEffect(6);
            GlobalEffectData gfd    = new GlobalEffectData(effect, 0, 5.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            //SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_TZ);
            SceneRuntime.PlayerMgr.PlaySkillAvatarEft(clientSeat);

            BlendData bd = new BlendData();

            bd.BaseTex    = SceneRuntime.EffectMgr.SkillDisasterTex;
            bd.EffectTex  = bd.BaseTex;
            bd.Blend_Type = (byte)BlendType.BLEND_ADD_TEX;
            bd.Duration1  = 1.0f;
            bd.Duration2  = 2.0f;
            bd.Factor     = 3.0f;

            FishOptPath pt = new FishOptPath(PathManager.Instance.DouDongPath, 0, 0, 1, 0, Vector3.zero);

            if (cmd.FishID != null)
            {
                for (int i = 0; i < cmd.FishID.Length; ++i)
                {
                    NetFishDeadTime dt  = cmd.FishID[i];
                    CatchFishData   cfd = SceneRuntime.FishMgr.FindFish(dt.FishID);
                    if (cfd.FishObj != null)
                    {
                        Fish fish = cfd.FishObj;
                        fish.StopLaugh(false);
                        float         t  = dt.DeadTime * ConstValue.INV255;
                        ReductionData rd = new ReductionData();

                        float dt1 = Utility.LerpFloat(FishSetting.FishDeadTime.TianZai_Dead_Time1, FishSetting.FishDeadTime.TianZai_Dead_Time1, t);
                        float dt2 = Utility.LerpFloat(FishSetting.FishDeadTime.TianZai_Stay_Time1, FishSetting.FishDeadTime.TianZai_Stay_Time2, t);
                        rd.Duration1 = dt1 + FishSetting.FishDeadTime.TianZai_DouDong_Time;

                        if (dt.LightingFishID != 0)
                        {
                            if (cll == null)
                            {
                                cll = new CatchLithingList();
                            }

                            CatchFishData cfd2 = SceneRuntime.FishMgr.FindFish(dt.LightingFishID);
                            if (cfd2.FishObj != null)
                            {
                                cll.AddSubFish(cfd2.FishObj, fish);
                            }
                        }

                        rd.Duration2 = dt2;
                        rd.Speed     = FishSetting.FishDeadTime.TianZai_Speed;
                        fish.ClearOpt();
                        FishOptOffset foo = new FishOptOffset(FishSetting.FishDeadTime.TianZai_DouDong_Time, PathManager.Instance.DouDongPath);
                        foo.Delay = dt1;
                        fish.AddOpt(foo);

                        FishOptReduction fr = new FishOptReduction(0, rd, rd.Duration1, bd);
                        fr.DeadType  = FishDeadType.DEAD_ACTION;
                        fr.CatchData = cd;
                        fish.SetCatched(clientSeat);
                        fish.AddOpt(fr);
                        fish.SetDropReward(dt.nReward);

                        cd.FishList.Add(cfd);
                    }
                    else if (cfd.IsValidFishType())
                    {
                        // SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        byte multiple = (byte)SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].multiple;
                        SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, multiple));
                        cd.FishList.Add(cfd);
                    }
                }
            }
            SceneRuntime.ComputeGoldNum(cd);
            SceneRuntime.SceneModel.CatchFish(cd);
            if (cll != null)
            {
                cll.DelayTime = 1.0f;
                m_LightinData.Add(cll);
                //ProcessLightingData(cll);
            }
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("天灾:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("天灾:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }
Beispiel #29
0
        public void UseSkillFreeze(NetCmdPack pack)
        {
            bool bNotDelay        = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            NetCmdSkillFreeze cmd = (NetCmdSkillFreeze)pack.cmd;
            byte clientSeat       = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }


            CatchedData cd = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_SKILL;
            cd.SubType    = (byte)SkillType.SKILL_FREEZE;
            cd.FishList   = new List <CatchFishData>();
            cd.ClientSeat = clientSeat;
            cd.RateIndex  = SceneRuntime.PlayerMgr.GetPlayer(cd.ClientSeat).RateIndex;

            RecordSkill(SkillType.SKILL_FREEZE, clientSeat);
            if (bNotDelay == false)
            {
                ProcessDelayOverFreeze(cmd.FishID, cd);
                return;
            }
            CatchLithingList cll    = null;
            GameObject       effect = SceneRuntime.EffectMgr.GetSkillEffect(2);

            effect.transform.localPosition = new Vector3(-17, -18.9f, 100);
            GlobalEffectData gfd = new GlobalEffectData(effect, 0, 5.0f);

            SceneRuntime.PlayerMgr.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_FREEZE].CDTime);
            // SceneRuntime.SceneModel.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte) SkillType.SKILL_FREEZE].CDTime,
            //    SkillType.SKILL_FREEZE);
            GlobalEffectMgr.Instance.AddEffect(gfd);
            //SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_BD);
            SceneRuntime.PlayerMgr.PlaySkillAvatarEft(clientSeat);

            ReductionData reduction = SkillSetting.SkillDataList[(int)SkillType.SKILL_FREEZE].Reduction;

            BlendData bd = new BlendData();

            bd.BaseTex    = SceneRuntime.EffectMgr.SkillFreezeBaseTex;
            bd.EffectTex  = SceneRuntime.EffectMgr.SkillFreezeEffectTex;
            bd.Blend_Type = (byte)BlendType.BLEND_ADD_TEX;
            bd.Duration1  = 0;
            bd.Duration2  = 2.0f;
            bd.Factor     = 0.5f;

            BlendData bd2 = new BlendData();

            bd2.EffectTex  = SceneRuntime.EffectMgr.SkillFreezeBaseTex;
            bd2.Blend_Type = (byte)BlendType.BLEND_ADD_TEX;
            bd2.Duration1  = reduction.Duration1;
            bd2.Duration2  = reduction.Duration2;
            bd2.Duration3  = reduction.Duration3;
            bd2.Factor     = 0.8f;
            if (cmd.FishID != null)
            {
                for (int i = 0; i < cmd.FishID.Length; ++i)
                {
                    NetFishDeadTime dt   = cmd.FishID[i];
                    CatchFishData   cfd  = SceneRuntime.FishMgr.FindFish(dt.FishID);
                    bool            dead = dt.DeadTime != 0;
                    if (cfd.FishObj != null)
                    {
                        Fish             fish = cfd.FishObj;
                        float            t    = dt.DeadTime * ConstValue.INV255;
                        FishOptReduction fr;
                        if (dead)
                        {
                            if (dt.LightingFishID != 0)
                            {
                                if (cll == null)
                                {
                                    cll = new CatchLithingList();
                                }
                                CatchFishData cfd2 = SceneRuntime.FishMgr.FindFish(dt.LightingFishID);
                                if (cfd2.FishObj != null)
                                {
                                    cll.AddSubFish(cfd2.FishObj, fish);
                                }
                            }

                            fish.Controller.PathEvent.Reset(0, false);
                            ReductionData rd = new ReductionData();
                            rd.Speed     = FishSetting.FishDeadTime.BingDong_Speed;
                            rd.Duration2 = Utility.LerpFloat(FishSetting.FishDeadTime.BingDong_Dead_Time1,
                                                             FishSetting.FishDeadTime.BingDong_Dead_Time2, t);
                            fr           = new FishOptReduction(rd.Speed, rd, 0, bd);
                            fr.DeadType  = FishDeadType.DEAD_IMMEDIATE;
                            fr.CatchData = cd;

                            effect = SceneRuntime.EffectMgr.GetSkillEffect(3);
                            Vector3 pos = fish.Position;
                            pos.z -= 20;
                            effect.transform.localPosition = pos;
                            gfd         = new GlobalEffectData(effect, rd.Duration2, 1.0f);
                            gfd.Scaling = fish.Scaling * Mathf.Max(1.0f, (pos.z / 1000)) * 0.2f;
                            fish.SetCatched(clientSeat);
                            GlobalEffectMgr.Instance.AddEffect(gfd);
                            fish.ClearOpt();
                            fish.AddOpt(fr);
                            cd.FishList.Add(cfd);
                            fish.SetDropReward(dt.nReward);
                        }
                        else
                        {
                            fr = new FishOptReduction(reduction.Speed, reduction, 0, bd2);
                            fish.ClearOpt();
                            fish.AddOpt(fr);
                        }
                    }
                    else if (dead && cfd.IsValidFishType())
                    {
                        // SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        byte multiple = (byte)SkillSetting.SkillDataList[(byte)SkillType.SKILL_FREEZE].multiple;
                        SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat,
                                                                SceneRuntime.GetFishGold(cfd.FishType, multiple));

                        cd.FishList.Add(cfd);
                    }
                }
            }
            SceneRuntime.ComputeGoldNum(cd);
            //SceneRuntime.SceneModel.CatchFish(cd);
            if (cll != null)
            {
                ProcessLightingData(cll);
            }
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("冰冻:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("冰冻:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }
Beispiel #30
0
        public void UseSkillLighting(NetCmdPack pack)
        {
            NetCmdSkillLighting cmd = (NetCmdSkillLighting)pack.cmd;
            bool bNotDelay          = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            byte clientSeat         = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }
            CatchedData cd = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_SKILL;
            cd.SubType    = (byte)SkillType.SKILL_LIGHTING;
            cd.FishList   = new List <CatchFishData>();
            cd.ClientSeat = clientSeat;
            cd.RateIndex  = SceneRuntime.PlayerMgr.GetPlayer(cd.ClientSeat).RateIndex;

            RecordSkill(SkillType.SKILL_LIGHTING, clientSeat);
            if (bNotDelay == false)
            {
                ProcessDelayOver(cmd.FishID, cd);
                return;
            }

            SceneRuntime.PlayerMgr.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_LIGHTING].CDTime);

            /*SceneRuntime.SceneModel.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte) SkillType.SKILL_LIGHTING].CDTime,
             *  SkillType.SKILL_LIGHTING);*/
            GameObject effect = SceneRuntime.EffectMgr.GetSkillEffect(5);

            effect.transform.localPosition = new Vector3(0, 21.7f, 150);
            GlobalEffectData gfd = new GlobalEffectData(effect, 0, 3.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            //SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_SD);
            SceneRuntime.PlayerMgr.PlaySkillAvatarEft(clientSeat);
            CatchLithingList cll            = null;
            float            lightDuration2 = 1.5f;

            if (cmd.FishID != null)
            {
                for (int i = 0; i < cmd.FishID.Length; ++i)
                {
                    NetFishDeadTime dt  = cmd.FishID[i];
                    CatchFishData   cfd = SceneRuntime.FishMgr.FindFish(dt.FishID);
                    if (cfd.FishObj != null)
                    {
                        Fish fish = cfd.FishObj;
                        fish.StopLaugh(false);
                        if (dt.LightingFishID != 0)
                        {
                            if (cll == null)
                            {
                                cll = new CatchLithingList();
                            }
                            CatchFishData cfd2 = SceneRuntime.FishMgr.FindFish(dt.LightingFishID);
                            if (cfd2.FishObj != null)
                            {
                                cll.AddSubFish(cfd2.FishObj, fish);
                            }
                            lightDuration2 = 2.0f;
                        }
                        else
                        {
                            lightDuration2 = 1.5f;
                        }
                        float         t  = dt.DeadTime * ConstValue.INV255;
                        ReductionData rd = new ReductionData();
                        rd.Speed     = 0;
                        rd.Duration1 = Utility.LerpFloat(FishSetting.FishDeadTime.ShanDian_Dead_Time1,
                                                         FishSetting.FishDeadTime.ShanDian_Dead_Time2, t);
                        rd.Duration2 = lightDuration2;
                        rd.Duration3 = 0;

                        BlendData bd = new BlendData();
                        bd.EffectTex  = SceneRuntime.EffectMgr.GetLightingTex(fish.FishType);
                        bd.Blend_Type = (byte)BlendType.BLEND_LERP_TEX;
                        bd.Duration1  = 0.25f;
                        bd.Duration2  = 2.0f;
                        bd.Factor     = 1.0f;
                        fish.ClearOpt();

                        FishOptReduction fr = new FishOptReduction(0.0f, rd, rd.Duration1, bd);
                        fr.DeadType  = FishDeadType.DEAD_IMMEDIATE;
                        fr.CatchData = cd;
                        fish.SetCatched(clientSeat);
                        fish.AddOpt(fr);
                        fish.SetDropReward(dt.nReward);

                        effect = SceneRuntime.EffectMgr.GetSkillEffect(4);
                        gfd    = new GlobalEffectData(fish, effect, rd.Duration1, lightDuration2,
                                                      GlobalEffectPosConverter.LightingPosConvert);
                        GlobalEffectMgr.Instance.AddEffect(gfd);
                        cd.FishList.Add(cfd);
                    }
                    else if (cfd.IsValidFishType())
                    {
                        byte multiple = (byte)SkillSetting.SkillDataList[(byte)SkillType.SKILL_TORNADO].multiple;
                        SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat,
                                                                SceneRuntime.GetFishGold(cfd.FishType, multiple));
                        //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        cd.FishList.Add(cfd);
                    }
                }
            }
            SceneRuntime.ComputeGoldNum(cd);
            //SceneRuntime.SceneModel.CatchFish(cd);
            if (cll != null)
            {
                ProcessLightingData(cll);
            }
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("闪电:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("闪电:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }