/// <summary> /// 设置我自己 的数据显示 /// </summary> /// <param name="level"></param> /// <param name="data"></param> /// <param name="type"></param> private void SetMyUIData(int level, UserInfo data, int type) { MeNameText.text = data.Nickname; MeHeadImage.sprite = SpriteHelper.GetPlayerHeadSpriteName(data.HeadId); if (level < 4) { MeRankNumberText.text = ""; RankLevelImg.gameObject.SetActive(true); RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_{level}"); RankLevelImg.SetNativeSize(); } else { MeRankNumberText.gameObject.SetActive(true); MeRankNumberText.text = level.ToString(); } if (type == 1) { TipsText.text = "拥有金币"; MeGoldText.text = GameHelper.ConvertCoinToString(data.Gold); } else { TipsText.text = "今日赢金"; MeGoldText.text = GameHelper.ConvertCoinToString(data.Score); } }
/// <summary> /// 今日盈利按钮 /// </summary> private async void OnClickProfitBtn() { SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click); TableBtn.SetActive(false); RankLevelImg.gameObject.SetActive(false); RecyleRankItem(); bool isMe = false; await Task.Delay(1); if (_resp != null) { _NoData.SetActive(_resp.IncomeList.Count == 0); for (int i = 0; i < _resp.IncomeList.Count; i++) { CreateRrankListsItem(_resp.IncomeList[i], 2); if (_resp.IncomeList[i].PlayerId == UserDataHelper.UserInfo.PlayerId) { SetMyUIData(i + 1, _resp.IncomeList[i], 2); isMe = true; } } } if (!isMe) { MeRankNumberText.text = ""; RankLevelImg.gameObject.SetActive(true); RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_weishangbang"); RankLevelImg.SetNativeSize(); MeNameText.text = UserDataHelper.UserInfo.Nickname; MeGoldText.text = "0"; TipsText.text = "今日赢金"; MeHeadImage.sprite = SpriteHelper.GetPlayerHeadSpriteName(UserDataHelper.UserInfo.HeadId); } }
/// <summary> /// 设置数据 type 1-金币,2-收益 /// </summary> /// <param name="parent"></param> /// <param name="level"></param> /// <param name="info"></param> /// <param name="type"></param> public void SetRankItemData(Transform parent, int level, UserInfo info, int type) { this.GameObject.transform.SetParent(parent); this.GameObject.transform.localScale = Vector3.one; if (level < 4) { RankLevelImg.gameObject.SetActive(true); RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_{level}"); RankLevelImg.SetNativeSize(); } else { RankLevelImg.gameObject.SetActive(false); } RankLevelTxt.text = level > 3 ? level.ToString() : ""; PlayerNameTxt.text = info.Nickname; PortraitImg.sprite = SpriteHelper.GetPlayerHeadSpriteName(info.HeadId); if (type == 1) { TipsText.text = "拥有金币"; ProfitTxt.text = GameHelper.ConvertCoinToString(info.Gold); } else { TipsText.text = "今日赢金"; ProfitTxt.text = GameHelper.ConvertCoinToString(info.Score); } IsMeObj.SetActive(info.PlayerId == UserDataHelper.UserInfo.PlayerId); BgImage.enabled = info.PlayerId != UserDataHelper.UserInfo.PlayerId; }
public void OnShow() { SoundHelper.FadeInPlaySound(DataCenterComponent.Instance.soundInfo.ddz_second_enter); this.panel.SetActive(true); this.GoldNumberText.text = UserDataHelper.UserInfo.Gold.ToString("F2"); this.PlayerIDText.text = "ID:" + UserDataHelper.UserInfo.PlayerId; this.playerHeadImg.sprite = SpriteHelper.GetPlayerHeadSpriteName(UserDataHelper.UserInfo.HeadId); var currentAreaInfo = GameHelper.AreaList[DDZGameHelper.CurrentGameInfo.GameId]; //this.LevelButton_middle.TryGetInChilds<Text>("ZhunRuText").text = "1"; //currentAreaInfo[0].Score.ToString(); //this.LevelButton_middle.TryGetInChilds<Text>("BottomScoreText").text = "1"; //currentAreaInfo[0].Score.ToString(); }
public static void SetHeadImage(Image img, int headid) { img.sprite = SpriteHelper.GetPlayerHeadSpriteName(headid); }
public void _InitData() { var myVo = DataCenterComponent.Instance.userInfo.getMyUserVo(); for (int i = 0; i < 3; i++) { var item = _rf.Get <GameObject>("Item" + i); var _ref = item.GetComponent <ReferenceCollector>(); var Status = _ref.Get <GameObject>("Status").GetComponent <Image>(); var HeadBox = _ref.Get <GameObject>("HeadBox").GetComponent <Image>(); var PlayerHead = _ref.Get <GameObject>("PlayerHead").GetComponent <Image>(); var PlayerName = _ref.Get <GameObject>("PlayerName").GetComponent <Text>(); var WinScore = _ref.Get <GameObject>("WinScore").GetComponent <Text>(); var LoseScore = _ref.Get <GameObject>("LoseScore").GetComponent <Text>(); var bg = _ref.Get <GameObject>("bg").GetComponent <Image>(); var baseScore = _ref.Get <GameObject>("baseScore").GetComponent <Text>(); var besu = _ref.Get <GameObject>("besu").GetComponent <Text>(); if (DDZGameHelper.settle != null) { var playerData = DDZGameHelper.settle.PlayerData[i]; int realSeatID = DDZGameHelper.ChangeSeat(playerData.ChairId); PlayerHead.sprite = SpriteHelper.GetPlayerHeadSpriteName(playerData.HeadId); PlayerName.text = playerData.NickeName; Status.sprite = playerData.IsLord ? SpriteHelper.GetSprite("ddzgame", "DDZ_dizhu2") : SpriteHelper.GetSprite("ddzgame", "DDZ_nm"); Status.gameObject.SetActive(true); besu.text = DDZGameHelper.settle.Beishu[realSeatID].ToString(); if (playerData.Score > 0) { WinScore.gameObject.SetActive(true); LoseScore.gameObject.SetActive(false); WinScore.text = "+" + playerData.Score; } else { WinScore.gameObject.SetActive(false); LoseScore.gameObject.SetActive(true); LoseScore.text = playerData.Score.ToString(); } //判断自己的分数为正还是为负 if (myVo != null) { if (myVo.userID == playerData.UserId) { PlayerName.color = Color.yellow; baseScore.color = Color.yellow; besu.color = Color.yellow; if (playerData.Score >= 0) { Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shengli"); //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_win); Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglidi"); winLab.SetActive(true); LoseLab.SetActive(false); bg.gameObject.SetActive(true); bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglitiao"); } else { Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibai"); //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_lose); Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibaidi"); winLab.SetActive(false); LoseLab.SetActive(true); bg.gameObject.SetActive(true); bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_sibaitiao"); } Title.SetNativeSize(); } } } } if (DDZGameHelper.settle != null) { baseScoreLab.text = "X" + DDZGameHelper.settle.OtherData[0].ToString(); bombScoreLab.text = "X" + DDZGameHelper.settle.OtherData[1].ToString(); FlowerScoreLab.text = "X" + DDZGameHelper.settle.OtherData[2].ToString(); } }