//更新 概述 排名 盲注 奖励 void MTTMatchState::UpdateMTTMatchStateInfo(unsigned index) { m_uCurPageIndex = 1; if (g_globaMttGameInfo.m_curMttTable.m_MttReward.size() == 0 && g_globaMttGameInfo.m_curMttTable.m_MttBilnd.size() == 0)//当前桌的信息为空 { m_bCurDataIsNULL = true; } else { m_bCurDataIsNULL = false; } m_uSizePaiMing = g_globaMttGameInfo.m_curMttTable.m_MttRank.size(); UpdateGaiShuInfo(g_globaMttGameInfo.m_curMttTable); //UpdatePaiMingInfo(); UpdateMangZhuInfo(); UpdateJiangLiInfo(g_globaMttGameInfo.m_curMttTable.m_MttReward, g_globaMttGameInfo.m_curMttTable.m_tableName); OnMenuItemSelected(nullptr, index); auto scale9SpriteSz = m_pScale9ContentBg->getContentSize(); if (g_globaMttGameInfo.m_curMttTable.m_isFloatMatch) { m_pScrollViewType[3]->setContentSize(Size(JiangLiScrollW-145, JiangLiScrollH)); m_pScrollViewType[3]->setPosition(217+150, 50); //m_pScrollViewType[3]->setPosition(217+150, 50); //m_pScrollViewType[4]->setVisible(true); m_pSpriteListTitle->setPreferredSize(Size(663-150, 40)); m_pSpriteListTitle->setPosition(scale9SpriteSz.width/2+70, scale9SpriteSz.height-33); float rewardPosX[3] = {75-30, 223-30, 570-150}; for (int i=0; i<3; i++) { m_labelJiangLiTitle[i]->setPosition(rewardPosX[i], 20); } /* m_pSpriteFuDongGold->setVisible(true); m_labelFuDong[0]->setVisible(true); m_labelFuDong[1]->setVisible(true);*/ SetLabelString(m_labelFuDong[1],FormatCash(g_globaMttGameInfo.m_curMttTable.m_MttFudongReward.m_maxReward)); UpdateFuDongInfo(); } else { m_pScrollViewType[3]->setContentSize(Size(JiangLiScrollW, JiangLiScrollH)); m_pScrollViewType[3]->setPosition(217, 50); m_pScrollViewType[4]->setVisible(false); m_pSpriteListTitle->setPreferredSize(Size(663, 40)); m_pSpriteListTitle->setPosition(scale9SpriteSz.width/2, scale9SpriteSz.height-33); float rewardPosX[3] = {75, 223, 570}; for (int i=0; i<3; i++) { m_labelJiangLiTitle[i]->setPosition(rewardPosX[i], 20); } m_pSpriteFuDongGold->setVisible(false); m_labelFuDong[0]->setVisible(false); m_labelFuDong[1]->setVisible(false); UpdateJiangLiInfo(g_globaMttGameInfo.m_curMttTable.m_MttReward, g_globaMttGameInfo.m_curMttTable.m_tableName); } }
//更新概述项 void MTTMatchState::UpdateGaiShuInfo(const GameMttTableInfo& tableInfo) { GetGaiShuItem(); m_bSignUp = (tableInfo.m_SiginState==4 ||tableInfo.m_SiginState==5)?true:false; OnMenuItemSelected(nullptr, 0); m_iLastTime = tableInfo.m_realTime; if (m_pGaishuItem != nullptr) { for (int i=0;i<8;i++) { m_pGaishuItem->m_GaishuSptite[i]->setVisible(false); m_pGaishuItem->m_GaiShuLine[i]->setVisible(false); m_pGaishuItem->m_GaiShuLine[i]->resetLable(); m_pGaishuItem->m_GaiShuLine[i]->ignoreAnchorPointForPosition(false); m_pGaishuItem->m_GaiShuLine[i]->setAnchorPoint(Vec2(0, 0.5)); } SetLabelString(m_pGaishuItem->m_labelTD[0], ""); SetLabelString(m_pGaishuItem->m_labelTD[1], ""); SetLabelString(m_pGaishuItem->m_labelTD[0], tableInfo.m_tableName); ////滚动视图中内容最低Y坐标 float posY = 20; char buff[32] = {0}; bool bDelaySign = false; if (tableInfo.m_isdelayRegist)//延时报名 { m_pGaishuItem->m_GaishuSptite[7]->setVisible(true); m_pGaishuItem->m_labelTD[1]->setPosition(80, posY); m_pGaishuItem->m_GaishuSptite[7]->setPosition(50, posY); SetLabelString(m_pGaishuItem->m_labelTD[1], "延时报名:比赛开始后,可以在延时时段内报名参赛"); bDelaySign = true; } if (tableInfo.m_isAddOn)//可增购 { posY+=39; m_pGaishuItem->m_GaiShuLine[7]->setVisible(true); m_pGaishuItem->m_GaiShuLine[6]->setVisible(true); m_pGaishuItem->m_GaishuSptite[6]->setVisible(true); m_pGaishuItem->m_GaiShuLine[7]->setPosition(180, posY); posY+=30; m_pGaishuItem->m_GaiShuLine[6]->setPosition(80, posY); m_pGaishuItem->m_GaishuSptite[6]->setPosition(50, posY); m_pGaishuItem->m_GaiShuLine[6]->Appand(22, "fzlt.ttf", "(Add On):可增购比赛,次数:", Color4B::WHITE); sprintf(buff, "%d", tableInfo.m_mttTableDes.m_addOnCount); m_pGaishuItem->m_GaiShuLine[6]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[6]->Appand(22, "fzlt.ttf", "次", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", "第", Color4B::WHITE); //sprintf(buff, "%d", tableInfo.m_mttTableDes.m_addOnLevelMin); if (tableInfo.m_mttTableDes.m_addOnLevelMin == tableInfo.m_mttTableDes.m_addOnLevelMax) { sprintf(buff, "%d", tableInfo.m_mttTableDes.m_addOnLevelMin); } else sprintf(buff, "%d-%d", tableInfo.m_mttTableDes.m_addOnLevelMin, tableInfo.m_mttTableDes.m_addOnLevelMax); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", "个盲注级别可用", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", FormatCash(tableInfo.m_mttTableDes.m_addOnMoney), Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", "德州币兑换", Color4B::WHITE); //sprintf(buff, "%d", tableInfo.m_mttTableDes.m_addOnToCarch); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", FormatCash(tableInfo.m_mttTableDes.m_addOnToCarch), Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[7]->Appand(22, "fzlt.ttf", "筹码", Color4B::WHITE); } if (tableInfo.m_isRebuy) { posY+=39; m_pGaishuItem->m_GaiShuLine[5]->setVisible(true); m_pGaishuItem->m_GaiShuLine[4]->setVisible(true); m_pGaishuItem->m_GaishuSptite[5]->setVisible(true); m_pGaishuItem->m_GaiShuLine[5]->setPosition(180, posY); posY+=30; m_pGaishuItem->m_GaiShuLine[4]->setPosition(80, posY); m_pGaishuItem->m_GaishuSptite[5]->setPosition(50, posY); m_pGaishuItem->m_GaiShuLine[4]->Appand(22, "fzlt.ttf", "(rebuy):可重购比赛,次数:", Color4B::WHITE); sprintf(buff, "%d", tableInfo.m_mttTableDes.m_rebuyCount); m_pGaishuItem->m_GaiShuLine[4]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[4]->Appand(22, "fzlt.ttf", "次", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", "第", Color4B::WHITE); if (tableInfo.m_mttTableDes.m_rebuyMin == tableInfo.m_mttTableDes.m_rebuyMax) { sprintf(buff, "%d", tableInfo.m_mttTableDes.m_rebuyMin); } else sprintf(buff, "%d-%d", tableInfo.m_mttTableDes.m_rebuyMin, tableInfo.m_mttTableDes.m_rebuyMax); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", "个盲注级别前可用", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", FormatCash(tableInfo.m_mttTableDes.m_rebuyMoney), Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", "德州币兑换", Color4B::WHITE); //sprintf(buff, "%d", tableInfo.m_mttTableDes.m_rebuyToCarch); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", FormatCash(tableInfo.m_mttTableDes.m_rebuyToCarch), Color4B(0xff,0xd2,0x00,0xff)); m_pGaishuItem->m_GaiShuLine[5]->Appand(22, "fzlt.ttf", "筹码", Color4B::WHITE); } if (posY == 20 && !bDelaySign) posY += 52;//没有增购、重购、延时报名时,其他坐标调整 else if (posY == 20 && bDelaySign)//没有增购、重购其他坐标调整 { posY += 52; m_pGaishuItem->m_labelTD[1]->setPosition(80, posY); m_pGaishuItem->m_GaishuSptite[7]->setPosition(50, posY); } for (int i=3; i>=0; i--) { m_pGaishuItem->m_GaiShuLine[i]->setVisible(true); m_pGaishuItem->m_GaishuSptite[i+1]->setVisible(true); posY+=39; m_pGaishuItem->m_GaiShuLine[i]->setPosition(80, posY); m_pGaishuItem->m_GaishuSptite[i+1]->setPosition(50, posY); } posY+=70; m_pGaishuItem->m_GaishuSptite[0]->setVisible(true); m_pGaishuItem->m_GaishuSptite[0]->setPosition(GaiShuScrollW/2, posY); posY+=60; //sprintf(buff, "%d", tableInfo.m_mttTableDes.m_siginDes); m_pGaishuItem->m_GaiShuLine[0]->Appand(22, "fzlt.ttf", "报名费用:", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[0]->Appand(22, "fzlt.ttf", tableInfo.m_mttTableDes.m_siginDes.c_str(), Color4B(0xff,0xd2,0x00,0xff)); sprintf(buff, "%s", tableInfo.m_mttTableDes.m_matchStartTime.c_str()); m_pGaishuItem->m_GaiShuLine[1]->Appand(22, "fzlt.ttf", "比赛时间:", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[1]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); sprintf(buff, "%d-%d人", tableInfo.m_mttTableDes.m_minRole, tableInfo.m_mttTableDes.m_maxRole); m_pGaishuItem->m_GaiShuLine[2]->Appand(22, "fzlt.ttf", "比赛人数:", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[2]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); sprintf(buff, "%d", tableInfo.m_mttTableDes.m_firstMoney); m_pGaishuItem->m_GaiShuLine[3]->Appand(22, "fzlt.ttf", "初始筹码:", Color4B::WHITE); m_pGaishuItem->m_GaiShuLine[3]->Appand(22, "fzlt.ttf", buff, Color4B(0xff,0xd2,0x00,0xff)); if (posY > GaiShuScrollH) { m_pScrollViewType[0]->setBounceable(true); } else { m_pScrollViewType[0]->setBounceable(false); } m_pScrollViewType[0]->setContentOffset(Vec2(0, GaiShuScrollH-posY)); m_pScrollViewType[0]->setContentSize(Size(GaiShuScrollW, posY)); } }
bool cEditor::OnEvent(const SEvent& event) { /*ISceneNode* hit=coli->getSceneNodeFromScreenCoordinatesBB(core::vector2d<s32>(event.MouseInput.X,event.MouseInput.Y)); if (hit==0){ std::cout << "No Nodes at that position" << std::endl; }else{ nodes[curId]->switchFocus(hit); }*/ if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP ){ mouse_down=false; // drop scale drag point if (point_on != -1) point_on = -1; }else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN ){ mouse_down=true; }else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_MOUSE_MOVED ){ mouse_position.X=event.MouseInput.X; mouse_position.Y=event.MouseInput.Y; }else if (event.EventType == EET_KEY_INPUT_EVENT){ if (event.KeyInput.Key== KEY_DOWN || event.KeyInput.Key== KEY_KEY_S){ pivot->setRotation(vector3df(pivot->getRotation().X-1,pivot->getRotation().Y,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_UP || event.KeyInput.Key== KEY_KEY_W){ pivot->setRotation(vector3df(pivot->getRotation().X+1,pivot->getRotation().Y,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_LEFT || event.KeyInput.Key== KEY_KEY_A){ pivot->setRotation(vector3df(pivot->getRotation().X,pivot->getRotation().Y+1,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_RIGHT || event.KeyInput.Key== KEY_KEY_D){ pivot->setRotation(vector3df(pivot->getRotation().X,pivot->getRotation().Y-1,pivot->getRotation().Z)); } }else if (event.EventType == EET_GUI_EVENT){ irr::s32 id = event.GUIEvent.Caller->getID(); irr::gui::IGUIEnvironment* env = device->getGUIEnvironment(); switch(event.GUIEvent.EventType) { case EGET_MENU_ITEM_SELECTED: OnMenuItemSelected( (IGUIContextMenu*)event.GUIEvent.Caller ); break; case EGET_ELEMENT_LEFT: if (id > 299 && id < 324){ if (mouse_down == true && point_on == -1){ printf("Selected scaler id %i\n",id); point_on = id - 300; } } break; case irr::gui::EGET_BUTTON_CLICKED: switch(id) { case 0: break; default: return false; } break; default: break; } } return false; }
bool Editor::OnEvent(const SEvent& event) { if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP ){ mouse_down=false; // drop scale drag point if (point_on != -1) point_on = -1; }else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN ){ mouse_down=true; }else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_MOUSE_MOVED ){ mouse_position.X=event.MouseInput.X; mouse_position.Y=event.MouseInput.Y; }else if (event.EventType == EET_KEY_INPUT_EVENT){ printf("key down %i \n",event.KeyInput.Key); if (event.KeyInput.Key== KEY_DOWN || event.KeyInput.Key== KEY_KEY_S){ pivot->setRotation(vector3df(pivot->getRotation().X-1,pivot->getRotation().Y,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_UP || event.KeyInput.Key== KEY_KEY_W){ pivot->setRotation(vector3df(pivot->getRotation().X+1,pivot->getRotation().Y,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_LEFT || event.KeyInput.Key== KEY_KEY_A){ pivot->setRotation(vector3df(pivot->getRotation().X,pivot->getRotation().Y+1,pivot->getRotation().Z)); }else if (event.KeyInput.Key== KEY_RIGHT || event.KeyInput.Key== KEY_KEY_D){ pivot->setRotation(vector3df(pivot->getRotation().X,pivot->getRotation().Y-1,pivot->getRotation().Z)); }else if (event.KeyInput.Key == 162){ printf("cntrl toggle\n"); KEY_SCALE_DOWN = event.KeyInput.PressedDown; }else if (event.KeyInput.Key == 160){ printf("shift toggle\n"); KEY_MOVE_DOWN = event.KeyInput.PressedDown; } }else if (event.EventType == EET_GUI_EVENT){ irr::s32 id = event.GUIEvent.Caller->getID(); irr::gui::IGUIEnvironment* env = device->getGUIEnvironment(); switch(event.GUIEvent.EventType) { case EGET_MENU_ITEM_SELECTED: OnMenuItemSelected( (IGUIContextMenu*)event.GUIEvent.Caller ); break; case EGET_ELEMENT_LEFT: if (id > 299 && id < 324){ if (mouse_down == true && point_on == -1){ printf("Selected scaler id %i\n",id); point_on = id - 300; } } break; case EGET_MESSAGEBOX_OK: if (event.GUIEvent.Caller->getID()==GUI_ID_NEW){ printf("New project...\n"); delete project; project = new Project(); project->nodes[0] = new Node(device,data); MoveTarget(project->nodes[0]->getPosition()); }else if (event.GUIEvent.Caller->getID()==GUI_ID_EXIT){ printf("Exiting...\n"); device->closeDevice(); } break; } for(list<IEventReceiver*>::Iterator Iterator = menus->begin(); Iterator != menus->end(); ++Iterator) { IEventReceiver* m = *Iterator; if (m && m->OnEvent(event)==true) return true; } } return false; }