Commit 9531b13e authored by fallenstardust's avatar fallenstardust

支持残局文件打开方式使用ygomobile

parent 871e518e
......@@ -130,7 +130,7 @@ int main(int argc, char* argv[]) {
BufferIO::DecodeUTF8(name, fname);
open_file = true;
index = GetListBoxIndex(ygo::mainGame->lstReplayList, fname);
index = GetListBoxIndex(ygo::mainGame->lstSinglePlayList, fname);
}
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ClickButton(ygo::mainGame->btnSingleMode);
......
......@@ -96,6 +96,15 @@
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\.yrp" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\..*\.yrp" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\..*\..*\.yrp" />
<data android:pathPattern=".*\.lua" />
<data android:pathPattern=".*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\..*\.lua" />
<data android:pathPattern=".*\..*\..*\..*\..*\..*\..*\..*\..*\.lua" />
</intent-filter>
<intent-filter>
......
......@@ -25,6 +25,7 @@ import ocgcore.DataManager;
import static cn.garymb.ygomobile.Constants.ACTION_OPEN_DECK;
import static cn.garymb.ygomobile.Constants.ACTION_OPEN_GAME;
import static cn.garymb.ygomobile.Constants.CORE_REPLAY_PATH;
import static cn.garymb.ygomobile.Constants.CORE_SINGLE_PATH;
import static cn.garymb.ygomobile.Constants.QUERY_NAME;
......@@ -166,7 +167,25 @@ public class GameUriManager {
if (!ComponentUtils.isActivityRunning(getActivity(), new ComponentName(getActivity(), YGOMobileActivity.class))) {
fname = new String[]{"-r", yrp.getName()};
YGOStarter.startGame(getActivity(), null, fname);
Toast.makeText(activity, activity.getString(R.string.yrp_installed), Toast.LENGTH_LONG).show();
Toast.makeText(activity, activity.getString(R.string.file_installed), Toast.LENGTH_LONG).show();
}
}
} else if (file.getName().toLowerCase(Locale.US).endsWith(".lua")) {
File single = new File(AppsSettings.get().getResourcePath() + "/" + CORE_SINGLE_PATH + "/" + file.getName());
if (single.exists()) {
fname = new String[]{"-s", single.getName()};
YGOStarter.startGame(activity, null, fname);
Toast.makeText(activity, activity.getString(R.string.file_exist), Toast.LENGTH_LONG).show();
} else {
try {
FileUtils.copyFile(file, single);
} catch (Throwable e) {
Toast.makeText(activity, activity.getString(R.string.install_failed_bcos) + e, Toast.LENGTH_LONG).show();
}
if (!ComponentUtils.isActivityRunning(getActivity(), new ComponentName(getActivity(), YGOMobileActivity.class))) {
fname = new String[]{"-s", single.getName()};
YGOStarter.startGame(activity, null, fname);
Toast.makeText(activity, activity.getString(R.string.file_installed), Toast.LENGTH_LONG).show();
}
}
}
......@@ -250,7 +269,36 @@ public class GameUriManager {
if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) {
fname = new String[]{"-r", yrp.getName()};
YGOStarter.startGame(activity, null, fname);
Toast.makeText(activity, activity.getString(R.string.yrp_installed), Toast.LENGTH_LONG).show();
Toast.makeText(activity, activity.getString(R.string.file_installed), Toast.LENGTH_LONG).show();
}
} else if (urifile.getName().toLowerCase(Locale.US).endsWith(".lua")) {
File single = new File(AppsSettings.get().getResourcePath() + "/" + CORE_SINGLE_PATH + "/" + urifile.getName());
try {
ParcelFileDescriptor pfd = getActivity().getContentResolver().openFileDescriptor(uri, "r");
if (single.exists()) {
fname = new String[]{"-s", single.getName()};
YGOStarter.startGame(getActivity(), null, fname);
Toast.makeText(activity, activity.getString(R.string.file_exist), Toast.LENGTH_SHORT).show();
} else {
if (pfd == null) {
return;
} else {
try {
FileUtils.copyFile(new FileInputStream(pfd.getFileDescriptor()), single);
} catch (Throwable e) {
Toast.makeText(activity, activity.getString(R.string.install_failed_bcos) + e, Toast.LENGTH_LONG).show();
} finally {
pfd.close();
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) {
fname = new String[]{"-s", single.getName()};
YGOStarter.startGame(activity, null, fname);
Toast.makeText(activity, activity.getString(R.string.file_installed), Toast.LENGTH_LONG).show();
}
}
} else {
......
......@@ -305,6 +305,6 @@
<string name="guide_search_result_count">여기에 검색 결과를 표시합니다</string>
<string name="about_delete_ex">만약 확장 카드를 사용하면서 문제가 발생했을 경우, 삭제하는 것도 좋은 선택이다</string>
<string name="title_delete_ex">확장 삭제</string>
<string name="yrp_installed">리플레이가 나왔습니다. 리플레이를 보려면 \"리플레이 보기\"를 누르십시오.</string>
<string name="file_installed">문건 나왔습니다.</string>
<string name="ask_delete_ex">지우려면 확인을 클릭하십시오.</string>
</resources>
......@@ -306,5 +306,5 @@
<string name="title_delete_ex">清空扩展卡包</string>
<string name="ask_delete_ex">点击确认以清空</string>
<string name="about_delete_ex">如果遇到拓展卡包问题时删除是个不错的办法</string>
<string name="yrp_installed">录像已导入,请在观看录像中选择查看</string>
<string name="file_installed">文件已导入</string>
</resources>
......@@ -308,6 +308,6 @@
<string name="guide_search_result_count">here shows search result count</string>
<string name="title_delete_ex">delete expansions</string>
<string name="about_delete_ex">if you need to delte all expansion cards</string>
<string name="yrp_installed">replay loaded, select it in \"\\Watch Replay\"\\</string>
<string name="file_installed">file loaded</string>
<string name="ask_delete_ex">Click OK to confirm the deletion</string>
</resources>
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