private static void initMaps() { if (Application.isPlaying) { Log.LogError(typeof(RewardableLoader), "RewardableLoader rewableable types were not initialized properly."); } rewardableTypeMap = new Dictionary <string, Type>(); rewardableIdentifierMap = new Dictionary <Type, string>(); Type typeFromHandle = typeof(IRewardable); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); int num = assemblies.Length; for (int i = 0; i < num; i++) { Assembly assembly = assemblies[i]; string name = assembly.GetName().Name; if (name.StartsWith("System") || name.StartsWith("Mono.") || name.StartsWith("UnityEngine") || name.StartsWith("UnityEditor") || name.StartsWith("Boo.") || name.StartsWith("Fabric.")) { continue; } Type[] exportedTypes = assembly.GetExportedTypes(); int num2 = exportedTypes.Length; for (int j = 0; j < num2; j++) { Type type = exportedTypes[j]; if (typeFromHandle.IsAssignableFrom(type) && type.IsClass && !type.IsAbstract) { IRewardable rewardable = GenerateRewardable(type); rewardableTypeMap.Add(rewardable.RewardType, type); rewardableIdentifierMap.Add(type, rewardable.RewardType); } } } }
public static void Init(Type[] rewardables) { rewardableTypeMap = new Dictionary <string, Type>(); rewardableIdentifierMap = new Dictionary <Type, string>(); int num = rewardables.Length; for (int i = 0; i < num; i++) { IRewardable rewardable = GenerateRewardable(rewardables[i]); rewardableTypeMap.Add(rewardable.RewardType, rewardables[i]); rewardableIdentifierMap.Add(rewardables[i], rewardable.RewardType); } }
public Reward ToReward() { Reward reward = new Reward(); using (Enumerator enumerator = GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, JsonData> current = enumerator.Current; if (RewardableLoader.RewardableTypeMap.ContainsKey(current.Key) && current.Value != null) { IRewardable rewardable = RewardableLoader.GenerateRewardable(current.Key); rewardable.FromJson(current.Value); reward.Add(rewardable); } } } return(reward); }
public void Add(IRewardable reward) { CoinReward coinReward = (CoinReward)reward; coins += coinReward.coins; }
public void Add(IRewardable reward) { data = combineMap(data, ((AbstractDictionaryReward <TKey, TValue>)reward).data, combineValues); }
public void Add(IRewardable reward) { data = combineLists(data, ((AbstractListReward <T>)reward).data); }
public void Add(IRewardable reward) { slotCount = ((SavedOutfitSlotReward)reward).slotCount; }
public void Add(IRewardable reward) { IglooSlotsReward iglooSlotsReward = (IglooSlotsReward)reward; iglooSlots += iglooSlotsReward.iglooSlots; }