Commit 16e97eda authored by fallenstardust's avatar fallenstardust

完善显示

parent 0feab90d
...@@ -67,29 +67,28 @@ public class YGOStarter { ...@@ -67,29 +67,28 @@ public class YGOStarter {
private static ImageLoader imageLoader; private static ImageLoader imageLoader;
private static StringManager mStringManager; private static StringManager mStringManager;
private static SparseArray<Card> cards; private static SparseArray<Card> cards;
private static Context mContext;
private static View view; private static View view;
public static void RandomCardDetail(Context context, Card cardInfo) { public static void RandomCardDetail(Context context, Card cardInfo) {
mContext = context; ThreeDLayoutUtil viewCardDetail = (ThreeDLayoutUtil) inflate(context, R.layout.dialog_cardinfo_small, null);
View viewCardDetail = inflate(mContext, R.layout.dialog_cardinfo_small, null); cardImage = viewCardDetail.findViewById(R.id.card_image_toast);
cardImage = viewCardDetail.findViewById(R.id.card_image); name = viewCardDetail.findViewById(R.id.card_name_toast);
name = viewCardDetail.findViewById(R.id.text_name); level = viewCardDetail.findViewById(R.id.card_level_toast);
level = viewCardDetail.findViewById(R.id.card_level); linkArrow = viewCardDetail.findViewById(R.id.link_arrows_toast);
linkArrow = viewCardDetail.findViewById(R.id.detail_link_arrows); race = viewCardDetail.findViewById(R.id.card_race_toast);
race = viewCardDetail.findViewById(R.id.card_race); attrView = viewCardDetail.findViewById(R.id.card_attr_toast);
attrView = viewCardDetail.findViewById(R.id.card_attribute); type = viewCardDetail.findViewById(R.id.card_type_toast);
type = viewCardDetail.findViewById(R.id.card_type); cardAtk = viewCardDetail.findViewById(R.id.card_atk_toast);
cardAtk = viewCardDetail.findViewById(R.id.card_atk); cardDef = viewCardDetail.findViewById(R.id.card_def_toast);
cardDef = viewCardDetail.findViewById(R.id.card_def); atkdefView = viewCardDetail.findViewById(R.id.layout_atkdef2_toast);
atkdefView = viewCardDetail.findViewById(R.id.layout_atkdef2); desc = viewCardDetail.findViewById(R.id.text_desc_toast);
desc = viewCardDetail.findViewById(R.id.text_desc);
monsterlayout = viewCardDetail.findViewById(R.id.layout_monster);
layout_detail_p_scale = viewCardDetail.findViewById(R.id.detail_p_scale); layout_detail_p_scale = viewCardDetail.findViewById(R.id.detail_p_scale);
detail_cardscale = viewCardDetail.findViewById(R.id.detail_cardscale); detail_cardscale = viewCardDetail.findViewById(R.id.detail_cardscale);
if (cardInfo == null) return; if (cardInfo == null) return;
mStringManager = DataManager.get().getStringManager();
imageLoader = ImageLoader.get(context);
imageLoader.bindImage(cardImage, cardInfo.Code, null, true); imageLoader.bindImage(cardImage, cardInfo.Code, null, true);
name.setText(cardInfo.Name); name.setText(cardInfo.Name);
type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|")); type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|"));
...@@ -97,20 +96,13 @@ public class YGOStarter { ...@@ -97,20 +96,13 @@ public class YGOStarter {
desc.setText(cardInfo.Desc); desc.setText(cardInfo.Desc);
if (cardInfo.isType(CardType.Monster)) { if (cardInfo.isType(CardType.Monster)) {
atkdefView.setVisibility(View.VISIBLE); atkdefView.setVisibility(View.VISIBLE);
monsterlayout.setVisibility(View.VISIBLE);
race.setVisibility(View.VISIBLE); race.setVisibility(View.VISIBLE);
String star = "★" + cardInfo.getStar(); String star = "★" + cardInfo.getStar();
level.setText(star); level.setText(star);
if (cardInfo.isType(CardType.Xyz)) { if (cardInfo.isType(CardType.Xyz)) {
level.setTextColor(mContext.getResources().getColor(R.color.star_rank)); level.setTextColor(context.getResources().getColor(R.color.star_rank));
} else { } else {
level.setTextColor(mContext.getResources().getColor(R.color.star)); level.setTextColor(context.getResources().getColor(R.color.star));
}
if (cardInfo.isType(CardType.Pendulum)) {
layout_detail_p_scale.setVisibility(View.VISIBLE);
detail_cardscale.setText(String.valueOf(cardInfo.LScale));
} else {
layout_detail_p_scale.setVisibility(View.GONE);
} }
cardAtk.setText((cardInfo.Attack < 0 ? "?" : String.valueOf(cardInfo.Attack))); cardAtk.setText((cardInfo.Attack < 0 ? "?" : String.valueOf(cardInfo.Attack)));
//连接怪兽设置 //连接怪兽设置
...@@ -128,11 +120,10 @@ public class YGOStarter { ...@@ -128,11 +120,10 @@ public class YGOStarter {
} else { } else {
atkdefView.setVisibility(View.GONE); atkdefView.setVisibility(View.GONE);
race.setVisibility(View.GONE); race.setVisibility(View.GONE);
monsterlayout.setVisibility(View.GONE);
level.setVisibility(View.GONE); level.setVisibility(View.GONE);
linkArrow.setVisibility(View.GONE); linkArrow.setVisibility(View.GONE);
} }
Toast toast = new Toast(mContext); Toast toast = new Toast(context);
toast.setView(viewCardDetail); toast.setView(viewCardDetail);
toast.setDuration(Toast.LENGTH_LONG); toast.setDuration(Toast.LENGTH_LONG);
toast.show(); toast.show();
...@@ -269,7 +260,6 @@ public class YGOStarter { ...@@ -269,7 +260,6 @@ public class YGOStarter {
//random carddetail first //random carddetail first
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
mCardManager = DataManager.get().getCardManager(); mCardManager = DataManager.get().getCardManager();
mStringManager = DataManager.get().getStringManager();
cards = mCardManager.getAllCards(); cards = mCardManager.getAllCards();
}).fail((e) -> { }).fail((e) -> {
//if failed, random tips second //if failed, random tips second
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment