Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -25,11 +25,12 @@ public static void Init() { // 登记相应的数据体及对应的数据转逻辑类 Register(typeof(HAC11_tagGCFeastRedPacketInfo), typeof(DTCAC11_tagGCFeastRedPacketInfo)); Register(typeof(HAB25_tagMCFeastRedPackInfo), typeof(DTCAB25_tagMCFeastRedPackInfo)); Register(typeof(HA816_tagMCMysticalShopInfo), typeof(DTCA816_tagMCMysticalShopInfo)); Register(typeof(HAC11_tagGCFeastRedPacketInfo), typeof(DTCAC11_tagGCFeastRedPacketInfo)); Register(typeof(HAB25_tagMCFeastRedPackInfo), typeof(DTCAB25_tagMCFeastRedPackInfo)); Register(typeof(HB213_tagMCZhuXianTowerInfo), typeof(DTCB213_tagMCZhuXianTowerInfo)); Register(typeof(HB413_tagMCPlayerSkills), typeof(DTCB413_tagMCPlayerSkills)); Register(typeof(HB212_tagMCZhuXianBossCnt), typeof(DTCB212_tagMCZhuXianBossCnt)); Register(typeof(HB413_tagMCPlayerSkills), typeof(DTCB413_tagMCPlayerSkills)); Register(typeof(HB212_tagMCZhuXianBossCnt), typeof(DTCB212_tagMCZhuXianBossCnt)); Register(typeof(H0208_tagTalkCountry), typeof(DTC0208_tagTalkCountry)); Register(typeof(HB102_tagMCClothesCoatSkinState), typeof(DTCB102_tagMCClothesCoatSkinState)); Register(typeof(HA112_tagMCDBPlayer), typeof(DTCA112_tagMCDBPlayer)); Core/GameEngine/Login/LaunchPostProcess.cs
@@ -29,6 +29,7 @@ try { InGameDownLoad.Instance.ParseRewardConfig(); LegendPropertyUtility.Init(); ItemLogicUtility.Instance.Init(); ModelCenter.Instance.Init(); SkillHelper.Instance.Init(); Core/NetworkPackage/ClientPack/ClientToMapServer/CA2_Interaction/CA232_tagCMRefreshMysticalShop.cs
New file @@ -0,0 +1,19 @@ using UnityEngine; using System.Collections; // A2 32 神秘商店刷新 #tagCMRefreshMysticalShop public class CA232_tagCMRefreshMysticalShop : GameNetPackBasic { public CA232_tagCMRefreshMysticalShop() { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA232; } public override void WriteToBytes() { } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA2_Interaction/CA232_tagCMRefreshMysticalShop.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 18beaa3b153bbc145a3d8de5fff41866 timeCreated: 1551083019 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA816_tagMCMysticalShopInfo.cs
New file @@ -0,0 +1,11 @@ using UnityEngine; using System.Collections; // A8 16 神秘商店商品信息 #tagMCMysticalShopInfo public class DTCA816_tagMCMysticalShopInfo : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HA816_tagMCMysticalShopInfo vNetData = vNetPack as HA816_tagMCMysticalShopInfo; } } Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA816_tagMCMysticalShopInfo.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 6c8ba6cba809df34286ebed23fe074a4 timeCreated: 1551081427 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HA8_Item/HA816_tagMCMysticalShopInfo.cs
New file @@ -0,0 +1,29 @@ using UnityEngine; using System.Collections; // A8 16 神秘商店商品信息 #tagMCMysticalShopInfo public class HA816_tagMCMysticalShopInfo : GameNetPackBasic { public ushort RefreshCnt; // 刷新次数 public byte Count; // 商品数 public tagMCMysticalShopGoods[] GoodsList = null; // 商品信息 public HA816_tagMCMysticalShopInfo () { _cmd = (ushort)0xA816; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out RefreshCnt, vBytes, NetDataType.WORD); TransBytes (out Count, vBytes, NetDataType.BYTE); GoodsList = new tagMCMysticalShopGoods[Count]; for (int i = 0; i < Count; i ++) { GoodsList[i] = new tagMCMysticalShopGoods(); TransBytes (out GoodsList[i].GoodsID, vBytes, NetDataType.DWORD); } } public struct tagMCMysticalShopGoods { public uint GoodsID; // 商品ID } } Core/NetworkPackage/ServerPack/HA8_Item/HA816_tagMCMysticalShopInfo.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: ae2fc63d69f962e4980c3b46c7a6a5a3 timeCreated: 1551081427 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Lua/Gen/StoreModelWrap.cs
@@ -415,9 +415,6 @@ { int _type = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.List<StoreModel.StoreData> gen_ret = gen_to_be_invoked.TryGetStoreDatas( _type ); translator.Push(L, gen_ret); return 1; System/BlastFurnace/DanDrugRecycleTip.cs
@@ -116,7 +116,7 @@ private void CreateShopCell() { shopCtrl.Refresh(); shoplist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); shoplist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); if (shoplist.Count > 0) { int i = 0; System/CrossServerOneVsOne/CrossServerOneVsOneHonorStoreWin.cs
@@ -53,7 +53,7 @@ private void CreateShopCell() { shoplist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); shoplist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); if(shoplist == null) { DebugEx.Log("跨服商店数据为空"); System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
@@ -755,7 +755,7 @@ var pkSeason = CrossServerOneVsOnePKSeason.Instance; if (!pkSeason.IsEnterCrossServer()) return; List<StoreModel.StoreData> storeDatas = storeModel.TryGetStoreDatas((int)StoreFunc.CrossOneVsOneHonor); List<StoreModel.StoreData> storeDatas = storeModel.TryGetStoreDatas(StoreFunc.CrossOneVsOneHonor); if (storeDatas != null) { for (int i = 0; i < storeDatas.Count; i++) System/HappyXB/HappyXBModel.cs
@@ -10,7 +10,7 @@ namespace Snxxz.UI { [XLua.LuaCallCSharp] public class HappyXBModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk public class HappyXBModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk { private Dictionary<string, XBGetItemConfig> xbGetItemDict = new Dictionary<string, XBGetItemConfig>(); private Dictionary<int, List<XBGetItemConfig>> xbTypeItemDict = new Dictionary<int, List<XBGetItemConfig>>(); @@ -18,10 +18,9 @@ private Dictionary<int, XBFuncSet> xbFuncSetDict = new Dictionary<int, XBFuncSet>(); public HappXBTitle title = HappXBTitle.Best; PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } } StoreModel _storeModel; StoreModel m_storeModel { StoreModel m_storeModel { get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } @@ -30,7 +29,7 @@ public List<ArrayList> XBNotifyParms = new List<ArrayList>(); public bool isXBCoolTime { get; set; } public bool isJumpBestXB { get; set;} public bool isJumpBestXB { get; set; } public bool isJumpRuneXB { get; set; } public override void Init() @@ -41,19 +40,19 @@ xbTypeItemDict.Clear(); xbFuncSetDict.Clear(); List<XBGetItemConfig> list = XBGetItemConfig.GetValues(); for(int i = 0;i < list.Count; i++) for (int i = 0; i < list.Count; i++) { string key = StringUtility.Contact(list[i].TreasureType,list[i].MinLV); if(!xbGetItemDict.ContainsKey(key)) string key = StringUtility.Contact(list[i].TreasureType, list[i].MinLV); if (!xbGetItemDict.ContainsKey(key)) { xbGetItemDict.Add(key,list[i]); xbGetItemDict.Add(key, list[i]); } if(!xbTypeItemDict.ContainsKey(list[i].TreasureType)) if (!xbTypeItemDict.ContainsKey(list[i].TreasureType)) { List<XBGetItemConfig> typeItemlist = new List<XBGetItemConfig>(); typeItemlist.Add(list[i]); xbTypeItemDict.Add(list[i].TreasureType,typeItemlist); xbTypeItemDict.Add(list[i].TreasureType, typeItemlist); } else { @@ -62,7 +61,7 @@ } FuncConfigConfig treasureSet11 = FuncConfigConfig.Get("TreasureSet11"); SetXBFuncDict(1,treasureSet11); SetXBFuncDict(1, treasureSet11); FuncConfigConfig treasureSet12 = FuncConfigConfig.Get("TreasureSet12"); SetXBFuncDict(2, treasureSet12); @@ -86,7 +85,7 @@ { int playerId = (int)PlayerDatas.Instance.baseData.PlayerID; HAPPYXBITEMKEY = StringUtility.Contact(playerId, "HappyXBItemTime"); USETOOLXBKey = StringUtility.Contact(playerId,"UseToolXB"); USETOOLXBKey = StringUtility.Contact(playerId, "UseToolXB"); XBWarehouseRedPoint(); m_storeModel.RefreshTCBPlayerDataEvent += RefreshStoreScore; playerPack.refreshItemCountEvent += RefreshXBTool; @@ -95,7 +94,7 @@ public override void UnInit() { } /// <summary> @@ -109,13 +108,13 @@ switch (title) { case HappXBTitle.Best: if(isJumpBestXB) if (isJumpBestXB) { return true; } break; case HappXBTitle.Rune: if(isJumpRuneXB) if (isJumpRuneXB) { return true; } @@ -134,13 +133,13 @@ public void GetNotifyResult(int itemId, int itemCount) { int notifyIndex = 0; if(CheckNotifyItemByIdAndCnt(itemId,itemCount,out notifyIndex)) if (CheckNotifyItemByIdAndCnt(itemId, itemCount, out notifyIndex)) { SysNotifyMgr.Instance.ShowTip("HappyXB", XBNotifyParms[notifyIndex].ToArray()); } } private bool CheckNotifyItemByIdAndCnt(int itemId,int itemCnt,out int notifyIndex) private bool CheckNotifyItemByIdAndCnt(int itemId, int itemCnt, out int notifyIndex) { notifyIndex = 0; for (int i = 0; i < XBNotifyParms.Count; i++) @@ -161,7 +160,7 @@ return false; } private void SetXBFuncDict(int type,FuncConfigConfig xbSet) private void SetXBFuncDict(int type, FuncConfigConfig xbSet) { if (!xbFuncSetDict.ContainsKey(type)) { @@ -184,12 +183,12 @@ funcSet.costToolNums = new int[jsonData.Count]; for (int i = 0; i < jsonData.Count; i++) { if(jsonData.IsArray) if (jsonData.IsArray) { funcSet.costToolIds[i] = int.Parse(jsonData[i][0].ToString()); funcSet.costToolNums[i] = int.Parse(jsonData[i][1].ToString()); } } jsonData = JsonMapper.ToObject(xbSet.Numerical4); funcSet.xbFreeCDs = new int[jsonData.Count]; @@ -210,15 +209,15 @@ public XBFuncSet GetXBFuncSet(int type) { XBFuncSet funcSet = null; xbFuncSetDict.TryGetValue(type,out funcSet); xbFuncSetDict.TryGetValue(type, out funcSet); return funcSet; } public bool IsUseToolXB() { if(!PlayerPrefs.HasKey(USETOOLXBKey)) if (!PlayerPrefs.HasKey(USETOOLXBKey)) { LocalSave.SetBool(USETOOLXBKey,true); LocalSave.SetBool(USETOOLXBKey, true); return true; } else @@ -229,16 +228,16 @@ public void SetUseToolXB(bool isToolXB) { LocalSave.SetBool(USETOOLXBKey,isToolXB); LocalSave.SetBool(USETOOLXBKey, isToolXB); } private void SetXBGetItemModel() { jobXBItemDict.Clear(); Dictionary<int, XBGetItem> getItemDict = new Dictionary<int, XBGetItem>(); Dictionary<int, List<int>> jobItemDict = new Dictionary<int, List<int>>(); Dictionary<int, List<int>> jobItemDict = new Dictionary<int, List<int>>(); int playerJob = PlayerDatas.Instance.baseData.Job; foreach(var key in xbGetItemDict.Keys) foreach (var key in xbGetItemDict.Keys) { getItemDict.Clear(); @@ -253,18 +252,18 @@ int count = int.Parse(getItemJson[grid][1].ToString()); XBGetItem getItem = new XBGetItem(); getItem.SetModel(int.Parse(grid), id, count, 0); getItemDict.Add(getItem.gridIndex,getItem); getItemDict.Add(getItem.gridIndex, getItem); } JsonData jobReplaceJson = JsonMapper.ToObject(getItemConfig.JobItemList); if(jobReplaceJson.IsArray) if (jobReplaceJson.IsArray) { for(int i = 0; i < jobReplaceJson.Count; i++) for (int i = 0; i < jobReplaceJson.Count; i++) { List<int> itemIdlist = new List<int>(); jobItemDict.Add(i,itemIdlist); jobItemDict.Add(i, itemIdlist); if (jobReplaceJson[i].IsArray) { for(int j= 0; j < jobReplaceJson[i].Count; j++) for (int j = 0; j < jobReplaceJson[i].Count; j++) { int id = int.Parse(jobReplaceJson[i][j].ToString()); itemIdlist.Add(id); @@ -273,24 +272,24 @@ } } foreach(var model in getItemDict.Values) foreach (var model in getItemDict.Values) { ItemConfig itemConfig = ItemConfig.Get(model.itemId); if(itemConfig.JobLimit == 0) if (itemConfig.JobLimit == 0) { jobGetItemDict.Add(model.gridIndex,model); jobGetItemDict.Add(model.gridIndex, model); } else { bool isReplace = false; foreach (var list in jobItemDict.Values) { if(list.Contains(model.itemId)) if (list.Contains(model.itemId)) { for(int i = 0; i < list.Count;i++) for (int i = 0; i < list.Count; i++) { int equipJob = int.Parse(list[i].ToString().Substring(0,1)); if(playerJob == equipJob) int equipJob = int.Parse(list[i].ToString().Substring(0, 1)); if (playerJob == equipJob) { isReplace = true; XBGetItem getItem = new XBGetItem(); @@ -302,37 +301,37 @@ break; } } if(!isReplace) if (!isReplace) { jobGetItemDict.Add(model.gridIndex, model); } } } } } public Dictionary<int, XBGetItem> GetXBGetItemByID(int type) { int lv = 0; List<XBGetItemConfig> configlist = null; xbTypeItemDict.TryGetValue(type,out configlist); if(configlist != null) xbTypeItemDict.TryGetValue(type, out configlist); if (configlist != null) { for(int i = configlist.Count - 1; i >-1; i--) for (int i = configlist.Count - 1; i > -1; i--) { if(PlayerDatas.Instance.baseData.LV >= configlist[i].MinLV) if (PlayerDatas.Instance.baseData.LV >= configlist[i].MinLV) { lv = configlist[i].MinLV; break; } } } string key = StringUtility.Contact(type,lv); string key = StringUtility.Contact(type, lv); Dictionary<int, XBGetItem> dict = null; jobXBItemDict.TryGetValue(key,out dict); jobXBItemDict.TryGetValue(key, out dict); return dict; } @@ -354,7 +353,7 @@ } XBGetItemConfig xbItemConfig = null; string key = StringUtility.Contact(type, lv); xbGetItemDict.TryGetValue(key,out xbItemConfig); xbGetItemDict.TryGetValue(key, out xbItemConfig); return xbItemConfig; } @@ -371,21 +370,21 @@ addXBScore = result.AddTreasureScore; addXBLuckValue = result.AddTreasureLuck; JsonData resultData = JsonMapper.ToObject(result.TreasureResult); if(resultData.IsArray) if (resultData.IsArray) { for(int i = 0; i < resultData.Count;i++) for (int i = 0; i < resultData.Count; i++) { if(resultData[i].IsArray) if (resultData[i].IsArray) { int index = int.Parse(resultData[i][0].ToString()); int itemId = int.Parse(resultData[i][1].ToString()); int count = int.Parse(resultData[i][2].ToString()); int isBind = int.Parse(resultData[i][3].ToString()); XBGetItem getItem = new XBGetItem(); getItem.SetModel(index,itemId,count,isBind); getItem.SetModel(index, itemId, count, isBind); if (!xbResultDict.ContainsKey(i)) { xbResultDict.Add(i,getItem); xbResultDict.Add(i, getItem); } else { @@ -400,7 +399,7 @@ { RefreshXBResultAct(); } } List<string> itemGetTimeArray = new List<string>(); @@ -459,7 +458,7 @@ rangelist.Clear(); index.Clear(); List<XBGetItem> xbItemlist = xbResultDict.Values.ToList(); for(int i = 0; i < xbItemlist.Count; i++) for (int i = 0; i < xbItemlist.Count; i++) { index.Add(i); } @@ -469,15 +468,15 @@ public void SetRandomList(List<XBGetItem> xbItemlist) { int currentRandom = UnityEngine.Random.Range(0,index.Count); int currentRandom = UnityEngine.Random.Range(0, index.Count); XBGetItem current = xbItemlist[index[currentRandom]]; if (!rangelist.Contains(current)) { rangelist.Add(current); index.Remove(index[currentRandom]); } if(index.Count > 0) if (index.Count > 0) { SetRandomList(xbItemlist); } @@ -496,19 +495,19 @@ private Dictionary<int, XBTypeInfo> xbTypeInfoDict = new Dictionary<int, XBTypeInfo>(); public void GetServerXBInfo(HA351_tagMCTreasureInfo info) { for(int i = 0; i < info.InfoCount; i++) for (int i = 0; i < info.InfoCount; i++) { if(!xbTypeInfoDict.ContainsKey(info.TreasuerInfoList[i].TreasureType)) if (!xbTypeInfoDict.ContainsKey(info.TreasuerInfoList[i].TreasureType)) { XBTypeInfo typeInfo = new XBTypeInfo(); typeInfo.xbType = info.TreasuerInfoList[i].TreasureType; typeInfo.luckValue = info.TreasuerInfoList[i].LuckValue; typeInfo.freeTimeDict = new Dictionary<int, int>(); for(int j = 0; j < info.TreasuerInfoList[i].IndexCount; j++) for (int j = 0; j < info.TreasuerInfoList[i].IndexCount; j++) { typeInfo.freeTimeDict.Add(j,(int)info.TreasuerInfoList[i].FreeCountTime[j]); typeInfo.freeTimeDict.Add(j, (int)info.TreasuerInfoList[i].FreeCountTime[j]); } xbTypeInfoDict.Add(info.TreasuerInfoList[i].TreasureType,typeInfo); xbTypeInfoDict.Add(info.TreasuerInfoList[i].TreasureType, typeInfo); } else { @@ -523,7 +522,7 @@ RecordFreeXBTime(); if(RefreshXBTypeInfoAct != null) if (RefreshXBTypeInfoAct != null) { RefreshXBTypeInfoAct(); } @@ -534,7 +533,7 @@ public XBTypeInfo GetXBInfoByType(int type) { XBTypeInfo typeInfo = null; xbTypeInfoDict.TryGetValue(type,out typeInfo); xbTypeInfoDict.TryGetValue(type, out typeInfo); return typeInfo; } @@ -545,7 +544,7 @@ /// <param name="type"></param> /// <param name="index"></param> public event Action<int> StartXBEvent; public void SendXBQuest(int type,int index,int costType) public void SendXBQuest(int type, int index, int costType) { isXBCoolTime = true; CA568_tagCMRequestTreasure treasure = new CA568_tagCMRequestTreasure(); @@ -553,13 +552,13 @@ treasure.TreasureIndex = (byte)index; treasure.CostType = (byte)costType; GameNetSystem.Instance.SendInfo(treasure); if(StartXBEvent != null) if (StartXBEvent != null) { StartXBEvent(index); } } public void SendPutOutXBItem(PackType curType,PackType targetType,int index,int isAll) public void SendPutOutXBItem(PackType curType, PackType targetType, int index, int isAll) { CA309_tagCMDropItemToOtherPack itemToOtherPack = new CA309_tagCMDropItemToOtherPack(); itemToOtherPack.SrcBackpack = (byte)curType; @@ -569,13 +568,13 @@ GameNetSystem.Instance.SendInfo(itemToOtherPack); } public bool CheckIsEmptyGrid(PackType type,int needGrid = 1) public bool CheckIsEmptyGrid(PackType type, int needGrid = 1) { switch (type) { case PackType.Treasure: SinglePack singlePack = playerPack.GetSinglePack(type); if(100 - singlePack.GetAllItems().Count < needGrid) if (100 - singlePack.GetAllItems().Count < needGrid) { SysNotifyMgr.Instance.ShowTip("XBWarehouseFull"); return false; @@ -600,7 +599,7 @@ return true; } public void SendOneXBQuest(PackType type,int xbType) public void SendOneXBQuest(PackType type, int xbType) { var funcSet = GetXBFuncSet(xbType); if (CheckIsEmptyGrid(type)) @@ -633,13 +632,13 @@ int needToolCnt = 0; if (IsHaveManyXBTool(xbType, out toolCnt, out needToolCnt)) { if(toolCnt >= needToolCnt) if (toolCnt >= needToolCnt) { CheckXBManyLimit(0, xbType, 2); } else { CheckXBManyLimit(funcSet.xbPrices[1], xbType,0); CheckXBManyLimit(funcSet.xbPrices[1], xbType, 0); } //needToolCnt = needToolCnt - toolCnt; //int needMoney = needToolCnt * funcSet.xbPrices[0]; @@ -663,13 +662,13 @@ } else { CheckXBManyLimit(funcSet.xbPrices[1],xbType,0); CheckXBManyLimit(funcSet.xbPrices[1], xbType, 0); } } } public void CheckXBManyLimit(int needMoney,int xbtype,int costType) public void CheckXBManyLimit(int needMoney, int xbtype, int costType) { if (UIHelper.GetMoneyCnt(1) >= (ulong)needMoney) { @@ -687,9 +686,9 @@ XBTypeInfo typeInfo = GetXBInfoByType(type); if (typeInfo == null) return false; foreach(var key in typeInfo.freeTimeDict.Keys) foreach (var key in typeInfo.freeTimeDict.Keys) { if(typeInfo.freeTimeDict[key] != 0 && xbFuncSetDict[type].xbFreeCDs[key] > 0) if (typeInfo.freeTimeDict[key] != 0 && xbFuncSetDict[type].xbFreeCDs[key] > 0) { TimeSpan t = TimeUtility.ServerNow - TimeUtility.GetTime((uint)typeInfo.freeTimeDict[key]); if (t.TotalMinutes > 0) @@ -709,22 +708,22 @@ XBFuncSet funcSet = GetXBFuncSet(type); if (funcSet == null) return false; for(int i = 0; i < funcSet.xbFreeCDs.Length;i++) for (int i = 0; i < funcSet.xbFreeCDs.Length; i++) { if(funcSet.xbFreeCDs[i] > 0) if (funcSet.xbFreeCDs[i] > 0) { return true; } } return false; } public bool CheckIsXBTool(int itemId,int type) public bool CheckIsXBTool(int itemId, int type) { XBFuncSet funcSet = GetXBFuncSet(type); if (funcSet == null) return false; if(funcSet.costToolIds.Contains(itemId)) if (funcSet.costToolIds.Contains(itemId)) { return true; } @@ -736,7 +735,7 @@ if (funcSet == null) return false; int toolCnt = playerPack.GetItemCountByID(PackType.Item, funcSet.costToolIds[0]); if(toolCnt >= funcSet.costToolNums[0]) if (toolCnt >= funcSet.costToolNums[0]) { return true; } @@ -744,7 +743,7 @@ return false; } public bool IsHaveManyXBTool(int type, out int toolCnt,out int needToolCnt) public bool IsHaveManyXBTool(int type, out int toolCnt, out int needToolCnt) { toolCnt = 0; needToolCnt = 0; @@ -765,12 +764,12 @@ foreach (var type in xbFuncSetDict.Keys) { XBTypeInfo typeInfo = GetXBInfoByType(type); if(typeInfo != null) if (typeInfo != null) { int[] freeCDs = xbFuncSetDict[type].xbFreeCDs; for (int i = 0; i < freeCDs.Length; i++) { if(freeCDs[i] != 0) if (freeCDs[i] != 0) { DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "免费时间:" + TimeUtility.GetTime((uint)typeInfo.freeTimeDict[i])); TimeSpan t = TimeUtility.ServerNow - TimeUtility.GetTime((uint)typeInfo.freeTimeDict[i]); @@ -785,17 +784,17 @@ { TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.HappyFreeBestXB, reamainSeconds, RefreshBestXBTime); } else if(type == 2) else if (type == 2) { TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.HappyFreeRuneXB, reamainSeconds, RefreshRuneXBTime); } } } } } } } } @@ -803,7 +802,7 @@ public event Action<float> RefreshRuneXBTimeAct; public void RefreshBestXBTime(float time) { if(RefreshBestXBTimeAct != null) if (RefreshBestXBTimeAct != null) { RefreshBestXBTimeAct(time); } @@ -820,7 +819,7 @@ RefreshRuneXBTimeAct(time); } if(time <= 0) if (time <= 0) { BestAndRuneXBRedPoint(); } @@ -832,11 +831,11 @@ /// </summary> /// <param name="xBTitle"></param> /// <param name="xbType"></param> public void SetAgainXBEvent(HappXBTitle xBTitle,int xbType) public void SetAgainXBEvent(HappXBTitle xBTitle, int xbType) { if(RefreshAgainXBAct != null) if (RefreshAgainXBAct != null) { RefreshAgainXBAct(xBTitle,xbType); RefreshAgainXBAct(xBTitle, xbType); } } @@ -858,11 +857,11 @@ public Redpoint happyXBRed = new Redpoint(MainTop_RedKey, HappyXB_RedKey); public Redpoint bestXBRed = new Redpoint(HappyXB_RedKey, BestXB_RedKey); public Redpoint runeXBRed = new Redpoint(HappyXB_RedKey, RuneXB_RedKey); public Redpoint xbStoreRed = new Redpoint(HappyXB_RedKey,XBStore_RedKey); public Redpoint xbWarehouseRed = new Redpoint(HappyXB_RedKey,XBWarehouse_RedKey); public Redpoint bestXBOneRed = new Redpoint(BestXB_RedKey,BestXB_OneRedKey); public Redpoint bestXBManyRed = new Redpoint(BestXB_RedKey,BestXB_ManyRedKey); public Redpoint bestXBFreeRed = new Redpoint(BestXB_RedKey,BestXB_FreeRedKey); public Redpoint xbStoreRed = new Redpoint(HappyXB_RedKey, XBStore_RedKey); public Redpoint xbWarehouseRed = new Redpoint(HappyXB_RedKey, XBWarehouse_RedKey); public Redpoint bestXBOneRed = new Redpoint(BestXB_RedKey, BestXB_OneRedKey); public Redpoint bestXBManyRed = new Redpoint(BestXB_RedKey, BestXB_ManyRedKey); public Redpoint bestXBFreeRed = new Redpoint(BestXB_RedKey, BestXB_FreeRedKey); public Redpoint runeXBOneRed = new Redpoint(RuneXB_RedKey, RuneXB_OneRedKey); public Redpoint runeXBManyRed = new Redpoint(RuneXB_RedKey, RuneXB_ManyRedKey); public Redpoint runeXBFreeRed = new Redpoint(RuneXB_RedKey, RuneXB_FreeRedKey); @@ -921,9 +920,9 @@ bestXBFreeRed.state = RedPointState.None; } if(IsHaveManyXBTool(1,out xbtoolCnt,out needtoolCnt)) if (IsHaveManyXBTool(1, out xbtoolCnt, out needtoolCnt)) { if(xbtoolCnt >= needtoolCnt) if (xbtoolCnt >= needtoolCnt) { bestXBManyRed.state = RedPointState.Simple; } @@ -948,7 +947,7 @@ runeXBFreeRed.state = RedPointState.None; } if(IsHaveManyXBTool(2,out xbtoolCnt,out needtoolCnt)) if (IsHaveManyXBTool(2, out xbtoolCnt, out needtoolCnt)) { if (xbtoolCnt >= needtoolCnt) { @@ -981,15 +980,15 @@ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return; ulong moneyNum = UIHelper.GetMoneyCnt(25); for(int i = 11; i < 14; i++) for (int i = 11; i < 14; i++) { storelist = m_storeModel.TryGetStoreDatas(i); if(storelist.Count > 0) storelist = m_storeModel.TryGetStoreDatas((StoreFunc)i); if (storelist.Count > 0) { List<StoreModel.StoreData> orderlist = new List<StoreModel.StoreData>(); orderlist.AddRange(storelist); orderlist.Sort(CompareByMoney); if(moneyNum >= (ulong)orderlist[0].storeConfig.MoneyNumber) if (moneyNum >= (ulong)orderlist[0].storeConfig.MoneyNumber) { xbStoreRed.state = RedPointState.Simple; return; @@ -1024,7 +1023,7 @@ public int xbType;// 1 极品寻宝 2 符印寻宝 public int[] xbNums; public int[] xbPrices; public int[]costToolIds; public int[] costToolIds; public int[] costToolNums; public int[] xbFreeCDs; public int[] xbScores; System/HappyXB/XBStoreWin.cs
@@ -108,7 +108,7 @@ private void CreateShopCell() { shopCtrl.Refresh(); shoplist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); shoplist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); if (shoplist.Count > 0) { int i = 0; System/KnapSack/FBHelpPointExchageModel.cs
@@ -132,7 +132,7 @@ if (type != PlayerDataRefresh.FBHelpPoint || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return; var storeDatas = storeModel.TryGetStoreDatas((int)StoreFunc.IntegralStore); var storeDatas = storeModel.TryGetStoreDatas(StoreFunc.IntegralStore); if(storeDatas != null) { for(int i = 0; i < storeDatas.Count; i++) System/KnapSack/Logic/LegendPropertyUtility.cs
@@ -226,7 +226,9 @@ foreach (var item in json.Keys) { var type = (LegendAttrType)(int.Parse(item) - 1); propertyTypes[(int)json[item]] = type; var propertyId = 0; int.TryParse(json[item].ToString(), out propertyId); propertyTypes[propertyId] = type; } json = JsonMapper.ToObject(placeConfig); @@ -239,12 +241,15 @@ if (json[key].IsArray) { var subJson = json[key]; foreach (var type in subJson.Keys) for (var i = 0; i < subJson.Count; i++) { for (var i = 0; i < subJson[type].Count; i++) if (subJson[i].IsArray) { var propertyId = (int)subJson[type][i]; properties.Add(propertyId); for (var j = 0; j < subJson[i].Count; j++) { var propertyId = (int)subJson[i][j]; properties.Add(propertyId); } } } } @@ -358,10 +363,14 @@ var star = int.Parse(key); var typeCounts = counts[star] = new Dictionary<LegendAttrType, int>(); var subJson = json[key]; foreach (var item in subJson.Keys) if (subJson.IsArray) { var type = (LegendAttrType)(int.Parse(item)); typeCounts[type] = (int)subJson[item]; for (int i = 0; i < subJson.Count; i++) { var type = (LegendAttrType)(i); typeCounts[type] = (int)subJson[i]; } } } } @@ -541,10 +550,15 @@ var count = subJson[propertyId].Count; var values = new List<int>(); levelValues[int.Parse(propertyId)] = values; foreach (var item in subJson[propertyId].Keys) if (subJson[propertyId].IsArray) { values.Add((int)subJson[propertyId][item]); for (var i = 0; i < subJson[propertyId].Count; i++) { values.Add((int)subJson[propertyId][i]); } } } } } System/KnapSack/New/FBHelpPointExchageNotify.cs
@@ -35,7 +35,7 @@ storeModel.SetJumpModel(StoreFunc.IntegralStore, ExchageModel.currentShopId); switch ((StoreFunc)storeConfig.ShopType) { case StoreFunc.WeekStore: case StoreFunc.MysteryStore: WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc1); break; case StoreFunc.CommonStore: System/MainInterfacePanel/HighSettingTip.cs
@@ -476,7 +476,7 @@ || !storeModel.IsNewDay(storeModel.StoreEffectRecord_Key)) return; var storeDatas = storeModel.TryGetStoreDatas((int)StoreFunc.WeekStore); var storeDatas = storeModel.TryGetStoreDatas(StoreFunc.MysteryStore); if (storeDatas != null && storeDatas.Count > 0 && !m_StoreEffect.IsPlaying) System/Store/BagStoreWin.cs
@@ -79,7 +79,7 @@ SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId); if (successConfig.Type == 96) { p_shopItemlist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); p_shopItemlist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); for (int i = 0; i < p_shopItemlist.Count; i++) { var storeData = p_shopItemlist[i]; System/Store/Logic/BuyItemInfoWin.cs
@@ -372,7 +372,7 @@ int unionLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV; switch (m_storeModel.storeFuncType) { case StoreFunc.WeekStore: case StoreFunc.MysteryStore: break; case StoreFunc.CommonStore: break; System/Store/Logic/BuyPetMatInfoWin.cs
@@ -342,7 +342,7 @@ int unionLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV; switch (m_storeModel.storeFuncType) { case StoreFunc.WeekStore: case StoreFunc.MysteryStore: break; case StoreFunc.CommonStore: break; System/Store/StoreModel.cs
@@ -20,7 +20,7 @@ public int count; public int isBind; public ShopItemInfo(int id,int count,int isBind) public ShopItemInfo(int id, int count, int isBind) { this.itemId = id; this.count = count; @@ -29,30 +29,27 @@ } [XLua.LuaCallCSharp] public class StoreModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk public class StoreModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk { public int[] normalBuyCoinsTypes { get; private set; } public string UNIONSTORESAVE_KEY { get; private set; } public string MUSTBUYSAVE_KEY { get; private set; } public string StoreEffectRecord_Key { get; private set; } public Dictionary<int,Dictionary<int,int>> JobReplaceIdDict = new Dictionary<int, Dictionary<int, int>>(); public Dictionary<int, Dictionary<int, int>> JobReplaceIdDict = new Dictionary<int, Dictionary<int, int>>(); public Dictionary<int, string> resetTimeDict { get; private set; } public Dictionary<int, int> showCoinsUIDict { get; private set; } public int storeTrailerLv { get; private set; } int mysteryRefreshedCount = 0; List<int> mysteryCommondities = new List<int>(); bool isLogin = true; public event Action mysteryShopRefreshEvent; RuneModel runeModel { get { return ModelCenter.Instance.GetModel<RuneModel>(); } } PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } private bool isUpdatePlayerLv; public override void Init() @@ -92,16 +89,16 @@ petAndMountPushlist.Clear(); ClearPushData(); tagTowerModel = null; storeFuncType = StoreFunc.WeekStore; storeFuncType = StoreFunc.MysteryStore; tcbRefreshDict.Clear(); } public void OnAfterPlayerDataInitialize() { UNIONSTORESAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, LocalSaveStoreType.UnionStore); StoreEffectRecord_Key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StoreEffectRecord"); MUSTBUYSAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"MustBuy"); MUSTBUYSAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "MustBuy"); } public void OnPlayerLoginOk() @@ -132,6 +129,45 @@ MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart; } public void RefreshMysteryShop() { var consumablesOwn = 0; var consumablesNeed = 1; if (consumablesOwn >= consumablesNeed) { var info = new CA232_tagCMRefreshMysticalShop(); GameNetSystem.Instance.SendInfo(info); return; } var moneyOwn = 0; var moneyNeed = 0; if (moneyOwn >= moneyNeed) { var info = new CA232_tagCMRefreshMysticalShop(); GameNetSystem.Instance.SendInfo(info); return; } //去充值吧 } public void UpdateMysteryCommondities(HA816_tagMCMysticalShopInfo info) { mysteryRefreshedCount = info.RefreshCnt; mysteryCommondities.Clear(); foreach (var item in info.GoodsList) { mysteryCommondities.Add((int)item.GoodsID); } if (mysteryShopRefreshEvent != null) { mysteryShopRefreshEvent(); } } #region 解析本地数据 public Dictionary<int, List<int>> storeRedRuleDict { get; private set; } //红点类型 1,免费商品 2,必买商品 3,坐骑灵宠 4,可购买物品(积分兑换) public Dictionary<int, List<int>> storePushDict { get; private set; } //1,每日弹1次2,只弹1次 @@ -140,35 +176,35 @@ storeRedRuleDict = new Dictionary<int, List<int>>(); storePushDict = new Dictionary<int, List<int>>(); FuncConfigConfig storeRedRules = FuncConfigConfig.Get("StoreRedRules"); if(storeRedRules != null) if (storeRedRules != null) { JsonData redRules = JsonMapper.ToObject(storeRedRules.Numerical1); foreach(var type in redRules.Keys) foreach (var type in redRules.Keys) { int redType = 0; int.TryParse(type,out redType); int.TryParse(type, out redType); JsonData shops = redRules[type]; if (!storeRedRuleDict.ContainsKey(redType)) { List<int> shopIdlist = new List<int>(); if(shops.IsArray) if (shops.IsArray) { for(int i = 0; i < shops.Count; i++) for (int i = 0; i < shops.Count; i++) { int shopId = 0; int.TryParse(shops[i].ToString(),out shopId); int.TryParse(shops[i].ToString(), out shopId); shopIdlist.Add(shopId); } } storeRedRuleDict.Add(redType,shopIdlist); storeRedRuleDict.Add(redType, shopIdlist); } } JsonData pushRules = JsonMapper.ToObject(storeRedRules.Numerical2); foreach(var type in pushRules.Keys) foreach (var type in pushRules.Keys) { int pushType = 0; int.TryParse(type,out pushType); int.TryParse(type, out pushType); JsonData shops = pushRules[type]; if (!storePushDict.ContainsKey(pushType)) { @@ -188,7 +224,7 @@ } } public Dictionary<int,List<StoreData>> storeTypeDict { get; private set; } public Dictionary<int, List<StoreData>> storeTypeDict { get; private set; } public Dictionary<int, List<StoreData>> theOnlyShopDict { get; private set; } //key 物品id public Dictionary<string, List<StoreData>> limitValueShopDict { get; private set; } //key 商品类型和限制条件 private void ParseStoreConfig() @@ -197,10 +233,10 @@ theOnlyShopDict = new Dictionary<int, List<StoreData>>(); limitValueShopDict = new Dictionary<string, List<StoreData>>(); List<StoreConfig> storeConfigs = StoreConfig.GetValues(); for(int i = 0; i < storeConfigs.Count; i++) for (int i = 0; i < storeConfigs.Count; i++) { var config = storeConfigs[i]; if(config.ShopType != 0) if (config.ShopType != 0) { StoreData storeData = new StoreData(); storeData.shopId = config.ID; @@ -231,12 +267,12 @@ } } string key = StringUtility.Contact(config.ShopType,config.LimitValue); if(!limitValueShopDict.ContainsKey(key)) string key = StringUtility.Contact(config.ShopType, config.LimitValue); if (!limitValueShopDict.ContainsKey(key)) { List<StoreData> storeDatas = new List<StoreData>(); storeDatas.Add(storeData); limitValueShopDict.Add(key,storeDatas); limitValueShopDict.Add(key, storeDatas); } else { @@ -245,18 +281,18 @@ } } foreach(var type in storeTypeDict.Keys) foreach (var type in storeTypeDict.Keys) { var configs = storeTypeDict[type]; configs.Sort(CompareByShopSort); } } private Dictionary<int,List<int>> AnalysisJobReplace(StoreConfig storeConfig) private Dictionary<int, List<int>> AnalysisJobReplace(StoreConfig storeConfig) { if (storeConfig == null || string.IsNullOrEmpty(storeConfig.JobItem)) return null; Dictionary<int,List<int>> replaceDict = new Dictionary<int, List<int>>(); Dictionary<int, List<int>> replaceDict = new Dictionary<int, List<int>>(); JsonData jsonData = JsonMapper.ToObject(storeConfig.JobItem); if (jsonData.IsArray) { @@ -290,7 +326,7 @@ { public int shopId; public StoreConfig storeConfig; public Dictionary<int,List<int>> jobReplaceDict; public Dictionary<int, List<int>> jobReplaceDict; } #endregion @@ -332,7 +368,7 @@ { if (storeData.storeConfig.TheOnlyShop == 1) { if(!CheckTheOnlyShopSellOut(storeData.shopId)) if (!CheckTheOnlyShopSellOut(storeData.shopId)) { showStoreDatas.Add(storeData); } @@ -381,10 +417,28 @@ return false; } public List<StoreData> TryGetStoreDatas(int type) public List<StoreData> TryGetStoreDatas(StoreFunc type) { List<StoreData> datas = null; showStoreTypeDict.TryGetValue(type,out datas); if (showStoreTypeDict.TryGetValue((int)type, out datas)) { switch (type) { case StoreFunc.MysteryStore: for (var i = datas.Count - 1; i >= 0; i--) { var data = datas[i]; if (!mysteryCommondities.Contains(data.storeConfig.ID)) { mysteryCommondities.RemoveAt(i); } } break; default: break; } } return datas; } @@ -397,10 +451,10 @@ storeTypeDict.TryGetValue(storeConfig.ShopType, out storeDatas); if (storeDatas != null) { for(int i = 0; i < storeDatas.Count; i++) for (int i = 0; i < storeDatas.Count; i++) { var storeData = storeDatas[i]; if(storeData.shopId == shopId) if (storeData.shopId == shopId) { return storeData; } @@ -409,14 +463,14 @@ return null; } public int GetReplaceId(int shopId,int itemId) public int GetReplaceId(int shopId, int itemId) { var storeData = GetStoreData(shopId); if (storeData == null) return 0; int job = PlayerDatas.Instance.baseData.Job; var replaceDict = storeData.jobReplaceDict; if(replaceDict != null) if (replaceDict != null) { foreach (var index in replaceDict.Keys) { @@ -428,7 +482,7 @@ } } } return itemId; } @@ -533,15 +587,15 @@ var vipLvs = config.VIPLV; if (vipLvs == null || vipLvs.Length < 1) return false; for(int i = 0; i < vipLvs.Length; i++) for (int i = 0; i < vipLvs.Length; i++) { var vipLv = vipLvs[i]; if(vipLv != 0) if (vipLv != 0) { isVipBuy = true; } } if (isVipBuy) { int playerVip = PlayerDatas.Instance.baseData.VIPLv; @@ -580,11 +634,11 @@ return false; } public List<StoreData> TryGetStoreDatasByLimit(int type,int limitValue) public List<StoreData> TryGetStoreDatasByLimit(int type, int limitValue) { string key = StringUtility.Contact(type,limitValue); string key = StringUtility.Contact(type, limitValue); List<StoreData> datas = null; limitValueShopDict.TryGetValue(key,out datas); limitValueShopDict.TryGetValue(key, out datas); return datas; } #endregion @@ -593,11 +647,11 @@ { if (resetTimeDict == null || !resetTimeDict.ContainsKey(type)) return string.Empty; switch(type) switch (type) { case 7: int willRefreshTime = GetWillRefreshTime(); return Language.Get(resetTimeDict[type],UIHelper.AppendStringColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime),true)); return Language.Get(resetTimeDict[type], UIHelper.AppendStringColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime), true)); default: return Language.Get(resetTimeDict[type]); } @@ -608,7 +662,7 @@ int willRefresh = (3 - TimeUtility.OpenDay % 3); if (willRefresh == 3) { if(TimeUtility.ServerNow.Hour < 5) if (TimeUtility.ServerNow.Hour < 5) { willRefresh = 0; } @@ -622,7 +676,7 @@ private void UpdateSecond() { if(isUpdatePlayerLv) if (isUpdatePlayerLv) { UpdatePlayerLv(); isUpdatePlayerLv = false; @@ -640,7 +694,7 @@ private void RefreshPlayerData(PlayerDataRefresh type) { switch(type) switch (type) { case PlayerDataRefresh.LV: isUpdatePlayerLv = true; @@ -662,7 +716,7 @@ private void RefreshFamilyLv() { int familyLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV; if(familyLv > GetSaveFairyLV()) if (familyLv > GetSaveFairyLV()) { ControllerRedPoint(); } @@ -686,7 +740,7 @@ UpdateMustBuyRedpoint(); } } if(!PlayerDatas.Instance.fairyData.HasFairy) if (!PlayerDatas.Instance.fairyData.HasFairy) { PlayerPrefs.DeleteKey(UNIONSTORESAVE_KEY); } @@ -694,7 +748,7 @@ public event Action RefreshBuyShopLimitEvent; public StoreFunc storeFuncType = StoreFunc.WeekStore; public StoreFunc storeFuncType = StoreFunc.MysteryStore; private Dictionary<uint, BuyShopItemLimit> shopItemlimitDict = new Dictionary<uint, BuyShopItemLimit>(); private Dictionary<string, RuneTowerFloorConfig> tagTowerModel; @@ -721,13 +775,13 @@ else { shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex].BuyCnt = buylimit.DayBuyCntList[i].BuyCnt; shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex]. isReset = buylimit.DayBuyCntList[i].IsReset; shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex].isReset = buylimit.DayBuyCntList[i].IsReset; } } } if(!isLogin) if (!isLogin) { UpdateShowStore(); UpdateFreeShopRedpoint(); @@ -766,7 +820,7 @@ if (storeConfig == null) return null; shopItemlist.Clear(); if(storeConfig.ItemID != 0) if (storeConfig.ItemID != 0) { int replaceId = GetReplaceId(storeConfig.ID, storeConfig.ItemID); ShopItemInfo shopItem = new ShopItemInfo(replaceId, storeConfig.ItemCnt, storeConfig.IsBind); @@ -784,7 +838,7 @@ int itemId = int.Parse(extraItem[i][0].ToString()); int itemCount = int.Parse(extraItem[i][1].ToString()); int isBind = int.Parse(extraItem[i][2].ToString()); if(itemId != 0) if (itemId != 0) { int extraReplaceId = GetReplaceId(storeConfig.ID, itemId); ShopItemInfo shop = new ShopItemInfo(extraReplaceId, itemCount, isBind); @@ -800,7 +854,7 @@ public bool TryGetShopItemInfo(StoreFunc _type, int _id, out List<ShopItemInfo> _shopItems) { _shopItems = null; var _list = TryGetStoreDatas((int)_type); var _list = TryGetStoreDatas(_type); var _index = _list.FindIndex((x) => { return x.shopId == _id; @@ -818,16 +872,16 @@ public event Action<PlayerDataRefresh> RefreshTCBPlayerDataEvent; public void RefreshTCBPlayerData(H0418_tagObjInfoRefresh info) { if(!tcbRefreshDict.ContainsKey((PlayerDataRefresh)info.RefreshType)) if (!tcbRefreshDict.ContainsKey((PlayerDataRefresh)info.RefreshType)) { tcbRefreshDict.Add((PlayerDataRefresh)info.RefreshType,(int)info.Value); tcbRefreshDict.Add((PlayerDataRefresh)info.RefreshType, (int)info.Value); } else { tcbRefreshDict[(PlayerDataRefresh)info.RefreshType] = (int)info.Value; } if(RefreshTCBPlayerDataEvent != null) if (RefreshTCBPlayerDataEvent != null) { RefreshTCBPlayerDataEvent((PlayerDataRefresh)info.RefreshType); } @@ -836,7 +890,7 @@ public int GetTCBPlayerData(PlayerDataRefresh tCDBPlayer) { int value = 0; tcbRefreshDict.TryGetValue(tCDBPlayer,out value); tcbRefreshDict.TryGetValue(tCDBPlayer, out value); return value; } @@ -846,11 +900,11 @@ public void OnClickShopCell(StoreConfig shopInfo) { BuyItemPopModel.Instance.SetModel(shopInfo.ID); int itemId = GetReplaceId(shopInfo.ID,shopInfo.ItemID); ItemAttrData attrData = new ItemAttrData(itemId,true, (ulong)shopInfo.ItemCnt,-1,shopInfo.IsBind,true,PackType.Deleted ,"",null,ItemTipChildType.Buy); itemTipsModel.SetItemTipsModel(attrData,false); attrData.SetTipsFuncBtn(ItemOperateType.buy,(ItemOperateType type ,string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); }); int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID); ItemAttrData attrData = new ItemAttrData(itemId, true, (ulong)shopInfo.ItemCnt, -1, shopInfo.IsBind, true, PackType.Deleted , "", null, ItemTipChildType.Buy); itemTipsModel.SetItemTipsModel(attrData, false); attrData.SetTipsFuncBtn(ItemOperateType.buy, (ItemOperateType type, string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); }); itemTipsModel.ShowUICtrl(); } @@ -884,7 +938,7 @@ } } SendBuyShopItem(storeConfig,BuyCnt); SendBuyShopItem(storeConfig, BuyCnt); } #endregion @@ -917,7 +971,7 @@ } else { switch(model.MoneyType) switch (model.MoneyType) { case 1: if (VersionConfig.Get().isBanShu) @@ -946,7 +1000,7 @@ StoreConfig tagStore = StoreConfig.Get((int)result.ItemIndex); if (tagStore != null) { ItemConfig chinModel = ItemConfig.Get(GetReplaceId(tagStore.ID,tagStore.ItemID)); ItemConfig chinModel = ItemConfig.Get(GetReplaceId(tagStore.ID, tagStore.ItemID)); if (!normalBuyCoinsTypes.Contains(tagStore.MoneyType)) { if (tagStore.RemindSuccess == 0) @@ -962,9 +1016,9 @@ else { float costMoney = tagStore.MoneyNumber; SysNotifyMgr.Instance.ShowTip("BuyItemHinit",costMoney,tagStore.MoneyType, chinModel.ItemName); SysNotifyMgr.Instance.ShowTip("BuyItemHinit", costMoney, tagStore.MoneyType, chinModel.ItemName); } if (RefreshBuyResultEvent != null) { RefreshBuyResultEvent(chinModel.ID); @@ -981,10 +1035,8 @@ { int playerTower = (int)runeModel.RuneTowerOpenLV; int offset = playerTower - limitTower; if (offset >= 0) return true; else return false; return offset >= 0; } public bool MoneyIsEnough(int moneyType, ulong money) @@ -999,7 +1051,7 @@ } } public int jumpToItemId { get;set;} public int jumpToItemId { get; set; } public void SetJumpToModel(int itemId) { jumpToItemId = itemId; @@ -1009,7 +1061,7 @@ private void FuncStateChange(int funcId) { switch((FuncOpenEnum)funcId) switch ((FuncOpenEnum)funcId) { case FuncOpenEnum.Store: if (StoreFuncOpenAct != null) @@ -1026,8 +1078,6 @@ ControllerRedPoint(); break; } } public bool IsNewDay(string recordKey) @@ -1037,7 +1087,7 @@ if (PlayerPrefs.HasKey(recordKey)) { int day = LocalSave.GetInt(recordKey); if(day != TimeUtility.ServerNow.Day) if (day != TimeUtility.ServerNow.Day) { LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day); return true; @@ -1171,17 +1221,17 @@ public const int StoreFunc4_RedKey = 2204; public const int StoreFunc5_RedKey = 2205; public Redpoint storeFuncPoint = new Redpoint(StoreFunc_RedKey); public Redpoint storeFunc1Point = new Redpoint(StoreFunc_RedKey,StoreFunc1_RedKey); public Redpoint storeFunc2Point = new Redpoint(StoreFunc_RedKey,StoreFunc2_RedKey); public Redpoint storeFunc3Point = new Redpoint(StoreFunc_RedKey,StoreFunc3_RedKey); public Redpoint storeFunc4Point = new Redpoint(StoreFunc_RedKey,StoreFunc4_RedKey); public Redpoint storeFunc5Point = new Redpoint(StoreFunc_RedKey,StoreFunc5_RedKey); public Redpoint storeFunc1Point = new Redpoint(StoreFunc_RedKey, StoreFunc1_RedKey); public Redpoint storeFunc2Point = new Redpoint(StoreFunc_RedKey, StoreFunc2_RedKey); public Redpoint storeFunc3Point = new Redpoint(StoreFunc_RedKey, StoreFunc3_RedKey); public Redpoint storeFunc4Point = new Redpoint(StoreFunc_RedKey, StoreFunc4_RedKey); public Redpoint storeFunc5Point = new Redpoint(StoreFunc_RedKey, StoreFunc5_RedKey); public Dictionary<int, Redpoint> shopRedDict = new Dictionary<int, Redpoint>(); public void SetShopRedpoint() { shopRedDict.Clear(); List<StoreConfig> storelist = StoreConfig.GetValues(); for(int i = 0; i < storelist.Count; i++) for (int i = 0; i < storelist.Count; i++) { StoreConfig storeConfig = storelist[i]; int redKey = 0; @@ -1189,14 +1239,14 @@ switch (storeConfig.ShopType) { case 1: redKey = StoreFunc1_RedKey*10000 + storeConfig.ID; redpoint = new Redpoint(StoreFunc1_RedKey,redKey); redKey = StoreFunc1_RedKey * 10000 + storeConfig.ID; redpoint = new Redpoint(StoreFunc1_RedKey, redKey); shopRedDict.Add(storeConfig.ID, redpoint); break; case 2: redKey = StoreFunc2_RedKey * 10000 + storeConfig.ID; redpoint = new Redpoint(StoreFunc2_RedKey, redKey); shopRedDict.Add(storeConfig.ID,redpoint); shopRedDict.Add(storeConfig.ID, redpoint); break; case 3: redKey = StoreFunc3_RedKey * 10000 + storeConfig.ID; @@ -1220,16 +1270,16 @@ public void UpdateFreeShopRedpoint() { if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return; foreach (var key in showStoreTypeDict.Keys) { var storeDatas = showStoreTypeDict[key]; for(int i = 0; i < storeDatas.Count; i++) for (int i = 0; i < storeDatas.Count; i++) { var storeConfig = storeDatas[i].storeConfig; int type = 0; TryGetRedTypeByShopId(storeConfig.ID,out type); if(type == 1) TryGetRedTypeByShopId(storeConfig.ID, out type); if (type == 1) { int remainNum = 0; if (!TryGetIsSellOut(storeConfig, out remainNum)) @@ -1242,10 +1292,10 @@ } } } } } public void UpdateCanBuyRedpoint() { if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return; @@ -1258,7 +1308,7 @@ var storeConfig = storeDatas[i].storeConfig; int type = 0; TryGetRedTypeByShopId(storeConfig.ID, out type); if(type == 4) if (type == 4) { int remainNum = 0; if (!TryGetIsSellOut(storeConfig, out remainNum)) @@ -1278,13 +1328,13 @@ } } } } } private void UpdateFairyEquip(PackType type, int index, int id) { if (type != PackType.Equip if (type != PackType.Equip && (index != (int)RoleEquipType.FairyCan || index != (int)RoleEquipType.FairyCan2)) return; ClearAllFairyEquipRedpoint(); @@ -1302,13 +1352,13 @@ { var storeData = storeDatas[i]; var storeConfig = storeData.storeConfig; int type = 0; int type = 0; TryGetRedTypeByShopId(storeConfig.ID, out type); if (type == 5) { string fairySaveKey = string.Empty; bool isGetSave = TryGetFairySaveKey(storeConfig,out fairySaveKey); bool isGetSave = TryGetFairySaveKey(storeConfig, out fairySaveKey); int remainNum = 0; if (!TryGetIsSellOut(storeConfig, out remainNum)) { @@ -1326,9 +1376,9 @@ } else { if(shopRedDict[storeData.shopId].state != RedPointState.None) if (shopRedDict[storeData.shopId].state != RedPointState.None) { LocalSave.SetBool(fairySaveKey,false); LocalSave.SetBool(fairySaveKey, false); shopRedDict[storeConfig.ID].state = RedPointState.None; } } @@ -1390,11 +1440,11 @@ string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", key, "EquipPlace:", 9); string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", key, "EquipPlace:", 10); if(LocalSave.GetBool(key1)) if (LocalSave.GetBool(key1)) { LocalSave.SetBool(key1, false); } else if(LocalSave.GetBool(key2)) else if (LocalSave.GetBool(key2)) { LocalSave.SetBool(key2, false); } @@ -1403,25 +1453,25 @@ } } public bool TryGetFairySaveKey(StoreConfig config,out string fairySaveKey) public bool TryGetFairySaveKey(StoreConfig config, out string fairySaveKey) { fairySaveKey = string.Empty; if (config == null) return false; ItemConfig itemConfig = ItemConfig.Get(config.ItemID); if(itemConfig.EquipPlace == (int)RoleEquipType.FairyCan) if (itemConfig.EquipPlace == (int)RoleEquipType.FairyCan) { string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId",config.ID,"EquipPlace:",9); string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:",10); ItemModel itemModel1 = playerPack.GetItemByIndex(PackType.Equip,9); string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:", 9); string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:", 10); ItemModel itemModel1 = playerPack.GetItemByIndex(PackType.Equip, 9); ItemModel itemModel2 = playerPack.GetItemByIndex(PackType.Equip, 10); if(itemModel1 == null if (itemModel1 == null && (!PlayerPrefs.HasKey(key1) || LocalSave.GetBool(key1))) { fairySaveKey = key1; return true; } else if(itemModel2 == null else if (itemModel2 == null && (!PlayerPrefs.HasKey(key2) || LocalSave.GetBool(key2))) { fairySaveKey = key2; @@ -1443,7 +1493,7 @@ var storeConfig = storeDatas[i].storeConfig; int type = 0; TryGetRedTypeByShopId(storeConfig.ID, out type); if(type == 2) if (type == 2) { if (CheckIsMustBuy(storeConfig)) { @@ -1455,15 +1505,15 @@ } } } } } public void ClearMustBuyRedpoint(StoreConfig storeConfig) { int type = 0; TryGetRedTypeByShopId(storeConfig.ID,out type); if(type == 2) TryGetRedTypeByShopId(storeConfig.ID, out type); if (type == 2) { shopRedDict[storeConfig.ID].state = RedPointState.None; IsMustBuyDay = false; @@ -1486,7 +1536,7 @@ || TimeUtility.ServerNow.Day != records[0])) { IsMustBuyDay = true; LocalSave.SetIntArray(MUSTBUYSAVE_KEY,saveTimes); LocalSave.SetIntArray(MUSTBUYSAVE_KEY, saveTimes); } else { @@ -1496,14 +1546,14 @@ else { IsMustBuyDay = true; LocalSave.SetIntArray(MUSTBUYSAVE_KEY,saveTimes); LocalSave.SetIntArray(MUSTBUYSAVE_KEY, saveTimes); } } public bool CheckIsMustBuy(StoreConfig config) { int remainNum = 0; if(!TryGetIsSellOut(config,out remainNum) && IsMustBuyDay) if (!TryGetIsSellOut(config, out remainNum) && IsMustBuyDay) { return true; } @@ -1517,16 +1567,16 @@ { if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return; List<StoreData> storelist = TryGetStoreDatas((int)StoreFunc.BindStore); List<StoreData> storelist = TryGetStoreDatas(StoreFunc.BindStore); if (storelist == null) return; for(int i = 0; i < storelist.Count; i++) for (int i = 0; i < storelist.Count; i++) { var storeData = storelist[i]; ItemConfig itemConfig = ItemConfig.Get(storeData.storeConfig.ItemID); int type = 0; TryGetRedTypeByShopId(storeData.shopId, out type); if(type == 3) if (type == 3) { string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeData.shopId); int remainNum = 0; @@ -1578,7 +1628,7 @@ if (shopRedDict[storeConfig.ID].state == RedPointState.Simple) { shopRedDict[storeConfig.ID].state = RedPointState.None; LocalSave.SetBool(key,false); LocalSave.SetBool(key, false); } break; } @@ -1588,7 +1638,7 @@ { if (storeFuncType == StoreFunc.BindStore && storeFunc != StoreFunc.BindStore) { foreach(var key in shopRedDict.Keys) foreach (var key in shopRedDict.Keys) { StoreConfig storeConfig = StoreConfig.Get(key); ItemConfig itemConfig = ItemConfig.Get(storeConfig.ItemID); @@ -1604,7 +1654,7 @@ } break; } } } @@ -1644,7 +1694,7 @@ pushRefreshEvent(); } } if(!isLogin) if (!isLogin) { SetPushPetAndMountWinState(); } @@ -1660,14 +1710,14 @@ MapConfig curMapConfig = MapConfig.Get(PlayerDatas.Instance.baseData.MapID); if (curMapConfig == null || curMapConfig.MapFBType != 0) { SetPushPetAndMountWinState(true,true); SetPushPetAndMountWinState(true, true); } } private void GuidBegin() { PetAndMountPushWin pushWin = WindowCenter.Instance.Get<PetAndMountPushWin>(); if(pushWin != null) if (pushWin != null) { SetPushPetAndMountWinState(true, true); } @@ -1675,7 +1725,7 @@ private void OnMoveTopPart(bool isMove) { if(!isLogin) if (!isLogin) { SetPushPetAndMountWinState(!isMove); } @@ -1685,7 +1735,7 @@ { if (win is FirstTimeRechargeWin) { SetPushPetAndMountWinState(true,true); SetPushPetAndMountWinState(true, true); } } @@ -1693,11 +1743,11 @@ { if (isLogin) return; if(win is MainInterfaceWin) if (win is MainInterfaceWin) { SetPushPetAndMountWinState(true); } else if(win is RoleParticularsWin else if (win is RoleParticularsWin || win is FirstTimeRechargeWin) { SetPushPetAndMountWinState(); @@ -1706,14 +1756,14 @@ public void SetPushPetAndMountWinState(bool isMustClose = false, bool isClearData = false) { if(isClearData) if (isClearData) { ClearPushData(); WindowCenter.Instance.Close<PetAndMountPushWin>(); return; } if(CheckIsShowPush(isMustClose)) if (CheckIsShowPush(isMustClose)) { if (!WindowCenter.Instance.IsOpen<PetAndMountPushWin>()) { @@ -1736,7 +1786,7 @@ else { MapConfig curMapConfig = MapConfig.Get(PlayerDatas.Instance.baseData.MapID); if ((curMapConfig == null || curMapConfig.MapFBType != 0) || !WindowCenter.Instance.IsOpen<MainInterfaceWin>() || NewBieCenter.Instance.inGuiding @@ -1762,11 +1812,11 @@ public void RemovePetAndMountPush(int shopId) { if(petAndMountPushlist.Contains(shopId)) if (petAndMountPushlist.Contains(shopId)) { petAndMountPushlist.Remove(shopId); currentPushId = GetPrePetAndMountPushId(); if(pushRefreshEvent != null) if (pushRefreshEvent != null) { pushRefreshEvent(); } @@ -1780,7 +1830,7 @@ private int GetPrePetAndMountPushId() { currentPushId = 0; for(int i = petAndMountPushlist.Count - 1; i > -1; i--) for (int i = petAndMountPushlist.Count - 1; i > -1; i--) { currentPushId = petAndMountPushlist[i]; break; @@ -1793,7 +1843,7 @@ #region 处理跳转数据 public int funcOrder { get; private set; } public int jumpShopId { get; private set; } public void SetJumpModel(StoreFunc storeFunc,int shopId) public void SetJumpModel(StoreFunc storeFunc, int shopId) { if (shopId == 0) return; @@ -1811,7 +1861,7 @@ public enum StoreFunc { WeekStore = 1, //1:每周限购 MysteryStore = 1, //1:每周限购 CommonStore = 2, //2:常用道具 GrowStrongerStore = 3, //3:成长变强 BindStore = 4, //4:绑玉商城 System/Store/StoreUIBasic.cs
@@ -53,7 +53,7 @@ virtual protected void CreateShopItemCell(ScrollerController shopCtrl,int row) { shopCtrl.Refresh(); p_shopItemlist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); p_shopItemlist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); if (p_shopItemlist.Count > 0) { int i = 0; System/Store/StoreWin.cs
@@ -11,62 +11,35 @@ using Snxxz.UI; namespace Snxxz.UI { namespace Snxxz.UI { public class StoreWin : Window { #region 成员变量 [SerializeField] private FunctionButton _weekStoreTitle; [SerializeField] private FunctionButton _commonStoreTitle; [SerializeField] private FunctionButton _growStrongerStoreTitle; [SerializeField] private FunctionButton _bindStoreTitle; [SerializeField] private FunctionButton _integralStoreTitle; [SerializeField] private FunctionButtonGroup _funcBtnGroup; [SerializeField] FunctionButton m_WeekStoreTitle; [SerializeField] FunctionButton m_CommonStoreTitle; [SerializeField] FunctionButton m_GrowStrongerStoreTitle; [SerializeField] FunctionButton m_BindStoreTitle; [SerializeField] FunctionButton m_IntegralStoreTitle; [SerializeField] FunctionButtonGroup m_FuncBtnGroup; [SerializeField] Button m_LeftBtn; [SerializeField] Button m_RightBtn; [SerializeField] Button m_CloseBtn; [SerializeField] ScrollerController m_ShopCtrl; [SerializeField] GameObject m_FollowStoreBottom; [SerializeField] Text m_CoinsType1; [SerializeField] Text m_CoinsType2; [SerializeField] Text m_CoinsType3; [SerializeField] RectTransform m_RefreshContainer; [SerializeField] Button m_RefreshCommodities; [SerializeField] Text m_RefreshTimeText; [SerializeField] GameObject m_IntegralBottom; [SerializeField] Button m_AssistBtn; [SerializeField] private Button _leftBtn; StoreModel model { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } [SerializeField] private Button _rightBtn; [SerializeField] private Button _closeBtn; [SerializeField] private ScrollerController _shopCtrl; [SerializeField] private GameObject _followStoreBottom; [SerializeField] private Text _coinsType1; [SerializeField] private Text _coinsType2; [SerializeField] private Text _resetRefreshTimeText; [SerializeField] private GameObject _integralBottom; [SerializeField] private Text _coinsType3; [SerializeField] Button assistBtn; #endregion StoreModel _storeModel; StoreModel m_storeModel { get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } private List<StoreModel.StoreData> _tagStoreModellist; private FuncConfigConfig _tagFuncModel1; private FuncConfigConfig _tagFuncModel2; private List<StoreModel.StoreData> commodities; private int shopId = 0; #region Built-in protected override void BindController() { @@ -74,63 +47,65 @@ protected override void AddListeners() { _shopCtrl.OnRefreshCell += RefreshShopCell; _shopCtrl.lockType = EnhanceLockType.KeepVertical; m_ShopCtrl.OnRefreshCell += RefreshShopCell; m_ShopCtrl.lockType = EnhanceLockType.KeepVertical; _weekStoreTitle.onClick.AddListener(()=> { OnClickWeekStore(); }); _commonStoreTitle.onClick.AddListener(()=> { OnClickCommonStore();}); _growStrongerStoreTitle.onClick.AddListener(()=>{ OnClickStrengthStore();}); _bindStoreTitle.onClick.AddListener(()=> { OnClickBindStore(); }); _integralStoreTitle.onClick.AddListener(()=> { OnClickIntegralStore(); }); _leftBtn.onClick.AddListener(OnClickLeftBtn); _rightBtn.onClick.AddListener(OnClickRightBtn); _closeBtn.onClick.AddListener(OnClickClose); assistBtn.AddListener(ClickAssistBtn); m_WeekStoreTitle.SetListener(OpenMysteryStore); m_CommonStoreTitle.SetListener(OpenCommonStore); m_GrowStrongerStoreTitle.SetListener(OpenStrengthStore); m_BindStoreTitle.SetListener(OpenBindGoldStore); m_IntegralStoreTitle.SetListener(OpenIntegralStore); m_AssistBtn.SetListener(ViewAssistRecorders); m_RefreshCommodities.SetListener(RefreshCommondities); m_LeftBtn.SetListener(() => { m_FuncBtnGroup.TriggerLast(); }); m_RightBtn.SetListener(() => { m_FuncBtnGroup.TriggerNext(); }); m_CloseBtn.SetListener(() => { CloseImmediately(); }); } protected override void OnPreOpen() { shopId = 0; m_storeModel.RefreshTCBPlayerDataEvent += OnRefreshPlayerInfo; m_storeModel.RefreshBuyShopLimitEvent += OnCreate; model.RefreshTCBPlayerDataEvent += OnRefreshPlayerInfo; model.RefreshBuyShopLimitEvent += OnCreate; GlobalTimeEvent.Instance.secondEvent += UpdateRefreshTime; RefreshCoins(); RefreshResetTime(); m_storeModel.SetPushPetAndMountWinState(true,true); UpdateRefreshTime(); model.SetPushPetAndMountWinState(true, true); } protected override void OnActived() { base.OnActived(); if(!WindowJumpMgr.Instance.IsJumpState && functionOrder == 0) if (!WindowJumpMgr.Instance.IsJumpState && functionOrder == 0) { if(m_storeModel.storeFunc1Point.state == RedPointState.Simple) if (model.storeFunc1Point.state == RedPointState.Simple) { functionOrder = _weekStoreTitle.order; functionOrder = m_WeekStoreTitle.order; } else if(m_storeModel.storeFunc2Point.state == RedPointState.Simple) else if (model.storeFunc2Point.state == RedPointState.Simple) { functionOrder = _commonStoreTitle.order; functionOrder = m_CommonStoreTitle.order; } else if (m_storeModel.storeFunc3Point.state == RedPointState.Simple) else if (model.storeFunc3Point.state == RedPointState.Simple) { functionOrder = _growStrongerStoreTitle.order; functionOrder = m_GrowStrongerStoreTitle.order; } else if (m_storeModel.storeFunc4Point.state == RedPointState.Simple) else if (model.storeFunc4Point.state == RedPointState.Simple) { functionOrder = _bindStoreTitle.order; functionOrder = m_BindStoreTitle.order; } else if (m_storeModel.storeFunc5Point.state == RedPointState.Simple) else if (model.storeFunc5Point.state == RedPointState.Simple) { functionOrder = _integralStoreTitle.order; functionOrder = m_IntegralStoreTitle.order; } } if(!WindowJumpMgr.Instance.IsJumpState && m_storeModel.funcOrder != -1) if (!WindowJumpMgr.Instance.IsJumpState && model.funcOrder != -1) { functionOrder = m_storeModel.funcOrder; functionOrder = model.funcOrder; } _funcBtnGroup.TriggerByOrder(functionOrder); GlobalTimeEvent.Instance.secondEvent += RefreshResetTime; m_FuncBtnGroup.TriggerByOrder(functionOrder); } protected override void OnAfterOpen() @@ -140,12 +115,11 @@ protected override void OnPreClose() { m_storeModel.CloseAllRedpoint(StoreFunc.WeekStore); m_storeModel.storeFuncType = StoreFunc.WeekStore; m_storeModel.RefreshBuyShopLimitEvent -= OnCreate; GlobalTimeEvent.Instance.secondEvent -= RefreshResetTime; m_storeModel.RefreshTCBPlayerDataEvent -= OnRefreshPlayerInfo; model.CloseAllRedpoint(StoreFunc.MysteryStore); model.storeFuncType = StoreFunc.MysteryStore; model.RefreshBuyShopLimitEvent -= OnCreate; GlobalTimeEvent.Instance.secondEvent -= UpdateRefreshTime; model.RefreshTCBPlayerDataEvent -= OnRefreshPlayerInfo; } protected override void OnAfterClose() @@ -161,21 +135,21 @@ { if (AchievementGoto.guideAchievementId != 0) { SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId); if(successConfig.Type == 97) var successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId); if (successConfig.Type == 97) { _tagStoreModellist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); commodities = model.TryGetStoreDatas(model.storeFuncType); List<StoreModel.StoreData> orderlist = new List<StoreModel.StoreData>(); orderlist.AddRange(_tagStoreModellist); orderlist.AddRange(commodities); orderlist.Sort(CompareByMoney); for (int i = 0; i < _tagStoreModellist.Count; i++) for (int i = 0; i < commodities.Count; i++) { if (_tagStoreModellist[i].shopId == orderlist[0].shopId) if (commodities[i].shopId == orderlist[0].shopId) { shopId = _tagStoreModellist[i].shopId; shopId = commodities[i].shopId; int index = i / 2; _shopCtrl.JumpIndex(index); _shopCtrl.m_Scorller.RefreshActiveCellViews(); m_ShopCtrl.JumpIndex(index); m_ShopCtrl.m_Scorller.RefreshActiveCellViews(); break; } } @@ -184,144 +158,159 @@ } else { if(m_storeModel.jumpShopId != 0) if (model.jumpShopId != 0) { _tagStoreModellist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); for (int i = 0; i < _tagStoreModellist.Count; i++) commodities = model.TryGetStoreDatas(model.storeFuncType); for (int i = 0; i < commodities.Count; i++) { if (_tagStoreModellist[i].shopId == m_storeModel.jumpShopId) if (commodities[i].shopId == model.jumpShopId) { shopId = _tagStoreModellist[i].shopId; int index = i / 2 ; _shopCtrl.JumpIndex(index > 2 ? index - 1 : index); _shopCtrl.m_Scorller.RefreshActiveCellViews(); shopId = commodities[i].shopId; int index = i / 2; m_ShopCtrl.JumpIndex(index > 2 ? index - 1 : index); m_ShopCtrl.m_Scorller.RefreshActiveCellViews(); break; } } m_storeModel.ClearJumpModel(); model.ClearJumpModel(); } } } private void RefreshResetTime() private void UpdateRefreshTime() { if(_tagStoreModellist == null || _tagStoreModellist.Count < 1) if (commodities == null || commodities.Count < 1) { _tagStoreModellist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); commodities = model.TryGetStoreDatas(model.storeFuncType); } if(_tagStoreModellist.Count > 0) if (commodities == null || commodities.Count == 0) { if (_tagStoreModellist[0].storeConfig.RefreshType == 0) { _resetRefreshTimeText.gameObject.SetActive(false); } else { _resetRefreshTimeText.gameObject.SetActive(true); _resetRefreshTimeText.text = m_storeModel.GetStoreRefreshTimeByType(_tagStoreModellist[0].storeConfig.RefreshType); } return; } var refreshType = commodities[0].storeConfig.RefreshType; if (refreshType == 0) { m_RefreshContainer.gameObject.SetActive(false); } else { m_RefreshCommodities.gameObject.SetActive(model.storeFuncType == StoreFunc.MysteryStore); m_RefreshContainer.gameObject.SetActive(true); m_RefreshTimeText.text = model.GetStoreRefreshTimeByType(refreshType); } } public int CompareByMoney(StoreModel.StoreData start, StoreModel.StoreData end) int CompareByMoney(StoreModel.StoreData start, StoreModel.StoreData end) { int money1 = start.storeConfig.MoneyNumber; int money2 = end.storeConfig.MoneyNumber; if (money1.CompareTo(money2) != 0) return money1.CompareTo(money2); int index1 = _tagStoreModellist.IndexOf(start); int index2 = _tagStoreModellist.IndexOf(end); if (index1.CompareTo(index2) != 0) return index1.CompareTo(index2); if (money1 != money2) { return money1.CompareTo(money2); } int index1 = commodities.IndexOf(start); int index2 = commodities.IndexOf(end); if (index1 != index2) { return index1.CompareTo(index2); } return 0; } private void RefreshUI() { if (_tagStoreModellist.Count < 1) return; if(m_storeModel.showCoinsUIDict != null && m_storeModel.showCoinsUIDict.ContainsKey(_tagStoreModellist[0].storeConfig.ShopType)) if (commodities.Count < 1) { if(m_storeModel.showCoinsUIDict[_tagStoreModellist[0].storeConfig.ShopType] == 1) { _followStoreBottom.gameObject.SetActive(true); _integralBottom.gameObject.SetActive(false); } else if(m_storeModel.showCoinsUIDict[_tagStoreModellist[0].storeConfig.ShopType] == 2) { _followStoreBottom.gameObject.SetActive(false); _integralBottom.gameObject.SetActive(true); } return; } var shopType = commodities[0].storeConfig.ShopType; if (model.showCoinsUIDict != null && model.showCoinsUIDict.ContainsKey(shopType)) { if (model.showCoinsUIDict[shopType] == 1) { m_FollowStoreBottom.gameObject.SetActive(true); m_IntegralBottom.gameObject.SetActive(false); } else if (model.showCoinsUIDict[shopType] == 2) { m_FollowStoreBottom.gameObject.SetActive(false); m_IntegralBottom.gameObject.SetActive(true); } } } public void RefreshCoins() { _coinsType1.text = UIHelper.GetMoneyCnt(1).ToString(); _coinsType2.text = UIHelper.GetMoneyCnt(2).ToString(); _coinsType3.text = UIHelper.ReplaceXianYuanCoinsNum(UIHelper.GetMoneyCnt(17)); m_CoinsType1.text = UIHelper.GetMoneyCnt(1).ToString(); m_CoinsType2.text = UIHelper.GetMoneyCnt(2).ToString(); m_CoinsType3.text = UIHelper.ReplaceXianYuanCoinsNum(UIHelper.GetMoneyCnt(17)); } private void OnCreate() { shopId = 0; _tagStoreModellist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); _shopCtrl.Refresh(); if (_tagStoreModellist.Count > 0) commodities = model.TryGetStoreDatas(model.storeFuncType); m_ShopCtrl.Refresh(); if (commodities.Count > 0) { int i = 0; int remain = _tagStoreModellist.Count % 2; int line = (int)_tagStoreModellist.Count / 2; int remain = commodities.Count % 2; int line = (int)commodities.Count / 2; if (remain > 0) { line += 1; } for (i = 0; i < line; i++) for (var i = 0; i < line; i++) { _shopCtrl.AddCell(ScrollerDataType.Header, i); m_ShopCtrl.AddCell(ScrollerDataType.Header, i); } } _shopCtrl.Restart(); _shopCtrl.JumpIndex(0); m_ShopCtrl.Restart(); m_ShopCtrl.JumpIndex(0); RefreshUI(); } private void OnRefreshPlayerInfo(PlayerDataRefresh refreshType) { if (refreshType == PlayerDataRefresh.VIPLv) OnCreate(); else if (refreshType == PlayerDataRefresh.Gold) RefreshCoins(); else if (refreshType == PlayerDataRefresh.GoldPaper) RefreshCoins(); else if(refreshType == PlayerDataRefresh.FBHelpPoint) RefreshCoins(); switch (refreshType) { case PlayerDataRefresh.VIPLv: OnCreate(); break; case PlayerDataRefresh.Gold: case PlayerDataRefresh.GoldPaper: case PlayerDataRefresh.FBHelpPoint: RefreshCoins(); break; default: break; } } private void RefreshShopCell(ScrollerDataType type, CellView cell) { int childCode = 0; for (childCode = 0; childCode < cell.transform.childCount; childCode++) for (var i = 0; i < cell.transform.childCount; i++) { int cellCount = (cell.transform.childCount) * cell.index + (childCode + 1); ShopItemCell shopItemCell = cell.transform.GetChild(childCode).GetComponent<ShopItemCell>(); if(shopItemCell == null) var cellCount = (cell.transform.childCount) * cell.index + (i + 1); var shopItemCell = cell.transform.GetChild(i).GetComponent<ShopItemCell>(); if (shopItemCell == null) { shopItemCell = cell.transform.GetChild(childCode).gameObject.AddComponent<ShopItemCell>(); shopItemCell = cell.transform.GetChild(i).gameObject.AddComponent<ShopItemCell>(); } if (_tagStoreModellist.Count >= cellCount) if (commodities.Count >= cellCount) { StoreConfig shopInfo = _tagStoreModellist[cellCount - 1].storeConfig; if(m_storeModel.shopRedDict.ContainsKey(shopInfo.ID)) StoreConfig shopInfo = commodities[cellCount - 1].storeConfig; if (model.shopRedDict.ContainsKey(shopInfo.ID)) { shopItemCell.redpoint.redpointId = m_storeModel.shopRedDict[shopInfo.ID].id; shopItemCell.redpoint.redpointId = model.shopRedDict[shopInfo.ID].id; } cell.transform.GetChild(childCode).gameObject.SetActive(true); cell.transform.GetChild(i).gameObject.SetActive(true); if (shopInfo.SalesStatus.Trim() != "") { shopItemCell.stateImage.gameObject.SetActive(true); @@ -333,12 +322,12 @@ shopItemCell.stateImage.gameObject.SetActive(false); } ItemConfig chinModel = ItemConfig.Get(m_storeModel.GetReplaceId(shopInfo.ID,shopInfo.ItemID)); if(chinModel != null) var config = ItemConfig.Get(model.GetReplaceId(shopInfo.ID, shopInfo.ItemID)); if (config != null) { ItemCellModel cellModel = new ItemCellModel(chinModel.ID,true,0,shopInfo.IsBind,"",PackType.Deleted,true); ItemCellModel cellModel = new ItemCellModel(config.ID, true, 0, shopInfo.IsBind, "", PackType.Deleted, true); shopItemCell.itemCell.Init(cellModel); shopItemCell.itemNameText.text = chinModel.ItemName; shopItemCell.itemNameText.text = config.ItemName; shopItemCell.coinsIcon.SetIconWithMoneyType(shopInfo.MoneyType); ulong shopCost = (ulong)(shopInfo.MoneyNumber); shopItemCell.coinNumText.text = UIHelper.ReplaceLargeNum(shopCost); @@ -348,18 +337,18 @@ bool isVipBuy = buyItem.CheckIsVipBuy(shopInfo, out curVipIndex, out nextVipIndex); int canBuyCnt = 0; int addBuyCnt = 0; bool isLimitBuy = buyItem.CheckIsLimitBuyCnt(shopInfo,out canBuyCnt,out addBuyCnt); bool isLimitBuy = buyItem.CheckIsLimitBuyCnt(shopInfo, out canBuyCnt, out addBuyCnt); bool isShowBuyPrice = true; if(isVipBuy) if (isVipBuy) { if(curVipIndex == -1 && nextVipIndex != -1) if (curVipIndex == -1 && nextVipIndex != -1) { shopItemCell.coinsIcon.gameObject.SetActive(false); shopItemCell.vipText.gameObject.SetActive(true); shopItemCell.vipText.text = Language.Get("StoreWin101", shopInfo.VIPLV[nextVipIndex]); shopItemCell.sellImage.gameObject.SetActive(false); shopItemCell.itemNameText.color = UIHelper.GetUIColor(TextColType.Red,true); shopItemCell.vipText.color = UIHelper.GetUIColor(TextColType.Red,true); shopItemCell.itemNameText.color = UIHelper.GetUIColor(TextColType.Red, true); shopItemCell.vipText.color = UIHelper.GetUIColor(TextColType.Red, true); isShowBuyPrice = false; } } @@ -374,7 +363,7 @@ if (canBuyCnt > 0) { shopItemCell.itemCell.countText.gameObject.SetActive(true); BuyShopItemLimit shopItemLimit = m_storeModel.GetBuyShopLimit((uint)shopInfo.ID); BuyShopItemLimit shopItemLimit = model.GetBuyShopLimit((uint)shopInfo.ID); int remainNum = canBuyCnt; if (shopItemLimit != null) { @@ -383,111 +372,99 @@ if (remainNum > 0) { shopItemCell.itemCell.countText.text = StringUtility.Contact(remainNum.ToString(), "/" + canBuyCnt.ToString()); shopItemCell.itemCell.countText.text = StringUtility.Contact(remainNum, "/" + canBuyCnt); shopItemCell.sellImage.gameObject.SetActive(false); } else { shopItemCell.itemCell.countText.text = StringUtility.Contact(UIHelper.AppendStringColor(TextColType.Red, remainNum.ToString()), "/" + canBuyCnt.ToString()); var remainNumDescription = UIHelper.AppendStringColor(TextColType.Red, remainNum.ToString()); shopItemCell.itemCell.countText.text = StringUtility.Contact(remainNumDescription, "/", canBuyCnt); shopItemCell.sellImage.gameObject.SetActive(true); shopItemCell.stateImage.gameObject.SetActive(false); } } shopItemCell.itemNameText.color = UIHelper.GetUIColor(chinModel.ItemColor,true); shopItemCell.vipText.color = UIHelper.GetUIColor(TextColType.Black,true); shopItemCell.itemNameText.color = UIHelper.GetUIColor(config.ItemColor, true); shopItemCell.vipText.color = UIHelper.GetUIColor(TextColType.Black, true); } shopItemCell.LoadGuidEffectCtrl(shopInfo.ID, shopId); } shopItemCell.ShopCellBtn.RemoveAllListeners(); shopItemCell.ShopCellBtn.AddListener(()=> { if(shopInfo.ID == shopId) shopItemCell.ShopCellBtn.AddListener(() => { if (shopInfo.ID == shopId) { shopId = 0; shopItemCell.LoadGuidEffectCtrl(shopInfo.ID, shopId); } m_storeModel.CloseRedPoint(shopInfo); m_storeModel.OnClickShopCell(shopInfo); model.CloseRedPoint(shopInfo); model.OnClickShopCell(shopInfo); }); } else { cell.transform.GetChild(childCode).gameObject.SetActive(false); cell.transform.GetChild(i).gameObject.SetActive(false); } } } #region 点击事件 private void OnClickIntegralStore() private void OpenIntegralStore() { m_storeModel.CloseAllRedpoint(StoreFunc.IntegralStore); m_storeModel.storeFuncType = StoreFunc.IntegralStore; model.CloseAllRedpoint(StoreFunc.IntegralStore); model.storeFuncType = StoreFunc.IntegralStore; OnCreate(); RefreshResetTime(); functionOrder = _integralStoreTitle.order; UpdateRefreshTime(); functionOrder = m_IntegralStoreTitle.order; } private void OnClickBindStore() private void OpenBindGoldStore() { m_storeModel.CloseAllRedpoint(StoreFunc.BindStore); m_storeModel.storeFuncType = StoreFunc.BindStore; model.CloseAllRedpoint(StoreFunc.BindStore); model.storeFuncType = StoreFunc.BindStore; OnCreate(); RefreshResetTime(); functionOrder = _bindStoreTitle.order; UpdateRefreshTime(); functionOrder = m_BindStoreTitle.order; } private void OnClickStrengthStore() private void OpenStrengthStore() { m_storeModel.CloseAllRedpoint(StoreFunc.GrowStrongerStore); m_storeModel.storeFuncType = StoreFunc.GrowStrongerStore; model.CloseAllRedpoint(StoreFunc.GrowStrongerStore); model.storeFuncType = StoreFunc.GrowStrongerStore; OnCreate(); RefreshResetTime(); functionOrder = _growStrongerStoreTitle.order; UpdateRefreshTime(); functionOrder = m_GrowStrongerStoreTitle.order; } private void OnClickCommonStore() private void OpenCommonStore() { m_storeModel.CloseAllRedpoint(StoreFunc.CommonStore); m_storeModel.storeFuncType = StoreFunc.CommonStore; model.CloseAllRedpoint(StoreFunc.CommonStore); model.storeFuncType = StoreFunc.CommonStore; OnCreate(); RefreshResetTime(); functionOrder = _commonStoreTitle.order; UpdateRefreshTime(); functionOrder = m_CommonStoreTitle.order; } private void OnClickWeekStore() private void OpenMysteryStore() { m_storeModel.CloseAllRedpoint(StoreFunc.WeekStore); m_storeModel.storeFuncType = StoreFunc.WeekStore; model.CloseAllRedpoint(StoreFunc.MysteryStore); model.storeFuncType = StoreFunc.MysteryStore; OnCreate(); RefreshResetTime(); functionOrder = _weekStoreTitle.order; UpdateRefreshTime(); functionOrder = m_WeekStoreTitle.order; } private void OnClickRightBtn() { _funcBtnGroup.TriggerNext(); } private void OnClickLeftBtn() { _funcBtnGroup.TriggerLast(); } private void OnClickClose() { CloseImmediately(); } private void ClickAssistBtn() private void ViewAssistRecorders() { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.DungeonAssitCheckIn); } #endregion private void RefreshCommondities() { model.RefreshMysteryShop(); } } } System/Store/UnionStoreWin.cs
@@ -107,7 +107,7 @@ SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId); if (successConfig.Type == 97) { p_shopItemlist = m_storeModel.TryGetStoreDatas((int)m_storeModel.storeFuncType); p_shopItemlist = m_storeModel.TryGetStoreDatas(m_storeModel.storeFuncType); List<StoreModel.StoreData> orderlist = new List<StoreModel.StoreData>(); orderlist.AddRange(p_shopItemlist); orderlist.Sort(CompareByMoney);