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); }
public void ResetPlayerData(JoinRoomData jrd, bool bFirst) { byte serverSeat = jrd.Seat; byte serverLauncherType = jrd.LauncherType; SceneObjMgr.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); }
//命令处理 //====================================================================== public void PlayerJoin(NetCmdPack pack) { 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); m_PlayerMgr.PlayerJoin(pd, clientSeat, ncp.rateIndex, clientLauncherType, launcherValid);//m_RoomRateIndex }
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(); } }
public void PlayerLeave(NetCmdPack pack) { byte clientSeat = SceneRuntime.ServerToClientSeat(((NetCmdPlayerLeave)pack.cmd).Seat); m_PlayerMgr.PlayerLeave(clientSeat); }