123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- 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 = MainBackgroundCfgArray.Instance.dataArray[0].id;
- public static int mainBgID
- {
- get
- {
- return _mainBgID;
- }
- set
- {
- _mainBgID = value;
- }
- }
- public static int saveDressUpBgToMainBg
- {
- get
- {
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.IsOpenChangeGearBg);
- }
- }
- private static int _achievementTaskCollect;
- public static int achievementTaskCollect
- {
- get
- {
- return _achievementTaskCollect;
- }
- set
- {
- _achievementTaskCollect = 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
- {
- if(GameGlobal.myNumericComponent != null)
- {
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
- }
- return 1;
- }
- }
- 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
- {
- if(GameGlobal.myNumericComponent != null)
- {
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel);
- }
- return 0;
- }
- }
- 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;
- }
- public static string GetMainBgRes()
- {
- // 如果主界面ID大于最大物品ID,说明是主界面专属背景
- if(mainBgID > ConstItemID.MAX_ITEM_ID)
- {
- return ResPathUtil.GetBgImgPath(MainBackgroundCfgArray.Instance.GetCfg(mainBgID).res);
- }
- // 换装背景
- else
- {
- return ResPathUtil.GetSceneBgPath(ItemCfgArray.Instance.GetCfg(mainBgID).res);
- }
- }
- /// <summary>
- /// 检查是否应该保存换装背景到主界面背景
- /// </summary>
- /// <param name="dressUpBgID"></param>
- public static void CheckSaveDressUpBgToMainBg(int dressUpBgID)
- {
- bool canChange =
- GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime) > TimeHelper.ServerNow()
- || GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime) > TimeHelper.ServerNow();
- if (canChange && saveDressUpBgToMainBg == 1)
- {
- SaveMainBgID(dressUpBgID);
- }
- }
- public static void SaveMainBgID(int bgID)
- {
- mainBgID = bgID;
- RoleInfoSProxy.ReqSaveMainBgID(bgID);
- }
- public static void UpdatePhotoData()
- {
- List<long> numArr = new List<long>();
- // 提取有数据的位置
- for (int i = 0; i < RoleDataManager.photoDatas.Count; i++)
- {
- if (RoleDataManager.photoDatas[i] > 0)
- {
- numArr.Add(RoleDataManager.photoDatas[i]);
- }
- }
- // 找到可用空位赋值
- int index = 0;
- for (int i = 0; i < photoDatas.Count; i++)
- {
- if (RoleInfoManager.GetPosType(i) == MonthCardType.Gold && !CheckIsMonthCardOpenByType(MonthCardType.Gold)
- || RoleInfoManager.GetPosType(i) == MonthCardType.BlackGold && !CheckIsMonthCardOpenByType(MonthCardType.BlackGold))
- {
- photoDatas[i] = -1;
- continue;
- }
- if (index < numArr.Count)
- {
- photoDatas[i] = numArr[index++];
- }
- else
- {
- photoDatas[i] = 0;
- }
- }
- }
- }
- }
|