Commit 4218b64d authored by fallenstardust's avatar fallenstardust

优化CardSearcher执行线程

parent e7a630cf
...@@ -108,18 +108,20 @@ int main(int argc, char* argv[]) { ...@@ -108,18 +108,20 @@ int main(int argc, char* argv[]) {
#else #else
char* name = argv[i+1]; char* name = argv[i+1];
#endif #endif
wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname); wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname);
index = GetListBoxIndex(ygo::mainGame->lstReplayList, fname); index = GetListBoxIndex(ygo::mainGame->lstReplayList, fname);
ALOGD("open replay file:index=%d, name=%s", index, name); ALOGD("open replay file:index=%d, name=%s", index, name);
} }
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu); ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ClickButton(ygo::mainGame->btnReplayMode); ClickButton(ygo::mainGame->btnReplayMode);
if (index >= 0) { if (index >= 0) {
ygo::mainGame->lstReplayList->setSelected(index); ygo::mainGame->lstReplayList->setSelected(index);
ClickButton(ygo::mainGame->btnLoadReplay); ClickButton(ygo::mainGame->btnLoadReplay);
} }
break;//只播放一个
break;//只播放一个
} else if(!strcmp(arg, "-s")) { // Single } else if(!strcmp(arg, "-s")) { // Single
exit_on_return = !keep_on_return; exit_on_return = !keep_on_return;
//显示残局窗口 //显示残局窗口
...@@ -134,13 +136,13 @@ int main(int argc, char* argv[]) { ...@@ -134,13 +136,13 @@ int main(int argc, char* argv[]) {
#else #else
char* name = argv[i+1]; char* name = argv[i+1];
#endif #endif
wchar_t fname[1024]; wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname); BufferIO::DecodeUTF8(name, fname);
index = GetListBoxIndex(ygo::mainGame->lstSinglePlayList, fname); index = GetListBoxIndex(ygo::mainGame->lstSinglePlayList, fname);
ALOGD("open single file:index=%d, name=%s", index, name); ALOGD("open single file:index=%d, name=%s", index, name);
} }
if(index >= 0){ if(index >= 0){
ygo::mainGame->lstSinglePlayList->setSelected(index); ygo::mainGame->lstSinglePlayList->setSelected(index);
ClickButton(ygo::mainGame->btnLoadSinglePlay); ClickButton(ygo::mainGame->btnLoadSinglePlay);
} }
break; break;
......
...@@ -285,9 +285,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -285,9 +285,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
ALOGD("1share replay file=%s", name); ALOGD("1share replay file=%s", name);
android::OnShareFile(mainGame->appMain, "yrp", name); android::OnShareFile(mainGame->appMain, "yrp", name);
ALOGD("2after share replay file:index=%d", sel); ALOGD("2after share replay file:index=%d", sel);
#endif #endif
break; break;
} }
......
...@@ -24,6 +24,7 @@ import cn.garymb.ygomobile.loader.ICardSearcher; ...@@ -24,6 +24,7 @@ import cn.garymb.ygomobile.loader.ICardSearcher;
import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter; import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter;
import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem; import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem;
import cn.garymb.ygomobile.ui.plus.DialogPlus; import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import ocgcore.DataManager; import ocgcore.DataManager;
import ocgcore.LimitManager; import ocgcore.LimitManager;
import ocgcore.StringManager; import ocgcore.StringManager;
...@@ -135,7 +136,7 @@ public class CardSearcher implements View.OnClickListener { ...@@ -135,7 +136,7 @@ public class CardSearcher implements View.OnClickListener {
myFavButton.setOnClickListener(v -> { myFavButton.setOnClickListener(v -> {
if(isShowFavorite()){ if(isShowFavorite()){
hideFavorites(); hideFavorites(true);
} else { } else {
showFavorites(true); showFavorites(true);
} }
...@@ -278,16 +279,30 @@ public class CardSearcher implements View.OnClickListener { ...@@ -278,16 +279,30 @@ public class CardSearcher implements View.OnClickListener {
myFavButton.setSelected(true); myFavButton.setSelected(true);
if (mCallBack != null) { if (mCallBack != null) {
mCallBack.onSearchStart(); mCallBack.onSearchStart();
mCallBack.onSearchResult(CardFavorites.get().getCards(mCardLoader), !showList); }
if (mCallBack != null) {
VUiKit.post(() -> {
mCallBack.onSearchResult(CardFavorites.get().getCards(mCardLoader), !showList);
});
} }
} }
public void hideFavorites(){ public void hideFavorites(boolean reload){
mShowFavorite = false; mShowFavorite = false;
myFavButton.setSelected(false); myFavButton.setSelected(false);
if (mCallBack != null) { if (mCallBack != null) {
mCallBack.onSearchStart(); mCallBack.onSearchStart();
mCallBack.onSearchResult(Collections.emptyList(), true); }
if (reload) {
VUiKit.post(() -> {
search();
});
} else {
if (mCallBack != null) {
VUiKit.post(() -> {
mCallBack.onSearchResult(Collections.emptyList(), true);
});
}
} }
} }
...@@ -529,8 +544,7 @@ public class CardSearcher implements View.OnClickListener { ...@@ -529,8 +544,7 @@ public class CardSearcher implements View.OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v.getId() == R.id.btn_search) { if (v.getId() == R.id.btn_search) {
hideFavorites(); hideFavorites(true);
search();
} else if (v.getId() == R.id.btn_reset) { } else if (v.getId() == R.id.btn_reset) {
resetAll(); resetAll();
} }
......
...@@ -13,7 +13,6 @@ public class CardData implements Parcelable { ...@@ -13,7 +13,6 @@ public class CardData implements Parcelable {
public CardData(int code) { public CardData(int code) {
Code = code; Code = code;
} }
public int Code; public int Code;
public int Ot; public int Ot;
public int Alias; public int Alias;
......
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