Esempio n. 1
0
        public IEnumerator GetMedalsFromPHP(MedalFilterManager medalFilter)
        {
            WWWForm form  = new WWWForm();
            var     query = medalFilter.GenerateFilterQuery();

            form.AddField("sqlQuery", query);

            using (UnityWebRequest www = UnityWebRequest.Post(selectFilteredMedalsPHP, form))
            {
                yield return(www.SendWebRequest());

                if (www.isNetworkError || www.isHttpError)
                {
                    Debug.Log("ERROR:: " + www.error);
                }
                else
                {
                    //Debug.Log(www.downloadHandler.text);
                    var rows = www.downloadHandler.text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var row in rows)
                    {
                        var splitRow = row.Split(new char[] { '|' }, StringSplitOptions.None);

                        var medal = new Medal(splitRow);

                        Medals.Add(medal.Id, medal);
                    }
                }
            }

            LoadManager.FinishLoading();
        }
Esempio n. 2
0
        public void SetLatestTiers(MedalFilterManager filters)
        {
            var highestTier = MedalManager.Medals.Values.OrderByDescending(x => x.Tier).FirstOrDefault()?.Tier;

            filters.Tiers = highestTier.HasValue ? new List <int> {
                highestTier.Value - 3, highestTier.Value - 2, highestTier.Value - 1, highestTier.Value
            } : new List <int> {
                7, 8, 9, 10
            };
        }
Esempio n. 3
0
        public void HandleGetMedals(MedalFilterManager medalFilter)
        {
            LoadManager.StartLoading();

            Medals.Clear();

            UIController.ResetViewWindow();//.OffsetY = 250;

            StartCoroutine(GetMedalsFromPHP(medalFilter));
        }
Esempio n. 4
0
        public void SetRange(MedalFilterManager filters)
        {
            var highRange    = MedalManager.Medals.Values.OrderByDescending(x => x.GuiltMultiplierHigh).FirstOrDefault()?.GuiltMultiplierHigh;
            var highRangeAlt = MedalManager.Medals.Values.OrderByDescending(x => x.GuiltMultiplierLow).FirstOrDefault()?.GuiltMultiplierLow;

            if (highRange < highRangeAlt && highRangeAlt < 1000)
            {
                highRange = highRangeAlt;
            }

            if (highRangeAlt.HasValue)
            {
                int value = (int)highRange.Value;
                filters.HighRange = value + 1;
                filters.LowRange  = (value - 50) > 0 ? value - 50 : 0;
            }
        }