420 lines
14 KiB
C#
420 lines
14 KiB
C#
using Games.GlobeDefine;
|
|
using GCGame;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RankWindow : MonoBehaviour
|
|
{
|
|
private static RankWindow m_Instance;
|
|
|
|
public UISubScollMenu _RankClass;
|
|
public UIContainerBase _RankInfo;
|
|
public GridLayoutGroup _RankInfoPanel;
|
|
public RankInfoItem _RankSelf;
|
|
public UISubScollMenu _RankSubClass;
|
|
public Text[] _RankTitles;
|
|
|
|
public static RankWindow Instance()
|
|
{
|
|
return m_Instance;
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
m_Instance = this;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
InitRankClasses();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
m_Instance = null;
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
UIManager.CloseUI(UIInfo.RankRoot);
|
|
}
|
|
|
|
#region Rank class
|
|
|
|
private int m_nPage;
|
|
private bool m_IsPage = true;
|
|
private int m_nRankType = 1;
|
|
public bool isRankDataReturn { set; get; }
|
|
|
|
private int m_nTipWaitWindow;
|
|
|
|
private void InitRankClasses()
|
|
{
|
|
_RankClass.Clear();
|
|
|
|
_RankClass.PushMenu(Utils.GetDicByID(4717),
|
|
new object[]
|
|
{
|
|
Utils.GetDicByID(4265), Utils.GetDicByID(4266), Utils.GetDicByID(4267), Utils.GetDicByID(4268),
|
|
Utils.GetDicByID(4269), Utils.GetDicByID(4270), Utils.GetDicByID(4271), Utils.GetDicByID(4281)
|
|
});
|
|
_RankClass.PushMenu(Utils.GetDicByID(4718),
|
|
new object[] {Utils.GetDicByID(4276), Utils.GetDicByID(4277), Utils.GetDicByID(4279)});
|
|
_RankClass.PushMenu(Utils.GetDicByID(4719),
|
|
new object[]
|
|
{
|
|
Utils.GetDicByID(4272), Utils.GetDicByID(4273), Utils.GetDicByID(4275), Utils.GetDicByID(4278),
|
|
Utils.GetDicByID(4280)
|
|
});
|
|
|
|
_RankSubClass.PushMenu(Utils.GetDicByID(1178));
|
|
_RankSubClass.PushMenu(Utils.GetDicByID(1179));
|
|
_RankSubClass.PushMenu(Utils.GetDicByID(1180));
|
|
_RankSubClass.PushMenu(Utils.GetDicByID(1181));
|
|
|
|
Instance().isRankDataReturn = false;
|
|
_RankClass.ShowDefaultFirst();
|
|
}
|
|
|
|
public void RankClass(object rankObj)
|
|
{
|
|
var rankStr = rankObj as string;
|
|
if (rankStr == Utils.GetDicByID(4265))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_USERLEVELRANK;
|
|
else if (rankStr == Utils.GetDicByID(4266))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOMBATRANK;
|
|
else if (rankStr == Utils.GetDicByID(4267))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_ATTACK;
|
|
else if (rankStr == Utils.GetDicByID(4268))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_USERHPRANK;
|
|
else if (rankStr == Utils.GetDicByID(4269))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOIN;
|
|
else if (rankStr == Utils.GetDicByID(4270))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_CHONGZHI;
|
|
else if (rankStr == Utils.GetDicByID(4271))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOSTYUANBAO;
|
|
else if (rankStr == Utils.GetDicByID(4281))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_TOTALONLINETIME;
|
|
else if (rankStr == Utils.GetDicByID(4276))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_GUILDCOMBAT;
|
|
else if (rankStr == Utils.GetDicByID(4277))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_MASTER;
|
|
else if (rankStr == Utils.GetDicByID(4279))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_MASTERAVTIVECOMBAT;
|
|
else if (rankStr == Utils.GetDicByID(4272))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_HUASHANPOS;
|
|
else if (rankStr == Utils.GetDicByID(4273))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_HUASHANJINYAODAI;
|
|
else if (rankStr == Utils.GetDicByID(4275))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_CANGJINGGE;
|
|
else if (rankStr == Utils.GetDicByID(4278))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_SHAOLINREPUTATION;
|
|
else if (rankStr == Utils.GetDicByID(4280))
|
|
m_nRankType = (int) GameDefine_Globe.RANKTYPE.TYPE_SHAOSHISHAN;
|
|
else
|
|
return;
|
|
|
|
m_nPage = 0;
|
|
if (isRankDataReturn == false) SendRankPack();
|
|
}
|
|
|
|
public void RankSubClass(object rankObj)
|
|
{
|
|
}
|
|
|
|
public void SendRankPack()
|
|
{
|
|
var packet = (CG_ASK_RANK) PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_RANK);
|
|
packet.NType = m_nRankType;
|
|
packet.NPage = m_nPage;
|
|
packet.SendPacket();
|
|
if (m_nTipWaitWindow != 0) MessageBoxLogic.OpenWaitBox(1290, 1, 0);
|
|
m_nTipWaitWindow = m_nTipWaitWindow + 1;
|
|
}
|
|
|
|
public void RankDataCallBack(int rankType)
|
|
{
|
|
InitRankTitle();
|
|
InitRankItems();
|
|
}
|
|
|
|
public void SetTotalPage(int totalPage, int curPage)
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region rank items
|
|
|
|
public void InitRankTitle()
|
|
{
|
|
if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_CHONGZHI)
|
|
{
|
|
//充值排行帮
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2766);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOMBATRANK)
|
|
{
|
|
//等级
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2044);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//战力排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2048);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERLEVELRANK)
|
|
{
|
|
// 战力
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2048);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//等级
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2044);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERHPRANK)
|
|
{
|
|
// 血量
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2058);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//帮会实力榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 1065);
|
|
SetItemTitleTxt(2, 2048);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_CANGJINGGE)
|
|
{
|
|
// 帮会战斗力
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 1065);
|
|
//SetItemTitleTxt(2, 2048);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//藏经阁排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2044);
|
|
SetItemTitleTxt(3, 2045);
|
|
SetItemTitleTxt(4, 2046);
|
|
SetTitleNum(5);
|
|
SetItemLabelNum(5);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_SHAOLINREPUTATION)
|
|
{
|
|
//门派大弟子
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2473);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_HUASHANPOS)
|
|
{
|
|
//大弟子排行榜
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2473);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
// 华山-排名
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetTitleNum(2);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_HUASHANJINYAODAI)
|
|
{
|
|
// 金币
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 1324);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//金腰带排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2057);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_HUASHANZHANJI)
|
|
{
|
|
//宗师
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2510);
|
|
//SetItemTitleTxt(3, 2511);
|
|
//SetTitleNum(4);
|
|
//SetItemLabelNum(4);
|
|
|
|
//战绩排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2056);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_MASTER)
|
|
{
|
|
//消费排行榜
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2528);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
//宗师排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2510);
|
|
SetItemTitleTxt(3, 2511);
|
|
SetTitleNum(4);
|
|
SetItemLabelNum(4);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_MASTERAVTIVECOMBAT)
|
|
{
|
|
// 攻击
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2713);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
// 师门战斗力
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 1464);
|
|
SetItemTitleTxt(2, 2048);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOSTYUANBAO) //门派大弟子
|
|
{
|
|
//充值
|
|
//SetItemTitleTxt(0, 2041);
|
|
//SetItemTitleTxt(1, 2042);
|
|
//SetItemTitleTxt(2, 2766);
|
|
//SetTitleNum(3);
|
|
//SetItemLabelNum(3);
|
|
|
|
// 消费排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2528);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_ATTACK)
|
|
{
|
|
//攻击排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2713);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERHPRANK)
|
|
{
|
|
// 血量排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2058);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERDEFENSE)
|
|
{
|
|
//防御力排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 1065);
|
|
SetItemTitleTxt(2, 4607);
|
|
SetItemTitleTxt(3, 4608);
|
|
SetItemTitleTxt(4, 4609);
|
|
SetTitleNum(5);
|
|
SetItemLabelNum(5);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_USERCOIN)
|
|
{
|
|
// 金币排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 1324);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_SHAOSHISHAN)
|
|
{
|
|
//少室山排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 2044);
|
|
SetItemTitleTxt(3, 3040);
|
|
SetItemTitleTxt(4, 2046);
|
|
SetTitleNum(5);
|
|
SetItemLabelNum(5);
|
|
}
|
|
else if (m_nRankType == (int) GameDefine_Globe.RANKTYPE.TYPE_TOTALONLINETIME)
|
|
{
|
|
//累计在线时间排行榜
|
|
SetItemTitleTxt(0, 2041);
|
|
SetItemTitleTxt(1, 2042);
|
|
SetItemTitleTxt(2, 3185);
|
|
SetTitleNum(3);
|
|
SetItemLabelNum(3);
|
|
}
|
|
}
|
|
|
|
public void InitRankItems()
|
|
{
|
|
_RankInfo.InitContentItem(PVPData.RankDataList);
|
|
}
|
|
|
|
public void SetItemTitleTxt(int idx, int dict)
|
|
{
|
|
if (idx < _RankTitles.Length && idx >= 0) _RankTitles[idx].text = Utils.GetDicByID(dict);
|
|
}
|
|
|
|
public void SetTitleNum(int num)
|
|
{
|
|
var exStrWidth = _RankInfoPanel.GetComponent<RectTransform>().sizeDelta.x / num;
|
|
var exStrHeight = _RankInfoPanel.GetComponent<RectTransform>().sizeDelta.y;
|
|
_RankInfoPanel.cellSize = new Vector2(exStrWidth, exStrHeight);
|
|
|
|
for (var i = 0; i < _RankTitles.Length; ++i)
|
|
if (i < num)
|
|
_RankTitles[i].gameObject.SetActive(true);
|
|
else
|
|
_RankTitles[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
public void SetItemLabelNum(int num)
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
} |