コード例 #1
0
ファイル: MedalManager.cs プロジェクト: WaterKH/MedalViewer
        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();
        }
コード例 #2
0
 public double GetHighestMultiplier(Medal medal)
 {
     return(medal.GuiltMultiplierHigh != 0.0f ? medal.GuiltMultiplierHigh :
            medal.GuiltMultiplierLow != 0.0f ? medal.GuiltMultiplierLow :
            medal.MaxMultiplierHigh != 0.0f ? medal.MaxMultiplierHigh /** medal.TierConversion[medal.Tier]*/ :
            medal.MaxMultiplierLow != 0.0f ? medal.MaxMultiplierLow /** medal.TierConversion[medal.Tier]*/ :
            medal.BaseMultiplierHigh != 0.0f ? medal.BaseMultiplierHigh /** medal.TierConversion[medal.Tier]*/ :
            medal.BaseMultiplierLow /** medal.TierConversion[medal.Tier]*/);
 }
コード例 #3
0
        public GameObject CreateMedal(Medal medal, bool highQuality = false)
        {
            var medalGameObject = Instantiate(Resources.Load("Medal") as GameObject);

            medalGameObject.GetComponent <CanvasGroup>().SetCanvasGroupInactive();

            medalGameObject.name = medal.Name;

            SetMedalImage(medal, medalGameObject, medal.ImageURL, highQuality);

            medalGameObject.GetComponent <MedalDisplay>().MapVariables(medal);

            return(medalGameObject);
        }
コード例 #4
0
ファイル: SearchManager.cs プロジェクト: WaterKH/MedalViewer
        public IEnumerator GetSearchMedalsFromPHP(string query, Action <Dictionary <int, Medal.Medal> > result)
        {
            LoadManager.StartLoading();

            WWWForm form = new WWWForm();

            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
                {
                    var medals = new Dictionary <int, Medal.Medal>();
                    //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);
                        //Debug.Log(splitRow.Length);
                        var medal = new Medal.Medal(splitRow);

                        //Debug.Log("Adding: " + medal.Name + " " + medal.Id);
                        //Globals.SearchMedals.Add(medal.Id, medal);
                        medals.Add(medal.Id, medal);
                    }

                    result(medals);
                }
            }

            LoadManager.FinishLoading();
        }
コード例 #5
0
        private void SetMedalImage(Medal medalItem, GameObject medalObject, string prevImg, bool highQuality = false)
        {
            var fileName = medalItem.ImageURL;

            // TODO Add thumbnails back?
            //if (!highQuality)
            //    fileName = fileName.Replace(".png", "_tn.png");

            if (fileName == "NULL")
            {
                print(prevImg);
                fileName = prevImg;
            }

            var path = "";

            //if (!highQuality)
            //    path = url + fileName;
            //else
            path = urlHighQuality + fileName;

            StartCoroutine(LoadImage(path, medalObject));
        }
コード例 #6
0
        public void MapVariables(Medal medal)
        {
            Id            = medal.Id;
            Name          = medal.Name;
            ImageURL      = medal.ImageURL;
            Star          = medal.Star;
            Attribute_PSM = medal.Attribute_PSM;
            Attribute_UR  = medal.Attribute_UR;

            if (medal.Star == 1 || medal.Star == 2)
            {
                var convertedMedal = medal;

                BaseStrength       = convertedMedal.BaseAttack;
                MaxStrength        = convertedMedal.MaxAttack;
                BaseDefense        = convertedMedal.BaseDefense;
                MaxDefense         = convertedMedal.MaxDefense;
                TraitSlots         = convertedMedal.TraitSlots;
                BasePetPoints      = convertedMedal.BasePetPoints;
                MaxPetPoints       = convertedMedal.MaxPetPoints;
                Ability            = convertedMedal.Ability;
                AbilityDescription = convertedMedal.AbilityDescription;
                BaseMultiplierLow  = convertedMedal.BaseMultiplierLow.ToString();
                BaseMultiplierHigh = convertedMedal.BaseMultiplierHigh.ToString();
                Target             = convertedMedal.Target;
                Gauge = convertedMedal.Gauge;
                Tier  = convertedMedal.Tier;
            }
            else if (medal.Star == 3 || medal.Star == 4 || medal.Star == 5)
            {
                var convertedMedal = medal;

                BaseStrength       = convertedMedal.BaseAttack;
                MaxStrength        = convertedMedal.MaxAttack;
                BaseDefense        = convertedMedal.BaseDefense;
                MaxDefense         = convertedMedal.MaxDefense;
                TraitSlots         = convertedMedal.TraitSlots;
                BasePetPoints      = convertedMedal.BasePetPoints;
                MaxPetPoints       = convertedMedal.MaxPetPoints;
                Ability            = convertedMedal.Ability;
                AbilityDescription = convertedMedal.AbilityDescription;
                BaseMultiplierLow  = convertedMedal.BaseMultiplierLow.ToString();
                BaseMultiplierHigh = convertedMedal.BaseMultiplierHigh.ToString();
                MaxMultiplierLow   = convertedMedal.MaxMultiplierLow.ToString();
                MaxMultiplierHigh  = convertedMedal.MaxMultiplierHigh.ToString();
                Target             = convertedMedal.Target;
                Gauge = convertedMedal.Gauge;
                Tier  = convertedMedal.Tier;
            }
            else if (medal.Star == 6)
            {
                var convertedMedal = medal;

                BaseStrength       = convertedMedal.BaseAttack;
                MaxStrength        = convertedMedal.MaxAttack;
                BaseDefense        = convertedMedal.BaseDefense;
                MaxDefense         = convertedMedal.MaxDefense;
                TraitSlots         = convertedMedal.TraitSlots;
                BasePetPoints      = convertedMedal.BasePetPoints;
                MaxPetPoints       = convertedMedal.MaxPetPoints;
                Ability            = convertedMedal.Ability;
                AbilityDescription = convertedMedal.AbilityDescription;
                BaseMultiplierLow  = convertedMedal.BaseMultiplierLow.ToString();
                BaseMultiplierHigh = convertedMedal.BaseMultiplierHigh.ToString();
                MaxMultiplierLow   = convertedMedal.MaxMultiplierLow.ToString();
                MaxMultiplierHigh  = convertedMedal.MaxMultiplierHigh.ToString();
                Target             = convertedMedal.Target;
                Gauge = convertedMedal.Gauge;
                GuiltMultiplierLow  = convertedMedal.GuiltMultiplierLow.ToString();
                GuiltMultiplierHigh = convertedMedal.GuiltMultiplierHigh.ToString();
                Tier = convertedMedal.Tier;

                if (!string.IsNullOrEmpty(convertedMedal.SupernovaName))
                {
                    IsSupernova          = true;
                    SupernovaName        = convertedMedal.SupernovaName;
                    SupernovaDescription = convertedMedal.SupernovaDescription;
                    SupernovaDamage      = convertedMedal.SupernovaDamage;
                    SupernovaTarget      = convertedMedal.SupernovaTarget;
                }
            }
            else if (medal.Star == 7)
            {
                var convertedMedal = medal;

                BaseStrength        = convertedMedal.BaseAttack;
                MaxStrength         = convertedMedal.MaxAttack;
                BaseDefense         = convertedMedal.BaseDefense;
                MaxDefense          = convertedMedal.MaxDefense;
                TraitSlots          = convertedMedal.TraitSlots;
                BasePetPoints       = convertedMedal.BasePetPoints;
                MaxPetPoints        = convertedMedal.MaxPetPoints;
                Ability             = convertedMedal.Ability;
                AbilityDescription  = convertedMedal.AbilityDescription;
                MaxMultiplierLow    = convertedMedal.MaxMultiplierLow.ToString();
                MaxMultiplierHigh   = convertedMedal.MaxMultiplierHigh.ToString();
                Target              = convertedMedal.Target;
                GuiltMultiplierLow  = convertedMedal.GuiltMultiplierLow.ToString();
                GuiltMultiplierHigh = convertedMedal.GuiltMultiplierHigh.ToString();
                Gauge             = convertedMedal.Gauge;
                SubslotMultiplier = convertedMedal.SubslotMultiplier;
                Tier = convertedMedal.Tier;

                if (!string.IsNullOrEmpty(convertedMedal.SupernovaName))
                {
                    IsSupernova          = true;
                    SupernovaName        = convertedMedal.SupernovaName;
                    SupernovaDescription = convertedMedal.SupernovaDescription;
                    SupernovaDamage      = convertedMedal.SupernovaDamage;
                    SupernovaTarget      = convertedMedal.SupernovaTarget;
                }
            }
            else
            {
                var convertedMedal = medal;

                Effect             = convertedMedal.Effect;
                Effect_Description = convertedMedal.Effect_Description;
            }
        }
コード例 #7
0
        public IEnumerator GetMedal(string query)
        {
            CurrentDamoThing = 1;
            Transitioning    = true;
            LoadManager.StartLoading();

            WWWForm form = new WWWForm();

            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 row = www.downloadHandler.text.Replace("\n", "");

                    var splitRow = row.Split(new char[] { '|' }, StringSplitOptions.None);

                    var medal = new Medal
                    {
                        Id                   = string.IsNullOrEmpty(splitRow[0]) ? -1 : int.Parse(splitRow[0]),
                        Name                 = string.IsNullOrEmpty(splitRow[1]) ? "" : splitRow[1],
                        ImageURL             = string.IsNullOrEmpty(splitRow[2]) ? "" : splitRow[2],
                        Star                 = string.IsNullOrEmpty(splitRow[3]) ? 0 : int.Parse(splitRow[3]),
                        Class                = string.IsNullOrEmpty(splitRow[4]) ? "" : splitRow[4],
                        Type                 = string.IsNullOrEmpty(splitRow[5]) ? "" : splitRow[5],
                        Attribute_PSM        = string.IsNullOrEmpty(splitRow[6]) ? "" : splitRow[6],
                        Attribute_UR         = string.IsNullOrEmpty(splitRow[7]) ? "" : splitRow[7],
                        Discriminator        = string.IsNullOrEmpty(splitRow[8]) ? "" : splitRow[8],
                        BaseAttack           = string.IsNullOrWhiteSpace(splitRow[9]) ? 0 : int.Parse(splitRow[9]),
                        MaxAttack            = string.IsNullOrEmpty(splitRow[10]) ? 0 : int.Parse(splitRow[10]),
                        BaseDefense          = string.IsNullOrEmpty(splitRow[11]) ? 0 : int.Parse(splitRow[11]),
                        MaxDefense           = string.IsNullOrEmpty(splitRow[12]) ? 0 : int.Parse(splitRow[12]),
                        TraitSlots           = string.IsNullOrEmpty(splitRow[13]) ? 0 : int.Parse(splitRow[13]),
                        BasePetPoints        = string.IsNullOrEmpty(splitRow[14]) ? 0 : int.Parse(splitRow[14]),
                        MaxPetPoints         = string.IsNullOrEmpty(splitRow[15]) ? 0 : int.Parse(splitRow[15]),
                        Ability              = string.IsNullOrEmpty(splitRow[16]) ? "" : splitRow[16],
                        AbilityDescription   = string.IsNullOrEmpty(splitRow[17]) ? "" : splitRow[17],
                        Target               = string.IsNullOrEmpty(splitRow[18]) ? "" : splitRow[18],
                        Gauge                = string.IsNullOrEmpty(splitRow[19]) ? 0 : int.Parse(splitRow[19]),
                        BaseMultiplierLow    = string.IsNullOrEmpty(splitRow[20]) ? 0.0 : double.Parse(splitRow[20]),
                        BaseMultiplierHigh   = string.IsNullOrEmpty(splitRow[21]) ? 0.0 : double.Parse(splitRow[21]),
                        MaxMultiplierLow     = string.IsNullOrEmpty(splitRow[22]) ? 0.0 : double.Parse(splitRow[22]),
                        MaxMultiplierHigh    = string.IsNullOrEmpty(splitRow[23]) ? 0.0 : double.Parse(splitRow[23]),
                        GuiltMultiplierLow   = string.IsNullOrEmpty(splitRow[24]) ? 0.0 : double.Parse(splitRow[24]),
                        GuiltMultiplierHigh  = string.IsNullOrEmpty(splitRow[25]) ? 0.0 : double.Parse(splitRow[25]),
                        SubslotMultiplier    = string.IsNullOrEmpty(splitRow[26]) ? 0.0 : double.Parse(splitRow[26]),
                        Tier                 = string.IsNullOrEmpty(splitRow[27]) ? 0 : int.Parse(splitRow[27]),
                        SupernovaName        = string.IsNullOrEmpty(splitRow[28]) ? "" : splitRow[28],
                        SupernovaDescription = string.IsNullOrEmpty(splitRow[29]) ? "" : splitRow[29],
                        SupernovaDamage      = string.IsNullOrEmpty(splitRow[30]) ? "" : splitRow[30],
                        SupernovaTarget      = string.IsNullOrEmpty(splitRow[31]) ? "" : splitRow[31],
                        Effect               = string.IsNullOrEmpty(splitRow[32]) ? "" : splitRow[32],
                        Effect_Description   = string.IsNullOrEmpty(splitRow[33]) ? "" : splitRow[33]
                    };

                    DamoMedal    = medal;
                    MedalDisplay = gameObject.GetComponent <MedalDisplay>();
                    MedalDisplay.MapVariables(DamoMedal);
                }
            }

            LoadManager.FinishLoading();

            StartCoroutine(MedalSpotlightDisplayManager.Display(null, MedalDisplay));
            Transitioning = false;
            //StartCoroutine(Idle());
        }