public IActionResult RunBattle(Guid id) { bool isBattleFinish = _game.RunBattle(id); List <Gladiator> players = _game.ShowPlayerInBattle(id); List <PlayerInfoDto> playerInfoDtos = new List <PlayerInfoDto>(); GameInfoDto gameInfoDto = new GameInfoDto(); foreach (var player in players) { var playerInfoDto = new PlayerInfoDto { Name = player.Name, Pv = player.Pv, Stamina = player.Stamina, PlayerId = player.GladiatorId }; playerInfoDtos.Add(playerInfoDto); } gameInfoDto.Gladiators = playerInfoDtos; gameInfoDto.IsBattleFinish = isBattleFinish; if (isBattleFinish) { gameInfoDto.GladiatorId = players.Single(s => s.Pv > 0).GladiatorId; } return(Ok(gameInfoDto)); }
public void UpdateUIData(PlayerInfoDto playerInfo) { if (playerInfo != null) { userPanelGold.text = NumberConvert.ConvertW(playerInfo.gold); userPanelRank.text = NumberConvert.GetTitle(playerInfo.gold); userPanelDiamond.text = playerInfo.diamond.ToString(); if (playerInfo.useAutoId > 0) { PlayerCache.loginInfo.useAutoId = playerInfo.useAutoId; currentCar.sprite = GameTools.Instance.GetSpite("Sprite/Shop/car/" + playerInfo.useAutoId); currentCar.gameObject.SetActive(true); } else { currentCar.gameObject.SetActive(false); } //头像显示 LoadHeadImgUtils.Instance.LoadHeadImg(userHeadimg, playerInfo.headImgUrl); userName.text = playerInfo.userName; //判断是不是靓号 if (false) { advanceTxt.gameObject.SetActive(true); generalTxt.gameObject.SetActive(false); advanceTxt.text = playerInfo.uid.ToString(); } else { advanceTxt.gameObject.SetActive(false); generalTxt.gameObject.SetActive(true); generalTxt.text = playerInfo.uid.ToString(); } userSex.text = PlayerCache.loginInfo.sex; userPanelRank.text = NumberConvert.GetTitle(playerInfo.gold); userPanelGold.text = NumberConvert.ConvertW(playerInfo.gold); userPanelDiamond.text = playerInfo.diamond.ToString(); userPanelCharm.text = playerInfo.charm.ToString(); StartCoroutine(GetLocatioin(addressTxt)); if (playerInfo.vipLv > 0) { //显示vip等级 vipImg.sprite = GameTools.Instance.GetSpriteAtlas("Sprite/Vip/VipAtlas1", "vip_level_big_icon_" + playerInfo.vipLv); vipImg.gameObject.SetActive(true); } else { vipImg.gameObject.SetActive(false); } } }
public IActionResult GetPlayerInfo() { int lastCityId = _sessionCache.LastCityId; if (lastCityId == default(int)) { lastCityId = 1; } PlayerInfoDto res = _playerService.GetPlayerInfo(lastCityId); return(Ok(res)); }
public IActionResult GetWinner(Guid id) { Gladiator playerWinner = _game.ShowPlayerWinner(id); PlayerInfoDto playerInfoDto = new PlayerInfoDto { PlayerId = playerWinner.GladiatorId, Name = playerWinner.Name, Pv = playerWinner.Pv, Stamina = playerWinner.Stamina }; return(Ok(playerInfoDto)); }
/// <summary> /// 查看其它玩家信息 /// </summary> /// <param name="otherPlayerUid"></param> public static void LookOtherPlayerInfo(long otherPlayerUid) { PlayerCache.CurrentOtherPlayerUID = otherPlayerUid; PlayerInfoDto playerInfo = PlayerCache.hallPlayerInfoOperation.playerInfo(otherPlayerUid); if (playerInfo != null) { if (playerInfo.uid != PlayerCache.loginInfo.uid) { if (PlayerCache.otherPlayerInfoDic.ContainsKey(otherPlayerUid)) { PlayerCache.otherPlayerInfoDic.Remove(otherPlayerUid); } PlayerCache.otherPlayerInfoDic.Add(otherPlayerUid, playerInfo); switch (CurrentSceneID) { case SceneID.Hall: UIManager.Instance.OpenUI <UIOtherPlayerPanel>("Prefabs/Friend/OtherPlayerInfoPanel", GetCanvas()); break; case SceneID.Primary: case SceneID.Middle: case SceneID.Advanced: UIManager.Instance.OpenUI <UIGameOtherPlayerPanel>("Prefabs/Game/GameOtherPlayerInfoPanel", GetCanvas()); break; case SceneID.Dice: UIManager.Instance.OpenUI <DiceotherPlayPlane>("Prefabs/Game/Dice/DiceOtherPlayerInfoPanel", GetCanvas()); break; case SceneID.Wanren: UIManager.Instance.OpenUI <UIOtherPlayerPanel>("Prefabs/Friend/OtherPlayerInfoPanel", GetCanvas()); break; case SceneID.CheatPrimary: case SceneID.CheatMiddle: case SceneID.CheatAdvanced: UIManager.Instance.OpenUI <UIGameOtherPlayerPanel>("Prefabs/Game/GameOtherPlayerInfoPanel", GetCanvas()); break; case SceneID.TianTianLe: break; default: break; } } } }
public PlayerInfoDto GetPlayerInfo(int lastCityId = 1) { PlayerInfoDto res = _sessionCache.PlayerInfo; if (res.Player != null) { return(res); } var currentPlayer = this.GetPlayer(_httpContextAccessor.HttpContext.User.Identity.Name); //todo: automapper na playera i tu dać playera res.Player = new PlayerDto() { Id = currentPlayer.Id, Name = currentPlayer.Login, Money = currentPlayer.Money, Age = (int)(DateTime.Now - currentPlayer.Created).TotalDays }; var currentCity = _cityService.GetCity(lastCityId); res.CurrentCity = new CityDto() { Id = currentCity.Id, Name = currentCity.Name, Created = currentCity.Created, Money = (int)currentCity.Money, //todo: automapper na playera i tu dać playera Owner = null, Population = currentCity.Population }; res.AvailableVehicles = new List <VehicleDto>(); _vehicleService.GetPlayerVehicles(currentPlayer.Id).ForEach(x => { res.AvailableVehicles.Add(new VehicleDto() { Id = x.Id, Owner = res.Player, Capacity = x.Capacity, Cost = x.Cost, Fuel = x.Fuel, Speed = x.Speed, VehicleType = x.VehicleType, SourcePath = x.Photo.SourcePath }); }); _sessionCache.PlayerInfo = res; return(res); }
/// <summary> /// 将该玩家踢出下座位 /// </summary> private void BtnKickOnClick() { //判断是否为vip if (PlayerCache.loginInfo.vipLv > 0) { PlayerInfoDto player = PlayerCache.otherPlayerInfoDic[PlayerCache.CurrentOtherPlayerUID]; //判断该玩家的vip等级是否大于自己 if (PlayerCache.loginInfo.vipLv > player.vipLv) { //踢下座位 DiceTcpOperation.kicking(PlayerCache.CurrentOtherPlayerUID); UIManager.Instance.Close("Prefabs/Game/Dice/DiceOtherPlayerInfoPanel"); } else { XUIMidMsg.QuickMsg("Vip等级低于该玩家"); } } else { XUIMidMsg.QuickMsg("只有vip用户才可以踢人哟"); } }
public PlayerPositionAckMessage(ulong accountId, PlayerInfoDto player) { AccountId = accountId; Player = player; }
public ChatPlayerInfoAckMessage(PlayerInfoDto player) { Player = player; }
public void UpdateUI() { PlayerInfoDto info = PlayerCache.hallPlayerInfoOperation.playerInfo(PlayerCache.CurrentOtherPlayerUID); // DebugUtils.DebugerExtension.Log(this, PlayerCache.CurrentOtherPlayerUID); if (info != null) { if (info != null) { userPanelGold.text = info.gold.ToString(); userPanelDiamond.text = info.diamond.ToString(); //头像显示 LoadHeadImgUtils.Instance.LoadHeadImg(userHeadimg, info.headImgUrl); userPanelName.text = info.userName; //判断是不是靓号 if (false) { advanceTxt.gameObject.SetActive(true); generalTxt.gameObject.SetActive(false); advanceTxt.text = info.uid.ToString(); } else { advanceTxt.gameObject.SetActive(false); generalTxt.gameObject.SetActive(true); generalTxt.text = info.uid.ToString(); } // userPanelSex.text = info.; userPanelRank.text = NumberConvert.GetTitle(info.gold); userPanelGold.text = NumberConvert.ConvertW(info.gold); userPanelDiamond.text = info.diamond.ToString(); userPanelCharm.text = info.charm.ToString(); ILMgr.Instance.StartCoroutine(GetLocation(userAddressTxt, info.ip)); userPanelSignAture.text = info.sigin; contactTxt.text = info.contactWay; if (info.vipLv > 0) { //显示vip等级 vipImg.sprite = GameTools.Instance.GetSpriteAtlas("Sprite/Vip/VipAtlas1", "vip_level_big_icon_" + info.vipLv); vipImg.gameObject.SetActive(true); } else { vipImg.gameObject.SetActive(false); } if (info.useAutoId > 0) { currentCar.sprite = GameTools.Instance.GetSpite("Sprite/Shop/car/" + info.useAutoId); currentCar.gameObject.SetActive(true); } else { currentCar.gameObject.SetActive(false); } } } }
private void OnEnable() { PlayerInfoDto playerInfo = hallPlayerInfoOperation.playerInfo(PlayerCache.loginInfo.uid); UpdateUIData(playerInfo); }
public override void OnStart() { PlayerInfoDto playerInfo = hallPlayerInfoOperation.playerInfo(PlayerCache.loginInfo.uid); UpdateUIData(playerInfo); }