Commit 8242a7c5 authored by fallenstardust's avatar fallenstardust

可切换额外卡库脚本

parent 425af859
#include "data_manager.h"
#include "game.h"
#include <stdio.h>
namespace ygo {
......@@ -321,13 +322,21 @@ int DataManager::CardReader(int code, void* pData) {
return 0;
}
byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
char exname[256] = "./expansions";
strcat(exname, script_name + 1);//default script name: ./script/c%d.lua
byte* buffer = irr::android::android_script_reader(exname, slen);
if(buffer)
return buffer;
// default script name: ./script/c%d.lua
char first[256];
char second[256];
if(mainGame->gameConf.prefer_expansion_script) {
sprintf(first, "expansions/%s", script_name + 2);
sprintf(second, "%s", script_name + 2);
} else {
sprintf(first, "%s", script_name + 2);
sprintf(second, "expansions/%s", script_name + 2);
}
// byte* buffer = irr::android::android_script_reader(first, slen);
if(ScriptReader(first, slen))
return irr::android::android_script_reader(first, slen);
else
return irr::android::android_script_reader(script_name, slen);
return irr::android::android_script_reader(second, slen);
}
byte* DataManager::ScriptReader(const char* script_name, int* slen) {
......
......@@ -1828,6 +1828,11 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true;
break;
}
case CHECKBOX_PREFER_EXPANSION: {
mainGame->gameConf.prefer_expansion_script = mainGame->chkPreferExpansionScript->isChecked() ? 1 : 0;
return true;
break;
}
case CHECKBOX_DRAW_FIELD_SPELL: {
mainGame->gameConf.draw_field_spell = mainGame->chkDrawFieldSpell->isChecked() ? 1 : 0;
return true;
......@@ -2219,7 +2224,7 @@ void ClientField::UpdateChainButtons() {
}
}
void ClientField::ShowCancelOrFinishButton(int buttonOp) {
if (!mainGame->dInfo.isReplay) {
if (!mainGame->gameConf.hide_hint_button && !mainGame->dInfo.isReplay) {
switch (buttonOp) {
case 1:
mainGame->btnCancelOrFinish->setText(dataManager.GetSysString(1295));
......
......@@ -471,6 +471,9 @@ bool Game::Initialize() {
posY += 60;
chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabSystem, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299));
chkQuickAnimation->setChecked(gameConf.quick_animation != 0);
posY += 60;
chkPreferExpansionScript = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabSystem, CHECKBOX_PREFER_EXPANSION, dataManager.GetSysString(1379));
chkPreferExpansionScript->setChecked(gameConf.prefer_expansion_script != 0);
//
wHand = env->addWindow(rect<s32>(500 * xScale, 450 * yScale, 825 * xScale, 605 * yScale), false, L"");
wHand->getCloseButton()->setVisible(false);
......@@ -847,12 +850,12 @@ bool Game::Initialize() {
}
//SINGLE MODE
irr::gui::IGUITab* tabSingle = wSingle->addTab(dataManager.GetSysString(1381));
env->addStaticText(dataManager.GetSysString(1352), rect<s32>(360 * xScale, 30 * yScale, 570 * xScale, 50 * yScale), false, true, tabSingle);
stSinglePlayInfo = env->addStaticText(L"", rect<s32>(360 * xScale, 60 * yScale, 570 * xScale, 295 * yScale), false, true, tabSingle);
lstSinglePlayList = CAndroidGUIListBox::addAndroidGUIListBox(env, rect<s32>(10 * xScale, 10 * yScale, 350 * xScale, 350 * yScale), tabSingle, LISTBOX_SINGLEPLAY_LIST, true, 40 * xScale);
lstSinglePlayList->setItemHeight(25 * yScale);
btnLoadSinglePlay = env->addButton(rect<s32>(460 * xScale, 260 * yScale, 570 * xScale, 300 * yScale), tabSingle, BUTTON_LOAD_SINGLEPLAY, dataManager.GetSysString(1211));
btnSinglePlayCancel = env->addButton(rect<s32>(460 * xScale, 310 * yScale, 570 * xScale, 350 * yScale),tabSingle, BUTTON_CANCEL_SINGLEPLAY, dataManager.GetSysString(1210));
env->addStaticText(dataManager.GetSysString(1352), rect<s32>(360 * xScale, 30 * yScale, 570 * xScale, 50 * yScale), false, true, tabSingle);
stSinglePlayInfo = env->addStaticText(L"", rect<s32>(360 * xScale, 60 * yScale, 570 * xScale, 295 * yScale), false, true, tabSingle);
//replay save
wReplaySave = env->addWindow(rect<s32>(490 * xScale, 180 * yScale, 840 * xScale, 340 * yScale), false, dataManager.GetSysString(1340));
wReplaySave->getCloseButton()->setVisible(false);
......
......@@ -380,8 +380,6 @@
!system 1351 投降
!system 1352 主要信息:
!system 1353 播放起始于回合:
!system 1354 不显示卡片系列
!system 1355 不显示提示按钮
!system 1356 是否要放弃对卡组的修改?
!system 1357 不提示保留对卡组的修改
!system 1358 键入关键字后自动进行搜索
......@@ -399,6 +397,7 @@
!system 1373 名称↓
!system 1374 连接标记
!system 1378 使用多个关键词搜索卡片
!system 1379 优先使用额外卡库数据
!system 1380 人机模式
!system 1381 残局模式
!system 1382 人机信息:
......
......@@ -380,8 +380,6 @@
!system 1351 Surrender
!system 1352 Main message
!system 1353 Start at turn
!system 1354 Hide set names
!system 1355 Hide chain buttons
!system 1356 Do you want to quit without saving?
!system 1357 Ignore deck changes while quiting
!system 1358 Search cards automatically
......@@ -399,6 +397,7 @@
!system 1373 Name
!system 1374 Link Arrows
!system 1378 Multiple Keyword Search
!system 1379 First Using Expansion Data
!system 1380 Single Mode
!system 1381 Puzzle Mode
!system 1382 Single Options:
......
......@@ -380,8 +380,6 @@
!system 1351 항복
!system 1352 정보:
!system 1353 이 턴부터 시작:
!system 1354 카드군 숨기기 
!system 1355 체인 버튼 숨기기
!system 1356 덱 변경 사항을 포기하겠습니까?
!system 1357 덱 변경 사항에 대해 요구하지 않음
!system 1358 자동으로 키워드를 검색
......@@ -399,6 +397,7 @@
!system 1372 수비력↑
!system 1373 이름↓
!system 1374 링크 마커
!system 1379 확장팩 사용 스크립트
!system 1380 AI 모드
!system 1381 퍼즐 모드
!system 1382 AI 정보:
......
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