From 862ef8b6cc1ccc7993d3dcd5c1cf0799ec12a752 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 25 二月 2019 18:06:10 +0800
Subject: [PATCH] 6255 【前端】【2.0】神秘商店开发
---
System/Store/StoreModel.cs | 336 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 193 insertions(+), 143 deletions(-)
diff --git a/System/Store/StoreModel.cs b/System/Store/StoreModel.cs
index bb04e59..9bea9d5 100644
--- a/System/Store/StoreModel.cs
+++ b/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 瑙f瀽鏈湴鏁版嵁
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锛氱粦鐜夊晢鍩�
--
Gitblit v1.8.0