| | |
| | | /// </summary>
|
| | | /// <param name="model"></param>
|
| | | /// <param name="isCompare"></param>
|
| | | public virtual void Init(ItemModel model, bool isCompare = false, int compareScore = 0)
|
| | | public virtual void Init(ItemModel model, bool isCompare = false)
|
| | | {
|
| | | itemConfig = model.config;
|
| | | InitUI(model.guid, model.itemId, (ulong)model.count, model.equipScore, model.isAuction, model.packType, isCompare, model.useDataDict, compareScore);
|
| | | InitUI(model.guid, model.itemId, (ulong)model.count, model.equipScore, model.isAuction, model.packType, isCompare, model.useDataDict);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化数据(预览)
|
| | | /// </summary>
|
| | | /// <param name="model"></param>
|
| | | public virtual void Init(ItemCellModel model, int compareScore = 0)
|
| | | public virtual void Init(ItemCellModel model)
|
| | | {
|
| | | itemConfig = model.itemConfig;
|
| | | InitUI(model.guid, model.itemId, model.count, model.score, false, model.packType, model.isCompare, model.useDataDic, compareScore);
|
| | | InitUI(model.guid, model.itemId, model.count, model.score, false, model.packType, model.isCompare, model.useDataDic);
|
| | | }
|
| | |
|
| | | private void InitUI(string guid, int itemId, ulong count, int score, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic, int compareScore = 0)
|
| | | private void InitUI(string guid, int itemId, ulong count, int score, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
|
| | | {
|
| | | if (itemConfig == null) return;
|
| | |
|
| | |
| | | countText.text = UIHelper.ReplaceLargeNum((double)count);
|
| | | }
|
| | |
|
| | | int compareReslut = Compare(type, itemId, score, isCompare, compareScore, guid);
|
| | | var compareReslut = isCompare ? Compare(type, itemId, score, guid) : 0;
|
| | | switch (compareReslut)
|
| | | {
|
| | | case -1:
|
| | | stateIcon.gameObject.SetActive(true);
|
| | | stateIcon.SetSprite("EquipDownIcon");
|
| | | break;
|
| | | case 0:
|
| | | stateIcon.gameObject.SetActive(false);
|
| | | break;
|
| | | case 1:
|
| | | stateIcon.gameObject.SetActive(true);
|
| | | stateIcon.SetSprite("EquipForbidIcon");
|
| | | break;
|
| | | case 2:
|
| | | stateIcon.gameObject.SetActive(true);
|
| | | stateIcon.SetSprite("EquipUpIcon");
|
| | | break;
|
| | | case 3:
|
| | | case 99:
|
| | | stateIcon.gameObject.SetActive(true);
|
| | | stateIcon.SetSprite("EquipDownIcon");
|
| | | stateIcon.SetSprite("EquipForbidIcon");
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 0 不比较 1 禁止比较 2 高评分 3 低评分
|
| | | /// 0 相等 99 禁止比较 1 高评分 -1 低评分
|
| | | /// </summary>
|
| | | /// <param name="itemId"></param>
|
| | | /// <param name="score"></param>
|
| | | /// <param name="isCompare"></param>
|
| | | /// <param name="compareSocre"></param>
|
| | | /// <returns></returns>
|
| | | int Compare(PackType type, int itemId, int score, bool isCompare, int compareSocre, string guid)
|
| | | int Compare(PackType type, int itemId, int score, string guid)
|
| | | {
|
| | | if (!isCompare && compareSocre == 0)
|
| | | if (type == PackType.Equip || type == PackType.DogzEquip)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | if (score == compareSocre && compareSocre != 0)
|
| | | if (!ItemLogicUtility.Instance.IsJobCompatibleItem(itemId))
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | if (compareSocre <= 0 && (type == PackType.Equip || type == PackType.DogzEquip))
|
| | | {
|
| | | return 0;
|
| | | return 99;
|
| | | }
|
| | |
|
| | | var config = ItemConfig.Get(itemId);
|
| | |
| | | }
|
| | |
|
| | | var item = packModel.GetItemByGuid(guid);
|
| | | if (item != null && item.isAuction)
|
| | | {
|
| | | return 99;
|
| | | }
|
| | |
|
| | | if (item != null && ItemLogicUtility.Instance.IsOverdue(guid, itemId, item.useDataDict))
|
| | | {
|
| | | return 1;
|
| | | return 99;
|
| | | }
|
| | |
|
| | | if (!ItemLogicUtility.Instance.IsJobCompatibleItem(itemId))
|
| | | {
|
| | | return 1;
|
| | | }
|
| | |
|
| | | if (isCompare)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case PackType.DogzItem:
|
| | | compareSocre = GetCurrentEquipSocre(PackType.DogzEquip, config.EquipPlace);
|
| | | break;
|
| | | default:
|
| | | var result = equipModel.CompareToCurrent(guid);
|
| | | if (result == 0)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | else if (result > 0)
|
| | | {
|
| | | return 2;
|
| | | }
|
| | | else
|
| | | {
|
| | | return 3;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (score == compareSocre)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | return score > compareSocre ? 2 : 3;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | int GetCurrentEquipSocre(PackType type, int equipPlace)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case PackType.DogzEquip:
|
| | | var dogzModel = ModelCenter.Instance.GetModel<DogzModel>();
|
| | | ItemModel putOnModel = null;
|
| | | dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, equipPlace, out putOnModel);
|
| | | return putOnModel == null ? 0 : putOnModel.equipScore;
|
| | | case PackType.DogzItem:
|
| | | var compareSocre = GetDogzEquipSocre(config.EquipPlace);
|
| | | return score.CompareTo(compareSocre);
|
| | | default:
|
| | | ItemModel model = packModel.GetItemByIndex(type, equipPlace);
|
| | | return model == null ? 0 : model.equipScore;
|
| | | return equipModel.CompareToCurrent(guid);
|
| | | }
|
| | | }
|
| | |
|
| | | int GetDogzEquipSocre(int equipPlace)
|
| | | {
|
| | | var dogzModel = ModelCenter.Instance.GetModel<DogzModel>();
|
| | | ItemModel putOnModel = null;
|
| | | dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, equipPlace, out putOnModel);
|
| | | return putOnModel == null ? 0 : putOnModel.equipScore;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public class ItemCellModel
|