| | |
| | | using UnityEngine.UI; |
| | | using System.Linq; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | | public class InvestModel : GameSystemManager<InvestModel> |
| | | { |
| | |
| | | Dictionary<int, int[][]> m_InvestItems = new Dictionary<int, int[][]>(); |
| | | Dictionary<int, int> m_InvestDays = new Dictionary<int, int>(); //投资对应天数 |
| | | Dictionary<int, int> m_InvestMaxDays = new Dictionary<int, int>(); //投资对应最大购买累加天数 |
| | | |
| | | public Dictionary<int, int[]> textColors = new(); |
| | | public Dictionary<int, int[]> outlineColors = new(); |
| | | |
| | | //投资对应充值ID |
| | | Dictionary<int, int[]> m_InvestRechargeIds = new Dictionary<int, int[]>(); |
| | |
| | | Dictionary<int, int> m_PrivilegeFightSpeed = new Dictionary<int, int>(); |
| | | // 英雄积分招募开启的特权类型 |
| | | int[] heroScoreCallOpenType; |
| | | |
| | | |
| | | |
| | | public event Action<int> onInvestUpdate; |
| | | |
| | |
| | | return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.PrivilegeCard); |
| | | } |
| | | |
| | | |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | m_InvestInfos.Clear(); |
| | | lastTotalBuyCountDict.Clear(); |
| | | } |
| | | |
| | | |
| | | |
| | | public Color32 ParseColor32(int[] colorArr) |
| | | { |
| | | return new Color32() |
| | | { |
| | | r = (byte)(colorArr.Length > 0 ? colorArr[0] : 0), |
| | | g = (byte)(colorArr.Length > 1 ? colorArr[1] : 0), |
| | | b = (byte)(colorArr.Length > 2 ? colorArr[2] : 0), |
| | | a = (byte)(colorArr.Length > 3 ? colorArr[3] : 255), |
| | | }; |
| | | } |
| | | |
| | | |
| | | void ParseConfig() |
| | |
| | | m_InvestMaxDays = ConfigParse.ParseIntDict(funcConfig.Numerical2); |
| | | m_InvestItems = ConfigParse.ParseIntArray2Dict(funcConfig.Numerical3); |
| | | |
| | | |
| | | funcConfig = FuncConfigConfig.Get("InvestPower"); |
| | | m_InvestAddFBCount = ConfigParse.ParseDictInDict(funcConfig.Numerical1); |
| | | m_InvestFreeFBID = ConfigParse.ParseIntArrayDict(funcConfig.Numerical2); |
| | |
| | | m_PrivilegeLins = ConfigParse.ParseIntDict(funcConfig.Numerical1); |
| | | m_PrivilegeFightSpeed = ConfigParse.ParseIntDict(funcConfig.Numerical2); |
| | | heroScoreCallOpenType = JsonMapper.ToObject<int[]>(funcConfig.Numerical3); |
| | | |
| | | textColors = ConfigParse.ParseIntArrayDict(funcConfig.Numerical4); |
| | | outlineColors = ConfigParse.ParseIntArrayDict(funcConfig.Numerical5); |
| | | |
| | | } |
| | | |
| | | public Color32 GetTextColor(int vipLevel) |
| | | { |
| | | if (textColors.ContainsKey(vipLevel)) |
| | | { |
| | | return ParseColor32(textColors[vipLevel]); |
| | | } |
| | | return Color.white; |
| | | } |
| | | |
| | | public Color32 GetOutlineColor(int vipLevel) |
| | | { |
| | | if (outlineColors.ContainsKey(vipLevel)) |
| | | { |
| | | return ParseColor32(outlineColors[vipLevel]); |
| | | } |
| | | return Color.white; |
| | | } |
| | | |
| | | Dictionary<int, int> lastTotalBuyCountDict = new Dictionary<int, int>(); |
| | |
| | | //月卡 限时类型的投资 未到期就算投资 |
| | | return m_InvestInfos[type].InvestEndTime > 0 && m_InvestInfos[type].InvestEndTime > TimeUtility.AllSeconds; |
| | | } |
| | | |
| | | |
| | | //永久类型的投资 只要购买了就算投资 |
| | | return m_InvestInfos[type].InvestBuyTime > 0; |
| | | } |