Main/Component/UI/Effect/EffectPlayer.cs
@@ -80,7 +80,7 @@ if (isPlayOnEnable) { PlayAsync(false).Forget(); Play(false); } else if (spineComp != null) { @@ -256,7 +256,7 @@ spineComp.raycastTarget = false; spineComp.Initialize(true); spineComp.timeScale = 1f; spineComp.timeScale = speedRate; // 检查动画是否有相加模式 // bool hasAdditiveBlend = CheckForAdditiveBlend(spineComp.Skeleton); // if (hasAdditiveBlend) Main/Config/ConfigManager.cs
@@ -46,6 +46,7 @@ typeof(FightPowerRatioConfig), typeof(HeroLineupHaloConfig), typeof(HeroQualityLVConfig), typeof(InvestConfig), typeof(ItemConfig), typeof(MainChapterConfig), typeof(MainLevelConfig), @@ -228,6 +229,8 @@ ClearConfigDictionary<HeroLineupHaloConfig>(); // 清空 HeroQualityLVConfig 字典 ClearConfigDictionary<HeroQualityLVConfig>(); // 清空 InvestConfig 字典 ClearConfigDictionary<InvestConfig>(); // 清空 ItemConfig 字典 ClearConfigDictionary<ItemConfig>(); // 清空 MainChapterConfig 字典 Main/Config/Configs/InvestConfig.cs
New file @@ -0,0 +1,56 @@ //-------------------------------------------------------- // [Author]: YYL // [ Date ]: 2025年8月22日 //-------------------------------------------------------- using System.Collections.Generic; using System; using UnityEngine; using LitJson; public partial class InvestConfig : ConfigBase<int, InvestConfig> { static InvestConfig() { // 访问过静态构造函数 visit = true; } public int id; public int type; public int needDay; public int needLV; public int needNPCID; public Dictionary<int, int[][]> award; public string info; public override int LoadKey(string _key) { int key = GetKey(_key); return key; } public override void LoadConfig(string input) { try { string[] tables = input.Split('\t'); int.TryParse(tables[0],out id); int.TryParse(tables[1],out type); int.TryParse(tables[2],out needDay); int.TryParse(tables[3],out needLV); int.TryParse(tables[4],out needNPCID); award = ConfigParse.ParseIntArray2Dict(tables[5]); info = tables[6]; } catch (Exception exception) { Debug.LogError(exception); } } } Main/Config/Configs/InvestConfig.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: ff3d77591e2aeaa438955b2b6322cfba MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Core/NetworkPackage/ClientPack/CA1_Sys/CA125_tagCMCoinBuyOrderInfo.cs
New file @@ -0,0 +1,24 @@ using UnityEngine; using System.Collections; // A1 25 代币购买充值商品编号商品 #tagCMCoinBuyOrderInfo public class CA125_tagCMCoinBuyOrderInfo : GameNetPackBasic { public byte AppIDLen; public string AppID; public byte OrderInfoLen; public string OrderInfo; //商品编号 public CA125_tagCMCoinBuyOrderInfo () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA125; } public override void WriteToBytes () { WriteBytes (AppIDLen, NetDataType.BYTE); WriteBytes (AppID, NetDataType.Chars, AppIDLen); WriteBytes (OrderInfoLen, NetDataType.BYTE); WriteBytes (OrderInfo, NetDataType.Chars, OrderInfoLen); } } Main/Core/NetworkPackage/ClientPack/CA1_Sys/CA125_tagCMCoinBuyOrderInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 05e91755d9d173640b5df5e6449852a4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Core/NetworkPackage/ClientPack/CA5_Function/CA541_tagCMGetInvestReward.cs
New file @@ -0,0 +1,20 @@ using UnityEngine; using System.Collections; // A5 41 领取投资理财回报 #tagCMGetInvestReward public class CA541_tagCMGetInvestReward : GameNetPackBasic { public byte InvestType; // 投资类型 public byte RewardIndex; // 回报索引 public CA541_tagCMGetInvestReward () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA541; } public override void WriteToBytes () { WriteBytes (InvestType, NetDataType.BYTE); WriteBytes (RewardIndex, NetDataType.BYTE); } } Main/Core/NetworkPackage/ClientPack/CA5_Function/CA541_tagCMGetInvestReward.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 1752ebc635762534790398ccd1c3c413 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Core/NetworkPackage/ClientPack/CA5_Function/CA568_tagCMRequestTreasure.cs
@@ -1,12 +1,12 @@ using UnityEngine; using System.Collections; using UnityEngine; using System.Collections; // A5 68 请求寻宝 #tagCMRequestTreasure public class CA568_tagCMRequestTreasure : GameNetPackBasic { public byte TreasureType; //寻宝类型 public byte TreasureIndex; //寻宝索引 public byte CostType; //消耗类型:0-默认仙玉;1-免费次数;2-寻宝道具 public byte CostType; //消耗类型:0-货币;1-免费次数;2-寻宝道具 public CA568_tagCMRequestTreasure () { combineCmd = (ushort)0x03FE; Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA338_tagMCInvestInfo.cs
New file @@ -0,0 +1,13 @@ using UnityEngine; using System.Collections; // A3 38 投资理财信息 #tagMCInvestInfo public class DTCA338_tagMCInvestInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA338_tagMCInvestInfo vNetData = vNetPack as HA338_tagMCInvestInfo; InvestModel.Instance.UpdateInvestInfo(vNetData); } } Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA338_tagMCInvestInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 642095ebf906d974e8bfb5c7d45d7fc8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Core/NetworkPackage/DataToCtl/PackageRegedit.cs
@@ -109,6 +109,7 @@ Register(typeof(HB125_tagSCPlayerHeroInfo), typeof(DTCB125_tagSCPlayerHeroInfo)); Register(typeof(HA814_tagMCMakeItemAnswer), typeof(DTCA814_tagMCMakeItemAnswer)); Register(typeof(HB122_tagSCHeroInfo), typeof(DTCB122_tagSCHeroInfo)); Register(typeof(HA338_tagMCInvestInfo), typeof(DTCA338_tagMCInvestInfo)); } //主工程注册封包 Main/Core/NetworkPackage/ServerPack/HA3_Function/HA338_tagMCInvestInfo.cs
New file @@ -0,0 +1,25 @@ using UnityEngine; using System.Collections; // A3 38 投资理财信息 #tagMCInvestInfo public class HA338_tagMCInvestInfo : GameNetPackBasic { public byte InvestType; // 投资类型 public ushort CurDay; // 当前天数,投资第一天为1 public byte ValueCount; public uint[] RewardValue; //领奖记录值,按投资回报索引位记录是否已领取 public uint[] ProgressValue; //投资相关可领取进度记录值: 9登录投资-记录已登录天数;11Boss投资-按回报索引位记录是否已击杀该boss public HA338_tagMCInvestInfo () { _cmd = (ushort)0xA338; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out InvestType, vBytes, NetDataType.BYTE); TransBytes (out CurDay, vBytes, NetDataType.WORD); TransBytes (out ValueCount, vBytes, NetDataType.BYTE); TransBytes (out RewardValue, vBytes, NetDataType.DWORD, ValueCount); TransBytes (out ProgressValue, vBytes, NetDataType.DWORD, ValueCount); } } Main/Core/NetworkPackage/ServerPack/HA3_Function/HA338_tagMCInvestInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 9e48c8be42d2313489b38b738ddf52c6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Main.cs
@@ -72,6 +72,7 @@ managers.Add(RankModel.Instance); managers.Add(PlayerMainDate.Instance); managers.Add(HeroUIManager.Instance); managers.Add(InvestModel.Instance); foreach (var manager in managers) { Main/SDK/SDKUtils.cs
@@ -374,7 +374,7 @@ var _result = "default"; switch (Application.platform) { case RuntimePlatform.Android: case RuntimePlatform.Android: _result = "android"; break; case RuntimePlatform.IPhonePlayer: @@ -955,53 +955,53 @@ public void FreePlatformPay(string title, float money, string cpInfo) { // 提示是否使用代金券 // var gameCash = UIHelper.GetAllVourcher(); var gameCash = UIHelper.GetAllVourcher(); // bool isBuyGameCash = false; //代金券本身的充值不能用代金券购买 造成循环 // int ctgID = ModelCenter.Instance.GetModel<VipModel>().orderInfoToCTGID[cpInfo]; // if (ctgID != 0) // { // isBuyGameCash = CTGConfig.Get(ctgID).PayType == 17; // } bool isBuyGameCash = false; //代金券本身的充值不能用代金券购买 造成循环 int ctgID = RechargeManager.Instance.orderInfoToCTGID[cpInfo]; if (ctgID != 0) { isBuyGameCash = CTGConfig.Get(ctgID).PayType == 17; } // if (!isBuyGameCash && gameCash >= money * 100 && !LoginAwardModel.rechargeLimit.Contains(ctgID)) // { if (!isBuyGameCash && gameCash >= money * 100) { // WindowCenter.Instance.Close<GotoChargeWin>(); // if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip)) // { // var pack = new CA125_tagCMCoinBuyOrderInfo(); // pack.AppID = VersionConfig.Get().appId; // pack.AppIDLen = (byte)pack.AppID.Length; // pack.OrderInfo = cpInfo; // pack.OrderInfoLen = (byte)pack.OrderInfo.Length; // GameNetSystem.Instance.SendInfo(pack); // } // else // { // ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("GameCashRule1", money), Language.Get("TodayNoNotify"), (bool isOk, bool isToggle) => // { // if (isOk) // { // var pack = new CA125_tagCMCoinBuyOrderInfo(); // pack.AppID = VersionConfig.Get().appId; // pack.AppIDLen = (byte)pack.AppID.Length; // pack.OrderInfo = cpInfo; // pack.OrderInfoLen = (byte)pack.OrderInfo.Length; // GameNetSystem.Instance.SendInfo(pack); // } // if (isToggle) // { // DayRemind.Instance.SetDayRemind(DayRemind.DJQTip, true); // } // }); // } // } // else // { // FreePlatformPayEx(title, money, cpInfo); // } UIManager.Instance.CloseWindow<GotoChargeWin>(); if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip)) { var pack = new CA125_tagCMCoinBuyOrderInfo(); pack.AppID = VersionConfig.Get().appId; pack.AppIDLen = (byte)pack.AppID.Length; pack.OrderInfo = cpInfo; pack.OrderInfoLen = (byte)pack.OrderInfo.Length; GameNetSystem.Instance.SendInfo(pack); } else { ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("GameCashRule1", money), Language.Get("TodayNoNotify"), (bool isOk, bool isToggle) => { if (isOk) { var pack = new CA125_tagCMCoinBuyOrderInfo(); pack.AppID = VersionConfig.Get().appId; pack.AppIDLen = (byte)pack.AppID.Length; pack.OrderInfo = cpInfo; pack.OrderInfoLen = (byte)pack.OrderInfo.Length; GameNetSystem.Instance.SendInfo(pack); } if (isToggle) { DayRemind.Instance.SetDayRemind(DayRemind.DJQTip, true); } }); } } else { FreePlatformPayEx(title, money, cpInfo); } } public void FreePlatformPayEx(string title, float money, string cpInfo) Main/System/HappyXB/HappyXBModel.cs
@@ -234,7 +234,7 @@ /// </summary> /// <param name="type">寻宝类型</param> /// <param name="index">0 单次寻宝 1 多次寻宝</param> /// <param name="costType">0-默认仙玉;1-免费次数;2-寻宝道具</param> /// <param name="costType">0-货币;1-免费次数;2-寻宝道具</param> public event Action<int> StartXBEvent; public void SendXBQuest(int type, int index, int costType) { @@ -310,16 +310,31 @@ if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbOneMoney) { StoreModel.Instance.UseMoneyCheck(xbOneMoney, moneyType, () => //暂定充值货币需要二次确认 if (moneyType == 1) { StoreModel.Instance.UseMoneyCheck(xbOneMoney, moneyType, () => { SendXBQuest(xbType, 0, 0); }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, xbOneMoney, UIHelper.GetIconNameWithMoneyType(moneyType), funcSet.CostItemCountList[0])); } else { SendXBQuest(xbType, 0, 0); }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, xbOneMoney, UIHelper.GetIconNameWithMoneyType(moneyType), funcSet.CostItemCountList[0])); } } else { SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true); if (!GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) { SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); } else { ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true); } } } } @@ -350,17 +365,31 @@ int moneyType = funcSet.CostMoneyType; if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)needMoney) { StoreModel.Instance.UseMoneyCheck(needMoney, moneyType, () => //暂定充值货币需要二次确认 if (moneyType == 1) { //只要有道具就是道具寻宝,不足部分服务端扣货币 StoreModel.Instance.UseMoneyCheck(needMoney, moneyType, () => { //只要有道具就是道具寻宝,不足部分服务端扣货币 SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0); }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, needMoney, UIHelper.GetIconNameWithMoneyType(moneyType), needToolCnt - toolCnt)); } else { SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0); }, (int)BuyStoreItemCheckType.HeroCall, fullTip: Language.Get("CostMoneyForItem", funcSet.CostItemID, needMoney, UIHelper.GetIconNameWithMoneyType(moneyType), needToolCnt - toolCnt)); } } else { SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true); if (!GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) { SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); } else { ItemTipUtility.Show(GeneralDefine.MoneyDisplayModel[moneyType], true); } } } Main/System/HappyXB/HeroCallResultWin.cs
@@ -70,19 +70,13 @@ HappyXBModel.Instance.RefreshXBTypeInfoAct += RefreshBtn; InitMoney(); UpdateState(); Display(); RefreshBtn(); } protected override void OnPreClose() { HappyXBModel.Instance.RefreshXBResultAct -= UpdateState; HappyXBModel.Instance.RefreshXBTypeInfoAct -= RefreshBtn; } void Display() { // RefreshState(); RefreshBtn(); } void UpdateState() @@ -131,13 +125,13 @@ if (resultState == 0) { btnsObj.SetActive(true); call1Btn.SetActive(true); call1Btn.SetActive(HeroUIManager.Instance.selectCallType != HappXBTitle.HeroCallScore ? true : false); call10Btn.SetActive(false); result1Obj.SetActive(true); result10Obj.SetActive(false); result10LihuiObj.SetActive(false); moneyObj.SetActive(true); ShowMoney(true); heroInfoObj.SetActive(true); result1Cell.Display(HappyXBModel.Instance.xbResultDict[0].itemId, 0); @@ -152,7 +146,7 @@ result1Obj.SetActive(false); result10Obj.SetActive(true); result10LihuiObj.SetActive(false); moneyObj.SetActive(true); ShowMoney(true); heroInfoObj.SetActive(false); if (isSkip) Refresh10Result(); @@ -164,7 +158,7 @@ result1Obj.SetActive(false); result10Obj.SetActive(true); result10LihuiObj.SetActive(false); moneyObj.SetActive(false); ShowMoney(false); heroInfoObj.SetActive(false); Refresh10Result(); } @@ -175,7 +169,7 @@ result1Obj.SetActive(false); result10Obj.SetActive(false); result10LihuiObj.SetActive(true); moneyObj.SetActive(false); ShowMoney(false); heroInfoObj.SetActive(true); RefreshLihui(); } @@ -184,6 +178,20 @@ public void RefreshBtn() { var funcSet = TreasureSetConfig.Get((int)HeroUIManager.Instance.selectCallType); if (funcSet.CostItemID == 0) { call1ItemIcon.SetActive(false); call1Text.SetActive(false); call10ItemIcon.SetActive(false); call10Text.SetActive(false); return; } call1ItemIcon.SetActive(true); call1Text.SetActive(true); call10ItemIcon.SetActive(true); call10Text.SetActive(true); var item = ItemConfig.Get(funcSet.CostItemID); var IconKey = item.IconKey; call1ItemIcon.SetOrgSprite(IconKey); @@ -203,6 +211,16 @@ call10Text.text = Language.Get("L1100", item.ItemName, funcSet.CostItemCountList[1]); } void ShowMoney(bool show) { if (HeroUIManager.Instance.selectCallType == HappXBTitle.HeroCallScore) { moneyObj.SetActive(false); return; } moneyObj.SetActive(show); } void Refresh10Result() { for (int i = 0; i < result10Cells.Length; i++) Main/System/HappyXB/HeroCallScoreWin.cs
New file @@ -0,0 +1,91 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; /// <summary> /// 积分招募 /// </summary> public class HeroCallScoreWin : UIBase { [SerializeField] Button ruleBtn; [SerializeField] Image sliderImg; [SerializeField] Text scoreProcessText; [SerializeField] Text tryLockText; [SerializeField] Button call1Btn; protected override void InitComponent() { call1Btn.AddListener(SendHeroCall); } protected override void OnPreOpen() { HappyXBModel.Instance.RefreshXBTypeInfoAct += Refresh; Refresh(); } protected override void OnPreClose() { HappyXBModel.Instance.RefreshXBTypeInfoAct -= Refresh; } public override void Refresh() { var funcSet = TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore); scoreProcessText.text = UIHelper.GetMoneyCnt(51) + "/" + TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0]; sliderImg.fillAmount = (float)UIHelper.GetMoneyCnt(51) / TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0]; if (UIHelper.GetMoneyCnt(51) >= (ulong)TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0]) { scoreProcessText.color = UIHelper.GetUIColor(TextColType.LightWhite); } else { scoreProcessText.color = UIHelper.GetUIColor(TextColType.Red); } if (InvestModel.Instance.IsInvested(InvestModel.monthCardType)) { tryLockText.SetActive(false); call1Btn.SetActive(true); } else { tryLockText.SetActive(true); if (HappyXBModel.Instance.GetXBInfoByType((int)HappXBTitle.HeroCallScore).treasureCount == 0) { tryLockText.text = Language.Get("heroCall4", 1); call1Btn.SetActive(true); } else { tryLockText.text = Language.Get("heroCall4", 0); call1Btn.SetActive(false); } } } void SendHeroCall() { if (!InvestModel.Instance.IsInvested(InvestModel.monthCardType)) { //未买月卡体验1次 if (HappyXBModel.Instance.GetXBInfoByType((int)HappXBTitle.HeroCallScore).treasureCount != 0) { return; } } HeroUIManager.Instance.selectCallType = HappXBTitle.HeroCallScore; HeroUIManager.Instance.selectCallIndex = 0; HappyXBModel.Instance.SendOneXBQuest((int)HappXBTitle.HeroCallScore); } } Main/System/HappyXB/HeroCallScoreWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 4a39b88777149fb498604231bb29f255 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/HappyXB/HeroCallWin.cs
@@ -33,11 +33,15 @@ }); ownItemCell.itemID = TreasureSetConfig.Get((int)HappXBTitle.HeroCallAdvanced).CostItemID; call1Btn.AddListener(SendHeroCall); call10Btn.AddListener(()=> call10Btn.AddListener(() => { HeroUIManager.Instance.selectCallType = HappXBTitle.HeroCallAdvanced; HeroUIManager.Instance.selectCallIndex = 1; HappyXBModel.Instance.SendXBManyQuest((int)HappXBTitle.HeroCallAdvanced); }); scoreBtn.AddListener(() => { UIManager.Instance.OpenWindow<HeroCallScoreWin>(); }); } @@ -72,6 +76,17 @@ } call10Text.text = Language.Get("L1100", item.ItemName, funcSet.CostItemCountList[1]); scoreText.text = UIHelper.GetMoneyCnt(51) + "/" + TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0]; if (UIHelper.GetMoneyCnt(51) >= (ulong)TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0]) { scoreTween.SetActive(true); } else { scoreTween.SetActive(false); } RefreshFreeTime(); } Main/System/Invest.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: 8b5c73a4ffdc4c64da1462264f99720f folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/System/Invest/InvestModel.cs
New file @@ -0,0 +1,377 @@ using System; using System.Collections.Generic; using UnityEngine.UI; using System.Linq; using LitJson; public class InvestModel : GameSystemManager<InvestModel> { public ILOpenServerActivityProxy activity; public const int FuncID = 119; //投资对应奖励 Dictionary<int, Dictionary<int, List<Item>>> m_InvestItems = new Dictionary<int, Dictionary<int, List<Item>>>(); //投资对应充值ID Dictionary<int, int[]> m_InvestRechargeIds = new Dictionary<int, int[]>(); //投资对应购买情况 Dictionary<int, InvestInfo> m_InvestInfos = new Dictionary<int, InvestInfo>(); //{投资类型:[领取天,当前天]} 天从1开始 Dictionary<int, List<List<int>>> m_InvestSingleInfos = new Dictionary<int, List<List<int>>>(); //投资对应的红点 Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>(); //投资类型 public List<int> investTypes = new List<int>(); //永久卡 权限 public const int foreverCardType = 12; //投资类型 public const int monthCardType = 7; // 月卡7 public event Action onSelectUpdate; public event Action onInvestUpdate; public const int redpointID = 20931; public Redpoint redpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, redpointID); public override void Init() { FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; //通过配置决定是否有此投资项,如港台没有登录投资 ParseConfig(); } public override void Release() { FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; } public bool IsOpen() { return FuncOpen.Instance.IsFuncOpen(FuncID); } public void OnBeforePlayerDataInitialize() { m_InvestInfos.Clear(); m_InvestSingleInfos.Clear(); } public void OnPlayerLoginOk() { UpdateRedpoint(); } void ParseConfig() { investTypes.Clear(); var funcConfig = FuncConfigConfig.Get("InvestCost"); m_InvestRechargeIds = ConfigParse.ParseIntArrayDict(funcConfig.Numerical3); //m_Redpoints investTypes = m_InvestRechargeIds.Keys.ToList(); investTypes.Sort(); var configs = InvestConfig.GetValues(); for (int i = 0; i < configs.Count; i++) { var config = configs[i]; 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 itemArray = config.award[1]; //1暂时约定月卡 永久卡,其他的自定义后续再定 for (int j = 0; j < itemArray.Length; j++) { items.Add(new Item() { id = itemArray[j][0], countEx = (ulong)itemArray[j][1], bind = itemArray[j][2], }); } } } public OrderInfoConfig GetOrderInfoId(int type) { var ids = m_InvestRechargeIds[type]; for (int i = 0; i < ids.Length; i++) { OrderInfoConfig config; if (RechargeManager.Instance.TryGetOrderInfo(ids[i], out config)) { return config; } } return null; } public bool hasInvestType(int type) { return investTypes.Contains(type); } public int GetInvestPassDays(int type) { return m_InvestInfos.ContainsKey(type) ? m_InvestInfos[type].days : 0; } //获得单投资的总收益 public ulong GetTotalIncome(int type) { ulong income = 0; if (m_InvestItems.ContainsKey(type)) { var keyList = m_InvestItems[type].Keys.ToList(); for (int i = 0; i < keyList.Count; i++) { var items = m_InvestItems[type][keyList[i]]; for (var j = 0; j < items.Count; j++) { var item = items[j]; if (item.id == 20 || item.id == 30) income += item.countEx; } } } return income; } //id 为表里的ID //0-未投资 1-未达成 2-可领取 3-已领取 public int GetSingleInvestState(int type, int id) { 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); if (!m_InvestSingleInfos.ContainsKey(type)) { return 0; } var index = id % 100; //每个数按位存31个激活索引 var listIndex = index / 31; var bitIndex = index % 31; return day < config.needDay ? 1 : 2; } } return 0; } 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 List<int> GetIdsByType(int type) { if (m_InvestItems.ContainsKey(type)) { return m_InvestItems[type].Keys.ToList(); } return null; } //判断是否购买了投资 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; //每个数按位存31个激活索引 var listIndex = index / 31; var bitIndex = index % 31; return ((int)Math.Pow(2, bitIndex) & m_InvestSingleInfos[type][1][listIndex]) != 0; } return false; } private void OnFuncStateChangeEvent(int id) { if (id == FuncID) { activity.StateUpdate(id); 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 BuyInvest(int type) { RechargeManager.Instance.CTG(GetOrderInfoId(type)); } public void UpdateInvestInfo(HA338_tagMCInvestInfo package) { if (!investTypes.Contains(package.InvestType)) { return; } m_InvestInfos[package.InvestType] = new InvestInfo() { days = (int)package.CurDay, money = package.CurDay >= 1 ? 1 : 0, }; List<List<int>> singleInfos; if (!m_InvestSingleInfos.TryGetValue(package.InvestType, out singleInfos)) { singleInfos = new List<List<int>>(); m_InvestSingleInfos.Add(package.InvestType, singleInfos); } singleInfos.Clear(); singleInfos.Add(new List<int>()); singleInfos.Add(new List<int>()); singleInfos.Add(new List<int>()); singleInfos[0].Add((int)package.CurDay); for (int i = 0; i < package.ValueCount; i++) { singleInfos[1].Add((int)package.RewardValue[i]); singleInfos[2].Add((int)package.ProgressValue[i]); } UpdateRedpoint(); if (onInvestUpdate != null) { onInvestUpdate(); } } void UpdateRedpoint() { List<int> redpointTypes = new List<int>(); if (IsOpen()) { for (var i = 0; i < investTypes.Count; i++) { var type = investTypes[i]; if (!IsInvested(type)) { continue; } var keyList = m_InvestItems[type].Keys.ToList(); for (int j = 0; j < keyList.Count; j++) { var id = keyList[j]; if (GetSingleInvestState(type, id) == 2) { redpointTypes.Add(type); break; } } } } var redList = m_Redpoints.Keys.ToList(); for (int j = 0; j < redList.Count; j++) { var type = redList[j]; m_Redpoints[type].state = redpointTypes.Contains(type) ? RedPointState.Simple : RedPointState.None; } } //已经购买并领取所有物品 public bool IsFinish() { for (int i = 0; i < investTypes.Count; i++) { int type = investTypes[i]; //忽略永久卡 if (type == foreverCardType) continue; var idsList = GetIdsByType(type); if (idsList.IsNullOrEmpty()) continue; for (int j = 0; j < idsList.Count; j++) { int id = idsList[j]; if (GetSingleInvestState(type, id) != 3) { return false; } } } return true; } public struct InvestInfo { public int money; public int days; } } Main/System/Invest/InvestModel.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 2b3e856e57feb8b48aff823cacee137c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/ItemTip/OwnItemCell.cs
@@ -12,7 +12,9 @@ void Start() { itemIcon.SetOrgSprite(ItemConfig.Get(itemID).IconKey); if (itemID != 0) itemIcon.SetOrgSprite(ItemConfig.Get(itemID).IconKey); wayBtn.AddListener(()=> { ItemTipUtility.Show(itemID, true); Main/System/ItemTip/OwnMoneyCell.cs
@@ -11,7 +11,9 @@ void Start() { moneyIcon.SetIconWithMoneyType(moneyType); if (moneyType != 0) moneyIcon.SetIconWithMoneyType(moneyType); if (wayBtn != null) { wayBtn.AddListener(()=> Main/System/Main/HomeWin.cs
@@ -29,6 +29,10 @@ [SerializeField] Button autoBtn; //其他功能入口 [SerializeField] Button monthCardBtn; /// <summary> /// 初始化组件 /// </summary> @@ -46,7 +50,7 @@ UIManager.Instance.OpenWindow<HeroPosWin>(); }); autoBtn.AddListener(()=> autoBtn.AddListener(() => { //测试拾取所有物品 var items = PackManager.Instance.GetItems(PackType.DropItem); @@ -64,9 +68,15 @@ } if (dropindexs.Count > 0) { EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0,5)].GetComponent<RectTransform>()); EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); dropindexs.Clear(); } }); monthCardBtn.AddListener(() => { InvestModel.Instance.BuyInvest(InvestModel.monthCardType); }); } @@ -77,6 +87,7 @@ { UpdatePlayerInfo(); UpdateTask(); RefreshRecharge(); } protected override void OnPreOpen() @@ -119,6 +130,11 @@ } void RefreshRecharge() { monthCardBtn.SetActive(!InvestModel.Instance.IsInvested(InvestModel.monthCardType)); } /// <summary> /// 更新玩家信息 /// </summary> Main/System/Recharge/GotoChargeWin.cs
New file @@ -0,0 +1,69 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, May 09, 2018 //-------------------------------------------------------- using System; using UnityEngine; using UnityEngine.UI; public class GotoChargeWin : UIBase { [SerializeField] Text m_CTGStageDisplay; public long startTime = DateTime.Now.Ticks; private void Update() { #if !UNITY_EDITOR if (SDKUtils.Instance.FreePlatformInfo == null || string.IsNullOrEmpty(SDKUtils.Instance.FreePlatformInfo.account)){ return; } if (DateTime.Now.Ticks - startTime > 50000000) { CloseWindow(); } #endif if (DateTime.Now.Ticks - startTime > 10000000) { CloseWindow(); } } protected override void OnPreOpen() { SDKUtils.Instance.onFreePlatformPayCancel += OnChargeComplete; SDKUtils.Instance.onFreePlatformPayFail += OnChargeComplete; SDKUtils.Instance.onFreePlatformPayOk += OnChargeComplete; m_CTGStageDisplay.text = Language.Get("GotoCharging"); RechargeManager.Instance.OnCTGStageChange += OnCTGStageChange; startTime = DateTime.Now.Ticks; } protected override void OnPreClose() { SDKUtils.Instance.onFreePlatformPayCancel -= OnChargeComplete; SDKUtils.Instance.onFreePlatformPayFail -= OnChargeComplete; SDKUtils.Instance.onFreePlatformPayOk -= OnChargeComplete; RechargeManager.Instance.OnCTGStageChange -= OnCTGStageChange; } private void OnCTGStageChange(string _display) { m_CTGStageDisplay.text = _display; } private void OnChargeComplete() { CloseWindow(); } } Main/System/Recharge/GotoChargeWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: de7b6ab55e42a8349b47e45201f894d9 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: