Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OddityCore"/> class.
        /// </summary>
        public OddityCore()
        {
            _httpClient             = new HttpClient();
            _httpClient.BaseAddress = new Uri(ApiConfiguration.ApiEndpoint);
            _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd($"{ApiConfiguration.LibraryName}/{GetLibraryVersion()} ({ApiConfiguration.GitHubLink})");

            SetTimeout(ApiConfiguration.DefaultTimeoutSeconds);

            var builderDelegatesContainer = new BuilderDelegatesContainer
            {
                DeserializationError = DeserializationError,
                RequestSend          = RequestSend,
                ResponseReceived     = ResponseReceived
            };

            Api              = new Api(_httpClient, builderDelegatesContainer);
            Company          = new Company(_httpClient, builderDelegatesContainer);
            Rockets          = new Rockets(_httpClient, builderDelegatesContainer);
            Capsules         = new Capsules(_httpClient, builderDelegatesContainer);
            DetailedCapsules = new DetailedCapsules(_httpClient, builderDelegatesContainer);
            DetailedCores    = new DetailedCores(_httpClient, builderDelegatesContainer);
            Launchpads       = new Launchpads(_httpClient, builderDelegatesContainer);
            Launches         = new Launches(_httpClient, builderDelegatesContainer);
            Roadster         = new Roadster(_httpClient, builderDelegatesContainer);
        }
Пример #2
0
        public override void ReadData(BinaryReader stream, IDictionary <object, object> userdata, int totalSize)
        {
            Name = stream.ReadSizedString();

            int length = stream.ReadInt32();

            Capsules.Capacity = length;
            for (int i = 0; i < length; i++)
            {
                Capsules.Add(new ShapeCapsule(stream));
            }

            length           = stream.ReadInt32();
            Spheres.Capacity = length;
            for (int i = 0; i < length; i++)
            {
                Spheres.Add(new ShapeSphere(stream));
            }

            length             = stream.ReadInt32();
            Manifolds.Capacity = length;
            for (int i = 0; i < length; i++)
            {
                Manifolds.Add(new ShapeManifold(stream));
            }
        }
Пример #3
0
    void ShowScore()
    {
        if (score > finalScore)
        {
            finalScore = score;
        }
        if (finalScore > PlayerPrefs.GetFloat("MemoryScore"))
        {
            PlayerPrefs.SetFloat("MemoryScore", finalScore);
        }
        else
        {
            finalScore = PlayerPrefs.GetFloat("MemoryScore");
        }

        lives = 5;
        UI.SetActive(false);
        Capsules.SetActive(false);
        Spheres.GetComponent <Randomsphere>().Getclonei().SetActive(false);
        Spheres.GetComponent <Randomsphere>().Getclonej().SetActive(false);
        Spheres.GetComponent <Randomsphere>().Getclonek().SetActive(false);
        scoreBoard.SetActive(true);
        scoreBoard.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 35);
        Username.GetComponent <TMPro.TextMeshPro>().text = FacebookManager.Instance.ProfileName + ": " + score.ToString();
        if (FacebookManager.Instance.ProfilePic != null)
        {
            ProfilePic.GetComponent <Image>().sprite = FacebookManager.Instance.ProfilePic;
        }
    }
Пример #4
0
 private void LoadCapsule(Capsules capsuleDB, CapsuleViewModel model)
 {
     model.CapsuleId     = capsuleDB.CapsuleId;
     model.Code          = capsuleDB.Code;
     model.Name          = ResolveCapsuleName(capsuleDB);
     model.TotalQuantity = capsuleDB.CapsulesItems.Sum(q => q.Quantity);
     model.Properties    = GetProperties(capsuleDB.ItemId);
     model.ItemInside    = capsuleDB.CapsulesItems.Count() == 1 ? Models.ItemViewModelLight.Create(ItemsXml, capsuleDB.CapsulesItems.First().ItemId) : null;
 }
Пример #5
0
        private string ResolveCapsuleName(Capsules capsule)
        {
            if (!string.IsNullOrEmpty(capsule.Name))
            {
                return(capsule.Name);
            }

            if (!capsule.CapsulesItems.Any())
            {
                return(Resources.General.ResourceManager.GetString("Capsule_Empty"));
            }

            if (capsule.CapsulesItems.Count() > 1)
            {
                return(string.Format("({0} items)", capsule.CapsulesItems.Count()));
            }

            return(string.Empty);
        }
Пример #6
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (Coins > 0u)
            {
                sb.Append($"$emotecoins {Coins.ToString()} ");
            }
            if (Tokens > 0u)
            {
                sb.Append($"$emotetokens {Tokens.ToString()} ");
            }
            if (Chests > 0u)
            {
                sb.Append($"$emotechest {Chests.ToString()} ");
            }
            if (Spheres > 0u)
            {
                sb.Append($"$emotesphere {Spheres.ToString()} ");
            }
            if (Capsules > 0u)
            {
                sb.Append($"$emotecapsule {Capsules.ToString()} ");
            }
            if (Tickets > 0u)
            {
                sb.Append($"$emoteticket {Tickets.ToString()} ");
            }
            if (BonusDoubleExp > 0u)
            {
                sb.Append($"$emote2exp {BonusDoubleExp.ToString()} ");
            }
            if (BonusBotRespect > 0u)
            {
                sb.Append($"$emoterespect {BonusBotRespect.ToString()} ");
            }
            if (BonusRewind > 0u)
            {
                sb.Append($"$emoterewind {BonusRewind.ToString()} ");
            }

            return(sb.ToString().TrimEnd());
        }