Commit e3f96e18 authored by fallenstardust's avatar fallenstardust

启动录像,残局前先刷新加载列表

parent 0604b102
......@@ -19,17 +19,17 @@ char* sub_string(const char* str, int start, int count=-1){
char* tmp = new char[1024];
int len = strlen(str);
int index = 0;
if(count < 0){
if(count < 0) {
count = len - start;
}
}
for (int j = start; j < len && count > 0; count--, j++) {
tmp[index++] = str[j];
}
}
tmp[index] = '\0';
return tmp;
}
#ifdef _IRR_ANDROID_PLATFORM_
int GetListBoxIndex(IGUIListBox* listbox, const wchar_t* target){
int GetListBoxIndex(IGUIListBox* listbox, const wchar_t * target){
int count = listbox->getItemCount();
for(int i = 0; i < count; i++){
auto item = listbox->getListItem(i);
......@@ -37,7 +37,7 @@ int GetListBoxIndex(IGUIListBox* listbox, const wchar_t* target){
return i;
}
}
return 0;
return -1;
}
void android_main(ANDROID_APP app) {
app->inputPollSource.process = android::process_input;
......@@ -61,9 +61,9 @@ int main(int argc, char* argv[]) {
* -j: join host (host info from system.conf)
* -d: deck edit
* -r: replay
* -s:single
*/
bool keep_on_return = false;
bool open_file = false;
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_WARN, "ygo", "handle args %d", argc);
__android_log_print(ANDROID_LOG_WARN, "ygo", "handle args %s", argv);
......@@ -96,7 +96,13 @@ int main(int argc, char* argv[]) {
break;
} else if(!strcmp(arg, "-r")) { // Replay
exit_on_return = !keep_on_return;
int index = 0;
//显示录像窗口
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ygo::mainGame->ShowElement(ygo::mainGame->wReplay);
ygo::mainGame->ebRepStartTurn->setText(L"1");
ygo::mainGame->stReplayInfo->setText(L"");
ygo::mainGame->RefreshReplay();
int index = -1;
if((i+1) < argc){//下一个参数是录像名
#ifdef _IRR_ANDROID_PLATFORM_
const char* name = argv[i+1].c_str();
......@@ -105,21 +111,24 @@ int main(int argc, char* argv[]) {
#endif
wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname);
open_file = true;
index = GetListBoxIndex(ygo::mainGame->lstReplayList, fname);
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "open replay file:index=%d, name=%s", index, name);
}
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ClickButton(ygo::mainGame->btnReplayMode);
if(open_file){
if (index >= 0) {
ygo::mainGame->lstReplayList->setSelected(index);
ClickButton(ygo::mainGame->btnLoadReplay);
}
break;//只播放一个
} else if(!strcmp(arg, "-s")) { // Single
exit_on_return = !keep_on_return;
int index = 0;
//显示残局窗口
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ygo::mainGame->ShowElement(ygo::mainGame->wSinglePlay);
ygo::mainGame->RefreshSingleplay();
ygo::mainGame->RefreshBot();
int index = -1;
if((i+1) < argc){//下一个参数是文件名
#ifdef _IRR_ANDROID_PLATFORM_
const char* name = argv[i+1].c_str();
......@@ -128,13 +137,10 @@ int main(int argc, char* argv[]) {
#endif
wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname);
open_file = true;
index = GetListBoxIndex(ygo::mainGame->lstSinglePlayList, fname);
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "open single file:index=%d, name=%s", index, name);
}
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ClickButton(ygo::mainGame->btnSingleMode);
if(open_file){
if(index >= 0){
ygo::mainGame->lstSinglePlayList->setSelected(index);
ClickButton(ygo::mainGame->btnLoadSinglePlay);
}
......
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