public UIGameRankWindowController() { for (var i = 1; i < 10; i++) { var tmpvo = new GameRankVo(); tmpvo.rankTip = "2" + i; tmpvo.playerName = "wahaha" + i.ToString(); tmpvo.headPath = GameModel.GetInstance.myHandInfor.headImg; tmpvo.rankIndex = i; activeRankList.Add(tmpvo); } }
/// <summary> /// Upates the data 刷新组件信息. gamevo数据 , 所在排行榜的类型排行榜的类型0 是活跃排行榜 1等级排行榜 2.资产排行榜 /// </summary> /// <param name="gameVo">Game vo.</param> /// <param name="rankType">Rank type.</param> public void UpateData(GameRankVo gameVo, int rankType) { if (null == gameVo) { gameobj.SetActiveEx(false); return; } gameobj.SetActiveEx(true); var index = gameVo.rankIndex; var isNormal = true; var tmpbgPath = ""; var tmpIconPath = ""; var tipStr = gameVo.rankTip; if (index == 1) { isNormal = false; tmpbgPath = brightbgPath; tmpIconPath = rankFirstPath; } else if (index == 2) { isNormal = false; tmpbgPath = brightbgPath; tmpIconPath = rankTwoPath; } else if (index == 3) { isNormal = false; tmpbgPath = brightbgPath; tmpIconPath = rankThreePath; } else { tmpbgPath = normalbgPath; } if (isNormal == false) { rankImg.SetActive(true); lb_rank.SetActiveEx(false); rankImg.Load(tmpIconPath); lb_name.color = brightColor; lb_tip.color = brightColor; bgimg.rectTransform.sizeDelta = new Vector2(327, 62); } else { rankImg.SetActive(false); lb_rank.SetActiveEx(true); lb_rank.text = index.ToString(); lb_name.color = normalColor; lb_tip.color = normalColor; bgimg.rectTransform.sizeDelta = new Vector2(340, 67); } if (rankType == 0) { tipStr = "游戏次数:" + gameVo.rankTip; } else if (rankType == 1) { tipStr = "当前等级:" + gameVo.rankTip; } else if (rankType == 2) { tipStr = "当前财富:" + gameVo.rankTip; } lb_name.text = gameVo.playerName; lb_tip.text = tipStr; //gameVo.headPath img_head.Load("share/atlas/battle/playerhead/head3.ab"); img_itembg.Load(tmpbgPath); }
/// <summary> /// Sets the rank infor. 需要填充数据的btn , 排行的数据 , 排行榜的类型0 是活跃排行榜 1等级排行榜 2.资产排行榜 /// </summary> /// <param name="target">Target.</param> /// <param name="tmpvo">Tmpvo.</param> /// <param name="rankType">Rank type.</param> private void _setRankInfor(RankItem target, GameRankVo tmpvo, int rankType) { target.UpateData(tmpvo, rankType); }