Commit 74be9404 authored by fallenstardust's avatar fallenstardust

增加卡差,数字计时,默认屏蔽虚拟键

parent b43e94c2
...@@ -91,6 +91,7 @@ void ClientField::Clear() { ...@@ -91,6 +91,7 @@ void ClientField::Clear() {
pzone_act[1] = false; pzone_act[1] = false;
conti_act = false; conti_act = false;
deck_reversed = false; deck_reversed = false;
RefreshCardCountDisplay();
} }
void ClientField::Initial(int player, int deckc, int extrac) { void ClientField::Initial(int player, int deckc, int extrac) {
ClientCard* pcard; ClientCard* pcard;
...@@ -114,6 +115,7 @@ void ClientField::Initial(int player, int deckc, int extrac) { ...@@ -114,6 +115,7 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->position = POS_FACEDOWN_DEFENSE; pcard->position = POS_FACEDOWN_DEFENSE;
GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true); GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true);
} }
RefreshCardCountDisplay();
} }
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) { ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0; std::vector<ClientCard*>* lst = 0;
...@@ -223,6 +225,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -223,6 +225,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
break; break;
} }
} }
RefreshCardCountDisplay();
} }
ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) { ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
ClientCard* pcard = 0; ClientCard* pcard = 0;
...@@ -1432,4 +1435,28 @@ void ClientField::UpdateDeclarableCode(bool enter) { ...@@ -1432,4 +1435,28 @@ void ClientField::UpdateDeclarableCode(bool enter) {
else else
UpdateDeclarableCodeOpcode(enter); UpdateDeclarableCodeOpcode(enter);
} }
void ClientField::RefreshCardCountDisplay() {
for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size();
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
}
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00;
mainGame->dInfo.card_count_color[1] = 0xffff0000;
} else if(mainGame->dInfo.card_count[1] > mainGame->dInfo.card_count[0]) {
mainGame->dInfo.card_count_color[1] = 0xffffff00;
mainGame->dInfo.card_count_color[0] = 0xffff0000;
} else {
mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff;
}
} }
}
\ No newline at end of file
...@@ -117,6 +117,8 @@ public: ...@@ -117,6 +117,8 @@ public:
void UpdateDeclarableCodeOpcode(bool enter); void UpdateDeclarableCodeOpcode(bool enter);
void UpdateDeclarableCode(bool enter); void UpdateDeclarableCode(bool enter);
void RefreshCardCountDisplay();
irr::gui::IGUIElement* panel; irr::gui::IGUIElement* panel;
std::vector<int> ancard; std::vector<int> ancard;
int hovered_controler; int hovered_controler;
......
...@@ -432,6 +432,13 @@ void Game::DrawCard(ClientCard* pcard) { ...@@ -432,6 +432,13 @@ void Game::DrawCard(ClientCard* pcard) {
}//pendulum RIGHT scale image }//pendulum RIGHT scale image
} }
} }
void Game::DrawShadowText(CGUITTFont * font, const core::stringw & text, const core::rect<s32>& position, const core::rect<s32>& padding,
video::SColor color, video::SColor shadowcolor, bool hcenter, bool vcenter, const core::rect<s32>* clip) {
core::rect<s32> shadowposition = recti(position.UpperLeftCorner.X - padding.UpperLeftCorner.X, position.UpperLeftCorner.Y - padding.UpperLeftCorner.Y,
position.LowerRightCorner.X - padding.LowerRightCorner.X, position.LowerRightCorner.Y - padding.LowerRightCorner.Y);
font->draw(text, shadowposition, shadowcolor, hcenter, vcenter, clip);
font->draw(text, position, color, hcenter, vcenter, clip);
}
void Game::DrawMisc() { void Game::DrawMisc() {
static irr::core::vector3df act_rot(0, 0, 0); static irr::core::vector3df act_rot(0, 0, 0);
int rule = (dInfo.duel_rule >= 4) ? 1 : 0; int rule = (dInfo.duel_rule >= 4) ? 1 : 0;
...@@ -542,10 +549,32 @@ void Game::DrawMisc() { ...@@ -542,10 +549,32 @@ void Game::DrawMisc() {
} }
} }
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
if(imageManager.tClock) {
driver->draw2DImage(imageManager.tClock, recti(577 * mainGame->xScale, 32 * mainGame->yScale, 595 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 0, 128, 128), 0, 0, true);
driver->draw2DImage(imageManager.tClock, recti(695 * mainGame->xScale, 32 * mainGame->yScale, 713 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 0, 128, 128), 0, 0, true);
}
DrawShadowText(numFont, dInfo.str_time_left[0], recti(595 * mainGame->xScale, 31 * mainGame->yScale, 625 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], recti(713 * mainGame->xScale, 31 * mainGame->yScale, 743 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tCover[0], recti(535 * mainGame->xScale, 32 * mainGame->yScale, 545 * mainGame->xScale, 50 * mainGame->yScale), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tCover[1], recti(745 * mainGame->xScale, 32 * mainGame->yScale, 757 * mainGame->xScale, 50 * mainGame->yScale), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
DrawShadowText(numFont, dInfo.str_card_count[0], recti(550 * mainGame->xScale, 31 * mainGame->yScale, 575 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], recti(757 * mainGame->xScale, 31 * mainGame->yScale, 782 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
/*
driver->draw2DRectangle(recti(525 * mainGame->xScale, 34 * mainGame->yScale, (525 + dInfo.time_left[0] * 100 / dInfo.time_limit) * mainGame->xScale, 44 * mainGame->yScale), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(recti(525 * mainGame->xScale, 34 * mainGame->yScale, (525 + dInfo.time_left[0] * 100 / dInfo.time_limit) * mainGame->xScale, 44 * mainGame->yScale), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(recti(525 * mainGame->xScale, 34 * mainGame->yScale, 625 * mainGame->xScale, 44 * mainGame->yScale), 0xffffffff); driver->draw2DRectangleOutline(recti(525 * mainGame->xScale, 34 * mainGame->yScale, 625 * mainGame->xScale, 44 * mainGame->yScale), 0xffffffff);
driver->draw2DRectangle(recti((795 - dInfo.time_left[1] * 100 / dInfo.time_limit) * mainGame->xScale, 34 * mainGame->yScale, 795 * mainGame->xScale, 44 * mainGame->yScale), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(recti((795 - dInfo.time_left[1] * 100 / dInfo.time_limit) * mainGame->xScale, 34 * mainGame->yScale, 795 * mainGame->xScale, 44 * mainGame->yScale), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(recti(695 * mainGame->xScale, 34 * mainGame->yScale, 795 * mainGame->xScale, 44 * mainGame->yScale), 0xffffffff); driver->draw2DRectangleOutline(recti(695 * mainGame->xScale, 34 * mainGame->yScale, 795 * mainGame->xScale, 44 * mainGame->yScale), 0xffffffff);
*/
}
else {
driver->draw2DImage(imageManager.tCover[0], recti(588 * mainGame->xScale, 32 * mainGame->yScale, 600 * mainGame->xScale, 50 * mainGame->yScale), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tCover[1], recti(695 * mainGame->xScale, 32 * mainGame->yScale, 707 * mainGame->xScale, 50 * mainGame->yScale), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
DrawShadowText(numFont, dInfo.str_card_count[0], recti(600 * mainGame->xScale, 31 * mainGame->yScale, 625 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], recti(707 * mainGame->xScale, 31 * mainGame->yScale, 732 * mainGame->xScale, 50 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
} }
numFont->draw(dInfo.strLP[0], recti(330 * mainGame->xScale, 11 * mainGame->yScale, 629 * mainGame->xScale, 30 * mainGame->yScale), 0xff000000, true, false, 0); numFont->draw(dInfo.strLP[0], recti(330 * mainGame->xScale, 11 * mainGame->yScale, 629 * mainGame->xScale, 30 * mainGame->yScale), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[0], recti(330 * mainGame->xScale, 12 * mainGame->yScale, 631 * mainGame->xScale, 30 * mainGame->yScale), 0xffffff00, true, false, 0); numFont->draw(dInfo.strLP[0], recti(330 * mainGame->xScale, 12 * mainGame->yScale, 631 * mainGame->xScale, 30 * mainGame->yScale), 0xffffff00, true, false, 0);
......
...@@ -453,6 +453,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -453,6 +453,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.time_limit = pkt->info.time_limit; mainGame->dInfo.time_limit = pkt->info.time_limit;
mainGame->dInfo.time_left[0] = 0; mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0; mainGame->dInfo.time_left[1] = 0;
mainGame->RefreshTimeDisplay();
mainGame->deckBuilder.filterList = 0; mainGame->deckBuilder.filterList = 0;
for(auto lit = deckManager._lfList.begin(); lit != deckManager._lfList.end(); ++lit) for(auto lit = deckManager._lfList.begin(); lit != deckManager._lfList.end(); ++lit)
if(lit->hash == pkt->info.lflist) if(lit->hash == pkt->info.lflist)
...@@ -570,6 +571,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -570,6 +571,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.turn = 0; mainGame->dInfo.turn = 0;
mainGame->dInfo.time_left[0] = 0; mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0; mainGame->dInfo.time_left[1] = 0;
mainGame->RefreshTimeDisplay();
mainGame->dInfo.time_player = 2; mainGame->dInfo.time_player = 2;
mainGame->dInfo.isReplaySwapped = false; mainGame->dInfo.isReplaySwapped = false;
mainGame->is_building = false; mainGame->is_building = false;
...@@ -710,6 +712,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -710,6 +712,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
DuelClient::SendPacketToServer(CTOS_TIME_CONFIRM); DuelClient::SendPacketToServer(CTOS_TIME_CONFIRM);
mainGame->dInfo.time_player = lplayer; mainGame->dInfo.time_player = lplayer;
mainGame->dInfo.time_left[lplayer] = pkt->left_time; mainGame->dInfo.time_left[lplayer] = pkt->left_time;
mainGame->RefreshTimeDisplay();
break; break;
} }
case STOC_CHAT: { case STOC_CHAT: {
......
...@@ -1367,8 +1367,10 @@ void Game::MainLoop() { ...@@ -1367,8 +1367,10 @@ void Game::MainLoop() {
cur_time -= 1000; cur_time -= 1000;
timer->setTime(0); timer->setTime(0);
if(dInfo.time_player == 0 || dInfo.time_player == 1) if(dInfo.time_player == 0 || dInfo.time_player == 1)
if(dInfo.time_left[dInfo.time_player]) if(dInfo.time_left[dInfo.time_player]) {
dInfo.time_left[dInfo.time_player]--; dInfo.time_left[dInfo.time_player]--;
RefreshTimeDisplay();
}
} }
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
device->yield(); // probably nicer to the battery device->yield(); // probably nicer to the battery
...@@ -1387,6 +1389,23 @@ void Game::MainLoop() { ...@@ -1387,6 +1389,23 @@ void Game::MainLoop() {
usleep(500000); usleep(500000);
// device->drop(); // device->drop();
} }
void Game::RefreshTimeDisplay() {
for(int i = 0; i < 2; ++i) {
if(dInfo.time_left[i] && dInfo.time_limit) {
if(dInfo.time_left[i] >= dInfo.time_limit / 2)
dInfo.time_color[i] = 0xffffffff;
else if(dInfo.time_left[i] >= dInfo.time_limit / 3)
dInfo.time_color[i] = 0xffffff00;
else if(dInfo.time_left[i] >= dInfo.time_limit / 6)
dInfo.time_color[i] = 0xffff7f00;
else
dInfo.time_color[i] = 0xffff0000;
} else
dInfo.time_color[i] = 0xffffffff;
}
myswprintf(dInfo.str_time_left[0], L"%d", dInfo.time_left[0]);
myswprintf(dInfo.str_time_left[1], L"%d", dInfo.time_left[1]);
}
void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) { void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) {
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)
mProjection[i] = 0; mProjection[i] = 0;
......
...@@ -57,6 +57,7 @@ struct DuelInfo { ...@@ -57,6 +57,7 @@ struct DuelInfo {
bool is_shuffling; bool is_shuffling;
bool tag_player[2]; bool tag_player[2];
int lp[2]; int lp[2];
int card_count[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -70,6 +71,10 @@ struct DuelInfo { ...@@ -70,6 +71,10 @@ struct DuelInfo {
unsigned char time_player; unsigned char time_player;
unsigned short time_limit; unsigned short time_limit;
unsigned short time_left[2]; unsigned short time_left[2];
wchar_t str_time_left[2][16];
video::SColor time_color[2];
wchar_t str_card_count[2][16];
video::SColor card_count_color[2];
bool isReplaySwapped; bool isReplaySwapped;
}; };
...@@ -102,6 +107,7 @@ public: ...@@ -102,6 +107,7 @@ public:
bool Initialize(); bool Initialize();
#endif #endif
void MainLoop(); void MainLoop();
void RefreshTimeDisplay();
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar); void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text); void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0); void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
...@@ -117,6 +123,7 @@ public: ...@@ -117,6 +123,7 @@ public:
void CheckMutual(ClientCard* pcard, int mark); void CheckMutual(ClientCard* pcard, int mark);
void DrawCards(); void DrawCards();
void DrawCard(ClientCard* pcard); void DrawCard(ClientCard* pcard);
void DrawShadowText(irr::gui::CGUITTFont* font, const core::stringw& text, const core::rect<s32>& position, const core::rect<s32>& padding, video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = 0);
void DrawMisc(); void DrawMisc();
void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2); void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2);
void DrawGUI(); void DrawGUI();
......
...@@ -48,6 +48,7 @@ bool ImageManager::Initial(const path dir) { ...@@ -48,6 +48,7 @@ bool ImageManager::Initial(const path dir) {
snprintf(buff, 100, "/textures/extra/lscale_%d.png", i); snprintf(buff, 100, "/textures/extra/lscale_%d.png", i);
tLScale[i] = driver->getTexture((dir + path(buff)).c_str()); tLScale[i] = driver->getTexture((dir + path(buff)).c_str());
} }
tClock = driver->getTexture((dir + path("/textures/clock.png")).c_str());
support_types.push_back(std::string("jpg")); support_types.push_back(std::string("jpg"));
support_types.push_back(std::string("png")); support_types.push_back(std::string("png"));
support_types.push_back(std::string("bpg")); support_types.push_back(std::string("bpg"));
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
irr::video::ITexture* tFieldTransparent[2]; irr::video::ITexture* tFieldTransparent[2];
irr::video::ITexture* tRScale[14]; irr::video::ITexture* tRScale[14];
irr::video::ITexture* tLScale[14]; irr::video::ITexture* tLScale[14];
irr::video::ITexture* tClock;
std::list<std::string> support_types; std::list<std::string> support_types;
}; };
......
...@@ -16,7 +16,20 @@ ...@@ -16,7 +16,20 @@
特别感谢: 菜菜,尸体,废话多,龙道香姐,晓L,幻兽L 的支持与努力. 特别感谢: 菜菜,尸体,废话多,龙道香姐,晓L,幻兽L 的支持与努力.
</pre> </pre>
<ul> <ul>
<li style="color:#ffffff">3.3.1</li> <li style="color:#ffff00">3.3.1</li>
</ul>
<pre>
更新:
1.更新ygo内核;
2.升级游戏版本号为1034.4
3.卡图全部翻新为第十期模板;
(为了回避版权问题不得已改为无字卡图)
优化:
1.精简资源缩小一些安装包体积;
2.为了避免误导用户取消直接启动游戏功能
</pre>
<ul>
<li style="color:#ffff00">3.3.1</li>
</ul> </ul>
<pre> <pre>
更新: 更新:
......
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile" applicationId "cn.garymb.ygomobile"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 33010603 versionCode 33010604
versionName "3.3.1" versionName "3.3.1"
flavorDimensions "versionCode" flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
...@@ -30,7 +30,7 @@ public interface Constants { ...@@ -30,7 +30,7 @@ public interface Constants {
String PREF_LOCK_SCREEN = "pref_key_game_screen_orientation"; String PREF_LOCK_SCREEN = "pref_key_game_screen_orientation";
boolean PREF_DEF_LOCK_SCREEN = true; boolean PREF_DEF_LOCK_SCREEN = true;
String PREF_IMMERSIVE_MODE = "pref_key_immersive_mode"; String PREF_IMMERSIVE_MODE = "pref_key_immersive_mode";
boolean PREF_DEF_IMMERSIVE_MODE = false; boolean PREF_DEF_IMMERSIVE_MODE = true;
String PREF_SENSOR_REFRESH = "pref_key_sensor_refresh"; String PREF_SENSOR_REFRESH = "pref_key_sensor_refresh";
boolean PREF_DEF_SENSOR_REFRESH = true; boolean PREF_DEF_SENSOR_REFRESH = true;
String PREF_CHANGE_LOG = "pref_key_change_log"; String PREF_CHANGE_LOG = "pref_key_change_log";
......
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