| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | |
|
| | | public class ItemModel
|
| | |
| | |
|
| | | public ItemConfig config { get; private set; }
|
| | | public ItemInfo itemInfo { get; private set; }
|
| | | public int score { get; private set; }
|
| | | private int score;
|
| | | public Dictionary<int, List<int>> useDataDict { get; private set; }
|
| | |
|
| | | public string guid { get { return itemInfo == null ? string.Empty : itemInfo.guid; } }
|
| | |
| | |
|
| | | itemInfo = info;
|
| | | config = ItemConfig.Get(info.itemId);
|
| | | if (config == null)
|
| | | {
|
| | | Debug.LogErrorFormat("ItemConfig.Get({0}) is null", info.itemId);
|
| | | return;
|
| | | }
|
| | | useDataDict = ConfigParse.Analysis(info.userData);
|
| | |
|
| | | var customCount = GetUseDataFirstValue((int)ItemUseDataKey.itemCount);
|
| | |
| | | useDataDict.TryGetValue(key, out list);
|
| | | }
|
| | |
|
| | | return list;
|
| | | return list == null ? new List<int>() : list;
|
| | | }
|
| | |
|
| | | public int GetUseDataFirstValue(int key)
|
| | |
| | |
|
| | | public string guid; //物品的实例ID
|
| | | public int gearScore; //评分
|
| | | public bool isLock; //是否锁定
|
| | |
|
| | | public ItemInfo()
|
| | | {
|
| | |
| | | {
|
| | | itemId = (int)serverItem.ItemID;
|
| | | index = serverItem.ItemPlace;
|
| | | count = serverItem.ItemCount;
|
| | | count = (int)serverItem.ItemCount;
|
| | | remainHour = (int)serverItem.RemainHour;
|
| | | userData = serverItem.UserData;
|
| | | guid = serverItem.ItemGUID;
|
| | | userData = serverItem.UserData.Trim().Replace("\0", "");
|
| | | guid = serverItem.ItemGUID.Trim().Replace("\0", "");
|
| | | isAuction = serverItem.IsBind;
|
| | | gearScore = (int)serverItem.GearScore;
|
| | | isLock = serverItem.IsLocked > 0;
|
| | | }
|
| | |
|
| | | public ItemInfo(H0704_tagRolePackRefresh serverItem)
|
| | | {
|
| | | itemId = (int)serverItem.ItemID;
|
| | | index = serverItem.ItemPlace;
|
| | | count = serverItem.ItemCount;
|
| | | count = (int)serverItem.ItemCount;
|
| | | remainHour = (int)serverItem.RemainHour;
|
| | | userData = serverItem.UserData;
|
| | | guid = serverItem.ItemGUID;
|
| | | //字符串后面有空字符问题,经常会导致不可预料的bug
|
| | | userData = serverItem.UserData.Trim().Replace("\0", "");
|
| | | guid = serverItem.ItemGUID.Trim().Replace("\0", "");
|
| | | isAuction = serverItem.IsBind;
|
| | | gearScore = (int)serverItem.GearScore;
|
| | | isLock = serverItem.IsLocked > 0;
|
| | | }
|
| | |
|
| | | }
|