// PRAGMA MARK - Static public static ILootReward[] SelectRewardsForLootDropGroupId(int lootDropGroupId) { List <ILootReward> rewards = new List <ILootReward>(); LootDropGroup dropGroup = IdList <LootDropGroup> .Instance.LoadById(lootDropGroupId); int selectedLootDropId = WeightedSelectionUtil.SelectWeightedObject(dropGroup.dropList).lootDropId; IIdList <LootDrop> lootDropList = ListFactory <LootDrop> .Instance.GetList(); LootDrop selectedLootDrop = lootDropList.LoadById(selectedLootDropId); if (selectedLootDrop == null) { Debug.LogError("SelectRewardsForLootDropGroupId: failed to select lootDrop with group id: " + lootDropGroupId); return(null); } foreach (int rewardedLootDropGroupId in selectedLootDrop.rewardedLootDropGroupIds) { rewards.AddRange(LootManager.SelectRewardsForLootDropGroupId(rewardedLootDropGroupId)); } rewards.AddRange(selectedLootDrop.RewardedLootRewards); return(rewards.ToArray()); }
private static void DrawListField(Rect contentRect, SerializedProperty property) { IIdList <TEntity> list = ListFactory <TEntity> .Instance.GetList(); if (list == null) { list = IdList <TEntity> .Instance; } if (list == null) { EditorGUI.LabelField(contentRect, IdList <TEntity> .ListName() + " instance not found!"); } else { List <string> displayedOptions = new List <string>(); List <int> optionValues = new List <int>(); foreach (TEntity obj in list) { IdComponent idComponent = obj.GetComponent <IdComponent>(); displayedOptions.Add(string.Format("{0} - {1}", idComponent.id, IdListDrawerUtil <TEntity> .GetTitleForObject(obj))); optionValues.Add(idComponent.id); } property.intValue = EditorGUI.IntPopup(contentRect, property.intValue, displayedOptions.ToArray(), optionValues.ToArray()); } }