コード例 #1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var vh   = holder as DollListViewHolder;
            var item = items[position];

            try
            {
                vh.DicNumber.Text = $"No. {item.DicNumber}";

                if (Preferences.Get("DBListImageShow", false))
                {
                    vh.SmallImage.Visibility = ViewStates.Visible;

                    if (File.Exists(Path.Combine(ETC.cachePath, "Doll", "Normal_Crop", $"{item.DicNumber}.gfdcache")))
                    {
                        vh.SmallImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(Path.Combine(ETC.cachePath, "Doll", "Normal_Crop", $"{item.DicNumber}.gfdcache")));
                    }
                }
                else
                {
                    vh.SmallImage.Visibility = ViewStates.Gone;
                }

                vh.Grade.SetImageResource(item.GradeIconId);
                vh.Type.Text        = item.Type;
                vh.Name.Text        = item.Name;
                vh.ProductTime.Text = ETC.CalcTime(item.ProductTime);
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, context);
                Toast.MakeText(context, "Error Create View", ToastLength.Short).Show();
            }
        }
コード例 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            FairyListViewHolder vh = holder as FairyListViewHolder;

            var item = items[position];

            try
            {
                int TypeIconId = 0;
                switch (item.Type)
                {
                case string s when s == ETC.Resources.GetString(Resource.String.Common_FairyType_Combat):
                    TypeIconId = Resource.Drawable.Fairy_Combat;
                    break;

                case string s when s == ETC.Resources.GetString(Resource.String.Common_FairyType_Strategy):
                    TypeIconId = Resource.Drawable.Fairy_Strategy;
                    break;

                default:
                    TypeIconId = Resource.Drawable.Fairy_Combat;
                    break;
                }
                vh.TypeIcon.SetImageResource(TypeIconId);

                if (Preferences.Get("DBListImageShow", false))
                {
                    vh.SmallImage.Visibility = ViewStates.Visible;
                    string FilePath = System.IO.Path.Combine(ETC.cachePath, "Fairy", "Normal_Crop", $"{item.DicNumber}.gfdcache");
                    if (System.IO.File.Exists(FilePath) == true)
                    {
                        vh.SmallImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(FilePath));
                    }
                }
                else
                {
                    vh.SmallImage.Visibility = ViewStates.Gone;
                }

                vh.Name.Text        = item.Name;
                vh.ProductTime.Text = ETC.CalcTime(item.ProductTime);
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, context);
                Toast.MakeText(context, "Error Create View", ToastLength.Short).Show();
            }
        }
コード例 #3
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            EquipListViewHolder vh = holder as EquipListViewHolder;

            var item = items[position];

            try
            {
                if (Preferences.Get("DBListImageShow", false))
                {
                    vh.SmallImage.Visibility = ViewStates.Visible;
                    string FilePath = System.IO.Path.Combine(ETC.cachePath, "Equip", "Normal", $"{item.Icon}.gfdcache");
                    if (System.IO.File.Exists(FilePath) == true)
                    {
                        vh.SmallImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(FilePath));
                    }
                }
                else
                {
                    vh.SmallImage.Visibility = ViewStates.Gone;
                }

                vh.Grade.SetImageResource(item.GradeIconId);

                vh.Category.Text = item.Category;
                vh.Type.Text     = item.Type;
                vh.Name.Text     = item.Name;

                vh.ProductTime.Text = ETC.CalcTime(item.ProductTime);
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, context);
                Toast.MakeText(context, "Error Create View", ToastLength.Short).Show();
            }
        }
コード例 #4
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var vh = holder as ProductResultViewHolder;

            string type = types[position];
            var    item = items[position];

            try
            {
                int dNum = (int)item["DicNumber"];

                vh.DicNumber.Text = $"No. {(int)item["DicNumber"]}";

                string url      = "";
                string filePath = "";

                switch (type)
                {
                case "Doll":
                    url      = Path.Combine(ETC.server, "Data", "Images", "Guns", "Normal_Crop", $"{(int)item["DicNumber"]}.png");
                    filePath = Path.Combine(ETC.cachePath, "Doll", "Normal_Crop", $"{(int)item["DicNumber"]}.gfdcache");
                    break;

                case "Equip":
                    url      = Path.Combine(ETC.server, "Data", "Images", "Equipments", $"{(string)item["Icon"]}.png");
                    filePath = Path.Combine(ETC.cachePath, "Equip", "Normal", $"{(string)item["Icon"]}.gfdcache");
                    break;

                case "Fairy":
                    url      = Path.Combine(ETC.server, "Data", "Images", "Fairy", $"{(int)item["Name"]}_1.png");
                    filePath = Path.Combine(ETC.cachePath, "Fairy", "Normal_Crop", $"{(int)item["DicNumber"]}.gfdcache");
                    break;
                }

                if (Preferences.Get("DBListImageShow", false))
                {
                    if (!File.Exists(filePath))
                    {
                        using (var wc = new WebClient())
                        {
                            wc.DownloadFile(url, filePath);
                        }
                    }

                    vh.SmallImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(filePath));
                }
                else
                {
                    vh.SmallImage.Visibility = ViewStates.Gone;
                }

                int gradeIconId = 0;
                if ((type == "Doll") || (type == "Equip"))
                {
                    switch ((int)item["Grade"])
                    {
                    default:
                    case 2:
                        gradeIconId = Resource.Drawable.Grade_2;
                        break;

                    case 3:
                        gradeIconId = Resource.Drawable.Grade_3;
                        vh.CardView.SetCardBackgroundColor(Android.Graphics.Color.ParseColor("#8055CCEE"));
                        break;

                    case 4:
                        gradeIconId = Resource.Drawable.Grade_4;
                        vh.CardView.SetCardBackgroundColor(Android.Graphics.Color.ParseColor("#80AACC22"));
                        break;

                    case 5:
                        gradeIconId = Resource.Drawable.Grade_5;
                        vh.CardView.SetCardBackgroundColor(Android.Graphics.Color.ParseColor("#80FFBB22"));
                        break;

                    case 0:
                        gradeIconId = Resource.Drawable.Grade_0;
                        vh.CardView.SetCardBackgroundColor(Android.Graphics.Color.ParseColor("#80C040B0"));
                        break;
                    }

                    vh.Type.Text = (string)item["Type"];
                }
                else if (type == "Fairy")
                {
                    gradeIconId = ((string)item["Type"]) switch
                    {
                        "전투" => Resource.Drawable.Fairy_Combat,
                        "책략" => Resource.Drawable.Fairy_Strategy,
                        _ => 0,
                    };

                    vh.Type.Visibility = ViewStates.Gone;
                }
                vh.Grade.SetImageResource(gradeIconId);

                string name = "";

                switch (type)
                {
                case "Doll":
                    if (ETC.locale.Language == "ko")
                    {
                        name = (string)item["Name"];
                    }
                    else
                    {
                        if (item["Name_EN"] == DBNull.Value)
                        {
                            name = (string)item["Name"];
                        }
                        else if (string.IsNullOrWhiteSpace((string)item["Name_EN"]))
                        {
                            name = (string)item["Name"];
                        }
                        else
                        {
                            name = (string)item["Name_EN"];
                        }
                    }
                    break;

                case "Equip":
                case "Fairy":
                    name = (string)item["Name"];
                    break;
                }

                vh.Name.Text        = name;
                vh.ProductTime.Text = ETC.CalcTime((int)item["ProductTime"]);
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, context);
                Toast.MakeText(context, "Error Create View", ToastLength.Short).Show();
            }
        }
コード例 #5
0
        private async Task InitLoadProcess(bool isRefresh)
        {
            await Task.Delay(100);

            try
            {
                refreshMainLayout.Refreshing = true;


                // 요정 타이틀 바 초기화

                try
                {
                    if (Preferences.Get("DBDetailBackgroundImage", false))
                    {
                        string fullImagePath = Path.Combine(ETC.cachePath, "Fairy", "Normal", $"{fairy.DicNumber}_1.gfdcache");
                        string url           = Path.Combine(ETC.server, "Data", "Images", "Fairy", "Normal", $"{fairy.DicNumber}_1.png");

                        if (!File.Exists(fullImagePath) || isRefresh)
                        {
                            using (var wc = new WebClient())
                            {
                                await wc.DownloadFileTaskAsync(url, fullImagePath);
                            }
                        }

                        var drawable = Drawable.CreateFromPath(fullImagePath);
                        drawable.SetAlpha(40);

                        FindViewById <ImageView>(Resource.Id.FairyDBDetailBackgroundImageView).Background = drawable;
                    }

                    string smallImagePath = Path.Combine(ETC.cachePath, "Fairy", "Normal_Crop", $"{fairy.DicNumber}.gfdcache");
                    string url2           = Path.Combine(ETC.server, "Data", "Images", "Fairy", "Normal_Crop", $"{fairy.DicNumber}.png");

                    if (!File.Exists(smallImagePath) || isRefresh)
                    {
                        using (var wc = new WebClient())
                        {
                            await wc.DownloadFileTaskAsync(url2, smallImagePath);
                        }
                    }

                    FindViewById <ImageView>(Resource.Id.FairyDBDetailSmallImage).SetImageDrawable(Drawable.CreateFromPath(smallImagePath));
                }
                catch (Exception ex)
                {
                    ETC.LogError(ex, this);
                }

                FindViewById <TextView>(Resource.Id.FairyDBDetailFairyType).Text        = fairy.Type;
                FindViewById <TextView>(Resource.Id.FairyDBDetailFairyName).Text        = fairy.Name;
                FindViewById <TextView>(Resource.Id.FairyDBDetailFairyProductTime).Text = ETC.CalcTime(fairy.ProductTime);


                // 요정 기본 정보 초기화

                FindViewById <TextView>(Resource.Id.FairyDBDetailInfoType).Text        = fairy.Type;
                FindViewById <TextView>(Resource.Id.FairyDBDetailInfoName).Text        = fairy.Name;
                FindViewById <TextView>(Resource.Id.FairyDBDetailInfoIllustrator).Text = "";
                FindViewById <TextView>(Resource.Id.FairyDBDetailInfoETC).Text         = fairy.Note;


                // 요정 스킬 정보 초기화

                try
                {
                    string skillIconPath = Path.Combine(ETC.cachePath, "Skill", $"{fairy.SkillName}.gfdcache");
                    string url2          = Path.Combine(ETC.server, "Data", "Images", "FairySkill", $"{fairy.SkillName}.png");

                    if (!File.Exists(skillIconPath) || isRefresh)
                    {
                        using (var wc = new WebClient())
                        {
                            await wc.DownloadFileTaskAsync(url2, skillIconPath);
                        }
                    }

                    FindViewById <ImageView>(Resource.Id.FairyDBDetailSkillIcon).SetImageDrawable(Drawable.CreateFromPath(skillIconPath));
                }
                catch (Exception ex)
                {
                    ETC.LogError(ex, this);
                }

                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillName).Text = fairy.SkillName;

                if (ETC.useLightTheme)
                {
                    FindViewById <ImageView>(Resource.Id.FairyDBDetailSkillTicketIcon).SetImageResource(Resource.Drawable.FairyTicket_Icon_WhiteTheme);
                    FindViewById <ImageView>(Resource.Id.FairyDBDetailSkillCoolTimeIcon).SetImageResource(Resource.Drawable.CoolTime_Icon_WhiteTheme);
                }

                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillTicket).Text   = fairy.OrderConsume.ToString();
                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillCoolTime).Text = fairy.CoolDown.ToString();
                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillExplain).Text  = fairy.SkillExplain.ToString();

                string[] effect = fairy.SkillEffect;
                string[] rate   = fairy.SkillRate;

                var sb1 = new StringBuilder();
                var sb2 = new StringBuilder();

                for (int i = 0; i < effect.Length; ++i)
                {
                    sb1.Append(effect[i]);
                    sb2.Append(rate[i]);

                    if (i < (effect.Length - 1))
                    {
                        sb1.Append(" || ");
                        sb2.Append(" || ");
                    }
                }

                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillEffect).Text = sb1.ToString();
                FindViewById <TextView>(Resource.Id.FairyDBDetailSkillRate).Text   = sb2.ToString();


                // 요정 능력치 초기화

                string[] abilities        = { "FireRate", "Accuracy", "Evasion", "Armor", "Critical" };
                int[]    Progresses       = { Resource.Id.FairyInfoFRProgress, Resource.Id.FairyInfoACProgress, Resource.Id.FairyInfoEVProgress, Resource.Id.FairyInfoAMProgress, Resource.Id.FairyInfoCRProgress };
                int[]    ProgressMaxTexts = { Resource.Id.FairyInfoFRProgressMax, Resource.Id.FairyInfoACProgressMax, Resource.Id.FairyInfoEVProgressMax, Resource.Id.FairyInfoAMProgressMax, Resource.Id.FairyInfoCRProgressMax };
                int[]    StatusTexts      = { Resource.Id.FairyInfoFRStatus, Resource.Id.FairyInfoACStatus, Resource.Id.FairyInfoEVStatus, Resource.Id.FairyInfoAMStatus, Resource.Id.FairyInfoCRStatus };

                for (int i = 0; i < Progresses.Length; ++i)
                {
                    FindViewById <TextView>(ProgressMaxTexts[i]).Text = FindViewById <ProgressBar>(Progresses[i]).Max.ToString();

                    int MaxValue = int.Parse(fairy.Abilities[abilities[i]].Split('/')[1]);

                    FindViewById <ProgressBar>(Progresses[i]).Progress = MaxValue;
                    FindViewById <TextView>(StatusTexts[i]).Text       = fairy.Abilities[abilities[i]];
                }

                if (ETC.useLightTheme)
                {
                    SetCardTheme();
                }

                ShowCardViewVisibility();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                Toast.MakeText(this, Resource.String.DBDetail_LoadDetailFail, ToastLength.Long).Show();
            }
            finally
            {
                refreshMainLayout.Refreshing = false;
            }
        }
コード例 #6
0
        private async Task InitLoadProcess(bool IsRefresh)
        {
            await Task.Delay(100);

            try
            {
                refreshMainLayout.Refreshing = true;


                // 장비 타이틀 바 초기화

                try
                {
                    if (!File.Exists(Path.Combine(ETC.cachePath, "Equip", "Normal", $"{equip.Icon}.gfdcache")) || IsRefresh)
                    {
                        using (WebClient wc = new WebClient())
                        {
                            await wc.DownloadFileTaskAsync(Path.Combine(ETC.server, "Data", "Images", "Equipments", $"{equip.Icon}.png"), Path.Combine(ETC.cachePath, "Equip", "Normal", $"{equip.Icon}.gfdcache"));
                        }
                    }

                    if (Preferences.Get("DBDetailBackgroundImage", true))
                    {
                        Drawable drawable = Drawable.CreateFromPath(Path.Combine(ETC.cachePath, "Equip", "Normal", $"{equip.Icon}.gfdcache"));
                        drawable.SetAlpha(40);
                        FindViewById <RelativeLayout>(Resource.Id.EquipDBDetailMainLayout).Background = drawable;
                    }

                    FindViewById <ImageView>(Resource.Id.EquipDBDetailImage).SetImageDrawable(Drawable.CreateFromPath(Path.Combine(ETC.cachePath, "Equip", "Normal", $"{equip.Icon}.gfdcache")));
                }
                catch (Exception ex)
                {
                    ETC.LogError(ex, this);
                }

                FindViewById <TextView>(Resource.Id.EquipDBDetailEquipName).Text        = equip.Name;
                FindViewById <TextView>(Resource.Id.EquipDBDetailEquipType).Text        = equip.Type;
                FindViewById <TextView>(Resource.Id.EquipDBDetailEquipProductTime).Text = ETC.CalcTime(equip.ProductTime);


                // 장비 기본 정보 초기화

                StringBuilder gradeString = new();

                if (equip.Grade is 0)
                {
                    gradeString.Append('★');
                    gradeString.Append(" EX");
                }
                else
                {
                    for (int i = 0; i < equip.Grade; ++i)
                    {
                        gradeString.Append('★');
                    }
                }

                FindViewById <TextView>(Resource.Id.EquipDBDetailInfoGrade).Text    = gradeString.ToString();
                FindViewById <TextView>(Resource.Id.EquipDBDetailInfoCategory).Text = equip.Category;
                FindViewById <TextView>(Resource.Id.EquipDBDetailInfoType).Text     = equip.Type;
                FindViewById <TextView>(Resource.Id.EquipDBDetailInfoName).Text     = equip.Name;
                FindViewById <TextView>(Resource.Id.EquipDBDetailInfoETC).Text      = equip.Note;


                // 장비 사용여부 정보 초기화

                bool IsOnlyUse = false;

                if (equip.OnlyUse != null)
                {
                    if (string.IsNullOrWhiteSpace(equip.OnlyUse[0]) == false)
                    {
                        IsOnlyUse = true;
                    }
                    else
                    {
                        IsOnlyUse = false;
                    }
                }
                else
                {
                    IsOnlyUse = false;
                }

                switch (IsOnlyUse)
                {
                case false:
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoOnlyUseLayout).Visibility   = ViewStates.Gone;
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoRecommendLayout).Visibility = ViewStates.Visible;
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoUseLayout).Visibility       = ViewStates.Visible;

                    string[]      TotalAvailable = equip.DollType;
                    List <string> RecommendType  = new List <string>();
                    List <string> UseType        = new List <string>();

                    foreach (string s in TotalAvailable)
                    {
                        string[] temp = s.Split(',');

                        if (temp[1] == "F")
                        {
                            RecommendType.Add(temp[0]);
                        }
                        else if (temp[1] == "U")
                        {
                            UseType.Add(temp[0]);
                        }
                    }

                    RecommendType.TrimExcess();
                    UseType.TrimExcess();

                    StringBuilder sb1 = new StringBuilder();
                    StringBuilder sb2 = new StringBuilder();

                    for (int i = 0; i < RecommendType.Count; ++i)
                    {
                        sb1.Append(RecommendType[i]);
                        if (i < (RecommendType.Count - 1))
                        {
                            sb1.Append(" | ");
                        }
                    }
                    for (int i = 0; i < UseType.Count; ++i)
                    {
                        sb2.Append(UseType[i]);
                        if (i < (UseType.Count - 1))
                        {
                            sb2.Append(" | ");
                        }
                    }

                    FindViewById <TextView>(Resource.Id.EquipDBDetailAvailableInfoRecommend).Text = sb1.ToString();
                    FindViewById <TextView>(Resource.Id.EquipDBDetailAvailableInfoUse).Text       = sb2.ToString();
                    break;

                case true:
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoRecommendLayout).Visibility = ViewStates.Gone;
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoUseLayout).Visibility       = ViewStates.Gone;
                    FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAvailableInfoOnlyUseLayout).Visibility   = ViewStates.Visible;

                    StringBuilder sb = new StringBuilder();

                    for (int i = 0; i < equip.OnlyUse.Length; ++i)
                    {
                        sb.Append(equip.OnlyUse[i]);
                        if (i < (equip.OnlyUse.Length - 1))
                        {
                            sb.Append(" | ");
                        }
                    }

                    FindViewById <TextView>(Resource.Id.EquipDBDetailAvailableInfoOnlyUse).Text = sb.ToString();
                    break;
                }


                // 장비 능력치 초기화

                string[] Abilities       = equip.Abilities;
                string[] AbilityInitMags = equip.InitMags;
                string[] AbilityMaxMags  = equip.MaxMags;

                abilityTableSubLayout.RemoveAllViews();

                for (int i = 0; i < equip.Abilities.Length; ++i)
                {
                    LinearLayout layout = new LinearLayout(this)
                    {
                        Orientation      = Orientation.Horizontal,
                        LayoutParameters = FindViewById <LinearLayout>(Resource.Id.EquipDBDetailAbilityTopLayout).LayoutParameters
                    };

                    TextView ability = new TextView(this);
                    TextView initmag = new TextView(this);
                    TextView maxmag  = new TextView(this);

                    ability.LayoutParameters = FindViewById <TextView>(Resource.Id.EquipDBDetailAbilityTopText1).LayoutParameters;
                    initmag.LayoutParameters = FindViewById <TextView>(Resource.Id.EquipDBDetailAbilityTopText2).LayoutParameters;
                    maxmag.LayoutParameters  = FindViewById <TextView>(Resource.Id.EquipDBDetailAbilityTopText3).LayoutParameters;

                    ability.Text = equip.Abilities[i];
                    ability.SetTextColor(Android.Graphics.Color.LimeGreen);
                    ability.Gravity = GravityFlags.Center;
                    initmag.Text    = equip.InitMags[i];
                    initmag.Gravity = GravityFlags.Center;
                    maxmag.Text     = equip.CanUpgrade ? equip.MaxMags[i] : "X";
                    maxmag.Gravity  = GravityFlags.Center;

                    layout.AddView(ability);
                    layout.AddView(initmag);
                    layout.AddView(maxmag);

                    abilityTableSubLayout.AddView(layout);
                }

                if (ETC.useLightTheme)
                {
                    SetCardTheme();
                }

                ShowCardViewVisibility();
            }
            catch (WebException ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.RetryLoad_CauseNetwork, Snackbar.LengthShort, Android.Graphics.Color.DarkMagenta);

                _ = InitLoadProcess(false);

                return;
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.DBDetail_LoadDetailFail, Snackbar.LengthShort, Android.Graphics.Color.DarkRed);
            }
            finally
            {
                refreshMainLayout.Refreshing = false;
            }
        }