public override IValue Serialize()
        {
#pragma warning disable LAA1002
            return(new Dictionary(new Dictionary <IKey, IValue>
            {
                [(Text)LevelKey] = Level.Serialize(),
                [(Text)ExpiredBlockIndexKey] = ExpiredBlockIndex.Serialize(),
                [(Text)StartedBlockIndexKey] = StartedBlockIndex.Serialize(),
                [(Text)ReceivedBlockIndexKey] = ReceivedBlockIndex.Serialize(),
                [(Text)RewardLevelKey] = RewardLevel.Serialize(),
                [(Text)RewardMapKey] = new Dictionary(
                    RewardMap.Select(
                        kv => new KeyValuePair <IKey, IValue>(
                            (IKey)kv.Key.Serialize(),
                            kv.Value.Serialize()
                            )
                        )
                    ),
                [(Text)EndKey] = End.Serialize(),
                [(Text)RewardLevelMapKey] = new Dictionary(
                    RewardLevelMap.Select(
                        kv => new KeyValuePair <IKey, IValue>(
                            (IKey)kv.Key.Serialize(),
                            new List(kv.Value.Select(v => v.Serialize())).Serialize()
                            )
                        )
                    ),
            }.Union((Dictionary)base.Serialize())));

#pragma warning restore LAA1002
        }
Beispiel #2
0
    private void LevelUp(RewardLevel rewardLevel)
    {
        // TODO: animation to show level up along with what power was received.
        print("Level up. " + rewardLevel.reward);

        DialogKey dialogKey = DialogKey.None;

        switch (rewardLevel.reward)
        {
        case RewardType.RewardPushCrates: dialogKey = DialogKey.MoveCrates; break;

        case RewardType.RewardCarryDoubleSouls: dialogKey = DialogKey.MoreSoulCapacity; break;

        case RewardType.RewardMoreTime: dialogKey = DialogKey.MoreTime; break;

        case RewardType.RewardDash: dialogKey = DialogKey.NowCanDash; break;

        case RewardType.RewardEvenMoreTime: dialogKey = DialogKey.EvenMoreTime; break;
        }

        if (dialogKey != DialogKey.None)
        {
            ShowDialog(dialogKey);
        }
    }
Beispiel #3
0
 public BotEntry(MinigameType _Type, int _Target, RewardLevel _DesiredLevel,
                 int _DesiredReward, ResolutionType _Resolution)
 {
     Type          = _Type;
     Target        = _Target;
     Running       = false;
     DesiredLevel  = _DesiredLevel;
     DesiredReward = _DesiredReward;
     Progress      = 0;
     Resolution    = _Resolution;
 }
Beispiel #4
0
        public async Task <RewardLevel> SendReward(Notes note)
        {
            var credential = DependencyService.Get <ICredentialRetriever>().GetCredential();

            //  var ls = new Lead();

            //System.Diagnostics.Debug.WriteLine($"{UmbrellaApi.SCHEME}://{UmbrellaApi.API_HOST_URL}/enquiryusers/");

            var client = new RestSharp.RestClient("http://mastereman.com/restful/pages/samplereward.php");

            var ls = new Lead();
            //   var client = new RestSharp.RestClient($"{UmbrellaApi.SCHEME}://{UmbrellaApi.API_HOST_URL}/enquiryusers/");
            var request = new RestRequest(Method.POST);

            request.AddParameter("partner_id", credential.UserID.ToString());
            request.AddParameter("status", note.status);
            request.AddParameter("category", note.category);
            request.AddParameter("contact_enquiry", note.contact_enquiry);
            request.AddHeader("umbrella-api-username", UmbrellaApi.USERNAME);
            request.AddHeader("umbrella-api-key", UmbrellaApi.PASSKEY);
            request.AddHeader("umbrella-partner-id", UmbrellaApi.PARTNER_ID);
            //   var content = response.Content;
            RewardLevel     convert = null;
            EventWaitHandle Wait    = new AutoResetEvent(false);

            var asyncHandle = client.ExecuteAsync <Lead>(request, response => {
                System.Diagnostics.Debug.WriteLine(response.Content);
                try
                {
                    var json   = response.Content.Replace("<", "");
                    JObject jo = JObject.Parse(json);
                    // var diskSpaceArray = jo.SelectToken("data", false).ToString();
                    convert = JsonConvert.DeserializeObject <RewardLevel>(json);
                    // convert = JsonConvert.DeserializeObject<RewardLevel>(diskSpaceArray);

                    System.Diagnostics.Debug.WriteLine("jo : " + convert.ToString());
                    System.Diagnostics.Debug.WriteLine("-end-");
                }
                catch (InvalidCastException e)
                {
                    System.Diagnostics.Debug.WriteLine("ERRor : " + e.ToString());
                }

                Wait.Set();
            });

            Wait.WaitOne();

            return(convert);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Level;
         hashCode = (hashCode * 397) ^ ExpiredBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ StartedBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ ReceivedBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ RewardLevel.GetHashCode();
         hashCode = (hashCode * 397) ^ (RewardMap != null ? RewardMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ End.GetHashCode();
         hashCode = (hashCode * 397) ^ (RewardLevelMap != null ? RewardLevelMap.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #6
0
    public void UpdateSoulsOffered(int souls)
    {
        print("Update souls offered to " + souls);
        RewardLevel rewardLevel = rewardLevels[0];
        bool        levelUp     = false;

        for (int idx = 0; idx < rewardLevels.Length; idx++)
        {
            rewardLevel = rewardLevels[idx];
            if (souls < rewardLevel.soulsRequired)
            {
                if (nextRewardLevel < idx)
                {
                    nextRewardLevel++;
                    levelUp = true;
                }
                break;
            }
            else
            {
                switch (rewardLevel.reward)
                {
                case RewardType.RewardCarryDoubleSouls: player.EnableDoubleSouls(); break;

                case RewardType.RewardMoreTime: player.SetTimeMultiplier(2); break;

                case RewardType.RewardDash: player.EnableDash(); break;

                case RewardType.RewardEvenMoreTime: player.SetTimeMultiplier(3); break;

                case RewardType.RewardDestroyDemon: player.EnableKillDemon(); break;

                case RewardType.RewardPushCrates: player.EnablePushCrates(); break;
                }
            }
        }
        soulsOffered.UpdateCurrent(souls);
        soulsOffered.UpdateCurrentMaximum(rewardLevel.soulsRequired);

        if (levelUp)
        {
            LevelUp(rewardLevels[nextRewardLevel - 1]);
        }
    }
Beispiel #7
0
        internal static Reward CreateRandomReward(IList <Reward> rewards, RewardLevel level)
        {
            var discount = new Reward()
            {
                Amount        = (decimal)GetRandom.Double(),
                CampaignId    = GetRandom.Guid(),
                CampaignName  = GetRandom.Phrase(20),
                Description   = GetRandom.Phrase(50),
                Id            = GetRandom.Guid(),
                Level         = level,
                PromotionId   = GetRandom.Guid(),
                PromotionName = GetRandom.String(20),
            };

            if (rewards != null)
            {
                rewards.Add(discount);
            }

            return(discount);
        }