Commit 8b0be901 authored by nanahira's avatar nanahira

merge

parents d6111991 5ef6e3c4
......@@ -141,6 +141,7 @@ public:
void UpdateChainButtons();
void ShowCancelOrFinishButton(int buttonOp);
void SetShowMark(ClientCard* pcard, bool enable);
void ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* element, irr::gui::IGUIElement* parent);
void SetResponseSelectedCards() const;
void SetResponseSelectedOption() const;
void CancelOrFinish();
......
......@@ -668,6 +668,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnCancelOrFinish->setVisible(false);
if(!mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
mainGame->dInfo.isReplaySkiping = false;
mainGame->wSurrender->setVisible(false);
mainGame->stMessage->setText(dataManager.GetSysString(1500));
mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock();
......@@ -702,6 +703,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case STOC_REPLAY: {
mainGame->gMutex.Lock();
mainGame->wPhase->setVisible(false);
mainGame->wSurrender->setVisible(false);
if(mainGame->dInfo.player_type < 7)
mainGame->btnLeaveGame->setVisible(false);
mainGame->btnChainIgnore->setVisible(false);
......@@ -2349,6 +2351,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dInfo.is_swapped = !mainGame->dInfo.is_swapped;
return true;
}
if(mainGame->wSurrender->isVisible())
mainGame->HideElement(mainGame->wSurrender);
if(!mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
mainGame->btnLeaveGame->setText(dataManager.GetSysString(1351));
mainGame->btnLeaveGame->setVisible(true);
......@@ -2811,7 +2815,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcarddif = 0;
mainGame->showcard = 1;
pcard->is_highlighting = true;
mainGame->WaitFrameSignal(30);
if(pcard->location & 0x30) {
float shift = -0.15f;
if(cc == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0);
pcard->dRot = irr::core::vector3df(0, 0, 0);
pcard->is_moving = true;
pcard->aniFrame = 5;
mainGame->WaitFrameSignal(30);
mainGame->dField.MoveCard(pcard, 5);
} else
mainGame->WaitFrameSignal(30);
pcard->is_highlighting = false;
mainGame->dField.current_chain.chain_card = pcard;
mainGame->dField.current_chain.code = code;
......@@ -2944,6 +2958,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.FadeCard(pcard, 255, 5);
mainGame->WaitFrameSignal(5);
}
} else if(pcard->location & 0x30) {
float shift = -0.15f;
if(c == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0);
pcard->dRot = irr::core::vector3df(0, 0, 0);
pcard->is_moving = true;
pcard->aniFrame = 5;
mainGame->WaitFrameSignal(30);
mainGame->dField.MoveCard(pcard, 5);
} else
mainGame->WaitFrameSignal(30);
myswprintf(textBuffer, dataManager.GetSysString(1610), dataManager.GetName(pcard->code), dataManager.FormatLocation(l, s), s + 1);
......
......@@ -147,10 +147,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(exit_on_return)
mainGame->device->closeDevice();
} else {
DuelClient::SendPacketToServer(CTOS_SURRENDER);
mainGame->PopupElement(mainGame->wSurrender);
}
break;
}
case BUTTON_SURRENDER_YES: {
soundManager.PlaySoundEffect(SOUND_BUTTON);
DuelClient::SendPacketToServer(CTOS_SURRENDER);
mainGame->HideElement(mainGame->wSurrender);
break;
}
case BUTTON_SURRENDER_NO: {
soundManager.PlaySoundEffect(SOUND_BUTTON);
mainGame->HideElement(mainGame->wSurrender);
break;
}
case BUTTON_CHAIN_IGNORE: {
soundManager.PlaySoundEffect(SOUND_BUTTON);
mainGame->ignore_chain = mainGame->btnChainIgnore->isPressed();
......@@ -979,6 +990,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(id >= BUTTON_CARD_0 && id <= BUTTON_CARD_4) {
int pos = mainGame->scrCardList->getPos() / 10;
ClientCard* mcard = selectable_cards[id - BUTTON_CARD_0 + pos];
SetShowMark(mcard, true);
ShowCardInfoInList(mcard, mainGame->btnCardSelect[id - BUTTON_CARD_0], mainGame->wCardSelect);
if(mcard->code) {
mainGame->ShowCardInfo(mcard->code);
} else {
......@@ -988,6 +1001,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) {
int pos = mainGame->scrDisplayList->getPos() / 10;
ClientCard* mcard = display_cards[id - BUTTON_DISPLAY_0 + pos];
SetShowMark(mcard, true);
ShowCardInfoInList(mcard, mainGame->btnCardDisplay[id - BUTTON_DISPLAY_0], mainGame->wCardDisplay);
if(mcard->code) {
mainGame->ShowCardInfo(mcard->code);
} else {
......@@ -996,6 +1011,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case irr::gui::EGET_ELEMENT_LEFT: {
if(id >= BUTTON_CARD_0 && id <= BUTTON_CARD_4) {
int pos = mainGame->scrCardList->getPos() / 10;
ClientCard* mcard = selectable_cards[id - BUTTON_CARD_0 + pos];
SetShowMark(mcard, false);
mainGame->stCardListTip->setVisible(false);
}
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) {
int pos = mainGame->scrDisplayList->getPos() / 10;
ClientCard* mcard = display_cards[id - BUTTON_DISPLAY_0 + pos];
SetShowMark(mcard, false);
mainGame->stCardListTip->setVisible(false);
}
break;
}
default:
break;
}
......@@ -1409,6 +1439,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->chain_when_avail = false;
UpdateChainButtons();
}
if(mainGame->wSurrender->isVisible())
mainGame->HideElement(mainGame->wSurrender);
mainGame->wCmdMenu->setVisible(false);
if(mainGame->fadingList.size())
break;
......@@ -2272,6 +2304,34 @@ void ClientField::SetShowMark(ClientCard* pcard, bool enable) {
chit->chain_card->is_showchaintarget = enable;
}
}
void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* element, irr::gui::IGUIElement* parent) {
std::wstring str(L"");
if(pcard->code) {
str.append(dataManager.GetName(pcard->code));
}
for(size_t i = 0; i < chains.size(); ++i) {
wchar_t formatBuffer[2048];
auto chit = chains[i];
if(pcard == chit.chain_card) {
myswprintf(formatBuffer, dataManager.GetSysString(216), i + 1);
str.append(L"\n").append(formatBuffer);
}
if(chit.target.find(pcard) != chit.target.end()) {
myswprintf(formatBuffer, dataManager.GetSysString(217), i + 1, dataManager.GetName(chit.chain_card->code));
str.append(L"\n").append(formatBuffer);
}
}
if(str.length() > 0) {
parent->addChild(mainGame->stCardListTip);
irr::core::rect<s32> epos = element->getRelativePosition();
s32 x = (epos.UpperLeftCorner.X + epos.LowerRightCorner.X) / 2;
s32 y = epos.LowerRightCorner.Y;
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stCardListTip->setRelativePosition(recti(x - dtip.Width / 2, y - 10, x + dtip.Width / 2, y - 10 + dtip.Height));
mainGame->stCardListTip->setText(str.c_str());
mainGame->stCardListTip->setVisible(true);
}
}
void ClientField::SetResponseSelectedCards() const {
unsigned char respbuf[64];
respbuf[0] = selected_cards.size();
......
......@@ -386,6 +386,14 @@ bool Game::Initialize() {
stQMessage->setTextAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_CENTER);
btnYes = env->addButton(rect<s32>(100, 105, 150, 130), wQuery, BUTTON_YES, dataManager.GetSysString(1213));
btnNo = env->addButton(rect<s32>(200, 105, 250, 130), wQuery, BUTTON_NO, dataManager.GetSysString(1214));
//surrender yes/no (310)
wSurrender = env->addWindow(rect<s32>(490, 200, 840, 340), false, dataManager.GetSysString(560));
wSurrender->getCloseButton()->setVisible(false);
wSurrender->setVisible(false);
stSurrenderMessage = env->addStaticText(dataManager.GetSysString(1359), rect<s32>(20, 20, 350, 100), false, true, wSurrender, -1, false);
stSurrenderMessage->setTextAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_CENTER);
btnSurrenderYes = env->addButton(rect<s32>(100, 105, 150, 130), wSurrender, BUTTON_SURRENDER_YES, dataManager.GetSysString(1213));
btnSurrenderNo = env->addButton(rect<s32>(200, 105, 250, 130), wSurrender, BUTTON_SURRENDER_NO, dataManager.GetSysString(1214));
//options (310)
wOptions = env->addWindow(rect<s32>(490, 200, 840, 340), false, L"");
wOptions->getCloseButton()->setVisible(false);
......@@ -717,6 +725,11 @@ bool Game::Initialize() {
stTip->setBackgroundColor(0xc0ffffff);
stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stTip->setVisible(false);
//tip for cards in select / display list
stCardListTip = env->addStaticText(L"", rect<s32>(0, 0, 150, 150), false, true, wCardSelect, -1, true);
stCardListTip->setBackgroundColor(0xc0ffffff);
stCardListTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stCardListTip->setVisible(false);
device->setEventReceiver(&menuHandler);
LoadConfig();
if(!soundManager.Init()) {
......@@ -1776,6 +1789,7 @@ void Game::CloseDuelWindow() {
wPhase->setVisible(false);
wPosSelect->setVisible(false);
wQuery->setVisible(false);
wSurrender->setVisible(false);
wReplayControl->setVisible(false);
wReplaySave->setVisible(false);
stHintMsg->setVisible(false);
......
......@@ -270,6 +270,7 @@ public:
//hint text
irr::gui::IGUIStaticText* stHintMsg;
irr::gui::IGUIStaticText* stTip;
irr::gui::IGUIStaticText* stCardListTip;
//infos
irr::gui::IGUITabControl* wInfos;
irr::gui::IGUIStaticText* stName;
......@@ -394,6 +395,11 @@ public:
irr::gui::IGUIStaticText* stQMessage;
irr::gui::IGUIButton* btnYes;
irr::gui::IGUIButton* btnNo;
//surrender yes/no
irr::gui::IGUIWindow* wSurrender;
irr::gui::IGUIStaticText* stSurrenderMessage;
irr::gui::IGUIButton* btnSurrenderYes;
irr::gui::IGUIButton* btnSurrenderNo;
//options
irr::gui::IGUIWindow* wOptions;
irr::gui::IGUIStaticText* stOptions;
......@@ -657,6 +663,8 @@ extern Game* mainGame;
#define BUTTON_DISPLAY_4 294
#define SCROLL_CARD_DISPLAY 295
#define BUTTON_CARD_DISP_OK 296
#define BUTTON_SURRENDER_YES 297
#define BUTTON_SURRENDER_NO 298
#define BUTTON_CATEGORY_OK 300
#define COMBOBOX_DBLFLIST 301
#define COMBOBOX_DBDECKS 302
......
......@@ -221,6 +221,8 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
PlaySoundEffect(SOUND_INFO);
} else if(element == mainGame->wQuery) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wSurrender) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wOptions) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANAttribute) {
......
......@@ -65,13 +65,13 @@ solution "ygo"
configuration {"not vs*", "windows"}
buildoptions { "-static-libgcc" }
include "lua"
include "ocgcore"
include "gframe"
if os.ishost("windows") then
include "event"
include "freetype"
include "irrlicht"
include "lua"
include "sqlite3"
end
if USE_IRRKLANG then
......
......@@ -68,6 +68,8 @@
!system 213 已选择种族:
!system 214 已选择属性:
!system 215 已选择数字:
!system 216 在连锁%d发动
!system 217 被连锁%d的[%ls]选择为对象
!system 500 请选择要解放的卡
!system 501 请选择要丢弃的手卡
!system 502 请选择要破坏的卡
......@@ -386,6 +388,7 @@
!system 1356 是否要放弃对卡组的修改?
!system 1357 不提示保留对卡组的修改
!system 1358 键入关键字后自动进行搜索
!system 1359 是否确定投降?
!system 1360 上一步
!system 1361 删除录像
!system 1362 重命名
......
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