using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
|
public class DungeonLiquidModel : Model
|
{
|
public Dictionary<int, Dictionary<int, StoreConfig>> liquidStoreDict = new Dictionary<int, Dictionary<int, StoreConfig>>();
|
public List<ItemModel> liquidItemList = new List<ItemModel>();
|
public List<int> liquidItems = new List<int>();
|
public List<StoreConfig> liquidStoreConfigs = new List<StoreConfig>();
|
|
public bool IsBagHasLiquid { get; set; }
|
|
public override void Init()
|
{
|
ParseConfig();
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
void ParseConfig()
|
{
|
FuncConfigConfig funcConfig = FuncConfigConfig.Get("BuyExpLiquidCondition");
|
liquidItems.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical3));
|
//liquidItems.Sort(Compare);
|
var _moneyTypes = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
|
var _moneyTypeList = new List<int>(_moneyTypes);
|
var _shopTypes = new List<int>(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1));
|
//_moneyTypeList.Sort((int x, int y) =>
|
//{
|
// return -x.CompareTo(y);
|
//});
|
for (int i = 0; i < liquidItems.Count; i++)
|
{
|
Dictionary<int, StoreConfig> _dict;
|
if (!liquidStoreDict.TryGetValue(liquidItems[i], out _dict))
|
{
|
_dict = new Dictionary<int, StoreConfig>();
|
liquidStoreDict.Add(liquidItems[i], _dict);
|
}
|
for (int j = 0; j < _shopTypes.Count; j++)
|
{
|
for (int k = 0; k < _moneyTypeList.Count; k++)
|
{
|
var config = StoreConfig.GetStoreCfg(liquidItems[i], _moneyTypeList[k], _shopTypes[j]);
|
if (config != null)
|
{
|
if (!_dict.ContainsKey(_moneyTypeList[k]))
|
{
|
_dict.Add(_moneyTypeList[k], config);
|
}
|
}
|
}
|
}
|
}
|
}
|
|
int Compare(int x, int y)
|
{
|
return -x.CompareTo(y);
|
}
|
}
|
}
|
|
|