Commit 74be9404 authored by fallenstardust's avatar fallenstardust

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

parent b43e94c2
......@@ -91,6 +91,7 @@ void ClientField::Clear() {
pzone_act[1] = false;
conti_act = false;
deck_reversed = false;
RefreshCardCountDisplay();
}
void ClientField::Initial(int player, int deckc, int extrac) {
ClientCard* pcard;
......@@ -114,6 +115,7 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->position = POS_FACEDOWN_DEFENSE;
GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true);
}
RefreshCardCountDisplay();
}
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0;
......@@ -223,6 +225,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
break;
}
}
RefreshCardCountDisplay();
}
ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
ClientCard* pcard = 0;
......@@ -1432,4 +1435,28 @@ void ClientField::UpdateDeclarableCode(bool enter) {
else
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:
void UpdateDeclarableCodeOpcode(bool enter);
void UpdateDeclarableCode(bool enter);
void RefreshCardCountDisplay();
irr::gui::IGUIElement* panel;
std::vector<int> ancard;
int hovered_controler;
......
......@@ -432,6 +432,13 @@ void Game::DrawCard(ClientCard* pcard) {
}//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() {
static irr::core::vector3df act_rot(0, 0, 0);
int rule = (dInfo.duel_rule >= 4) ? 1 : 0;
......@@ -542,10 +549,32 @@ void Game::DrawMisc() {
}
}
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->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->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, 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) {
mainGame->dInfo.time_limit = pkt->info.time_limit;
mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0;
mainGame->RefreshTimeDisplay();
mainGame->deckBuilder.filterList = 0;
for(auto lit = deckManager._lfList.begin(); lit != deckManager._lfList.end(); ++lit)
if(lit->hash == pkt->info.lflist)
......@@ -570,6 +571,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.turn = 0;
mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0;
mainGame->RefreshTimeDisplay();
mainGame->dInfo.time_player = 2;
mainGame->dInfo.isReplaySwapped = false;
mainGame->is_building = false;
......@@ -710,6 +712,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
DuelClient::SendPacketToServer(CTOS_TIME_CONFIRM);
mainGame->dInfo.time_player = lplayer;
mainGame->dInfo.time_left[lplayer] = pkt->left_time;
mainGame->RefreshTimeDisplay();
break;
}
case STOC_CHAT: {
......
......@@ -1367,8 +1367,10 @@ void Game::MainLoop() {
cur_time -= 1000;
timer->setTime(0);
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]--;
RefreshTimeDisplay();
}
}
#ifdef _IRR_ANDROID_PLATFORM_
device->yield(); // probably nicer to the battery
......@@ -1387,6 +1389,23 @@ void Game::MainLoop() {
usleep(500000);
// 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) {
for(int i = 0; i < 16; ++i)
mProjection[i] = 0;
......
......@@ -57,6 +57,7 @@ struct DuelInfo {
bool is_shuffling;
bool tag_player[2];
int lp[2];
int card_count[2];
int duel_rule;
int turn;
short curMsg;
......@@ -70,6 +71,10 @@ struct DuelInfo {
unsigned char time_player;
unsigned short time_limit;
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;
};
......@@ -102,6 +107,7 @@ public:
bool Initialize();
#endif
void MainLoop();
void RefreshTimeDisplay();
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 SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
......@@ -117,6 +123,7 @@ public:
void CheckMutual(ClientCard* pcard, int mark);
void DrawCards();
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 DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2);
void DrawGUI();
......
......@@ -48,6 +48,7 @@ bool ImageManager::Initial(const path dir) {
snprintf(buff, 100, "/textures/extra/lscale_%d.png", i);
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("png"));
support_types.push_back(std::string("bpg"));
......
......@@ -47,6 +47,7 @@ public:
irr::video::ITexture* tFieldTransparent[2];
irr::video::ITexture* tRScale[14];
irr::video::ITexture* tLScale[14];
irr::video::ITexture* tClock;
std::list<std::string> support_types;
};
......
......@@ -16,7 +16,20 @@
特别感谢: 菜菜,尸体,废话多,龙道香姐,晓L,幻兽L 的支持与努力.
</pre>
<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>
<pre>
更新:
......
......@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile"
minSdkVersion 16
targetSdkVersion 22
versionCode 33010603
versionCode 33010604
versionName "3.3.1"
flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true
......
......@@ -30,7 +30,7 @@ public interface Constants {
String PREF_LOCK_SCREEN = "pref_key_game_screen_orientation";
boolean PREF_DEF_LOCK_SCREEN = true;
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";
boolean PREF_DEF_SENSOR_REFRESH = true;
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