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 types = new Dictionary(); 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> subRankItems = new Dictionary>(); Dictionary menuRankItem = new Dictionary(); 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