예제 #1
0
        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);
                    }
                }
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
    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);
    }
예제 #4
0
    public void Add(IRewardable reward)
    {
        CoinReward coinReward = (CoinReward)reward;

        coins += coinReward.coins;
    }
예제 #5
0
 public void Add(IRewardable reward)
 {
     data = combineMap(data, ((AbstractDictionaryReward <TKey, TValue>)reward).data, combineValues);
 }
예제 #6
0
 public void Add(IRewardable reward)
 {
     data = combineLists(data, ((AbstractListReward <T>)reward).data);
 }
예제 #7
0
 public void Add(IRewardable reward)
 {
     slotCount = ((SavedOutfitSlotReward)reward).slotCount;
 }
예제 #8
0
    public void Add(IRewardable reward)
    {
        IglooSlotsReward iglooSlotsReward = (IglooSlotsReward)reward;

        iglooSlots += iglooSlotsReward.iglooSlots;
    }