예제 #1
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);
        }
예제 #2
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);
                    }
                }
            }
        }
예제 #3
0
        public void UpdatePlayerGold(byte clientSeat, int gold)
        {
            if (GetPlayer(clientSeat) == null)
            {
                return;
            }
            ScenePlayer sp = SceneRuntime.PlayerMgr.GetPlayer(clientSeat);

            PlayerRole.Instance.OnAddUserGlobelByCatchedData(clientSeat, gold);
            if (sp != null && sp.Launcher != null)
            {
                sp.Launcher.UpdateUserGold(clientSeat);
            }
        }
예제 #4
0
        public bool PlayerJoin(PlayerExtraData player, byte clientSeat, byte rateIdx, byte launcherType, bool valid)
        {
            if (m_PlayerList[clientSeat] != null)
            {
                LogMgr.Log("Seat palyer already exists:" + clientSeat.ToString());
                return(false);
            }
            ScenePlayer sp = new ScenePlayer();

            sp.Player     = player;
            sp.ClientSeat = clientSeat;
            sp.RateIndex  = rateIdx;
            sp.Launcher   = new Launcher(launcherType, valid, clientSeat, rateIdx);
            sp.Launcher.Init();
            m_PlayerList[clientSeat] = sp;

            if (clientSeat != MyClientSeat)
            {
                //获取头像

                /*if (player.playerData.ImgCrc < ConstValue.CUSTOM_HEADER)
                 *  sp.Launcher.SetPlayerImg(null, player.playerData.ImgCrc);
                 * else
                 *  HeaderManager.Instance.GetPlayerHeader(player.playerData.ID, player.playerData.ImgCrc,
                 *      HeaderOptType.HEADER_SCENE, clientSeat);*/
            }
            else
            {
                /*SceneRuntime.LogicUI.GetSkillBar.UpdateData();
                 * SceneRuntime.LogicUI.UpdateSkillState();*/
            }
            //获取金币
            m_PlayerList[clientSeat].Launcher.UpdateUserGold(clientSeat);



            return(true);
        }
예제 #5
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);
            }
        }