Files
JJBB/Assets/Project/Script/GUI/Rank/RankWindowNew.cs
2024-08-23 15:49:34 +08:00

881 lines
29 KiB
C#

using Games.GlobeDefine;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Module.Log;
using GCGame;
using System;
using GCGame.Table;
using Games.Events;
public class RankWindowNew : MonoBehaviour
{
#region Single
private static RankWindowNew _instance;
public static RankWindowNew Instance
{
get
{
if (_instance != null)
{
return _instance;
}
LogModule.ErrorLog("Single : Can't get instance.");
return null;
}
}
#endregion
public enum RankType_T
{
InvalidType = -1, //默认无效排行
LevelComposite = 0, //等级综合排行
LevelProf0 = 1, //等级职业0排行
LevelProf1 = 2, //等级职业1排行
LevelProf2 = 3, //等级职业2排行
LevelProf3 = 4, //等级职业3排行
AbalityComposite = 5, //修为综合排行
AbalityProf0 = 6, //修为排行职业0
AbalityProf1 = 7, //修为排行职业1
AbalityProf2 = 8, //修为排行职业2
AbalityProf3 = 9, //修为排行职业3
LingYu = 10, //灵玉排行
YuanBao = 11, //元宝排行
YinLiang = 12, //银两排行
YinPiao = 13, //银票排行
EquipScoreComposite = 14, //装备评分综合排行
EquipScoreProf0 = 15, //装备评分排行职业0
EquipScoreProf1 = 16, //装备评分排行职业1
EquipScoreProf2 = 17, //装备评分排行职业2
EquipScoreProf3 = 18, //装备评分排行职业3
BattlePointComposite = 19, //战斗力综合排行
BattlePointProf0 = 20, //战斗力排行职业0
BattlePointProf1 = 21, //战斗力排行职业1
BattlePointProf2 = 22, //战斗力排行职业2
BattlePointProf3 = 23, //战斗力排行职业3
PetScoreComposite = 24, //宠物评分综合排行
PetScoreProf0 = 25, //宠物评分排行职业0
PetScoreProf1 = 26, //宠物评分排行职业1
PetScoreProf2 = 27, //宠物评分排行职业2
PetScoreProf3 = 28, //宠物评分排行职业3
GuildPraticeComposite = 29, //帮会修炼综合排行
GuildPraticeProf0 = 30, //帮会修炼排行职业0
GuildPraticeProf1 = 31, //帮会修炼排行职业1
GuildPraticeProf2 = 32, //帮会修炼排行职业2
GuildPraticeProf3 = 33, //帮会修炼排行职业3
UserShopMoney = 34, //玩家商店资金排行
Hot = 35, //人气排行
Flower = 36, //鲜花排行
GiveFlower = 37, //排行
HotWeek = 38, //人气周排行
FlowerWeek = 39, //鲜花周排行
GiveFlowerWeek = 40, //周排行
GuildFinishTimes = 41, //帮会出师次数排行
Constitu = 42, //根骨排行
Morfib = 43, //精力排行
Strength = 44, //力量排行
Intelleng = 45, //智力排行
Agile = 46, //敏捷排行
LuckyVal = 47, //幸运值排行
MaxHp = 48, //最大气血排行
MaxMp = 49, //最大法力排行
PysAttack = 50, //物理攻击排行
MagAttack = 51, //法术攻击排行
PysDef = 52, //物理防御排行
MagDef = 53, //法术防御排行
GuildMoney = 54, //帮会财富排行
GuildActive = 55, //帮会活跃度排行
GuildScope = 56, //帮会规模排行
GuildEquipScore = 57, //帮会装备评分排行
GuildUnionGame0 = 58, //帮会甲级联赛排行
GuildUnionGame1 = 59, //帮会乙级联赛排行
GuildUnionGame2 = 60, //帮会丙级联赛排行
GuildUnionGame3 = 61, //帮会丁级联赛排行
GuildUnionGame4 = 62, //帮会戊级联赛排行
GuildUnionGame5 = 63, //帮会己级联赛排行
GuildUnionGame6 = 64, //帮会庚级联赛排行
GuildUnionGame7 = 65, //帮会辛级联赛排行
GuildUnionGame8 = 66, //帮会壬级联赛排行
GuildUnionGame9 = 67, //帮会癸级联赛排行
GuildPoem = 68, //行酒令对诗排行
GuildRobberCostTime = 69, //帮会大盗排行
WeiboHot = 70, //微博热点排行<模板>
Advance_0 = 71, //进阶排行榜0
Advance_1 = 72, //进阶排行榜1
Advance_2 = 73, //进阶排行榜2
Advance_3 = 74, //进阶排行榜3
Advance_4 = 75, //进阶排行榜4
Advance_5 = 76, //进阶排行榜5
Advance_6 = 77, //进阶排行榜6
DailyRecharge = 78, // 每日充值排行榜
DailyConsume = 79, // 每日消费排行榜
CopyDefend_0 = 80,//守护岳飞副本难度0
CopyDefend_1 = 81,//守护岳飞副本难度1
CopyDefend_2 = 82,//守护岳飞副本难度2
CopyDefend_3 = 83,//守护岳飞副本难度3
CopyClimb_0 = 84,//爬塔副本副本难度0
CopyClimb_Buff_0 = 85, // 爬塔Buff副本难度
CopyClimb_Buff_1 = 86, // 爬塔Buff副本难度
CopyClimb_Buff_2 = 87, // 爬塔Buff副本难度
CopyClimb_Buff_3 = 88, // 爬塔Buff副本难度
CopyShadow_0 = 89, // 影子战场
CopyRealm_0 = 90, // 诸界爬塔副本
GemCombat = 102, //灵玉排行职业0
StrengthCombat = 103, //灵玉排行职业1
SkillCombat = 104, //灵玉排行职业2
RankMax,
}
public enum RankPropID
{
InvalidID = -1, //无效ID
UserGuid = 0, //玩家Guid
UserProf = 1, //玩家职业
UserName = 2, //玩家名
GuildName = 3, //帮会名
MasterName = 4, //师门名
LoverName = 5, //配偶名
HomelandName = 6, //家园名
PetName = 7, //宠物名
UserLevel = 8, //玩家等级
UserAbalityLevel = 9, //玩家修为
UserLingYu = 10, //灵玉
UserYuanBao = 11, //元宝
UserYinliang = 12, //银两
UserYinPiao = 13, //银票
UserEquipScore = 14, //玩家装备评分
UserBattlePoint = 15, //玩家战斗力
UserPetScore = 16, //玩家宠物评分
UserGuildPratice = 17, //玩家帮派修炼
UserShopMoney = 18, //玩家商店资金
UserGuildFinishTimes = 19, //玩家出师次数
UserHot = 20, //人气
UserFlower = 21, //鲜花
UserGiveFlower = 22, //送鲜花
UserHotWeek = 23, //周人气
UserFlowerWeek = 24, //周鲜花
UserGiveFlowerWeek = 25, //周送鲜花
UserConstitu = 26, //根骨
UserMorfib = 27, //精力
UserStrength = 28, //力量
UserIntelleng = 29, //智力
UserAgile = 30, //敏捷
UserLuckyVal = 31, //幸运值
UserMaxHp = 32, //最大气血
UserMaxMp = 33, //最大法力
UserPysAttack = 34, //物理攻击
UserMagAttack = 35, //法术攻击
UserPysDef = 36, //物理防御
UserMagDef = 37, //法术防御
GuildGuid = 38, //帮会Guid
GuildMemberCount = 39, //帮会成员数目
GuildScope = 40, //帮会规模
GuildMoney = 41, //帮会资金
GuildActiveVal = 42, //帮会活跃度
GuildEquipScore = 43, //帮会装备评分
GuildUnionGameRank = 44, //帮会联赛排名
GuildPoem = 45, //帮会行酒令对诗
GuildRobberCostTime = 46, //帮会大盗耗时
RecordTime = 47, // 本条记录产生时间
UserShopName = 48, //玩家商店名
UserRankIndex = 49, //玩家在榜单中的排名0~N
GuildCreateTime = 50, //帮会建立时间
WeiboRecordGuid = 51, //微博guid
WeiboLikedCount = 52, //微博点赞次数
GuildPoemCostTime = 53, //帮会行酒令对诗总耗时
UserAdvanceGrade = 54, //玩家的进阶阶级
UserAdvanceStar = 55, //玩家的进阶星数
TestingCopyPassedLevel = 56, //试炼副本通过波数
//家园暂时不搞
// 消费/充值榜新增
DailyRecharge = 57, // 每日充值金额
DailyConsume = 58, // 每日消费金额
RealRank = 59, // 真实排名
HeadPicName = 60, // 梦岛头像
//-----------------
AdvanceCombatValue = 61, // 进阶战斗力
RedPacketNum = 62, //红包数
Wing = 63, //翅膀id
FashionId = 64, //时装id
WeaponId = 65, //武器id
FellowId = 66, //宠物dataid
EffectId = 67, //装备特效id
AuraWingId = 68, //翅膀特效id
EnhanceTotalLV = 69, //强化总登记
EnhancePerfect = 70, //强化完美度
GemCombat = 71, //宝石战力
SkillCombat = 72, //技能战力
PropMax,
}
private Dictionary<int, string> types = new Dictionary<int, string>();
public GameObject RankMain; //左侧一级按钮
public GameObject RankSub; //左侧二级按钮
public GameObject RankSubRight; //右侧顶部排行分类
public GameObject RankInfoItem; //排名具体信息每条的记录
public ToggleGroup contentGroup;
public Text headItemText1;
public Text headItemText2;
public Text headItemText3;
public Text headItemText4;
public GameObject SelfRankInfoObj;
public TogglesControl toggleControl;
public NewRankRoot _newRankRootPanel;
public GameObject _OldPanel;
public GameObject _NewPanel;
int currentSelctRankMainType = -1;
int currentSelectRankSubType = -1;
int currentSelectRankSubSubType = -1;
Dictionary<int, List<GameObject>> subRankItems = new Dictionary<int, List<GameObject>>();
Dictionary<int, GameObject> menuRankItem = new Dictionary<int, GameObject>();
private bool hasInit = false;
void Awake()
{
Hashtable calbackparam = new Hashtable();
calbackparam["name"] = "RankInfoList";
MessageEventCallBack fun = OnNewRankInfo;
calbackparam.Add("callFun", fun);
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.RankInfoList, calbackparam);
if(_instance == null)
{
_instance = this;
hasInit = false;
}
toggleControl.OnTogglesSelect += OnRankMainSelect;
}
private void OnEnable()
{
toggleControl.SetToggleOn(0);
//OnRankMainSelect(0);
}
private int _CurSelectPageIndex = -1;
public void OnRankMainSelect(int index)
{
_CurSelectPageIndex = index;
if (index == 0 || index == 1)
{
_OldPanel.SetActive(false);
_NewPanel.SetActive(true);
_newRankRootPanel.ShowPanel(index);
}else
{
_OldPanel.SetActive(true);
_NewPanel.SetActive(false);
}
OnSelectMain(index);
}
void OnDestroy()
{
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.RankInfoList, "RankInfoList");
hasInit = false;
_instance = null;
}
void Start()
{
Init();
}
private void Init()
{
if (hasInit == false)
{
var rankTypeInfos = TableManager.GetRankInfoType().Values;
foreach (var typeInfo in rankTypeInfos)
{
types[typeInfo.Id] = typeInfo.ProStr;
}
var rankinfos = TableManager.GetRankProInfo().Values;
int index = 0;
currentSelctRankMainType = 0;
int indexChild = 0;
foreach (var type in types)
{
foreach (var rankInfo in rankinfos)
{
if (rankInfo.Type == type.Key)
{
CloneRankChild(rankInfo, indexChild); //排行榜左侧二级按钮
indexChild++;
}
}
index++;
}
// 默认开启第一个选项
toggleControl.SetToggleOn(0);
hasInit = true;
}
}
public void OnSelectMain(int type)
{
if (subRankItems.ContainsKey(type) == false)
{
if(type == -1)
{
currentSelctRankMainType = -1;
}
return;
}
if (subRankItems.ContainsKey(currentSelctRankMainType))
{
for (int i = 0; i < subRankItems[currentSelctRankMainType].Count; i++)
{
subRankItems[currentSelctRankMainType][i].SetActive(false);
}
}
currentSelctRankMainType = type;
for (int i = 0; i < subRankItems[currentSelctRankMainType].Count; i++)
{
subRankItems[currentSelctRankMainType][i].SetActive(true);
Transform checkMark = subRankItems[currentSelctRankMainType][i].transform.Find("Checkmark");
if(checkMark!=null)
{
if (i == 0)
{
subChildCheckmark = checkMark.gameObject;
checkMark.gameObject.SetActive(true);
Button btn = subRankItems[currentSelctRankMainType][i].GetComponent<Button>();
if(btn!=null)
{
btn.onClick.Invoke();
}
}
else
checkMark.gameObject.SetActive(false);
}
}
}
void CloneRankChild( Tab_RankProInfo rankInfo,int index)
{
if (RankSub == null)
return;
GameObject newMain = GameObject.Instantiate(RankSub);
if (newMain == null)
return;
newMain.transform.SetParent(RankSub.transform.parent);
newMain.transform.localPosition = RankSub.transform.localPosition;
newMain.transform.localScale = RankSub.transform.localScale;
newMain.SetActive(true);
if (subRankItems.ContainsKey(rankInfo.Type) == false)
subRankItems[rankInfo.Type] = new List<GameObject>();
subRankItems[rankInfo.Type].Add(newMain);
Text[] btnNames = newMain.GetComponentsInChildren<Text>();
for (int i = 0; i < btnNames.Length; i++)
{
btnNames[i].text = rankInfo.ProStr;
}
if(rankInfo.Type == currentSelctRankMainType)
{
newMain.SetActive(true);
Transform checkMark = newMain.transform.Find("Checkmark");
if (checkMark != null)
{
if (index == 0)
{
currentSelectRankSubType = rankInfo.SubType;
checkMark.gameObject.SetActive(true);
}
else
checkMark.gameObject.SetActive(false);
}
}
else
{
newMain.SetActive(false);
}
Button btn = newMain.GetComponent<Button>();
if (btn != null)
{
btn.onClick.AddListener(delegate ()
{
OnSelectSubChild(btn.gameObject, rankInfo.SubType);
});
}
if(index == 0)
{
OnSelectSubChild(btn.gameObject, rankInfo.SubType);
}
}
GameObject subChildCheckmark = null;
public void OnSelectSubChild(GameObject subChildBtn,int subType)
{
if (subChildBtn == null)
return;
Transform checkMark = subChildBtn.transform.Find("Checkmark");
if (checkMark == null)
return;
if (subChildCheckmark != null)
subChildCheckmark.SetActive(false);
subChildCheckmark = checkMark.gameObject;
subChildCheckmark.SetActive(true);
var ranks = TableManager.GetRankInfo().Values;
for(int i=0;i< rightTopItems.Count;i++)
{
rightTopItems[i].SetActive(false);
Destroy(rightTopItems[i]);
}
rightTopItems.Clear();
RightTopCheckMark = null;
currentSelectRankSubType = subType;
foreach (var rank in ranks)
{
if(rank.Type == currentSelctRankMainType && rank.SubType == subType)
{
CloneRightTopChild(rank);
}
}
}
List<GameObject> rightTopItems = new List<GameObject>();
void CloneRightTopChild(Tab_RankInfo rank)
{
if (RankSubRight == null)
return;
GameObject newObj = GameObject.Instantiate(RankSubRight);
if (newObj == null)
return;
newObj.transform.SetParent(RankSubRight.transform.parent);
newObj.transform.localPosition = RankSubRight.transform.localPosition;
newObj.transform.localScale = RankSubRight.transform.localScale;
newObj.SetActive(true);
rightTopItems.Add(newObj);
Text[] btnNames = newObj.GetComponentsInChildren<Text>();
for (int i = 0; i < btnNames.Length; i++)
{
btnNames[i].text = rank.SubSubTypeName;
}
Transform checkMark = newObj.transform.Find("Checkmark");
if (checkMark != null)
{
checkMark.gameObject.SetActive(false);
}
Button btn = newObj.GetComponent<Button>();
if (btn != null)
{
btn.onClick.AddListener(delegate ()
{
OnSelectRightTopItem(btn.gameObject,rank);
});
}
if(rightTopItems.Count ==1)
{
OnSelectRightTopItem(btn.gameObject, rank);
}
}
GameObject RightTopCheckMark;
public void OnSelectRightTopItem(GameObject RightTopItemBtn, Tab_RankInfo rank)
{
if (RightTopCheckMark != null)
RightTopCheckMark.SetActive(false);
if (RightTopItemBtn == null)
return;
Transform checkMark = RightTopItemBtn.transform.Find("Checkmark");
if (checkMark == null)
return;
if (RightTopCheckMark != null)
RightTopCheckMark.SetActive(false);
RightTopCheckMark = checkMark.gameObject;
RightTopCheckMark.SetActive(true);
headItemText1.text = "";
headItemText2.text = "";
headItemText3.text = "";
headItemText4.text = "";
Tab_RankProStr proStr1 = TableManager.GetRankProStrByID(rank.GetInfoIDbyIndex(0),0);
if(proStr1!=null)
{
headItemText1.text = proStr1.ProStr;
}
Tab_RankProStr proStr2 = TableManager.GetRankProStrByID(rank.GetInfoIDbyIndex(1), 0);
if (proStr2 != null)
{
headItemText2.text = proStr2.ProStr;
}
Tab_RankProStr proStr3 = TableManager.GetRankProStrByID(rank.GetInfoIDbyIndex(2), 0);
if (proStr3 != null)
{
headItemText3.text = proStr3.ProStr;
}
Tab_RankProStr proStr4 = TableManager.GetRankProStrByID(rank.GetInfoIDbyIndex(3), 0);
if (proStr4 != null)
{
headItemText4.text = proStr4.ProStr;
}
currentSelectRankSubSubType = rank.SubSubType;
//请求排行榜信息
if (_CurSelectPageIndex == 2)
{
CG_REQ_RANK_LIST send = (CG_REQ_RANK_LIST)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_RANK_LIST);
send.Ranktype = rank.Id;
send.SendPacket();
}
}
List<GameObject> rankInfoItems = new List<GameObject>();
GameObject curSelectInfo;
public void CloneRankInfoItem(int rank,int rankinfoID,RankElemStruct rankInfo)
{
Tab_RankInfo rankTabInfo = TableManager.GetRankInfoByID(rankinfoID, 0);
if (rankTabInfo == null)
return;
if (rankTabInfo.Type != currentSelctRankMainType)
return;
if (rankTabInfo.SubType != currentSelectRankSubType)
return;
if (rankTabInfo.SubSubType != currentSelectRankSubSubType)
return;
GameObject newObj = GameObject.Instantiate(RankInfoItem);
if (newObj == null)
return;
newObj.transform.SetParent(RankInfoItem.transform.parent);
newObj.transform.localPosition = RankInfoItem.transform.localPosition;
newObj.transform.localScale = RankInfoItem.transform.localScale;
newObj.SetActive(true);
rankInfoItems.Add(newObj);
SetRanInfo(rank, newObj, rankTabInfo, rankInfo);
long PlayerGuid = GetProValueInt((int)RankPropID.UserGuid, rankInfo); //玩家GUID 属性ID是 0
long GuildGuid = GetProValueInt((int)RankPropID.GuildGuid, rankInfo); //帮会guid 属性ID是38
string PlayerName = GetProValueStr((int)RankPropID.UserName, rankInfo); //玩家名称
long PlayerLevel = GetProValueInt((int)RankPropID.UserLevel, rankInfo); //玩家等级
long PlayerPro = GetProValueInt((int)RankPropID.UserProf, rankInfo); //玩家职业
long PlayerXiuwei = GetProValueInt((int)RankPropID.UserAbalityLevel, rankInfo); //玩家修为
GameObject select = newObj.transform.Find("select").gameObject;
if (select != null)
select.SetActive(false);
Button btn = newObj.GetComponent<Button>();
if(btn!=null)
{
btn.onClick.AddListener(delegate ()
{
if(PlayerGuid!=-1)
PlayerTooltipsLogic.ShowPlayerTooltip((ulong)PlayerGuid, PlayerName,Utils.GetProfessionSpriteName((int)PlayerPro), (int)PlayerLevel,-1, (int)PlayerXiuwei, Vector3.zero);
if(GuildGuid!=-1)
{
PopMenuLogic.ShowMenu("RankAddGuild", newObj, (ulong)GuildGuid, PlayerName);
}
if(curSelectInfo != null)
{
curSelectInfo.SetActive(false);
}
curSelectInfo = select;
curSelectInfo.SetActive(true);
});
}
}
void SetRanInfo(int rank,GameObject ParentObj, Tab_RankInfo rankTabInfo, RankElemStruct rankInfo)
{
if (rankTabInfo == null)
return;
Text[] childTexts = ParentObj.GetComponentsInChildren<Text>();
for (int i = 0; i < childTexts.Length; i++)
{
childTexts[i].text = "";
if (childTexts[i].name == "rank")
{
if (rank <= 0)
childTexts[i].text = StrDictionary.GetClientDictionaryString("#{2049}");
else
childTexts[i].text = rank.ToString();
Transform First = ParentObj.transform.Find("First");
Transform Second = ParentObj.transform.Find("Second");
Transform Three = ParentObj.transform.Find("Three");
if(First!=null)
{
First.gameObject.SetActive(rank == 1);
}
if (Second != null)
{
Second.gameObject.SetActive(rank == 2);
}
if (Three != null)
{
Three.gameObject.SetActive(rank == 3);
}
}
if (childTexts[i].name == "info0")
{
SetRankInfoText(childTexts[i], rankTabInfo.GetInfoIDbyIndex(0), rankInfo);
}
if (childTexts[i].name == "info1")
{
SetRankInfoText(childTexts[i], rankTabInfo.GetInfoIDbyIndex(1), rankInfo);
}
if (childTexts[i].name == "info2")
{
SetRankInfoText(childTexts[i], rankTabInfo.GetInfoIDbyIndex(2), rankInfo);
}
if (childTexts[i].name == "info3")
{
SetRankInfoText(childTexts[i], rankTabInfo.GetInfoIDbyIndex(3), rankInfo);
}
}
}
//自己的排名信息
void SetSelfRankInfo(RankElemStruct selfRank, int rankinfoID)
{
Tab_RankInfo rankTabInfo = TableManager.GetRankInfoByID(rankinfoID, 0);
if (rankTabInfo == null)
return;
int rank = (int)GetProValueInt((int)RankPropID.UserRankIndex, selfRank);
SetRanInfo(rank+1, SelfRankInfoObj, rankTabInfo,selfRank);
}
void SetRankInfoText(Text rankInfoText,int proID, RankElemStruct rankInfo)
{
if (proID == -1)
return;
long proValue = GetProValueInt(proID, rankInfo);
if (proValue != -1)
{
//职业特殊处理
if(proID == (int)RankPropID.UserProf)
{
rankInfoText.text = Utils.GetProfession((int)proValue);
}
else if(proID == (int)RankPropID.GuildEquipScore)
{
rankInfoText.text = (proValue > 0 ? StrDictionary.GetClientDictionaryString("#{2972}", proValue) : "0");
}
else
rankInfoText.text = proValue.ToString();
return;
}
string proValues = GetProValueStr(proID, rankInfo);
if(proValues != "")
{
rankInfoText.text = proValues;
}
}
public long GetProValueInt(int proID, RankElemStruct ranklist)
{
if (ranklist == null)
return -1;
for(int i=0;i< ranklist.numberfieldsCount;i++)
{
RankFieldNumberStruct numberInfo = ranklist.GetNumberfields(i);
if (proID == numberInfo.Propid)
return numberInfo.Propvalue;
}
return -1;
}
public string GetProValueStr(int proID, RankElemStruct ranklist)
{
if (ranklist == null)
return "";
for (int i = 0; i < ranklist.stringfieldsCount; i++)
{
RankFieldStringStruct stringInfo = ranklist.GetStringfields(i);
if (proID == stringInfo.Propid)
return stringInfo.Propvalue;
}
return "";
}
public void OnNewRankInfo(Hashtable addParam,Hashtable sendParam)
{
if (sendParam.ContainsKey("data") == false)
return;
GC_RET_RANK_LIST packet = (GC_RET_RANK_LIST)sendParam["data"];
if (packet == null)
return;
for(int i=0;i<rankInfoItems.Count;i++)
{
rankInfoItems[i].SetActive(false);
GameObject.Destroy(rankInfoItems[i]);
}
rankInfoItems.Clear();
for (int i=0;i<packet.ranklistCount;i++)
{
if (i >= 100)
break;
CloneRankInfoItem(i + 1, packet.Ranktype,packet.ranklistList[i]);
}
SetSelfRankInfo(packet.Myrankinfo, packet.Ranktype);
}
public static void ShowPage(RankType_T type)
{
var rankInfoTab = TableManager.GetRankInfoByID((int)type, 0);
if (rankInfoTab == null)
return;
UIManager.ShowUI(UIInfo.RankRoot, delegate(bool bSucess, object param) {
if(bSucess)
{
if (rankInfoTab.Type == 0 || rankInfoTab.Type == 1)
NewRankRoot.Instance.isShowType = (int)type;
RankWindowNew.Instance.PositionRankItem((int)type);
}
});
}
public void PositionRankItem(int type)
{
var rankTab = TableManager.GetRankInfoByID(type, 0);
if (rankTab == null)
{
LogModule.ErrorLog("Can't find type inf rankInfo : " + type);
return;
}
if (rankTab.Type == 2)
{
SetShowPage(rankTab);
return;
}
else
{
toggleControl.SetToggleOn(rankTab.Type);
if (NewRankRoot.Instance)
NewRankRoot.Instance.ShowMenuItem(type);
}
}
// 对外接口:设置需要显示的具体页面
public void SetShowPage(Tab_RankInfo rank)
{
if(rank != null)
{
Init();
toggleControl.SetToggleOn(rank.Type);
var subDic = TableManager.GetRankProInfo().Values;
int subIndex = -1;
foreach(var item in subDic)
{
if(item.Type == rank.Type)
{
++subIndex;
if(item.SubType == rank.SubType)
{
break;
}
}
}
if(subIndex != -1)
{
GameObject subMenuItem = subRankItems[rank.Type][subIndex];
OnSelectSubChild(subMenuItem, rank.SubType);
var subSubDic = TableManager.GetRankInfo().Values;
int subSubIndex = -1;
foreach (var item in subSubDic)
{
if(item.Type == rank.Type && item.SubType == rank.SubType)
{
++subSubIndex;
if(item.SubSubType == rank.SubSubType)
{
break;
}
}
}
if(subSubIndex != -1)
{
// 注意 : rightTopItems中的索引是从 1 开始的。
OnSelectRightTopItem(rightTopItems[subSubIndex], rank);
}
}
}
}
public void Close()
{
UIManager.CloseUI(UIInfo.RankRoot);
}
}