Core/GameEngine/Model/Config/TaskFeedbackConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: Friday, May 17, 2019 // [ Date ]: Tuesday, June 11, 2019 //-------------------------------------------------------- using System.Collections.Generic; @@ -22,6 +22,7 @@ public readonly string reikiRoot; public readonly int succGuide; public readonly int jump; public readonly string[] funcTitles; public readonly string failFuncs; public readonly string[] remind; @@ -53,9 +54,11 @@ int.TryParse(tables[8],out jump); failFuncs = tables[9]; funcTitles = tables[9].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); remind = tables[10].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); failFuncs = tables[10]; remind = tables[11].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); } catch (Exception ex) { @@ -139,6 +142,7 @@ path = AssetVersionUtility.GetAssetFilePath("config/TaskFeedback.txt"); } configs.Clear(); var tempConfig = new TaskFeedbackConfig(); var preParse = tempConfig is IConfigPostProcess; Core/GameEngine/Model/Config/TaskFeedbackConfig.cs.meta
@@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: b80a883f246077d46ab59d6938182ec9 timeCreated: 1558075313 timeCreated: 1560244941 licenseType: Pro MonoImporter: serializedVersion: 2 Core/GameEngine/Model/Config/TaskFeedbackFuncConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: Monday, June 10, 2019 // [ Date ]: Tuesday, June 11, 2019 //-------------------------------------------------------- using System.Collections.Generic; @@ -15,7 +15,6 @@ public readonly int id; public readonly string name; public readonly string category; public readonly int jump; public readonly int guide; public readonly int type; @@ -37,24 +36,22 @@ name = tables[1]; category = tables[2]; int.TryParse(tables[2],out jump); int.TryParse(tables[3],out jump); int.TryParse(tables[3],out guide); int.TryParse(tables[4],out guide); int.TryParse(tables[4],out type); int.TryParse(tables[5],out type); int.TryParse(tables[5],out condition); int.TryParse(tables[6],out condition); string[] itemConditionStringArray = tables[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); string[] itemConditionStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); itemCondition = new Int2[itemConditionStringArray.Length]; for (int i=0;i<itemConditionStringArray.Length;i++) { Int2.TryParse(itemConditionStringArray[i],out itemCondition[i]); } string[] excludeFuncsStringArray = tables[8].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); string[] excludeFuncsStringArray = tables[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); excludeFuncs = new int[excludeFuncsStringArray.Length]; for (int i=0;i<excludeFuncsStringArray.Length;i++) { Core/GameEngine/Model/Config/TaskFeedbackFuncConfig.cs.meta
@@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: b2d416872ed7b3048a5b2d4696c3541f timeCreated: 1560146342 timeCreated: 1560244979 licenseType: Pro MonoImporter: serializedVersion: 2 Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA337_tagMCGoldInvestInfo.cs
@@ -8,20 +8,16 @@ public class DTCA337_tagMCGoldInvestInfo : DtcBasic { VipInvestModel InvestModel { get { return ModelCenter.Instance.GetModel<VipInvestModel>(); } } MonthlyInvestmentModel monthlyInvestmentModel { get { return ModelCenter.Instance.GetModel<MonthlyInvestmentModel>(); } } FairyJadeInvestmentModel FairyJadeModel { get { return ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>(); } } MonthWeekInvestModel monthWeekInvestModel { get { return ModelCenter.Instance.GetModel<MonthWeekInvestModel>(); } } public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA337_tagMCGoldInvestInfo vNetData = vNetPack as HA337_tagMCGoldInvestInfo; InvestModel.SetServerInvestInfo(vNetData); if (vNetData == null) { return; } monthlyInvestmentModel.GetInfoSeriors(vNetData); FairyJadeModel.GetInfoSeriors(vNetData); monthWeekInvestModel.OnReceivePackage(vNetData); } } Lua/Gen/FairyJadeInvestmentModelWrap.cs
File was deleted Lua/Gen/FairyJadeInvestmentModelWrap.cs.meta
File was deleted Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs
File was deleted Lua/Gen/SnxxzUIVipInvestModelWrap.cs
@@ -255,7 +255,7 @@ int _type = LuaAPI.xlua_tointeger(L, 2); int _index = LuaAPI.xlua_tointeger(L, 3); int gen_ret = gen_to_be_invoked.GetInvestGold( _type, _index ); int gen_ret = gen_to_be_invoked.GetInvestAmount( _type, _index ); LuaAPI.xlua_pushinteger(L, gen_ret); Lua/Gen/XLuaGenAutoRegister.cs
@@ -1309,9 +1309,6 @@ translator.DelayWrapLoader(typeof(Snxxz.UI.LuckyTreasureModel), SnxxzUILuckyTreasureModelWrap.__Register); translator.DelayWrapLoader(typeof(Snxxz.UI.MonthlyInvestmentModel), SnxxzUIMonthlyInvestmentModelWrap.__Register); translator.DelayWrapLoader(typeof(Snxxz.UI.MysticalPurchaseModel), SnxxzUIMysticalPurchaseModelWrap.__Register); @@ -1473,9 +1470,6 @@ translator.DelayWrapLoader(typeof(Snxxz.UI.TreasureFindHostModel), SnxxzUITreasureFindHostModelWrap.__Register); translator.DelayWrapLoader(typeof(FairyJadeInvestmentModel), FairyJadeInvestmentModelWrap.__Register); translator.DelayWrapLoader(typeof(Snxxz.UI.FirstTimeRechargeModel), SnxxzUIFirstTimeRechargeModelWrap.__Register); System/DailyQuest/DayRemind.cs
@@ -113,7 +113,7 @@ SetDayRemind(EQUIPSTRENGTH_REDPOINT); } private void SetDayRemind(string _key) public void SetDayRemind(string _key) { var intarray = LocalSave.GetIntArray(StringUtility.Contact(_key, PlayerDatas.Instance.baseData.PlayerID)); if (dayRemindDic.ContainsKey(_key)) System/FindPrecious/DemonJarModel.cs
@@ -130,8 +130,12 @@ { demonJarSoulIncreaseDelta = 0; var bossId = GetLastUnlockBoss(); AutoSubscribeLastUnLockBoss(bossId); if (FuncOpen.Instance.IsFuncOpen(76)) { var bossId = GetLastUnlockBoss(); AutoSubscribeLastUnLockBoss(bossId); } ParseLocalSaveAutoChallengeLogs(); DemonJarAutoChallenge.Instance.Begin(); } System/LoginAd/LoginAdModel.cs
@@ -111,7 +111,7 @@ switch ((LoginAdCondition)config.condition[0]) { case LoginAdCondition.MoneyInvest: int InvestmentGrade = moneyInvestModel.GetInvestmentGrade(); int InvestmentGrade = moneyInvestModel.GetFairyInvestGear(); if (InvestmentGrade > 0 || PlayerDatas.Instance.baseData.LV >= 500) { continue; System/MainInterfacePanel/TaskFeedbackFuncWin.cs
@@ -18,6 +18,8 @@ [SerializeField] Text m_Category; [SerializeField] TaskFeedbackFunc[] m_Funcs; public static string funcTitle = string.Empty; public static event Action<int> onSelectTask; TaskFeedbackModel model { get { return ModelCenter.Instance.GetModel<TaskFeedbackModel>(); } } @@ -67,6 +69,7 @@ void Display() { m_Category.text = funcTitle; for (int i = 0; i < m_Funcs.Length; i++) { m_Funcs[i].button.gameObject.SetActive(i < model.taskFeedbackFuncs.Count); @@ -76,11 +79,6 @@ if (config != null) { m_Funcs[i].label.text = config.name; if (i == 0) { m_Category.text = config.category; } } } } System/MainInterfacePanel/TaskFeedbackModel.cs
@@ -174,11 +174,13 @@ if (feedback.failFuns != null) { var index = Mathf.Min(condition, feedback.failFuns.Count - 1); var funcTitle = index < config.funcTitles.Length ? config.funcTitles[index] : string.Empty; List<int> succFuncs; if (TryGetSatisfyConditionFuncs(feedback.failFuns[index], out succFuncs)) { taskFeedbackFuncs.Clear(); taskFeedbackFuncs.AddRange(succFuncs); TaskFeedbackFuncWin.funcTitle = funcTitle; WindowCenter.Instance.Open<TaskFeedbackFuncWin>(); } } @@ -204,11 +206,13 @@ { var taskIndex = feedback.IndexOfSideTasks(condition); var index = Mathf.Min(taskIndex, feedback.failFuns.Count - 1); var funcTitle = index < config.funcTitles.Length ? config.funcTitles[index] : string.Empty; List<int> succFuncs; if (TryGetSatisfyConditionFuncs(feedback.failFuns[index], out succFuncs)) { taskFeedbackFuncs.Clear(); taskFeedbackFuncs.AddRange(succFuncs); TaskFeedbackFuncWin.funcTitle = funcTitle; WindowCenter.Instance.Open<TaskFeedbackFuncWin>(); } } @@ -235,11 +239,13 @@ IsSatisfySideTask(feedback.sideTasks, out sideTaskId); var taskIndex = feedback.IndexOfSideTasks(sideTaskId); var index = Mathf.Min(taskIndex, feedback.failFuns.Count - 1); var funcTitle = index < config.funcTitles.Length ? config.funcTitles[index] : string.Empty; List<int> succFuncs; if (TryGetSatisfyConditionFuncs(feedback.failFuns[index], out succFuncs)) { taskFeedbackFuncs.Clear(); taskFeedbackFuncs.AddRange(succFuncs); TaskFeedbackFuncWin.funcTitle = funcTitle; WindowCenter.Instance.Open<TaskFeedbackFuncWin>(); } } System/OpenServerActivity/ImpactRankModel.cs
@@ -861,8 +861,10 @@ LuckyTreasure = 20, [Header("登录奖励")] LoginReward = 21, [Header("月卡周卡")] MonthWeekInvest = 22, max=100, max =100, } } System/OpenServerActivity/MonthlyInvestmentModel.cs
File was deleted System/OpenServerActivity/MonthlyInvestmentModel.cs.meta
File was deleted System/OpenServerActivity/MonthlyInvestmentWin.cs
File was deleted System/OpenServerActivity/MonthlyInvestmentWin.cs.meta
File was deleted System/OpenServerActivity/MotnlyInvestmentItem.cs
File was deleted System/OpenServerActivity/MotnlyInvestmentItem.cs.meta
File was deleted System/OpenServerActivity/OpenServerActivityWin.cs
@@ -39,6 +39,7 @@ FairyLeagueModel fairyLeagueModel { get { return ModelCenter.Instance.GetModel<FairyLeagueModel>(); } } OSGiftModel giftModel { get { return ModelCenter.Instance.GetModel<OSGiftModel>(); } } FestivalRedpackModel festivalRedpackModel { get { return ModelCenter.Instance.GetModel<FestivalRedpackModel>(); } } MonthWeekInvestModel monthWeekInvestModel { get { return ModelCenter.Instance.GetModel<MonthWeekInvestModel>(); } } List<int> openActivitys = new List<int>(); List<int> priorityActivitys = new List<int>(); @@ -77,6 +78,7 @@ impactRankModel.gotoImpactRankType = 0; envelopeModel.selectType = 1; festivalRedpackModel.selectType = 1; monthWeekInvestModel.selectType = monthWeekInvestModel.investTypes[0]; giftModel.SetAreadyOpens(); GlobalTimeEvent.Instance.secondEvent += SecondEvent; CheckAlreadyOpen(); @@ -129,6 +131,10 @@ { festivalRedpackModel.selectType = festivalRedpackModel.jumpType != 0 ? festivalRedpackModel.jumpType : 1; festivalRedpackModel.jumpType = 0; } if (functionOrder == 22) { monthWeekInvestModel.selectType = monthWeekInvestModel.GetSelectType(); } UpdateFunctionBtns(); } @@ -229,6 +235,9 @@ } festivalRedpackModel.selectType = 1; break; case OpenServerActivityCenter.OSActivityType.MonthWeekInvest: monthWeekInvestModel.selectType = monthWeekInvestModel.GetSelectType(); break; } } } @@ -305,7 +314,7 @@ if (type == ScrollerDataType.Header) { if (!m_ActivitySpreadDict.ContainsKey(sort) || !m_ActivitySpreadDict[sort] || (sort != 2 && sort != 0 && sort != 19)) || (sort != 2 && sort != 0 && sort != 19 && sort != 22)) { height = 114; return true; @@ -361,7 +370,8 @@ _cell.downArrow.gameObject.SetActive(false); _cell.upArrow.gameObject.SetActive(false); if (_cell.activityType == 0 || _cell.activityType == 2 || _cell.activityType == 19) if (_cell.activityType == 0 || _cell.activityType == 2 || _cell.activityType == 19 || _cell.activityType == 22) { _cell.downArrow.gameObject.SetActive(m_ActivitySpreadDict[_cell.activityType]); _cell.upArrow.gameObject.SetActive(!m_ActivitySpreadDict[_cell.activityType]); @@ -400,6 +410,11 @@ _cell.redpoint.redpointId = 20919 * 100 + _type; _cell.titleTxt.text = Language.Get(StringUtility.Contact("FestivalRedpackType_", _type)); _cell.SetSelect(_type == festivalRedpackModel.selectType); break; case 22: _cell.redpoint.redpointId = 20922 * 100 + _type; _cell.titleTxt.text = Language.Get(StringUtility.Contact("MonthWeekInvestType_", _type)); _cell.SetSelect(_type == monthWeekInvestModel.selectType); break; } _cell.functionBtn.onClick.RemoveAllListeners(); @@ -467,6 +482,18 @@ m_ActivityCtrl.AddCell(ScrollerDataType.Normal, sort * 100 + 1); m_ActivityCtrl.AddCell(ScrollerDataType.Normal, sort * 100 + 2); m_ActivityCtrl.AddCell(ScrollerDataType.Normal, sort * 100 + 3); break; case 22: m_ActivityCtrl.AddCell(ScrollerDataType.Header, sort); if (!m_ActivitySpreadDict[sort]) { m_ActivitySpreadDict[sort] = false; break; } for (int k = 0; k < monthWeekInvestModel.investTypes.Count; k++) { m_ActivityCtrl.AddCell(ScrollerDataType.Normal, sort * 100 + monthWeekInvestModel.investTypes[k]); } break; default: m_ActivityCtrl.AddCell(ScrollerDataType.Header, sort); @@ -578,6 +605,9 @@ case 21: WindowCenter.Instance.Open<LoginRewardWin>(true); break; case 22: WindowCenter.Instance.Open<MonthWeekInvestWin>(true); break; } } @@ -596,6 +626,9 @@ case 19: festivalRedpackModel.selectType = _type; break; case 22: monthWeekInvestModel.selectType = _type; break; } m_ActivityCtrl.m_Scorller.RefreshActiveCellViews(); } System/Vip/FairyJadeInvestmentItem.cs
@@ -21,41 +21,48 @@ [SerializeField] Text m_Label_Text;//标签 [SerializeField] GameObject m_IsReachImage;//未达成 FairyJadeInvestmentModel m_FairyJadeInvestmentModel; FairyJadeInvestmentModel fairyJadeInvestmentModel { get { return m_FairyJadeInvestmentModel ?? (m_FairyJadeInvestmentModel = ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>()); } } public void GetPlayerLV(int Lv) FairyJadeInvestmentModel model { get { return ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>(); } } VipInvestModel investModel { get { return ModelCenter.Instance.GetModel<VipInvestModel>(); } } public void Display(int id) { int PlayerLv = PlayerDatas.Instance.baseData.LV; if (PlayerLv >= Lv) int _type = model.fairyInvestType; if (model.fairyInvestItems.ContainsKey(_type)) { MoreThanGrade(Lv); } else { BeforeTheClass(Lv); var info = model.fairyInvestItems[_type][id]; if (PlayerLv >= info.levelLimit) { MoreThanGrade(id); } else { BeforeTheClass(id); } } } private void MoreThanGrade(int Lv)//超过等级 private void MoreThanGrade(int id)//超过等级 { int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; if (Dit.ContainsKey(Lv)) var Dit = model.fairyInvestItems[_type]; if (Dit.ContainsKey(id)) { if (Lv <= 0) var info = Dit[id]; if (info.levelLimit <= 0) { m_Label_Text.gameObject.SetActive(true); m_Label_Text.text = Language.Get("FairyJadeInvestment_12"); } else { int GetRebateMultiple = RebateMultiple(Lv); if (fairyJadeInvestmentModel.MultipleList.Contains(GetRebateMultiple)) int GetRebateMultiple = RebateMultiple(id); if (model.fairyInvestMultiples.Contains(GetRebateMultiple)) { m_Label_Text.gameObject.SetActive(true); m_Label_Text.text = string.Format(Language.Get("FairyJadeInvestment_11"), GetRebateMultiple); @@ -65,8 +72,8 @@ m_Label_Text.gameObject.SetActive(false); } } int indexID = Dit[Lv].ID; int InvestmentGrade = fairyJadeInvestmentModel.GetInvestmentGrade(); int indexID = info.id; int InvestmentGrade = model.GetFairyInvestGear(); if (InvestmentGrade == 0) { m_ReceiveAwardBtn.gameObject.SetActive(false); @@ -78,7 +85,7 @@ else { int IsReceive = 0; var dit = fairyJadeInvestmentModel.GetInfoSeriors(); var dit = model.GetInfoSeriors(); if (dit.ContainsKey(indexID)) { IsReceive = dit[indexID]; @@ -93,18 +100,18 @@ m_ReceiveAwardBtn.RemoveAllListeners(); m_ReceiveAwardBtn.AddListener(() => { int type = fairyJadeInvestmentModel.BinningType; fairyJadeInvestmentModel.SendInvestment(type, indexID); int type = model.fairyInvestType; model.SendGotInvestReward(type, indexID); }); } else { List<Item> fairyJadeInvestmentItem = Dit[Lv].FairyJadeInvestmentItem.GetAwardItem(InvestmentGrade); List<Item> fairyJadeInvestmentItem = info.items.ContainsKey(InvestmentGrade) ? info.items[InvestmentGrade] : null; int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = Dit[Lv].FairyJadeInvestmentItem.GetAwardItem(IsReceive); List<Item> fairyJadeInvestmentItemAdd = info.items.ContainsKey(IsReceive) ? info.items[IsReceive] : null; Item itemAdd = fairyJadeInvestmentItemAdd[0]; AtPresentNumber = itemAdd.count; } @@ -118,8 +125,8 @@ m_ReceiveAwardBtn.RemoveAllListeners(); m_ReceiveAwardBtn.AddListener(() => { int type = fairyJadeInvestmentModel.BinningType; fairyJadeInvestmentModel.SendInvestment(type, indexID); int type = model.fairyInvestType; model.SendGotInvestReward(type, indexID); }); } else @@ -133,28 +140,29 @@ } } } ItemCellAssignment(Lv); ItemCellAssignment(id); } private void BeforeTheClass(int Lv)//未到等级 private void BeforeTheClass(int id)//未到等级 { int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; if (Dit.ContainsKey(Lv)) var Dit = model.fairyInvestItems[_type]; if (Dit.ContainsKey(id)) { if (Lv <= 0) var info = Dit[id]; if (info.levelLimit <= 0) { m_Label_Text.gameObject.SetActive(true); m_Label_Text.text = Language.Get("FairyJadeInvestment_12"); } else { int GetRebateMultiple= RebateMultiple(Lv); if (fairyJadeInvestmentModel.MultipleList.Contains(GetRebateMultiple)) int GetRebateMultiple= RebateMultiple(id); if (model.fairyInvestMultiples.Contains(GetRebateMultiple)) { m_Label_Text.gameObject.SetActive(true); m_Label_Text.text = string.Format(Language.Get("FairyJadeInvestment_11"), GetRebateMultiple); @@ -170,43 +178,39 @@ m_IsReachImage.SetActive(true); m_Uieffect.gameObject.SetActive(false); } ItemCellAssignment(Lv); ItemCellAssignment(id); } private void ItemCellAssignment(int Lv) private void ItemCellAssignment(int id) { int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; int InvestmentGrade = fairyJadeInvestmentModel.GetInvestmentGrade(); if (Dit.ContainsKey(Lv)) var Dit = model.fairyInvestItems[_type]; int InvestmentGrade = model.GetFairyInvestGear(); if (Dit.ContainsKey(id)) { int grade = 3; var info = Dit[id]; int grade = 1; if (InvestmentGrade != 0) { grade = InvestmentGrade; } else { int type = fairyJadeInvestmentModel.BinningType; if (fairyJadeInvestmentModel.InvestmentAmountTypeDic.ContainsKey(type)) int type = model.fairyInvestType; var _gear = investModel.GetInvestGear(type, model.selectInvestMoney); if (_gear != 0) { var _dit = fairyJadeInvestmentModel.InvestmentAmountTypeDic[type]; if (_dit.ContainsKey(fairyJadeInvestmentModel.SelectNumber)) { grade = _dit[fairyJadeInvestmentModel.SelectNumber]; } grade = _gear; } } List<Item> fairyJadeInvestmentItem = Dit[Lv].FairyJadeInvestmentItem.GetAwardItem(grade); int indexID = Dit[Lv].ID; List<Item> fairyJadeInvestmentItem = info.items.ContainsKey(grade) ? info.items[grade] : null; int indexID = info.id; int IsReceive = 0; var dit = fairyJadeInvestmentModel.GetInfoSeriors(); var dit = model.GetInfoSeriors(); if (dit.ContainsKey(indexID)) { IsReceive = dit[indexID]; @@ -224,16 +228,16 @@ if (IsReceive == 0) { if (Lv <= 0) if (info.levelLimit <= 0) { motnlyItem.NameText.text = string.Format(Language.Get("FairyJadeInvestment_3"), item.count); } else { float GetFairyJadeNumber = InvestmentProportion(Lv); int ShowLinesNumber = ShowLines(grade); float GetFairyJadeNumber = InvestmentProportion(id); int ShowLinesNumber = investModel.GetInvestAmount(_type, grade - 1); int GetValue = Mathf.FloorToInt((GetFairyJadeNumber / ShowLinesNumber) * 100); motnlyItem.NameText.text = string.Format(Language.Get("FairyJadeInvestment_10"), Lv, GetValue); motnlyItem.NameText.text = string.Format(Language.Get("FairyJadeInvestment_10"), info.levelLimit, GetValue); } motnlyItem.MoneyNumberText.text = item.count.ToString(); } @@ -242,7 +246,7 @@ int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = Dit[Lv].FairyJadeInvestmentItem.GetAwardItem(IsReceive); List<Item> fairyJadeInvestmentItemAdd = info.items.ContainsKey(IsReceive) ? info.items[IsReceive] : null; Item itemAdd = fairyJadeInvestmentItemAdd[i]; AtPresentNumber = itemAdd.count; } @@ -269,104 +273,77 @@ } } private int ShowLines(int grade)//获取需要 显示的额度 private float InvestmentProportion(int id)//获取返回仙玉的比例 { int ShowLineNumber = 0; int type = fairyJadeInvestmentModel.BinningType; if (fairyJadeInvestmentModel.InvestmentAmountTypeDic.ContainsKey(type)) { var dit = fairyJadeInvestmentModel.InvestmentAmountTypeDic[type]; foreach (var key in dit.Keys) { if (dit[key] == grade) { ShowLineNumber = key; } } } return ShowLineNumber; } private float InvestmentProportion(int Lv)//获取返回仙玉的比例 { int grade = 3; int InvestmentGrade = fairyJadeInvestmentModel.GetInvestmentGrade(); int grade = 1; int InvestmentGrade = model.GetFairyInvestGear(); if (InvestmentGrade != 0) { grade = InvestmentGrade; } else { int type = fairyJadeInvestmentModel.BinningType; if (fairyJadeInvestmentModel.InvestmentAmountTypeDic.ContainsKey(type)) int type = model.fairyInvestType; var _gear = investModel.GetInvestGear(type, model.selectInvestMoney); if (_gear != 0) { var dit = fairyJadeInvestmentModel.InvestmentAmountTypeDic[type]; if (dit.ContainsKey(fairyJadeInvestmentModel.SelectNumber)) { grade = dit[fairyJadeInvestmentModel.SelectNumber]; } } grade = _gear; } } int GetFairyJade = 0; int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return GetFairyJade; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; foreach (var key in Dit.Keys) var Dit = model.fairyInvestItems[_type]; if (Dit.ContainsKey(id)) { if (key == Lv) { List<Item> fairyJadeInvestmentItem = Dit[key].FairyJadeInvestmentItem.GetAwardItem(grade); Item item = fairyJadeInvestmentItem[0]; GetFairyJade = item.count; } var info = Dit[id]; List<Item> fairyJadeInvestmentItem = info.items.ContainsKey(grade) ? info.items[grade] : null; Item item = fairyJadeInvestmentItem[0]; GetFairyJade = item.count; } return GetFairyJade; } private int RebateMultiple(int lv) private int RebateMultiple(int id) { int grade = 3; int InvestmentGrade = fairyJadeInvestmentModel.GetInvestmentGrade(); int type = model.fairyInvestType; int grade = 1; int InvestmentGrade = model.GetFairyInvestGear(); if (InvestmentGrade != 0) { grade = InvestmentGrade; } else { int type = fairyJadeInvestmentModel.BinningType; if (fairyJadeInvestmentModel.InvestmentAmountTypeDic.ContainsKey(type)) var _gear = investModel.GetInvestGear(type, model.selectInvestMoney); if (_gear != 0) { var dit = fairyJadeInvestmentModel.InvestmentAmountTypeDic[type]; if (dit.ContainsKey(fairyJadeInvestmentModel.SelectNumber)) { grade = dit[fairyJadeInvestmentModel.SelectNumber]; } grade = _gear; } } int ShowLinesNumber = ShowLines(grade); int ShowLinesNumber = investModel.GetInvestAmount(type, grade - 1); int GetFairyJade = 0; int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return GetFairyJade; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; foreach (var key in Dit.Keys) var Dit = model.fairyInvestItems[_type]; var compareInfo = Dit[id]; foreach (var info in Dit.Values) { if (key <= lv) if (info.levelLimit <= compareInfo.levelLimit) { List<Item> fairyJadeInvestmentItem = Dit[key].FairyJadeInvestmentItem.GetAwardItem(grade); List<Item> fairyJadeInvestmentItem = info.items.ContainsKey(grade) ? info.items[grade] : null; Item item = fairyJadeInvestmentItem[0]; GetFairyJade += item.count; } } int GetValue = (int)(GetFairyJade / ShowLinesNumber); if ((float)GetFairyJade / ShowLinesNumber >= (GetValue + 0.5)) { System/Vip/FairyJadeInvestmentModel.cs
@@ -8,40 +8,49 @@ using Snxxz.UI; using System.Linq; //仙玉投资 public class BinningClass public struct FairyInvestInfo { public int Money;//金额 public int Binning;// public int money;//金额 public int gear;// } } public class FairyJadeInvestmentClass public struct FairyInvestItems { public int ID;//ID public int Type;//类型 public int NeedDay;//需要天数 public int NeedLv;//需要等级 public MonthlyInvestmentModel.MonthlyInvestmentItem FairyJadeInvestmentItem;//奖励 public int id; public int levelLimit; public Dictionary<int, List<Item>> items;//奖励 } [XLua.LuaCallCSharp] public class FairyJadeInvestmentModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity { public Dictionary<int, Dictionary<int, FairyJadeInvestmentClass>> FairyJadeInvestmentTypeDic = new Dictionary<int, Dictionary<int, FairyJadeInvestmentClass>>();//根据投资类型来存储奖励类型和金额(类型3,4,5); public Dictionary<int, Dictionary<int, int>> InfoSeriorsTypeDic = new Dictionary<int, Dictionary<int, int>>();//根据类型存储奖励信息 public Dictionary<int, Dictionary<int, int>> InvestmentAmountTypeDic = new Dictionary<int, Dictionary<int, int>>();//根据类型获得投资金额 public Dictionary<int, BinningClass> BinningDic = new Dictionary<int, BinningClass>();//根据类型获取各个类型投资的档位金额和分档 public static Action FairyJadeInfoSeriorsUpdate; public int SelectNumber = 0;//记录想要投资的钱数 public int RecordSelectNumberMax = 0;//用来标记最大可投资额度 public List<int> MultipleList = new List<int>(); VipInvestModel m_VipInvestModel; VipInvestModel VipInvestModel { get { return m_VipInvestModel ?? (m_VipInvestModel = ModelCenter.Instance.GetModel<VipInvestModel>()); } } public int BinningType = 3; public event Action<int> onStateUpate; public Dictionary<int, Dictionary<int, FairyInvestItems>> fairyInvestItems = new Dictionary<int, Dictionary<int, FairyInvestItems>>();//根据投资类型来存储奖励类型和金额(类型3,4,5); public Dictionary<int, Dictionary<int, int>> fairyInvestSingleInfos = new Dictionary<int, Dictionary<int, int>>();//根据类型存储奖励信息 public Dictionary<int, FairyInvestInfo> fairyInvestInfos = new Dictionary<int, FairyInvestInfo>();//根据类型获取各个类型投资的档位金额和分档 public Dictionary<int, int> fairyInvestLevelLimits { get; private set; } public List<int> fairyInvestMultiples = new List<int>(); public int fairyInvestType { get; set; } public int selectInvestMoney { get; set; } public int prioritySelectIndex { get; private set; } bool isServerPrepare = false; public bool IsRedpoint = false; private int redpointLevelLimit = 0;//显示等级 private int redpointDays = 0;//显示天数 private bool redpointDirty = true; public readonly Redpoint redpoint = new Redpoint(209, 20910);//仙玉投资红点 public bool IsOpen { get { return IsOpenFeatures(); return IsFuncOpen(); } } @@ -49,7 +58,7 @@ { get { return IsRedPoint(); return redpoint.state != RedPointState.None; } } @@ -61,118 +70,119 @@ } } private bool IsRedPoint()//红点 { public event Action<int> onStateUpate; public event Action fairyInvestUpdate; if (redPointStre1.state == RedPointState.None) { return false; } else { return true; } } private bool IsOpenFeatures()//功能是否开启 { bool isOpen = false; int InvestmentGrade = GetInvestmentGrade(); if (InvestmentGrade > 0 && InvestmentGrade < 4) { isOpen = true; } else { if (InvestmentGrade == 4) { var dit = GetInfoSeriors(); foreach (int key in dit.Keys) { if (dit[key] != 4) { isOpen = true; } } } } if (!FuncOpen.Instance.IsFuncOpen(118)) { return false; } if (PlayerDatas.Instance.baseData.LV >= 500 && !isOpen) { return false; } else { return true; } } VipInvestModel investModel { get { return ModelCenter.Instance.GetModel<VipInvestModel>(); } } private bool IsOk = false; public bool IsRedpoint = false; private int DisplayLevel = 0;//显示等级 private int DisplayDays = 0;//显示天数 private bool IsUpdateBool = true; public override void Init() { OpenServerActivityCenter.Instance.Register(10, this); var InvestRedPoint = FuncConfigConfig.Get("InvestRedPoint"); DisplayLevel = int.Parse(InvestRedPoint.Numerical2); DisplayDays = int.Parse(InvestRedPoint.Numerical3); ParseConfig(); int[] MultipleIntList = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("JadeInvest").Numerical1); MultipleList.Clear(); for (int i = 0; i < MultipleIntList.Length; i++) { MultipleList.Add(MultipleIntList[i]); } Assignment(); OpenServerActivityCenter.Instance.Register(10, this); } public void OnBeforePlayerDataInitialize() { IsUpdateBool = true; IsOk = false; redpointDirty = true; isServerPrepare = false; IsRedpoint = false; SelectNumber = 0; RecordSelectNumberMax = 0; BinningDic.Clear(); InfoSeriorsTypeDic.Clear(); InvestmentAmountTypeDic.Clear(); FairyJadeInvestmentTypeDic.Clear(); Assignment(); selectInvestMoney = 0; fairyInvestInfos.Clear(); fairyInvestSingleInfos.Clear(); } public void OnPlayerLoginOk() { IsUpdateBool = true; IsOk = true; InvestmentAmount(); BinningType = GetFairyJadeType(); InvestmentRedPoint(); redpointDirty = true; isServerPrepare = true; fairyInvestType = GetFairyInvestType(); UpdateRedpoint(); IsShowRedPointSimple(); PlayerDatas.Instance.playerDataRefreshEvent -= Updatefighting; PlayerDatas.Instance.playerDataRefreshEvent += Updatefighting; PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent; PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent; FairyJadeInvestmentWin.FairyJadeInvestmentRedPointEvent -= FairyJadeInvestmentRedPoint; FairyJadeInvestmentWin.FairyJadeInvestmentRedPointEvent += FairyJadeInvestmentRedPoint; GlobalTimeEvent.Instance.secondEvent -= secondEvent; GlobalTimeEvent.Instance.secondEvent += secondEvent; GlobalTimeEvent.Instance.secondEvent -= PerSecond; GlobalTimeEvent.Instance.secondEvent += PerSecond; } private void secondEvent() public override void UnInit() { if (IsUpdateBool) } private void ParseConfig() { var funcConfig = FuncConfigConfig.Get("InvestRedPoint"); redpointLevelLimit = int.Parse(funcConfig.Numerical2); redpointDays = int.Parse(funcConfig.Numerical3); funcConfig = FuncConfigConfig.Get("JadeInvest"); fairyInvestMultiples.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1)); funcConfig = FuncConfigConfig.Get("GoldInvestLVLimit"); fairyInvestLevelLimits = ConfigParse.GetDic<int, int>(funcConfig.Numerical1); var configs = InvestConfig.GetValues(); foreach (var config in configs) { if (fairyInvestLevelLimits.ContainsKey(config.type)) { Dictionary<int, FairyInvestItems> dict; if (!fairyInvestItems.TryGetValue(config.type,out dict)) { dict = new Dictionary<int, FairyInvestItems>(); fairyInvestItems.Add(config.type, dict); } var items = new Dictionary<int, List<Item>>(); var json = LitJson.JsonMapper.ToObject(config.award); foreach (string gearKey in json.Keys) { var gear = int.Parse(gearKey); items.Add(gear, new List<Item>()); var itemArray = LitJson.JsonMapper.ToObject<int[][]>(json[gearKey].ToJson()); for (int j = 0; j < itemArray.Length; j++) { items[gear].Add(new Item() { id = itemArray[j][0], count = itemArray[j][1], }); } } dict.Add(config.id % 100, new FairyInvestItems() { id = config.id % 100, levelLimit = config.needLV, items = items, }); } } } private void PerSecond() { if (redpointDirty) { int InvestGold = GetInvestGold(); if (InvestGold > 0) { InvestmentRedPoint(); UpdateRedpoint(); } IsShowRedPointSimple(); IsUpdateBool = false; redpointDirty = false; } } private void PlayerDataRefreshEvent(PlayerDataType dataType) { if (dataType == PlayerDataType.LV) { redpointDirty = true; } } @@ -181,288 +191,157 @@ RedPointSate(); } private void Updatefighting(PlayerDataType _tCDBPlayerRefresh) private bool IsFuncOpen()//功能是否开启 { if (_tCDBPlayerRefresh == PlayerDataType.LV) { IsUpdateBool = true; } } bool existInvestGear = false; public override void UnInit() { int gear = GetFairyInvestGear(); var maxGear = investModel.GetInvestMaxGear(fairyInvestType); } private void AssignmentType() { //根据投资类型来存储奖励信息(类型3,4,5) if (FairyJadeInvestmentTypeDic.Count >= 3) if (gear > 0) { return; } var investConfig = InvestConfig.GetValues(); foreach (var value in investConfig) { if ((value.type == 3 || value.type == 4 || value.type == 5)) if (gear < maxGear) { if (!FairyJadeInvestmentTypeDic.ContainsKey(value.type)) existInvestGear = true; } else if (gear == maxGear) { var dit = GetInfoSeriors(); foreach (int key in dit.Keys) { Dictionary<int, FairyJadeInvestmentClass> Dic = new Dictionary<int, FairyJadeInvestmentClass>(); FairyJadeInvestmentClass fairyJadeInvestment = new FairyJadeInvestmentClass(); fairyJadeInvestment.ID = value.id % 100; fairyJadeInvestment.Type = value.type; fairyJadeInvestment.NeedDay = value.needDay; fairyJadeInvestment.NeedLv = value.needLV; SetInfoSeriors(value.type, fairyJadeInvestment.ID); MonthlyInvestmentModel.MonthlyInvestmentItem FairyJadeItem = new MonthlyInvestmentModel.MonthlyInvestmentItem(); var _jsonData = LitJson.JsonMapper.ToObject(value.award); foreach (string key in _jsonData.Keys) if (dit[key] < gear) { var _job = int.Parse(key); var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[key].ToJson()); for (int j = 0; j < _itemArray.Length; j++) { FairyJadeItem.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1])); } } fairyJadeInvestment.FairyJadeInvestmentItem = FairyJadeItem; Dic.Add(value.needLV, fairyJadeInvestment); FairyJadeInvestmentTypeDic.Add(value.type, Dic); } else { var dict = FairyJadeInvestmentTypeDic[value.type]; FairyJadeInvestmentClass fairyJadeInvestment = new FairyJadeInvestmentClass(); fairyJadeInvestment.ID = fairyJadeInvestment.ID = value.id % 100; SetInfoSeriors(value.type, fairyJadeInvestment.ID); fairyJadeInvestment.Type = value.type; fairyJadeInvestment.NeedDay = value.needDay; fairyJadeInvestment.NeedLv = value.needLV; MonthlyInvestmentModel.MonthlyInvestmentItem FairyJadeItem = new MonthlyInvestmentModel.MonthlyInvestmentItem(); var _jsonData = LitJson.JsonMapper.ToObject(value.award); foreach (string key in _jsonData.Keys) { var _job = int.Parse(key); var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[key].ToJson()); for (int j = 0; j < _itemArray.Length; j++) { FairyJadeItem.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1])); } } fairyJadeInvestment.FairyJadeInvestmentItem = FairyJadeItem; if (!dict.ContainsKey(value.needLV)) { dict.Add(value.needLV, fairyJadeInvestment); } else { dict[value.needLV] = fairyJadeInvestment; existInvestGear = true; } } } } } private void SetInfoSeriors(int type, int id) { if (!InfoSeriorsTypeDic.ContainsKey(type)) if (!FuncOpen.Instance.IsFuncOpen(118)) { Dictionary<int, int> dic = new Dictionary<int, int>(); dic.Add(id, 0); InfoSeriorsTypeDic.Add(type, dic); return false; } var maxLevelLimit = fairyInvestLevelLimits.Values.Last(); if (PlayerDatas.Instance.baseData.LV > maxLevelLimit && !existInvestGear) { return false; } else { var dict = InfoSeriorsTypeDic[type]; if (dict.ContainsKey(id)) { dict.Add(id, 0); } else { dict[id] = 0; } InfoSeriorsTypeDic[type] = dict; return true; } } public void Assignment() { AssignmentType(); } public void GetInfoSeriors(HA337_tagMCGoldInvestInfo vNetData)//接受信息 public void GetInfoSeriors(HA337_tagMCGoldInvestInfo package)//接受信息 { if (vNetData.InvestType == 3 || vNetData.InvestType == 4 || vNetData.InvestType == 5) if (fairyInvestLevelLimits.ContainsKey(package.InvestType)) { InvestmentAmount(); if (InvestmentAmountTypeDic.ContainsKey(vNetData.InvestType)) var fairyInvestInfo = new FairyInvestInfo() { var dit = InvestmentAmountTypeDic[vNetData.InvestType]; if (dit.ContainsKey((int)vNetData.InvestGold)) { BinningClass binningClass = new BinningClass(); binningClass.Money= (int)vNetData.InvestGold; binningClass.Binning= dit[(int)vNetData.InvestGold]; BinningDic[vNetData.InvestType] = binningClass; } money = (int)package.InvestGold, gear = investModel.GetInvestGear(package.InvestType, (int)package.InvestGold), }; fairyInvestInfos[package.InvestType] = fairyInvestInfo; } if (InfoSeriorsTypeDic.ContainsKey(vNetData.InvestType))//奖励刷新赋值 if (!fairyInvestSingleInfos.ContainsKey(package.InvestType))//奖励刷新赋值 { var Dit = InfoSeriorsTypeDic[vNetData.InvestType]; for (int i = 0; i < vNetData.RewardRecordCnt; i++) fairyInvestSingleInfos.Add(package.InvestType, new Dictionary<int, int>()); } var Dit = fairyInvestSingleInfos[package.InvestType]; for (int i = 0; i < package.RewardRecordCnt; i++) { Dit[(int)package.InvestRewardList[i].RewardIndex] = (int)package.InvestRewardList[i].RewardValue; } UpdateRedpoint(); if (fairyInvestUpdate != null) { fairyInvestUpdate(); } } } public void SendGotInvestReward(int type, int index)//领取奖励 { var pak = new CA541_tagCMGetInvestReward(); pak.InvestType = (byte)type; pak.RewardIndex = (byte)index; GameNetSystem.Instance.SendInfo(pak); } public void SendFairyInvest(int type, int money)//仙玉投资 { var pak = new CA540_tagCMGoldInvest(); pak.InvestType = (byte)type; pak.InvestGold = (uint)money; GameNetSystem.Instance.SendInfo(pak); } private void UpdateRedpoint()//红点 { prioritySelectIndex = 0; var redpointAble = false; int playerLevel = PlayerDatas.Instance.baseData.LV; if (fairyInvestLevelLimits.ContainsKey(fairyInvestType)) { int investGear = fairyInvestInfos.ContainsKey(fairyInvestType) ? fairyInvestInfos[fairyInvestType].gear : 0; var investItems = fairyInvestItems[fairyInvestType]; var index = 0; foreach (var investItem in investItems.Values) { if (playerLevel >= investItem.levelLimit) { if (Dit.ContainsKey((int)vNetData.InvestRewardList[i].RewardIndex)) if (investGear != 0) { Dit[(int)vNetData.InvestRewardList[i].RewardIndex] = (int)vNetData.InvestRewardList[i].RewardValue; var gear = fairyInvestSingleInfos[fairyInvestType][investItem.id]; if (gear == 0) { redpointAble = true; prioritySelectIndex = index; break; } else { var currentItems = investItem.items.ContainsKey(investGear) ? investItem.items[investGear] : null; var items = investItem.items.ContainsKey(gear) ? investItem.items[gear] : null; if (currentItems[0].count > items[0].count) { redpointAble = true; prioritySelectIndex = index; break; } } } } InfoSeriorsTypeDic[vNetData.InvestType] = Dit; index++; } InvestmentRedPoint(); if (FairyJadeInfoSeriorsUpdate != null) index = 0; if (!redpointAble && investGear != 0) { FairyJadeInfoSeriorsUpdate(); } } } public void SendInvestment(int InvestType, int RewardIndex)//领取奖励 { CA541_tagCMGetInvestReward CA541 = new CA541_tagCMGetInvestReward(); CA541.InvestType = (byte)InvestType; CA541.RewardIndex = (byte)RewardIndex; GameNetSystem.Instance.SendInfo(CA541); } public void InvestmentMonthlyInvestment(int InvestType, int InvestGold)//仙玉投资 { CA540_tagCMGoldInvest C540 = new CA540_tagCMGoldInvest(); C540.InvestType = (byte)InvestType; C540.InvestGold = (uint)InvestGold; GameNetSystem.Instance.SendInfo(C540); } public void InvestmentAmount() { InvestmentAmountType(); } private void InvestmentAmountType() { if (InvestmentAmountTypeDic.Count > 0) { return; } if (VipInvestModel.GetInvestGoldGears(3) > 0) { Dictionary<int, int> dict = new Dictionary<int, int>(); var maxGear = VipInvestModel.GetInvestGoldGears(3); for (int i = 0; i < maxGear; i++) { dict.Add(VipInvestModel.GetInvestGold(3, i), i + 1); } InvestmentAmountTypeDic.Add(3, dict); RecordSelectNumberMax = VipInvestModel.GetInvestGold(3, maxGear - 1); } if (VipInvestModel.GetInvestGoldGears(4) > 0) { Dictionary<int, int> dict = new Dictionary<int, int>(); var maxGear = VipInvestModel.GetInvestGoldGears(4); for (int i = 0; i < maxGear; i++) { dict.Add(VipInvestModel.GetInvestGold(4, i), i + 1); } InvestmentAmountTypeDic.Add(4, dict); } if (VipInvestModel.GetInvestGoldGears(5) > 0) { Dictionary<int, int> dict = new Dictionary<int, int>(); var maxGear = VipInvestModel.GetInvestGoldGears(5); for (int i = 0; i < maxGear; i++) { dict.Add(VipInvestModel.GetInvestGold(5, i), i + 1); } InvestmentAmountTypeDic.Add(5, dict); } } private const int Redpoint_key1 = 20910; public Redpoint redPointStre1 = new Redpoint(209, Redpoint_key1);//仙玉投资红点 public int JumpInedx = 0; private void InvestmentRedPoint()//红点 { JumpInedx = 0; int type = -1; redPointStre1.state = RedPointState.None; int PlayerLV = PlayerDatas.Instance.baseData.LV; int InvestmentGrade = GetInvestmentGrade(); int _type = BinningType; if (!FairyJadeInvestmentTypeDic.ContainsKey(_type)) { return; } var Dit = FairyJadeInvestmentTypeDic[_type]; foreach (var key in Dit.Keys) { type += 1; if (PlayerLV >= key) { int indexID = Dit[key].ID; if (InvestmentGrade != 0) foreach (var investItem in investItems.Values) { var dit = GetInfoSeriors(); int IsReceive = 0; if (dit.ContainsKey(indexID)) if (investItem.levelLimit > playerLevel) { IsReceive = dit[indexID]; } if (IsReceive == 0) { redPointStre1.state = RedPointState.GetReward; JumpInedx = type; prioritySelectIndex = index; return; } else { List<Item> fairyJadeInvestmentItem = Dit[key].FairyJadeInvestmentItem.GetAwardItem(InvestmentGrade); int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = Dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive); Item itemAdd = fairyJadeInvestmentItemAdd[0]; AtPresentNumber = itemAdd.count; } if (fairyJadeInvestmentItem[0].count > AtPresentNumber) { redPointStre1.state = RedPointState.GetReward; JumpInedx = type; return; } } index++; } } } int type1 = -1; if (JumpInedx == 0 && InvestmentGrade != 0) { foreach (var key in Dit.Keys) { type1 += 1; if (key > PlayerLV) { JumpInedx = type1; return; } } } redpoint.state = redpointAble ? RedPointState.GetReward : RedPointState.None; } private void RedPointSate()//月卡投资创角前三天红点 { @@ -473,15 +352,15 @@ } if (IsRedpoint) { if (IsOpenFeatures()) if (IsFuncOpen()) { redPointStre1.state = RedPointState.Simple; redpoint.state = RedPointState.Simple; } } else { InvestmentRedPoint(); UpdateRedpoint(); } } @@ -492,8 +371,8 @@ int day = LocalSave.GetInt(strKey); if (day != GetDayOfYear) { if (TimeUtility.CreateDays <= DisplayDays && redPointStre1.state == RedPointState.None && PlayerDatas.Instance.baseData.LV >= DisplayLevel) if (TimeUtility.CreateDays <= redpointDays && redpoint.state == RedPointState.None && PlayerDatas.Instance.baseData.LV >= redpointLevelLimit) { LocalSave.SetInt(strKey, GetDayOfYear); IsRedpoint = true; @@ -502,9 +381,9 @@ } } if (!IsOpenFeatures())//功能关闭 if (!IsFuncOpen())//功能关闭 { redPointStre1.state = RedPointState.None; redpoint.state = RedPointState.None; return; } } @@ -512,13 +391,13 @@ public void MessageNotification() { var _funcOrder = 0; int InvestmentGrade = GetInvestmentGrade(); var gear = GetFairyInvestGear(); if (!OpenServerActivityCenter.Instance.IsAnyActivityOpen(out _funcOrder)) { SysNotifyMgr.Instance.ShowTip("JadeInvestmentLimit1");//信息提示 return; } else if (InvestmentGrade <= 0 && PlayerDatas.Instance.baseData.LV >= 300) else if (gear <= 0 && PlayerDatas.Instance.baseData.LV >= fairyInvestLevelLimits.Values.Last()) { SysNotifyMgr.Instance.ShowTip("JadeInvestmentLimit2");//信息提示 return; @@ -526,7 +405,7 @@ else { bool isOpen = false; if (InvestmentGrade == 4) if (gear == 4) { var dit = GetInfoSeriors(); foreach (int key in dit.Keys) @@ -545,188 +424,85 @@ } } public int GetFairyJadeType()//获取投资类型 public int GetFairyInvestType()//获取投资类型 { int type = 3; bool Isbool = true; int PlayerLV = PlayerDatas.Instance.baseData.LV; foreach (var key in BinningDic.Keys) { if (BinningDic[key].Money != 0) { Isbool = false; } } if (Isbool)//没有投资过永远为第一档 { return 3; } bool Isbool3 = false; if (FairyJadeInvestmentTypeDic.ContainsKey(3) && InfoSeriorsTypeDic.ContainsKey(3)) { int typeGrade = GetInvestmentGradeT(3); var dit = FairyJadeInvestmentTypeDic[3]; var dit1 = InfoSeriorsTypeDic[3]; foreach (var key in dit.Keys) { if (PlayerLV >= key) { int indexID = dit[key].ID; int IsReceive = dit1[indexID]; if (IsReceive == 0) { Isbool3 = true; } else { List<Item> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade); int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive); Item itemAdd = fairyJadeInvestmentItemAdd[0]; AtPresentNumber = itemAdd.count; } if (fairyJadeInvestmentItem[0].count > AtPresentNumber) { Isbool3 = true; } } } } } if (Isbool3 || PlayerLV <= 300) { return 3; } if (BinningDic.ContainsKey(4) && BinningDic[4].Money == 0) { return 4; } bool Isbool4 = false; if (BinningDic.ContainsKey(4) && BinningDic[4].Money != 0 && FairyJadeInvestmentTypeDic.ContainsKey(4) && InfoSeriorsTypeDic.ContainsKey(4)) { int typeGrade = GetInvestmentGradeT(4); var dit = FairyJadeInvestmentTypeDic[4]; var dit1 = InfoSeriorsTypeDic[4]; foreach (var key in dit.Keys) { if (PlayerLV >= key) { int indexID = dit[key].ID; int IsReceive = dit1[indexID]; if (IsReceive == 0) { Isbool4 = true; } else { List<Item> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade); int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive); Item itemAdd = fairyJadeInvestmentItemAdd[0]; AtPresentNumber = itemAdd.count; } if (fairyJadeInvestmentItem[0].count > AtPresentNumber) { Isbool4 = true; } int playerLevel = PlayerDatas.Instance.baseData.LV; var selectType = fairyInvestLevelLimits.Keys.First(); foreach (var type in fairyInvestInfos.Keys) { if (fairyInvestInfos[type].money == 0) { continue; } var existUnGotReward = false; var investGear = fairyInvestInfos[type].gear; if (fairyInvestSingleInfos.ContainsKey(type)) { var singleInfos = fairyInvestSingleInfos[type]; var investItems = fairyInvestItems[type]; foreach (var investItem in investItems.Values) { if (playerLevel >= investItem.levelLimit) { var gotGear = singleInfos[investItem.id]; if (gotGear == 0) { existUnGotReward = true; } else { List<Item> currentItems = investItem.items.ContainsKey(investGear) ? investItem.items[investGear] : null; List<Item> items = investItem.items.ContainsKey(gotGear) ? investItem.items[gotGear] : null; if (currentItems[0].count > items[0].count) { existUnGotReward = true; } } } } } } if (FairyJadeInvestmentTypeDic.ContainsKey(4) && ((PlayerLV > 300 && PlayerLV <= 400) || Isbool4)) { return 4; } if (BinningDic.ContainsKey(5) && BinningDic[5].Money == 0) { return 5; } bool Isbool5 = false; if (FairyJadeInvestmentTypeDic.ContainsKey(5) && InfoSeriorsTypeDic.ContainsKey(5)) { int typeGrade = GetInvestmentGradeT(5); var dit = FairyJadeInvestmentTypeDic[5]; var dit1 = InfoSeriorsTypeDic[5]; foreach (var key in dit.Keys) { if (PlayerLV >= key) if (existUnGotReward || playerLevel <= fairyInvestLevelLimits[type]) { int indexID = dit[key].ID; int IsReceive = dit1[indexID]; if (IsReceive == 0) { Isbool5 = true; } else { List<Item> fairyJadeInvestmentItem = dit[key].FairyJadeInvestmentItem.GetAwardItem(typeGrade); int AtPresentNumber = 0; if (IsReceive != 0) { List<Item> fairyJadeInvestmentItemAdd = dit[key].FairyJadeInvestmentItem.GetAwardItem(IsReceive); Item itemAdd = fairyJadeInvestmentItemAdd[0]; AtPresentNumber = itemAdd.count; } if (fairyJadeInvestmentItem[0].count > AtPresentNumber) { Isbool5 = true; } } selectType = type; break; } } } if (FairyJadeInvestmentTypeDic.ContainsKey(5) && ((PlayerLV > 400 && PlayerLV <= 500) || Isbool5)) { return 5; } return 3; return selectType; } private int GetInvestmentGradeT(int Type) public int GetFairyInvestGear()//获取投资档位 { int InvestmentGrade = 0; if (BinningDic.ContainsKey(Type)) if (fairyInvestInfos.ContainsKey(fairyInvestType)) { InvestmentGrade = BinningDic[Type].Binning; return fairyInvestInfos[fairyInvestType].gear; } return InvestmentGrade; return 0; } public int GetInvestmentGrade()//获取投资档位 { int InvestmentGrade = 0; int type =BinningType; if (BinningDic.ContainsKey(type)) { InvestmentGrade = BinningDic[type].Binning; } return InvestmentGrade; } public int GetInvestGold()//获取投资金额 { int InvestGold = 0; int type = BinningType; if (BinningDic.ContainsKey(type)) int type = fairyInvestType; if (fairyInvestInfos.ContainsKey(type)) { InvestGold = BinningDic[type].Money; InvestGold = fairyInvestInfos[type].money; } return InvestGold; } public Dictionary<int, int> GetInfoSeriors() { Dictionary<int, int> dit = new Dictionary<int, int>(); int type = BinningType; if (InfoSeriorsTypeDic.ContainsKey(type)) int type = fairyInvestType; if (fairyInvestSingleInfos.ContainsKey(type)) { dit = InfoSeriorsTypeDic[type]; dit = fairyInvestSingleInfos[type]; } return dit; } System/Vip/FairyJadeInvestmentTipWin.cs
@@ -39,14 +39,14 @@ protected override void OnPreOpen() { var maxGear = VipInvestModel.GetInvestGoldGears(3); var maxGear = VipInvestModel.GetInvestMaxGear(3); int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); for (int i = 0; i < m_AmountOfChoices.Length; i++) { m_AmountOfChoices[i].gameObject.SetActive(i < maxGear); if (i < maxGear) { var gold = VipInvestModel.GetInvestGold(3, i); var gold = VipInvestModel.GetInvestAmount(3, i); m_Labels[i].text = gold.ToString(); m_AmountOfChoices[i].gameObject.SetActive(InvestGold < gold); } @@ -68,7 +68,7 @@ private void OnAmount(int index) { fairyJadeInvestmentModel.SelectNumber = VipInvestModel.GetInvestGold(3, index); fairyJadeInvestmentModel.selectInvestMoney = VipInvestModel.GetInvestAmount(3, index); if (SelectNumberRefresh != null) { SelectNumberRefresh(); System/Vip/FairyJadeInvestmentWin.cs
@@ -15,10 +15,6 @@ public class FairyJadeInvestmentWin : Window { FairyJadeInvestmentModel m_FairyJadeInvestmentModel; FairyJadeInvestmentModel fairyJadeInvestmentModel { get { return m_FairyJadeInvestmentModel ?? (m_FairyJadeInvestmentModel = ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>()); } } VipInvestModel m_VipInvestModel; VipInvestModel VipInvestModel { get { return m_VipInvestModel ?? (m_VipInvestModel = ModelCenter.Instance.GetModel<VipInvestModel>()); } } [SerializeField] ScrollerController m_ScrollerController; [SerializeField] Button m_InvestmentButton;//投资按钮 [SerializeField] GameObject m_MaxInverstment;//最大投资上限 @@ -43,6 +39,10 @@ private string[] IconList1 = new string[4]; private string[] IconList2 = new string[4]; private string[] IconList3 = new string[4]; FairyJadeInvestmentModel model { get { return ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>(); } } VipInvestModel investModel { get { return ModelCenter.Instance.GetModel<VipInvestModel>(); } } protected override void BindController() { var JadeInves = FuncConfigConfig.Get("JadeInvestIconKey"); @@ -66,17 +66,18 @@ protected override void OnPreOpen() { fairyJadeInvestmentModel.BinningType = fairyJadeInvestmentModel.GetFairyJadeType(); model.fairyInvestType = model.GetFairyInvestType(); var maxAmount = investModel.GetMaxInvestAmount(model.fairyInvestType); SetText(); int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); if (InvestGold < fairyJadeInvestmentModel.RecordSelectNumberMax) int InvestGold = model.GetInvestGold(); if (InvestGold < maxAmount) { var maxGear = VipInvestModel.GetInvestGoldGears(3); var maxGear = investModel.GetInvestMaxGear(3); for (int i = 0; i < maxGear; i++) { if (InvestGold < VipInvestModel.GetInvestGold(3, i)) if (InvestGold < investModel.GetInvestAmount(3, i)) { fairyJadeInvestmentModel.SelectNumber = VipInvestModel.GetInvestGold(3, i); model.selectInvestMoney = investModel.GetInvestAmount(3, i); break; } } @@ -84,7 +85,7 @@ } else { fairyJadeInvestmentModel.SelectNumber = fairyJadeInvestmentModel.RecordSelectNumberMax; model.selectInvestMoney = maxAmount; m_SelectButton.gameObject.SetActive(false); } if (InvestGold <= 0) @@ -95,7 +96,7 @@ { m_InvestmentText.text = string.Format(Language.Get("FairyJadeInvestment_8"), InvestGold); } if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) if (InvestGold >= maxAmount) { m_JadeText.gameObject.SetActive(false); } @@ -103,33 +104,33 @@ { m_JadeText.gameObject.SetActive(true); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), fairyJadeInvestmentModel.SelectNumber - InvestGold); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), model.selectInvestMoney - InvestGold); } IsInvestment(); GetMoney(); SetIconKeyImage(); if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) if (InvestGold >= maxAmount) { m_TextNumber.text = fairyJadeInvestmentModel.RecordSelectNumberMax.ToString(); m_TextNumber.text = maxAmount.ToString(); } else { m_TextNumber.text = (fairyJadeInvestmentModel.SelectNumber - InvestGold).ToString(); m_TextNumber.text = (model.selectInvestMoney - InvestGold).ToString(); } PlayerDatas.Instance.playerDataRefreshEvent += Updatefighting;//数据的刷新(h0418) FairyJadeInvestmentModel.FairyJadeInfoSeriorsUpdate += FairyJadeInfoSeriorsUpdate; model.fairyInvestUpdate += FairyJadeInfoSeriorsUpdate; FairyJadeInvestmentTipWin.SelectNumberRefresh += SelectNumberRefresh; m_ScrollerController.OnRefreshCell += OnRefreshGridCell; OnCreateGridLineCell(m_ScrollerController); m_ScrollerController.JumpIndex(fairyJadeInvestmentModel.JumpInedx); m_ScrollerController.JumpIndex(model.prioritySelectIndex); } protected override void OnAfterOpen() { if (fairyJadeInvestmentModel.redPointStre1.state == RedPointState.Simple) if (model.redpoint.state == RedPointState.Simple) { fairyJadeInvestmentModel.IsRedpoint = false; model.IsRedpoint = false; if (FairyJadeInvestmentRedPointEvent != null) { FairyJadeInvestmentRedPointEvent(); @@ -140,31 +141,32 @@ protected override void OnPreClose() { PlayerDatas.Instance.playerDataRefreshEvent -= Updatefighting;//数据的刷新(h0418) FairyJadeInvestmentModel.FairyJadeInfoSeriorsUpdate -= FairyJadeInfoSeriorsUpdate; model.fairyInvestUpdate -= FairyJadeInfoSeriorsUpdate; m_ScrollerController.OnRefreshCell -= OnRefreshGridCell; FairyJadeInvestmentTipWin.SelectNumberRefresh -= SelectNumberRefresh; } private void SelectNumberRefresh() { int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) int InvestGold = model.GetInvestGold(); var maxAmount = investModel.GetMaxInvestAmount(model.fairyInvestType); if (InvestGold >= maxAmount) { m_TextNumber.text = fairyJadeInvestmentModel.RecordSelectNumberMax.ToString(); m_TextNumber.text = maxAmount.ToString(); } else { m_TextNumber.text = (fairyJadeInvestmentModel.SelectNumber - InvestGold).ToString(); m_TextNumber.text = (model.selectInvestMoney - InvestGold).ToString(); } SetIconKeyImage(); if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) if (InvestGold >= maxAmount) { m_JadeText.gameObject.SetActive(false); } else { m_JadeText.gameObject.SetActive(true); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), fairyJadeInvestmentModel.SelectNumber - InvestGold); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), model.selectInvestMoney - InvestGold); } m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 } @@ -175,15 +177,17 @@ #endregion private void FairyJadeInfoSeriorsUpdate() { int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); if (InvestGold < fairyJadeInvestmentModel.RecordSelectNumberMax) int InvestGold = model.GetInvestGold(); var maxAmount = investModel.GetMaxInvestAmount(model.fairyInvestType); if (InvestGold < maxAmount) { fairyJadeInvestmentModel.SelectNumber = fairyJadeInvestmentModel.RecordSelectNumberMax; model.selectInvestMoney = maxAmount; m_SelectButton.gameObject.SetActive(true); } else { fairyJadeInvestmentModel.SelectNumber = fairyJadeInvestmentModel.RecordSelectNumberMax; model.selectInvestMoney = maxAmount; m_SelectButton.gameObject.SetActive(false); } if (InvestGold <= 0) @@ -194,23 +198,23 @@ { m_InvestmentText.text = string.Format(Language.Get("FairyJadeInvestment_8"), InvestGold); } if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) if (InvestGold >= maxAmount) { m_JadeText.gameObject.SetActive(false); } else { m_JadeText.gameObject.SetActive(true); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), fairyJadeInvestmentModel.SelectNumber - InvestGold); m_JadeText.text = string.Format(Language.Get("FairyJadeInvestment_9"), model.selectInvestMoney - InvestGold); } if (InvestGold >= fairyJadeInvestmentModel.RecordSelectNumberMax) if (InvestGold >= maxAmount) { m_TextNumber.text = fairyJadeInvestmentModel.RecordSelectNumberMax.ToString(); m_TextNumber.text = maxAmount.ToString(); } else { m_TextNumber.text = (fairyJadeInvestmentModel.SelectNumber - InvestGold).ToString(); m_TextNumber.text = (model.selectInvestMoney - InvestGold).ToString(); } SetIconKeyImage(); IsInvestment(); @@ -220,12 +224,12 @@ void OnCreateGridLineCell(ScrollerController gridCtrl)//预制体创建 { gridCtrl.Refresh(); int _type = fairyJadeInvestmentModel.BinningType; if (!fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic.ContainsKey(_type)) int _type = model.fairyInvestType; if (!model.fairyInvestItems.ContainsKey(_type)) { return; } var Dit = fairyJadeInvestmentModel.FairyJadeInvestmentTypeDic[_type]; var Dit = model.fairyInvestItems[_type]; foreach (int key in Dit.Keys) { gridCtrl.AddCell(ScrollerDataType.Header, key); @@ -237,13 +241,15 @@ { FairyJadeInvestmentItem fairyJadeInvestmentItem = cell.GetComponent<FairyJadeInvestmentItem>(); int playerlv = cell.index; fairyJadeInvestmentItem.GetPlayerLV(playerlv); fairyJadeInvestmentItem.Display(playerlv); } private void IsInvestment()//是否可投资 { int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); if (InvestGold < fairyJadeInvestmentModel.RecordSelectNumberMax) int InvestGold = model.GetInvestGold(); var maxAmount = investModel.GetMaxInvestAmount(model.fairyInvestType); if (InvestGold < maxAmount) { m_MaxInverstment.SetActive(false); @@ -271,7 +277,7 @@ private void InvestmentButton()//仙玉投资 { var vipLevelLimit = VipInvestModel.GetVipLevelLimit(fairyJadeInvestmentModel.BinningType); var vipLevelLimit = investModel.GetVipLevelLimit(model.fairyInvestType); if (PlayerDatas.Instance.baseData.VIPLv < vipLevelLimit) { ConfirmCancel.ShowRealmPopConfirm(Language.Get("Mail101"), @@ -284,7 +290,7 @@ } int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); int InvestGold = model.GetInvestGold(); //if (PlayerDatas.Instance.baseData.LV > 300) //{ // ServerTipDetails.DisplayNormalTip(Language.Get("HasExceededTheInvestmentGrade_Z")); @@ -292,21 +298,21 @@ //} if (InvestGold > 0) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_2"), fairyJadeInvestmentModel.SelectNumber - InvestGold), (bool isOk) => ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_2"), model.selectInvestMoney - InvestGold), (bool isOk) => { if (isOk) { ConsumeFairyJade(fairyJadeInvestmentModel.SelectNumber); ConsumeFairyJade(model.selectInvestMoney); } }); } else { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_1"), fairyJadeInvestmentModel.SelectNumber), (bool isOk) => ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_1"), model.selectInvestMoney), (bool isOk) => { if (isOk) { ConsumeFairyJade(fairyJadeInvestmentModel.SelectNumber); ConsumeFairyJade(model.selectInvestMoney); } }); } @@ -314,24 +320,24 @@ private void RealizedInvestment_Button()//追加投资按钮 { int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); int InvestGold = model.GetInvestGold(); if (InvestGold > 0) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_2"), fairyJadeInvestmentModel.SelectNumber - InvestGold), (bool isOk) => ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_2"), model.selectInvestMoney - InvestGold), (bool isOk) => { if (isOk) { ConsumeFairyJade(fairyJadeInvestmentModel.SelectNumber); ConsumeFairyJade(model.selectInvestMoney); } }); } else { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_1"), fairyJadeInvestmentModel.SelectNumber), (bool isOk) => ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), string.Format(Language.Get("FairyJadeInvestment_1"), model.selectInvestMoney), (bool isOk) => { if (isOk) { ConsumeFairyJade(fairyJadeInvestmentModel.SelectNumber); ConsumeFairyJade(model.selectInvestMoney); } }); } @@ -341,12 +347,12 @@ private void ConsumeFairyJade(int fairyJade) { int InvestGold = fairyJadeInvestmentModel.GetInvestGold(); int InvestGold = model.GetInvestGold(); int getFairyJade = (int)UIHelper.GetMoneyCnt(1); if (getFairyJade >= (fairyJade - InvestGold)) { int type = fairyJadeInvestmentModel.BinningType; fairyJadeInvestmentModel.InvestmentMonthlyInvestment(type, fairyJade); int type = model.fairyInvestType; model.SendFairyInvest(type, fairyJade); } else { @@ -380,7 +386,7 @@ private void SetText() { int Type= fairyJadeInvestmentModel.BinningType; int Type= model.fairyInvestType; switch (Type) { case 3: @@ -398,25 +404,18 @@ private void SetIconKeyImage() { var money = fairyJadeInvestmentModel.SelectNumber; int ype = fairyJadeInvestmentModel.BinningType; if (fairyJadeInvestmentModel.InvestmentAmountTypeDic.ContainsKey(ype)) var money = model.selectInvestMoney; int type = model.fairyInvestType; var gear = investModel.GetInvestGear(type, money); if (GearPositionList.Contains(gear)) { var dit = fairyJadeInvestmentModel.InvestmentAmountTypeDic[ype]; if (dit.ContainsKey(money)) { var type = dit[money]; if (GearPositionList.Contains(type)) { int Inedx = GearPositionList.IndexOf(type); m_Image1.SetSprite(IconList1[Inedx]); m_Image1.SetNativeSize(); m_Image2.SetSprite(IconList2[Inedx]); m_Image2.SetNativeSize(); m_Image3.SetSprite(IconList3[Inedx]); m_Image3.SetNativeSize(); } } int Inedx = GearPositionList.IndexOf(gear); m_Image1.SetSprite(IconList1[Inedx]); m_Image1.SetNativeSize(); m_Image2.SetSprite(IconList2[Inedx]); m_Image2.SetNativeSize(); m_Image3.SetSprite(IconList3[Inedx]); m_Image3.SetNativeSize(); } } } System/Vip/VipInvest/MonthWeekInvestCell.cs
New file @@ -0,0 +1,75 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class MonthWeekInvestCell : CellView { [SerializeField] ItemBehaviour m_Item; [SerializeField] Text m_Description; [SerializeField] Text m_Count; [SerializeField] Text m_Income; [SerializeField] Transform m_ContainerUnReach; [SerializeField] Transform m_ContainerReward; [SerializeField] Button m_Func; [SerializeField] Transform m_ContainerGot; [SerializeField] Transform m_ContainerOverdue; MonthWeekInvestModel model { get { return ModelCenter.Instance.GetModel<MonthWeekInvestModel>(); } } public void Display(int id) { List<Item> items; if (model.TryGetItems(model.selectType, id, out items)) { var item = items[0]; m_Item.SetItem(item.id, 0); var config = InvestConfig.Get(id); if (config.needDay == 1) { m_Description.text = Language.Get("MonthWeekFirstIncome", item.count); } else { m_Description.text = Language.Get("MonthWeekDailyIncome", config.needDay, item.count); } m_Count.text = item.count.ToString(); var state = model.GetSingleInvestState(model.selectType, id); m_ContainerUnReach.gameObject.SetActive(state == 1); m_ContainerReward.gameObject.SetActive(state == 2); m_ContainerGot.gameObject.SetActive(state == 3); m_ContainerOverdue.gameObject.SetActive(state == 4); var rate = model.GetIncomeRate(model.selectType, config.needDay); var lastRate = (int)model.GetIncomeRate(model.selectType, config.needDay - 1); if ((int)rate != lastRate) { m_Income.text = Language.Get("MonthWeekIncomeRate", rate); } else { m_Income.text = string.Empty; } switch (state) { case 2: m_Func.SetListener(() => { model.SendGetReward(model.selectType, id); }); break; } } } } } System/Vip/VipInvest/MonthWeekInvestCell.cs.meta
File was renamed from Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 129cd7237fa54844cb8038793a512d2a timeCreated: 1557818429 guid: 9f2a1bb863ae5fb46a02e8fe6e8fae60 timeCreated: 1560246850 licenseType: Pro MonoImporter: serializedVersion: 2 System/Vip/VipInvest/MonthWeekInvestModel.cs
New file @@ -0,0 +1,395 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace Snxxz.UI { public class MonthWeekInvestModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity { Dictionary<int, Dictionary<int, List<Item>>> m_InvestItems = new Dictionary<int, Dictionary<int, List<Item>>>(); Dictionary<int, List<int>> m_InvestRechargeIds = new Dictionary<int, List<int>>(); Dictionary<int, InvestInfo> m_InvestInfos = new Dictionary<int, InvestInfo>(); Dictionary<int, Dictionary<int, int>> m_InvestSingleInfos = new Dictionary<int, Dictionary<int, int>>(); Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>(); public List<int> investTypes { get; private set; } int m_SelectType = 0; public int selectType { get { return m_SelectType; } set { if (m_SelectType != value) { m_SelectType = value; if (onSelectUpdate != null) { onSelectUpdate(); } } } } public int jumpType { get; set; } public bool IsOpen { get { return FuncOpen.Instance.IsFuncOpen(119); } } public bool IsAdvance { get { return false; } } public bool priorityOpen { get { return redpoint.state == RedPointState.Simple || redpoint.state == RedPointState.GetReward; } } public event Action<int> onStateUpate; public event Action onSelectUpdate; public event Action onInvestUpdate; public readonly Redpoint redpoint = new Redpoint(209, 20922); VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } public override void Init() { OpenServerActivityCenter.Instance.Register((int)OpenServerActivityCenter.OSActivityType.MonthWeekInvest, this); FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; ParseConfig(); } public void OnBeforePlayerDataInitialize() { m_InvestInfos.Clear(); m_InvestSingleInfos.Clear(); } public void OnPlayerLoginOk() { foreach (var type in investTypes) { DayRemind.Instance.SetDayRemind("MonthWeekInvest_" + type); } UpdateRedpoint(); } public override void UnInit() { FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; } void ParseConfig() { var funcConfig = FuncConfigConfig.Get("InvestCost"); var json = LitJson.JsonMapper.ToObject(funcConfig.Numerical3); foreach (var typeKey in json.Keys) { var type = int.Parse(typeKey); m_InvestRechargeIds[type] = new List<int>(LitJson.JsonMapper.ToObject<int[]>(json[typeKey].ToJson())); m_Redpoints.Add(type, new Redpoint(redpoint.id, redpoint.id * 100 + type)); } investTypes = m_InvestRechargeIds.Keys.ToList(); var configs = InvestConfig.GetValues(); foreach (var config in configs) { if (!investTypes.Contains(config.type)) { continue; } Dictionary<int, List<Item>> dict; if (!m_InvestItems.TryGetValue(config.type, out dict)) { dict = new Dictionary<int, List<Item>>(); m_InvestItems.Add(config.type, dict); } List<Item> items; if (!dict.TryGetValue(config.id, out items)) { items = new List<Item>(); dict.Add(config.id, items); } var itemJson = LitJson.JsonMapper.ToObject(config.award); var itemArray = LitJson.JsonMapper.ToObject<int[][]>(itemJson["1"].ToJson()); for (int i = 0; i < itemArray.Length; i++) { items.Add(new Item() { id = itemArray[i][0], count = itemArray[i][1], }); } } } public int GetOrderInfoId(int type) { var ids = m_InvestRechargeIds[type]; for (int i = 0; i < ids.Count; i++) { OrderInfoConfig config; if (vipModel.TryGetOrderInfo(ids[i], out config)) { return config.id; } } return 0; } public int GetSelectType() { if (jumpType != 0 && investTypes.Contains(jumpType)) { var type = jumpType; jumpType = 0; return type; } else { foreach (var type in m_Redpoints.Keys) { if (m_Redpoints[type].state == RedPointState.GetReward) { return type; } } } return investTypes[0]; } public int GetInvestPassDays(int type) { return m_InvestInfos.ContainsKey(type) ? m_InvestInfos[type].days : 0; } public int GetTotalIncome(int type) { var income = 0; if (m_InvestItems.ContainsKey(type)) { foreach (var items in m_InvestItems[type].Values) { income += items[0].count; } } return income; } public int GetFirstIncome(int type) { if (m_InvestItems.ContainsKey(type)) { return m_InvestItems[type].Values.First()[0].count; } return 0; } public int GetDailyIncome(int type) { var income = 0; if (m_InvestItems.ContainsKey(type)) { var index = 0; foreach (var items in m_InvestItems[type].Values) { if (index == 1) { income = items[0].count; break; } index++; } } return income; } public int GetSingleInvestState(int type, int id)//0-未投资 1-未达成 2-可领取 3-已领取 4-已过期 { if (IsInvested(type)) { var day = GetInvestPassDays(type); if (m_InvestItems.ContainsKey(type) && m_InvestItems[type].ContainsKey(id)) { if (IsRewardGot(type, id)) { return 3; } var config = InvestConfig.Get(id); return day < config.needDay ? 1 : day == config.needDay ? 2 : 4; } } return 0; } public float GetIncomeRate(int type, int day) { var orderInfoId = GetOrderInfoId(type); var orderInfoConfig = OrderInfoConfig.Get(orderInfoId); var money = (int)orderInfoConfig.PayRMBNum * 10; var income = 0; if (m_InvestItems.ContainsKey(type)) { foreach (var id in m_InvestItems[type].Keys) { var config = InvestConfig.Get(id); if (day >= config.needDay) { income += m_InvestItems[type][id][0].count; } } } return (float)Math.Round((float)income / money, 2); } public bool TryGetItems(int type, int id, out List<Item> items) { items = null; if (m_InvestItems.ContainsKey(type)) { return m_InvestItems[type].TryGetValue(id, out items); } return false; } public bool TryGetInvestItems(int type, out Dictionary<int, List<Item>> dict) { return m_InvestItems.TryGetValue(type, out dict); } public bool IsInvested(int type) { return m_InvestInfos.ContainsKey(type) && m_InvestInfos[type].money > 0; } public bool IsRewardGot(int type, int id) { if (m_InvestSingleInfos.ContainsKey(type)) { var index = id % 100; return m_InvestSingleInfos[type].ContainsKey(index) && m_InvestSingleInfos[type][index] > 0; } return false; } private void OnFuncStateChangeEvent(int id) { if (id == 119) { if (onStateUpate != null) { onStateUpate((int)OpenServerActivityCenter.OSActivityType.MonthWeekInvest); } UpdateRedpoint(); } } public void SendGetReward(int type, int id) { var pak = new CA541_tagCMGetInvestReward(); pak.InvestType = (byte)type; pak.RewardIndex = (byte)(id % 100); GameNetSystem.Instance.SendInfo(pak); } public void SendInvest(int type) { var orderInfoId = GetOrderInfoId(type); var config = OrderInfoConfig.Get(orderInfoId); vipModel.CTG(config); } public void SetDayRemind(int type) { DayRemind.Instance.SetDayRemind("MonthWeekInvest_" + type, true); UpdateRedpoint(); } public void OnReceivePackage(HA337_tagMCGoldInvestInfo package) { if (!investTypes.Contains(package.InvestType)) { return; } m_InvestInfos[package.InvestType] = new InvestInfo() { days = (int)package.CurDay, money = (int)package.InvestGold, }; Dictionary<int, int> singleInfos; if (!m_InvestSingleInfos.TryGetValue(package.InvestType, out singleInfos)) { singleInfos = new Dictionary<int, int>(); m_InvestSingleInfos.Add(package.InvestType, singleInfos); } for (int i = 0; i < package.RewardRecordCnt; i++) { var data = package.InvestRewardList[i]; singleInfos[data.RewardIndex] = data.RewardValue; } UpdateRedpoint(); if (onInvestUpdate != null) { onInvestUpdate(); } } void UpdateRedpoint() { List<int> redpointTypes = new List<int>(); List<int> dayReminds = new List<int>(); if (IsOpen) { foreach (var type in investTypes) { if (!IsInvested(type)) { if (!DayRemind.Instance.GetDayRemind("MonthWeekInvest_" + type)) { dayReminds.Add(type); } continue; } foreach (var id in m_InvestItems[type].Keys) { if (GetSingleInvestState(type, id) == 2) { redpointTypes.Add(type); break; } } } } foreach (var type in m_Redpoints.Keys) { m_Redpoints[type].state = redpointTypes.Contains(type) ? RedPointState.GetReward : dayReminds.Contains(type) ? RedPointState.Simple : RedPointState.None; } } public struct InvestInfo { public int money; public int days; } } } System/Vip/VipInvest/MonthWeekInvestModel.cs.metacopy from Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs.meta copy to System/Vip/VipInvest/MonthWeekInvestModel.cs.meta
File was copied from Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 129cd7237fa54844cb8038793a512d2a timeCreated: 1557818429 guid: 54d9b5b379fac394ab95bb496e7cd93d timeCreated: 1560243624 licenseType: Pro MonoImporter: serializedVersion: 2 System/Vip/VipInvest/MonthWeekInvestWin.cs
New file @@ -0,0 +1,184 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, June 11, 2019 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class MonthWeekInvestWin : Window { [SerializeField] InvestCategory[] m_InvestCategories; [SerializeField] Text m_TotalIncome; [SerializeField] Text m_FirstIncome; [SerializeField] Text m_DailyIncome; [SerializeField] Transform m_UnInvestSymbol; [SerializeField] Button m_Invest; [SerializeField] Text m_InvestLabel; [SerializeField] Text m_Price; [SerializeField] Text m_Diamond; [SerializeField] Transform m_CompleteSymbol; [SerializeField] ScrollerController m_ScrollControl; MonthWeekInvestModel model { get { return ModelCenter.Instance.GetModel<MonthWeekInvestModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_ScrollControl.OnRefreshCell += OnRefreshCell; m_Invest.AddListener(OnInvest); } protected override void OnPreOpen() { model.onSelectUpdate += OnSelectUpdate; model.onInvestUpdate += OnInvestUpdate; PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent; } protected override void OnActived() { base.OnActived(); Display(); model.SetDayRemind(model.selectType); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.onSelectUpdate -= OnSelectUpdate; model.onInvestUpdate -= OnInvestUpdate; PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent; } protected override void OnAfterClose() { } #endregion void Display() { DisplayBase(); DisplayInvests(); DisplayInvestState(); DisplayDiamond(); } void DisplayBase() { for (int i = 0; i < m_InvestCategories.Length; i++) { m_InvestCategories[i].transform.gameObject.SetActive(m_InvestCategories[i].type == model.selectType); } m_TotalIncome.text = model.GetTotalIncome(model.selectType).ToString(); m_FirstIncome.text = model.GetFirstIncome(model.selectType).ToString(); m_DailyIncome.text = model.GetDailyIncome(model.selectType).ToString(); var orderInfoId = model.GetOrderInfoId(model.selectType); var config = OrderInfoConfig.Get(orderInfoId); m_Price.text = Language.Get("MonthWeekPrice", config.PayRMBNum); m_InvestLabel.text = Language.Get("MonthWeekInvestFunc_" + model.selectType); } void DisplayInvests() { var jumpIndex = -1; m_ScrollControl.Refresh(); Dictionary<int, List<Item>> dict; if (model.TryGetInvestItems(model.selectType, out dict)) { var index = 0; foreach (var id in dict.Keys) { m_ScrollControl.AddCell(ScrollerDataType.Header, id); var state = model.GetSingleInvestState(model.selectType, id); if (state == 2) { jumpIndex = index; } if (jumpIndex == -1 && state == 1) { jumpIndex = index; } index++; } } m_ScrollControl.Restart(); if (jumpIndex != -1) { m_ScrollControl.JumpIndex(jumpIndex); } } void DisplayInvestState() { m_CompleteSymbol.gameObject.SetActive(model.IsInvested(model.selectType)); m_UnInvestSymbol.gameObject.SetActive(!model.IsInvested(model.selectType)); } void DisplayDiamond() { m_Diamond.text = PlayerDatas.Instance.baseData.diamond.ToString(); } private void OnInvest() { model.SendInvest(model.selectType); } private void OnSelectUpdate() { Display(); model.SetDayRemind(model.selectType); } private void OnInvestUpdate() { m_ScrollControl.m_Scorller.RefreshActiveCellViews(); DisplayInvestState(); } private void OnRefreshCell(ScrollerDataType type, CellView cell) { var investCell = cell as MonthWeekInvestCell; investCell.Display(cell.index); } private void PlayerDataRefreshEvent(PlayerDataType dataType) { if (dataType == PlayerDataType.Gold) { DisplayDiamond(); } } [Serializable] public class InvestCategory { public int type; public Transform transform; } } } System/Vip/VipInvest/MonthWeekInvestWin.cs.metacopy from Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs.meta copy to System/Vip/VipInvest/MonthWeekInvestWin.cs.meta
File was copied from Lua/Gen/SnxxzUIMonthlyInvestmentModelWrap.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 129cd7237fa54844cb8038793a512d2a timeCreated: 1557818429 guid: dbd1e2d5f83549348b0e630065fccf59 timeCreated: 1560245547 licenseType: Pro MonoImporter: serializedVersion: 2 System/Vip/VipInvest/VipInvestModel.cs
@@ -8,12 +8,12 @@ [XLua.LuaCallCSharp] public class VipInvestModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity { private Dictionary<string, Dictionary<string, List<InvestReward>>> vipInvestDict = new Dictionary<string, Dictionary<string, List<InvestReward>>>(); private Dictionary<int, List<InvestConfig>> investCycleDict = new Dictionary<int, List<InvestConfig>>(); //每周期数据 private Dictionary<string, int[]> vipInvestLvlimitDict = new Dictionary<string, int[]>(); private Dictionary<int, int[]> investGoldDict = new Dictionary<int, int[]>(); private Dictionary<int, int> investMaxDayDict = new Dictionary<int, int>(); private Dictionary<int, int> vipLevelLimitDict = new Dictionary<int, int>(); Dictionary<string, Dictionary<string, List<InvestReward>>> vipInvestDict = new Dictionary<string, Dictionary<string, List<InvestReward>>>(); Dictionary<int, List<InvestConfig>> investCycleDict = new Dictionary<int, List<InvestConfig>>(); //每周期数据 Dictionary<string, int[]> vipInvestLvlimitDict = new Dictionary<string, int[]>(); Dictionary<int, int[]> m_InvestAmounts = new Dictionary<int, int[]>(); Dictionary<int, int> investMaxDayDict = new Dictionary<int, int>(); Dictionary<int, int> vipLevelLimitDict = new Dictionary<int, int>(); public bool IsOpen { @@ -58,7 +58,6 @@ vipInvestDict.Clear(); investCycleDict.Clear(); vipInvestLvlimitDict.Clear(); investGoldDict.Clear(); investMaxDayDict.Clear(); OpenServerActivityCenter.Instance.Register(11, this); var InvestRedPoint = FuncConfigConfig.Get("InvestRedPoint"); @@ -78,20 +77,23 @@ } } } FuncConfigConfig InvestGold = FuncConfigConfig.Get("InvestCost"); var json = JsonMapper.ToObject(InvestGold.Numerical1); var funcConfig = FuncConfigConfig.Get("InvestCost"); var json = JsonMapper.ToObject(funcConfig.Numerical1); foreach (var typeKey in json.Keys) { var type = int.Parse(typeKey); var golds = LitJson.JsonMapper.ToObject<int[]>(json[typeKey].ToJson()); investGoldDict.Add(type, golds); var amounts = LitJson.JsonMapper.ToObject<int[]>(json[typeKey].ToJson()); m_InvestAmounts.Add(type, amounts); } json = LitJson.JsonMapper.ToObject(InvestGold.Numerical2); json = LitJson.JsonMapper.ToObject(funcConfig.Numerical2); vipLevelLimitDict = new Dictionary<int, int>(); foreach (var typeKey in json.Keys) { vipLevelLimitDict.Add(int.Parse(typeKey), int.Parse(json[typeKey].ToString())); } FuncConfigConfig maxDay = FuncConfigConfig.Get("InvestMaxDay"); JsonData maxDayData = JsonMapper.ToObject(maxDay.Numerical1); foreach (var type in maxDayData.Keys) @@ -205,20 +207,46 @@ return list; } public int GetInvestGoldGears(int type) public int GetInvestMaxGear(int type) { if (investGoldDict.ContainsKey(type)) if (m_InvestAmounts.ContainsKey(type)) { return investGoldDict[type].Length; return m_InvestAmounts[type].Length; } return 0; } public int GetInvestGold(int type, int index) public int GetInvestAmount(int type, int index) { if (investGoldDict.ContainsKey(type)) if (m_InvestAmounts.ContainsKey(type)) { return investGoldDict[type][index]; return m_InvestAmounts[type][index]; } return 0; } public int GetMaxInvestAmount(int type) { if (m_InvestAmounts.ContainsKey(type)) { var amounts = m_InvestAmounts[type]; return amounts[amounts.Length - 1]; } return 0; } public int GetInvestGear(int type, int money) { if (m_InvestAmounts.ContainsKey(type)) { var amounts = m_InvestAmounts[type]; for (int i = 0; i < amounts.Length; i++) { if (amounts[i] == money) { return i + 1; } } } return 0; } @@ -353,7 +381,7 @@ public void SendInvestQuest(int type, int index) { int gold = GetInvestGold(type, index); int gold = GetInvestAmount(type, index); DebugEx.Log("SendInvestQuest:" + gold); CA540_tagCMGoldInvest investGold = new CA540_tagCMGoldInvest(); investGold.InvestType = (byte)type; System/WindowBase/ModelCenter.cs
@@ -152,7 +152,6 @@ RegisterModel<LevelGiftModel>(); RegisterModel<CapacityDelayModel>(); RegisterModel<TreasureEffectModel>(); RegisterModel<MonthlyInvestmentModel>(); RegisterModel<VipInvestModel>(); RegisterModel<ChatCenter>(); RegisterModel<HappyXBModel>(); @@ -233,6 +232,7 @@ RegisterModel<AlchemyModel>(); RegisterModel<OtherPlayerEquipModel>(); RegisterModel<TaskFeedbackModel>(); RegisterModel<MonthWeekInvestModel>(); inited = true; }