protected override void OnUnityAwake() { itemDataMngTraverse = new Traverse(OcItemDataMng.Inst); itemList = itemDataMngTraverse.Field <SoItemDataList>("SoItemDataList").Value; itemListTraverse = new Traverse(itemList); allItems = new CachedTraverse <ItemData[]>(itemListTraverse.Field("all")); allItems.Changed += updateLastItemId; familyList = itemDataMngTraverse.Field <SoItemFamilyList>("SoItemFamilyList").Value; familyListTraverse = new Traverse(familyList); allFamilies = new CachedTraverse <SoItemFamily[]>(familyListTraverse.Field("all")); allFamilies.Changed += updateLastFamilyId; DefaultHandler = itemListTraverse.Field <ItemHandlerSO>("defaultHandler").Value; EquipHandler = itemListTraverse.Field <ItemHandlerSO>("equipHandler").Value; PotionHandler = itemListTraverse.Field <ItemHandlerSO>("potionHandler").Value; SkillHandler = itemListTraverse.Field <ItemHandlerSO>("skillHandler").Value; BreedSeedHandler = itemListTraverse.Field <ItemHandlerSO>("breedSeedHandler").Value; UseActHandler = itemListTraverse.Field <ItemHandlerSO>("useActHandler").Value; }
private void updateLastFamilyId(CachedTraverse <SoItemFamily[]> sender, SoItemFamily[] oldValue, SoItemFamily[] newValue) { lastFamilyId = Math.Max(lastFamilyId, newValue.Select(item => item.FamilyId).Max()); }
private void updateLastItemId(CachedTraverse <ItemData[]> sender, ItemData[] oldValue, ItemData[] newValue) { lastId = Math.Max(lastId, newValue.Select(item => item.Id).Max()); }