コード例 #1
0
    public static Reward GetRewardForProgressionLevel(int level)
    {
        Reward reward = new Reward();
        Dictionary <ProgressionUnlockCategory, string[]> unlockedIDsForLevel = Service.Get <ProgressionService>().GetUnlockedIDsForLevel(level);
        Dictionary <ProgressionUnlockCategory, ProgressionService.UnlockDefinition> unlockedDefinitionsForLevel = Service.Get <ProgressionService>().GetUnlockedDefinitionsForLevel(level);
        Dictionary <ProgressionUnlockCategory, int> unlockedCountsForLevel = Service.Get <ProgressionService>().GetUnlockedCountsForLevel(level);

        foreach (KeyValuePair <ProgressionUnlockCategory, string[]> item in unlockedIDsForLevel)
        {
            if (RewardableLoader.RewardableTypeMap.ContainsKey(item.Key.ToString()))
            {
                for (int i = 0; i < item.Value.Length; i++)
                {
                    reward.Add(RewardableLoader.GenerateRewardable(item.Key.ToString(), item.Value));
                }
            }
        }
        foreach (KeyValuePair <ProgressionUnlockCategory, ProgressionService.UnlockDefinition> item2 in unlockedDefinitionsForLevel)
        {
            string text        = item2.Key.ToString();
            Type   elementType = typeof(ProgressionUnlockDefinition).GetField(text).FieldType.GetElementType();
            if (elementType != null)
            {
                FieldInfo attributedField = StaticGameDataDefinitionIdAttribute.GetAttributedField(elementType);
                if (attributedField != null)
                {
                    if (RewardableLoader.RewardableTypeMap.ContainsKey(text) && item2.Value.Definitions.Length > 0)
                    {
                        Type  type  = attributedField.GetValue(item2.Value.Definitions[0]).GetType();
                        Type  type2 = typeof(List <>).MakeGenericType(type);
                        IList list  = (IList)Activator.CreateInstance(type2);
                        for (int i = 0; i < item2.Value.Definitions.Length; i++)
                        {
                            list.Add(attributedField.GetValue(item2.Value.Definitions[i]));
                        }
                        for (int i = 0; i < list.Count; i++)
                        {
                            reward.Add(RewardableLoader.GenerateRewardable(text, list[i]));
                        }
                    }
                }
                else
                {
                    Log.LogErrorFormatted(typeof(RewardUtils), "Could not find a StaticGameDataDefinitionId field on type {0}", elementType);
                }
            }
            else
            {
                Log.LogErrorFormatted(typeof(RewardUtils), "Could not find an element type for the field {0}, the field must be an array", text);
            }
        }
        foreach (KeyValuePair <ProgressionUnlockCategory, int> item3 in unlockedCountsForLevel)
        {
            if (RewardableLoader.RewardableTypeMap.ContainsKey(item3.Key.ToString()))
            {
                reward.Add(RewardableLoader.GenerateRewardable(item3.Key.ToString(), item3.Value));
            }
        }
        return(reward);
    }
コード例 #2
0
    public static void QA_SetMascotXP([NamedToggleValue(typeof(MascotService.MascotNameGenerator), 0u)] string mascot, int xp)
    {
        Reward reward = new Reward();

        reward.Add(new MascotXPReward(mascot, xp));
        Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward);
    }
コード例 #3
0
    public static void QA_SetCoins(int coins)
    {
        Reward reward = new Reward();

        reward.Add(new CoinReward(coins));
        Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward);
    }
コード例 #4
0
    public static void QA_SetCollectibleCount([NamedToggleValue(typeof(CollectibleDefinitionService.CollectibleTypeGenerator), 0u)] string type, int count)
    {
        Reward reward = new Reward();

        reward.Add(new CollectibleReward(type, count));
        Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward);
    }
コード例 #5
0
ファイル: OneDimTask4.cs プロジェクト: ktkrhr/-
    void Update()
    {
        float z = agent.transform.position.z;

        if (range.start <= z && z <= range.end)
        {
            if (!rewardShown && waited >= 2 * 60)
            {
                rewardCount += 1;
                Reward.Add(2.0F);

                GameObject rewardObj = (GameObject)GameObject.Instantiate(
                    reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity
                    );

                rewardObj.transform.parent = transform;
                rewardShown = true;
            }

            waited += 1;
        }
        else
        {
            waited = 0;
        }
    }
コード例 #6
0
        public Reward ToReward()
        {
            Reward reward = new Reward();

            using (IEnumerator <IRewardableDefinition> enumerator = GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IRewardableDefinition current = enumerator.Current;
                    if (current == null)
                    {
                        Log.LogErrorFormatted(this, "Contains null reward definition {0}", current);
                    }
                    try
                    {
                        reward.Add(current.Reward);
                    }
                    catch (Exception ex)
                    {
                        Log.LogErrorFormatted(this, "Skipping bad reward component {0}, in {1}, throwing exception {2}", current, base.name, ex.Message);
                        Log.LogException(this, ex);
                    }
                }
            }
            return(reward);
        }
コード例 #7
0
    private static void setXpForAllMascots(int xp)
    {
        Reward reward = new Reward();

        foreach (Mascot mascot in Service.Get <MascotService>().Mascots)
        {
            reward.Add(new MascotXPReward(mascot.Name, xp));
        }
        Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward);
    }
コード例 #8
0
        private void qaSetFurnitureCount(int count = 10)
        {
            Dictionary <int, int> dictionary  = new Dictionary <int, int>();
            Dictionary <int, int> dictionary2 = new Dictionary <int, int>();
            Reward reward = new Reward();

            foreach (int key in Service.Get <IGameData>().Get <Dictionary <int, DecorationDefinition> >().Keys)
            {
                reward.Add(new DecorationInstanceReward(key, count));
                dictionary.Add(key, count);
            }
            foreach (int key2 in Service.Get <IGameData>().Get <Dictionary <int, StructureDefinition> >().Keys)
            {
                reward.Add(new StructureInstanceReward(key2, count));
                dictionary2.Add(key2, count);
            }
            Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward);
            if (decorationInventory != null && structureInventory != null)
            {
                decorationInventory.Decorations = dictionary;
                structureInventory.Structures   = dictionary2;
            }
        }
コード例 #9
0
        public override void OnEnter()
        {
            EventDispatcher eventDispatcher = Service.Get <EventDispatcher>();

            if (Xp > 0)
            {
                Reward reward = new Reward();
                reward.Add(new MascotXPReward(MascotName, Xp));
                eventDispatcher.DispatchEvent(new RewardServiceEvents.MyRewardEarned(RewardSource.QUEST_OBJECTIVE, base.Name, reward));
            }
            if (Coins > 0)
            {
                Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).AddCoins(Coins);
            }
            Finish();
        }
コード例 #10
0
ファイル: ArrowMazeTask1.cs プロジェクト: ktkrhr/-
    void Update()
    {
        float x = agent.transform.position.x;

        if (0.0f <= x && x <= 4.0f)
        {
            if (!waited && (waitedTime >= 2 * 60))
            {
                Reward.Add(2.0F);
                waited = true;
            }
            waitedTime += 1;
        }
        else
        {
            waitedTime = 0;
        }
    }
コード例 #11
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);
    }
コード例 #12
0
    void Update()
    {
        float z = agent.transform.position.z;

        if (11.5F <= z && z <= 15.5F)
        {
            if (!rewardShown)
            {
                rewardCount += 1;
                Reward.Add(2.0F);

                GameObject rewardObj = (GameObject)GameObject.Instantiate(
                    reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity
                    );

                rewardObj.transform.parent = transform;
                rewardShown = true;
            }
        }
    }
コード例 #13
0
        private void onGetInventoryComplete()
        {
            Reward reward = item.Definition.Reward.ToReward();

            if (reward.TryGetValue <EquipmentInstanceReward>(out var rewardable))
            {
                CustomEquipment[] array = rewardable.EquipmentInstances.ToArray();
                reward.ClearReward(typeof(EquipmentInstanceReward));
                for (int i = 0; i < array.Length; i++)
                {
                    if (InventoryUtils.TryGetDCustomEquipment(array[i], out var equipmentData))
                    {
                        array[i].equipmentId = equipmentData.Id;
                    }
                    reward.Add(new EquipmentInstanceReward(array[i]));
                }
            }
            Service.Get <EventDispatcher>().DispatchEvent(new DisneyStoreEvents.PurchaseComplete(reward));
            hidePurchaseModal();
        }
コード例 #14
0
    void FixedUpdate()
    {
        base.FixedUpdate();

        float z = agent.transform.position.z;

        if (elapsed < 130)
        {
            agent.controller.Paralyzed = true;
            selector.Visible           = true;
            elapsed += 1;
        }
        else
        {
            agent.controller.Paralyzed = false;
            selector.Visible           = false;
        }

        if (range.start <= z && z <= range.end)
        {
            if (!rewardShown && waited >= 2 * 60)
            {
                rewardCount += 1;
                Reward.Add(2.0F);

                GameObject rewardObj = (GameObject)GameObject.Instantiate(
                    reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity
                    );

                rewardObj.transform.parent = transform;
                rewardShown = true;
            }

            waited += 1;
        }
        else
        {
            waited = 0;
        }
    }
コード例 #15
0
    void Update()
    {
        float x = agent.transform.position.x;

        if (0.0f <= x && x <= 4.0f)
        {
            if (!waited && (waitedTime >= 2 * 60))
            {
                Reward.Add(2.0F);

                GameObject rewardObj = (GameObject)GameObject.Instantiate(
                    reward, new Vector3(10.56F, 0.5F, 8.05F), Quaternion.identity
                    );

                waited = true;
            }
            waitedTime += 1;
        }
        else
        {
            waitedTime = 0;
        }
    }
コード例 #16
0
ファイル: Task.cs プロジェクト: ktkrhr/-
 protected virtual void Punishment()
 {
     Reward.Add(-0.001F);
 }
コード例 #17
0
ファイル: Task.cs プロジェクト: ktkrhr/-
 protected virtual void OnRewardCollision()
 {
     rewardCount += 1;
     Reward.Add(2.0F);
 }