| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 | using FairyGUI;using ET;using System.Collections.Generic;namespace GFGGame{    public class RoleDataManager    {        public static bool powerTimeServerLock;        public static long roleId;        public static string roleName        {            get            {                return GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();            }        }        public static int rechargeTotalMon        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.RechargeTotaMonthly);            }        }        public static string slogan = "";        public static int headId = ConstItemID.HEADID;        public static int headBorderId = ConstItemID.BORDERID;        private static List<long> _photoDatas = new List<long>();        public static List<long> photoDatas        {            get            {                return _photoDatas;            }            set            {                _photoDatas = value;            }        }        // 佩戴徽章列表        private static List<int> _badgeDatas = new List<int>();        public static List<int> badgeDatas        {            get            {                return _badgeDatas;            }            set            {                _badgeDatas = value;            }        }        private static int _mainBgID;        public static int mainBgID        {            get            {                return _mainBgID;            }            set            {                _mainBgID = value;            }        }        public static int power        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);            }        }        public static int powerLimit        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerLimit) + GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardPowerLimitAdd);            }        }        public static long gold        {            get            {                return ItemDataManager.GetItemNum(ConstItemID.GOLD); //GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);            }        }        public static int exp        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);            }        }        public static int lvl        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);            }        }        public static long diaP        {            get            {                return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE); // GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);            }        }        public static long diaR        {            get            {                return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_RED); //GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);            }        }        public static int vipLv        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel);            }        }        public static int vipExp        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.VipExp);            }        }        public static int DailyLiveness        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.DailyLiveness);            }        }        public static int WeeklyLiveness        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.WeeklyLiveness);            }        }        /// <summary>        /// 今日竞技场可挑战次数        /// </summary>        /// <value></value>        public static int ArenaFightTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFightTimes);            }        }                /// <summary>        /// 玩家竞技场最大挑战存储量        /// </summary>        /// <value></value>        public static int ArenaMaxStorageNum        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaMaxStorageNum);            }        }                /// <summary>        /// 今日竞技场可购买挑战的次数        /// </summary>        /// <value></value>        public static int ArenaBuyFightTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaBuyFightTimes);            }        }        /// <summary>        /// 今日竞技场可刷新次数        /// </summary>        /// <value></value>        public static int ArenaFreshTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFreshTimes);            }        }        /// <summary>        /// 今日竞技场可获取特殊奖励的次数        /// </summary>        /// <value></value>        public static int ArenaTimesBonusSpecial        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaTimesBonusSpecial);            }        }        /// <summary>        ///类型一今日祈福次数        /// </summary>        /// <value></value>        public static int LeagueType1PrayTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType1PrayTimes);            }        }        /// <summary>        ///类型二今日祈福次数        /// </summary>        /// <value></value>        public static int LeagueType2PrayTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType2PrayTimes);            }        }        /// <summary>        ///类型三今日祈福次数        /// </summary>        /// <value></value>        public static int LeagueType3PrayTimes        {            get            {                return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType3PrayTimes);            }        }        /// <summary>        /// 万水千山最大存储量        /// </summary>        public static int WanShuiQianShanMaxStorageCount        {            get { return GameGlobal.myNumericComponent.GetAsInt(NumericType.WanShuiQianShanMaxStorageCount); }        }        public static bool CheckPowerFull()        {            return RoleDataManager.power >= powerLimit;        }        public static void InitServerData()        {            roleId = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;        }        /// <summary>        /// 检测是否开通指定类型月卡        /// </summary>        /// <returns></returns>        public static bool CheckIsMonthCardOpenByType(int monthCardType)        {            if (monthCardType == MonthCardType.Gold)            {                return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);            }            else if (monthCardType == MonthCardType.BlackGold)            {                return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime);            }            return true;        }        public static OtherRoleInfoData GetOtherRoleInfoData(OtherRoleInfoProto otherRoleInfo)        {            OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();            otherRoleInfoData.roleId = otherRoleInfo.RoleId;            otherRoleInfoData.headId = otherRoleInfo.HeadItemId;            otherRoleInfoData.headBorderId = otherRoleInfo.HeadBorderItemId;            otherRoleInfoData.roleName = otherRoleInfo.RoleName;            otherRoleInfoData.roleLv = otherRoleInfo.RoleLvl;            otherRoleInfoData.offlineTimeSec = otherRoleInfo.OfflineTimeSec;            return otherRoleInfoData;        }        public static OtherRoleInfoData GetMineRoleInfoData()        {            OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();            otherRoleInfoData.roleId = roleId;            otherRoleInfoData.headId = headId;            otherRoleInfoData.headBorderId = headBorderId;            otherRoleInfoData.roleName = roleName;            otherRoleInfoData.roleLv = lvl;            return otherRoleInfoData;        }        private static int oldLvValue;        public static void RoleLvUp(int oldValue)        {            oldLvValue = oldValue;            Timers.inst.Remove(CheckUpLv);            Timers.inst.Remove(OpenRoleLvUpView);            Timers.inst.Add(0.2f, 0, CheckUpLv);            CheckUpLv(null);        }        private static void CheckUpLv(object param)        {            if (GuideDataManager.currentGuideId > 0) return;//在新手引导中不弹            if (ViewManager.isViewOpen(typeof(FunctionOpenView).Name)) return;//等功能开启展示完成后再展示角色升级            if (ViewManager.isViewOpen(typeof(StoryFightSingleScoreView).Name)) return;//战斗界面关闭前不弹升级            if (InstanceZonesDataManager.isQuicklyFighting == true) return;//速刷中不弹            if (InstanceZonesDataManager.isResultFighting == true) return;//结算中经验进度结束前不弹            OpenRoleLvUpView(null);        }        private static void OpenRoleLvUpView(object param)        {            ViewManager.Show<RoleLvUpView>(oldLvValue);            Timers.inst.Remove(CheckUpLv);        }        public static bool HaveBadge(int id)        {            return ItemDataManager.GetItemNum(id) > 0;        }    }}
 |