void MPILock::reserve(Resource resource) { MPIResource *res = get_resource(resource); res->lock(); if (DEBUG) printf("#%u: reserve(%s)\n", index, RESOURCE(resource)); if (DEBUG) res->print_state(sides); if (res->has_any_tokens(SIDE_INDEX_SELF)) { res->change_state(HAS_TOKEN); } else { res->push_request(SIDE_INDEX_SELF); vector<unsigned> choices(1, SIDE_INDEX_PARENT); for (unsigned side_index = SIDE_INDEX_FIRST_CHILD, len = sides.size(); side_index < len; side_index += 1) { choices.push_back(side_index); } try_request_token(res, choices); if (DEBUG) res->print_state(sides); if (DEBUG) printf("#%u: wait(%s)\n", index, RESOURCE(resource)); res->wait(); if (DEBUG) printf("#%u: woken up(%s)\n", index, RESOURCE(resource)); } if (DEBUG) printf("#%u: reserved successfully(%s)\n", index, RESOURCE(resource)); if (DEBUG) res->print_state(sides); res->unlock(); }
void TDBoss::initAttributeWithIndex(int type,int id) { m_nType = type; m_birthPosition = Point(GLB_SIZE.width-120,100); m_nId = id; m_nHP = 300; m_fHpBackUp = static_cast<float>(m_nHP); m_nAttackRate = 1; m_nDPS = 200; //初始化BossHp; Sprite* bg = Sprite::create(RESOURCE("td/ui_hpboss01.png")); bg->setPosition(Vec2(0,100.f)); this->addChild(bg,Z_First); m_BossHpProgress = ProgressTimer::create(Sprite::create(RESOURCE("td/ui_hpboss02.png")));//创建一个进程条; m_BossHpProgress->setAnchorPoint(Vec2::ZERO); m_BossHpProgress->setBarChangeRate(Point(1,0));//设置进程条的变化速率; m_BossHpProgress->setType(ProgressTimer::Type::BAR);//设置进程条的类型; m_BossHpProgress->setMidpoint(Point(0,0.5));//设置进度的运动方向; m_BossHpProgress->setPosition(Vec2::ZERO); bg->addChild(m_BossHpProgress,Z_First); m_BossHpProgress->setPercentage(90); //初始化Boss类型; initType(); m_bossLCA = TDBossLCA :: create(m_nAttackRate); this->addChild(m_bossLCA); }
TableViewCell* GameChallengeMap::tableCellAtIndex(TableView* table,ssize_t idx) { std::string id = StringUtils::format("%d", idx+1); TableViewCell *cell = table->dequeueCell(); if (1) { cell = new TableViewCell(); cell->autorelease(); Sprite* bg = Sprite::create(RESOURCE("map_002.png")); if (idx%2) { bg->setTexture(RESOURCE("map_001.png")); } bg->setFlippedX(fileMap); bg->setAnchorPoint(Point(0, 0)); bg->setTextureRect(Rect(0,0,window_size.width,window_size.height)); cell->addChild(bg); // ID部分 auto *label = Label::createWithSystemFont(id.c_str(), "Arial", 20); label->setAnchorPoint(Point(0, 0)); label->setPosition(Point(50, 0)); label->setColor(Color3B(0,0,0)); cell->addChild(label); if (idx>=(12-ci_NormalMissionNum/10)) //如果130关,就是13,但必须是10的整数倍 { int missionId=120-idx*10; //本单元最大关卡ID for (int i=0;i<10;++i) { GameChallengeMission* mission = GameChallengeMission::create(); mission->setTag(missionId); mission->setAnchorPoint(Vec2::ZERO); //取得关卡ID对应的坐标 Vec2 temp=GameUIData::getInstance()->getNormalMissionPos(missionId); mission->setPosition(temp); cell->addChild(mission); mission->setMissionPorperty(missionId); mission->missionShow(missionId); --missionId; } } } return cell; }
void GameChallengeMission::initMission() { m_btnCandle = Button::create(RESOURCE("zhutai_01.png"),RESOURCE("zhutai_03.png"),RESOURCE("zhutai_02.png")); m_btnCandle->setTag(T_First); m_btnCandle->addTouchEventListener(CC_CALLBACK_2(GameChallengeMission::BtnCall,this)); m_btnCandle->setAnchorPoint(Vec2(0.5f,0.5f)); m_size = m_btnCandle->getContentSize(); m_btnCandle->setPosition(Vec2(m_size.width*0.5,m_size.height*0.5)); this->addChild(m_btnCandle,Z_First); m_labMissionId = Label :: createWithCharMap(RESOURCE("jindu_number.png"),16,25,'0'); m_labMissionId->setAnchorPoint(Vec2(0.5f,0.5f)); m_labMissionId->setPosition(Vec2(m_size.width*0.5,m_size.height*0.5)); //m_btnCandle->addChild(m_labMissionId); }
void CUIImageList::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIImageList"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } if ( cs.dict.Exists("image0") ) { for ( uint32 iValue = 0 ; ; ++iValue ) { char szValue[256]; sprintf(szValue, "image%d", iValue); if ( !cs.dict.Exists(szValue) ) break; m_vecImages.push_back(RESOURCE(cs.dict.GetString(szValue)).LoadBitmap()); } } if ( cs.dict.Exists("string0") ) { for ( uint32 iValue = 0 ; ; ++iValue ) { char szValue[256]; sprintf(szValue, "string%d", iValue); if ( !cs.dict.Exists(szValue) ) break; m_vecStrings.push_back(cs.dict.GetString(szValue)); } } m_hWnd = CreateWindow("CUIImageList", "CUIImageList", WS_CHILD|WS_VISIBLE, cs.x, cs.y, cs.cx, cs.cy, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; // SetCapture(m_hWnd); // SetFocus(m_hWnd); }
void GameChallengeMission::missionOpen() { m_btnCandle->setBright(true); m_btnCandle->setEnabled(true); Sprite* pSpr = Sprite :: create(); pSpr->setAnchorPoint(Vec2(0.5f,0.5f)); pSpr->setPosition(Vec2(m_size.width*0.5-2,m_size.height+12)); m_btnCandle->addChild(pSpr); //-创建动作-; Animation* pAniamtion = Animation :: create(); char strPic[50] = {0}; //-加载帧-; for (int i=1;i<6;i++) { sprintf(strPic,"animature/lazhu/lazhu_0%d.png",i); pAniamtion->addSpriteFrameWithFile(RESOURCE(strPic)); } //-加载动作-; pAniamtion->setDelayPerUnit(0.2f); pAniamtion->setRestoreOriginalFrame(true); pAniamtion->setLoops(-1); //-创建动画-; Animate* pAction = Animate :: create(pAniamtion); pSpr->runAction(pAction); }
void GameChallengeMission::missionNow() { Sprite* halo = Sprite::create(RESOURCE("guangquan002.png")); halo->setAnchorPoint(Vec2(0.5f,0.5f)); halo->setPosition(Vec2(m_size.width*0.5,m_size.height*0.5+12)); m_btnCandle->addChild(halo,Z_Back); halo->runAction(RepeatForever::create(RotateBy::create(1.5f,360.f))); }
void GameNormalMission::initMission() { m_btnDizuo = Button :: create(RESOURCE("stone_dizuo.png"),RESOURCE("stone_dizuo.png")); m_btnDizuo->setTag(T_First); m_btnDizuo->addTouchEventListener(CC_CALLBACK_2(GameNormalMission::BtnCall,this)); m_btnDizuo->setAnchorPoint(Vec2(0.5f,0.5f)); m_dizuoSize = m_btnDizuo->getContentSize(); m_btnDizuo->setPosition(Vec2(m_dizuoSize.width*0.5,m_dizuoSize.height*0.5)); this->addChild(m_btnDizuo,Z_First); m_btnDizuo->setSwallowTouches(false); m_btnStone = Button :: create(RESOURCE("stone_001.png"),RESOURCE("stone_003.png"),RESOURCE("stone_002.png")); m_btnStone->setTag(T_Second); m_btnStone->addTouchEventListener(CC_CALLBACK_2(GameNormalMission::BtnCall,this)); m_btnStone->setAnchorPoint(Vec2(0.5f,0.5f)); m_stoneSize = m_btnStone->getContentSize(); m_btnStone->setPosition(Vec2(m_dizuoSize.width*0.5,m_dizuoSize.height+15.f)); this->addChild(m_btnStone,Z_Second); m_btnStone->setSwallowTouches(false); m_labMissionId = Label::createWithCharMap(RESOURCE("jindu_number.png"),16,25,'0'); m_labMissionId->setAnchorPoint(Vec2(0.5f,0.5f)); m_labMissionId->setPosition(Vec2(m_stoneSize.width*0.5,m_stoneSize.height*0.5+20)); m_btnStone->addChild(m_labMissionId); m_halo = Sprite::create(RESOURCE("guang_effect.png")); m_halo->setAnchorPoint(Vec2(0.5f,0.5f)); m_halo->setPosition(Vec2(m_stoneSize.width*0.5,m_stoneSize.height*0.5+12)); m_btnStone->addChild(m_halo,Z_Back); m_halo->setVisible(false); }
void MPILock::release(Resource resource) { MPIResource *res = get_resource(resource); res->lock(); if (DEBUG) printf("#%u: release(%s)\n", index, RESOURCE(resource)); if (DEBUG) res->print_state(sides); res->change_state(IDLE); deliver_token(res); if (DEBUG) res->print_state(sides); res->unlock(); }
void CUIWaveform3::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIWaveform3"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } if ( cs.dict.Exists("trail") ) { m_nTrailLength = cs.dict.GetUint32("trail"); } m_hBitmapMarkerSync = RESOURCE("WaveformMarkerSync.bmp").LoadBitmap(); m_hBitmapMarkerFreeze = RESOURCE("WaveformMarkerFreeze.bmp").LoadBitmap(); m_hBitmapMarkerStop = RESOURCE("WaveformMarkerStop.bmp").LoadBitmap(); m_hBitmapWaveform = RESOURCE("Waveform.bmp").LoadBitmap(); m_hWnd = CreateWindow("CUIWaveform3", "CUIWaveform3", WS_CHILD|WS_VISIBLE, cs.x, cs.y, cs.cx, cs.cy, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; }
void MPILock::receive_token(unsigned sender, MPITokenMessage &message) { MPIResource *resource = get_resource(message.resource); resource->lock(); if (DEBUG) printf("#%u: received token from #%u for %s\n", index, sender, RESOURCE(message.resource)); if (DEBUG) resource->print_state(sides); resource->add_token(SIDE_INDEX_SELF); if (message.send_back) { resource->push_request(get_side_index(sender)); } deliver_token(resource); if (DEBUG) resource->print_state(sides); resource->unlock(); }
void CUIImage::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIImage"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } if ( cs.dict.Exists("image") ) { m_hBitmap = RESOURCE(cs.dict.GetString("image")).LoadBitmap(); } m_bTransparent = cs.dict.Exists("transparent") ? cs.dict.GetBool("transparent") : false; m_colorTransparent = cs.dict.Exists("colortransparent") ? cs.dict.GetColor("colortransparent") : RGB(0, 0, 0); BITMAP bm; GetObject(m_hBitmap, sizeof(BITMAP), &bm); uint32 cx = bm.bmWidth; uint32 cy = bm.bmHeight; m_hWnd = CreateWindow("CUIImage", "CUIImage", WS_CHILD|WS_VISIBLE, cs.x, cs.y, cx, cy, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; // SetCapture(m_hWnd); // SetFocus(m_hWnd); }
void GameChallengeMission::missionShow(int missionId) { //根据ID获取星星数量 //设置星星显示; static int startNum=1; for (int i=1;i<=startNum;++i) { Sprite* start = Sprite::create(RESOURCE(StringUtils::format("baoshi2_00%d.png",i))); start->setAnchorPoint(Vec2::ZERO); start->setPosition(Vec2::ZERO); m_btnCandle->addChild(start,Z_First); } ++startNum; if (startNum>3) { startNum=1; } }
void CUIKnob::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIKnob"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } m_fValue = cs.dict.GetFloat("value"); m_hBitmap = RESOURCE(cs.dict.GetString("image")).LoadBitmap();//LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_KNOB)); BITMAP bm; GetObject(m_hBitmap, sizeof(BITMAP), &bm); m_hWnd = CreateWindow("CUIKnob", "CUIKnob", WS_CHILD|WS_VISIBLE, cs.x, cs.y, bm.bmWidth, bm.bmHeight, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; // SetCapture(m_hWnd); // SetFocus(m_hWnd); }
void MPILock::receive_request(unsigned sender, MPIRequestMessage &message) { MPIResource *resource = get_resource(message.resource); unsigned side_index = get_side_index(sender); resource->lock(); if (DEBUG) printf("#%u: requested by #%u for %s\n", index, sender, RESOURCE(message.resource)); if (DEBUG) resource->print_state(sides); if (resource->can_give_token()) { resource->transfer_token(SIDE_INDEX_SELF, side_index); MPITokenMessage message(resource->get_type(), false); interface->send_token(sides[side_index], &message); } else { resource->push_request(side_index); vector<unsigned> choices; if (side_index != SIDE_INDEX_PARENT) { choices.push_back(SIDE_INDEX_PARENT); } for (unsigned idx = SIDE_INDEX_FIRST_CHILD, len = sides.size(); idx < len; idx += 1) { if(idx != side_index) { choices.push_back(idx); } } if (DEBUG >= 2) { printf("#%u: choices(%lu) - { %u }", index, choices.size(), side_index); if (choices.size() > 0) { printf(",\t{ %u", choices[0]); for (unsigned i = 1; i < choices.size(); ++i) printf(", %u", choices[i]); printf(" }"); } printf("\n"); } try_request_token(resource, choices); } if (DEBUG) resource->print_state(sides); resource->unlock(); }
void GameMissionSet::showUI() { Sprite* bg = Sprite::create(RESOURCE("gamemissionset/bgt_01.png")); bg->setPosition(Vec2::ZERO); bg->setAnchorPoint(Vec2::ZERO); this->addChild(bg,Z_Back); m_btnStart = Button :: create(RESOURCE("gamemissionset/kaishi_01.png"),RESOURCE("gamemissionset/kaishi_02.png")); m_btnStart->setAnchorPoint(Vec2(0.5f,0.5f)); m_btnStart->setPosition(Vec2(GLB_SIZE.width*0.5,GLB_SIZE.height*0.5)); this->addChild(m_btnStart,Z_First); m_btnStart->addTouchEventListener(CC_CALLBACK_2(GameMissionSet::BtnCall,this)); m_btnStart->setTag(GameMissionSetBtnStart); m_btnExit = Button :: create(RESOURCE("gamemissionset/gb_01.png"),RESOURCE("gamemissionset/gb_02.png")); m_btnExit->setAnchorPoint(Vec2(0.5f,0.5f)); m_btnExit->setPosition(Vec2(GLB_SIZE.width-80.f,GLB_SIZE.height-80.f)); this->addChild(m_btnExit,Z_First); m_btnExit->addTouchEventListener(CC_CALLBACK_2(GameMissionSet::BtnCall,this)); m_btnExit->setTag(GameMissionSetBtnExit); m_nHp = GameUIData::getInstance()->getIntegerForKey(cs_CurUserHp.c_str(),60); m_labHpCoin = Label::createWithCharMap(RESOURCE("shuliang_number.png"),16,27,'0'); m_labHpCoin->setAnchorPoint(Vec2(0.5f,0.5f)); m_labHpCoin->setPosition(Vec2(m_labHpCoin->getContentSize().width*0.5+80.f,GLB_SIZE.height-m_labHpCoin->getContentSize().height-80.f)); m_labHpCoin->setString(__String::createWithFormat("%d:60",m_nHp)->getCString()); this->addChild(m_labHpCoin,Z_First); m_labTimer = Label :: createWithSystemFont("00:00","Arial",16); m_labTimer->setAnchorPoint(Vec2(0.5f,0.5f)); m_labTimer->setPosition(Vec2(m_labHpCoin->getContentSize().width*0.5+40.f,GLB_SIZE.height-m_labHpCoin->getContentSize().height-100.f)); this->addChild(m_labTimer,Z_First); if (m_nHp==60) { m_labTimer->setVisible(false); } else { startHpTimer(); } }
void CUIToggle::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIToggle"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } // m_hBitmapOn = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_RADIOBUTTON_ON)); // m_hBitmapOff = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_RADIOBUTTON_OFF)); m_hFont = CreateFont(8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, cs.dict.GetString("font").c_str()); m_hWnd = CreateWindow("CUIToggle", "CUIToggle", WS_CHILD|WS_VISIBLE, cs.x, cs.y, cs.cx, 9, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; if ( cs.dict.Exists("readonly") ) { m_bReadOnly = cs.dict.GetBool("readonly"); } m_bValue = cs.dict.GetBool("value"); if ( cs.dict.Exists("text") ) { m_sText = cs.dict.GetString("text"); RECT rect; HDC hDC = GetDC(m_hWnd); SelectObject(hDC, m_hFont); DrawText(hDC, m_sText.c_str(), -1, &rect, DT_CALCRECT); ReleaseDC(m_hWnd, hDC); MoveWindow(m_hWnd, cs.x, cs.y, 13 + rect.right - rect.left, 9, TRUE); } else { if ( cs.dict.Exists("image") ) { m_hBitmapImage = RESOURCE(cs.dict.GetString("image")).LoadBitmap(); } BITMAP bm; GetObject(m_hBitmapImage, sizeof(BITMAP), &bm); MoveWindow(m_hWnd, cs.x, cs.y, 13 + bm.bmWidth, 9, TRUE); } // SetCapture(m_hWnd); // SetFocus(m_hWnd); }
//设计单元格内容; TableViewCell* OverTableView::tableCellAtIndex(TableView *table,ssize_t idx) { CCLOG(" ~(^OO^)~ %d",idx); std::string id = StringUtils::format("%ld", idx+1); TableViewCell *cell = table->dequeueCell(); cell = new TableViewCell(); cell->autorelease(); cell->setLocalZOrder(idx+1); string filename = StringUtils::format("mapbg/map_00%ld.png",ci_MapNum-(idx)%ci_MapNum); Sprite* bg_left = Sprite::create(RESOURCE(filename)); bg_left->setFlippedX(false); bg_left->setAnchorPoint(Point(0, 0)); bg_left->setPosition(Vec2::ZERO); cell->addChild(bg_left); if (!idx) { Sprite* expect = Sprite::create(RESOURCE("mapbg/map_jqqd.png")); expect->setAnchorPoint(Vec2(0.5f,0.5f)); expect->setPosition(Vec2(GLB_SIZE.width*0.5,GLB_SIZE.height-300)); bg_left->addChild(expect,Z_First); } Sprite* bg_right = Sprite::create(RESOURCE(filename)); bg_right->setFlippedX(true); bg_right->setAnchorPoint(Point(0, 0)); bg_right->setPosition(Vec2(639,0)); cell->addChild(bg_right); if (!idx) { Sprite* expect = Sprite::create(RESOURCE("mapbg/map_jqqd.png")); expect->setAnchorPoint(Vec2(0.5f,0.5f)); expect->setPosition(Vec2(GLB_SIZE.width*0.5,GLB_SIZE.height-300)); bg_right->addChild(expect,Z_First); } // ID部分 auto *label_left = Label::createWithSystemFont(id.c_str(),"Arial",20); label_left->setAnchorPoint(Point(0, 0)); label_left->setPosition(Point(50, 0)); label_left->setColor(Color3B(0,0,0)); //cell->addChild(label_left); auto *label_right = Label::createWithSystemFont(id.c_str(),"Arial",20); label_right->setAnchorPoint(Point(0, 0)); label_right->setPosition(Point(50+639, 0)); label_right->setColor(Color3B(0,0,0)); //cell->addChild(label_right); // vec_normalMissionBack.clear(); // for (int i=0;i<vec_normalMission.size();i++) // { // vec_normalMissionBack.push_back(vec_normalMission.at(i)); // } vec_normalMission.clear(); m_mapNormalMission[idx].clear(); //布置普通关卡; if (idx>=ci_MapNum-ci_NormalMissionNum/10) //如果130关,就是13,但必须是10的整数倍; { int missionId=10*ci_MapNum-idx*10; //本单元最大关卡ID; for (int i=0;i<10;++i) { GameNormalMission* mission_left = GameNormalMission :: create(); mission_left->m_nMissionId = missionId; mission_left->setTag(missionId); mission_left->setAnchorPoint(Vec2::ZERO); //取得关卡ID对应的坐标; Vec2 temp=GameUIData::getInstance()->getNormalMissionPos(missionId); mission_left->setPosition(temp); cell->addChild(mission_left); vec_normalMission.push_back(mission_left); mission_left->setMissionPorperty(missionId); mission_left->missionShow(missionId); --missionId; } m_mapNormalMission[ci_MapNum-1-idx]=vec_normalMission; } // 特殊关卡蒙灰; m_pMengBan = Sprite :: create(RESOURCE("overlay_map.png")); m_pMengBan->setAnchorPoint(Vec2::ZERO); m_pMengBan->setPosition(Vec2(GLB_SIZE.width,0)); m_pMengBan->setOpacity(120); cell->addChild(m_pMengBan,Z_Second); // 设置混合模式; BlendFunc cbl = {GL_DST_COLOR,GL_ONE_MINUS_SRC_ALPHA}; m_pMengBan->setBlendFunc(cbl); auto pFog = Sprite::create(RESOURCE("wuqi_ddt.png")); pFog->setAnchorPoint(Vec2::ZERO); pFog->setPosition(Vec2(GLB_SIZE.width,0)); cell->addChild(pFog,Z_Third); //布置特殊关卡; if (idx>=ci_MapNum-ci_ChallengeMissionNum/5) { int missionId=5*ci_MapNum-idx*5; //本单元最大关卡ID; for (int i=0;i<5;++i) { GameChallengeMission* mission_right = GameChallengeMission::create(); mission_right->setTag(missionId); mission_right->m_nMissionId = missionId; mission_right->setAnchorPoint(Vec2::ZERO); //取得关卡ID对应的坐标; Vec2 temp=GameUIData::getInstance()->getChallengeMissionPos(missionId); mission_right->setPosition(Vec2(temp.x+639,temp.y)); cell->addChild(mission_right); mission_right->setMissionPorperty(missionId); mission_right->missionShow(missionId); --missionId; } } return cell; }
void ItemManager::inputCombineInfo() { if (!DATABASE->isExistTable("combine")) DATABASE->addTable("combine"); addCombineInfo("ingot silver", 1, "tile silver", 2, "", 0); addCombineInfo("ingot gold", 1, "tile gold", 2, "", 0); //방어구 //방어구 - 실버 addCombineInfo("helmet silver", 1, "ingot silver", 2); addCombineInfo("body silver", 1, "ingot silver", 2); addCombineInfo("pant silver", 1, "ingot cobalt", 2); //방어구 - 골드 addCombineInfo("helmet gold", 1, "helmet silver", 1, "ingot gold", 2); addCombineInfo("body gold", 1, "body silver", 1, "ingot gold", 2); addCombineInfo("pant gold", 1, "pant silver", 1, "ingot gold", 2); //방어구 - 코발트 addCombineInfo("helmet cobalt magician", 1, "helmet gold", 1, "ingot cobalt", 2); addCombineInfo("helmet cobalt ranger", 1, "helmet gold", 1, "ingot cobalt", 2); addCombineInfo("helmet cobalt warrior", 1, "helmet gold", 1, "ingot cobalt", 2); addCombineInfo("body cobalt", 1, "body gold", 1, "ingot cobalt", 2); addCombineInfo("pant cobalt", 1, "pant gold", 1, "ingot cobalt", 2); //방어구 - 미스릴 addCombineInfo("helmet mythril magician", 1, "helmet cobalt magician", 1, "ingot mythril", 2); addCombineInfo("helmet mythril ranger", 1, "helmet cobalt ranger", 1, "ingot mythril", 2); addCombineInfo("helmet mythril warrior", 1, "helmet cobalt warrior", 1, "ingot mythril", 2); addCombineInfo("body mythril", 1, "body cobalt", 1, "ingot mythril", 2); addCombineInfo("pant mythril", 1, "pant cobalt", 1, "ingot mythril", 2); //방어구 - 블러드 addCombineInfo("helmet blood magician", 1, "helmet mythril magician", 1, "ingot blood", 2); addCombineInfo("helmet blood ranger", 1, "helmet mythril ranger", 1, "ingot blood", 2); addCombineInfo("helmet blood warrior", 1, "helmet mythril warrior", 1, "ingot blood", 2); addCombineInfo("body blood", 1, "body mythril", 1, "ingot blood", 2); addCombineInfo("pant blood", 1, "pant mythril", 1, "ingot blood", 2); //무기 //소모품 addCombineInfo("arrow", 10, "tile stone", 1); addCombineInfo("bullet", 10, "tile stone", 1); //무기 - 실버 addCombineInfo("bow silver", 1, "ingot silver", 2, "bow basic", 1); addCombineInfo("sword silver", 1, "ingot silver", 2, "sword basic", 1); addCombineInfo("gun I", 1, "ingot silver", 2); //addCombineInfo("magic silver", 1, "ingot silver", 1); //무기 - 골드 addCombineInfo("bow gold", 1, "ingot gold", 2, "bow silver", 1); addCombineInfo("sword gold", 1, "ingot gold", 2, "sword silver", 1); addCombineInfo("gun II", 1, "ingot gold", 2, "gun I", 1); //addCombineInfo("magic gold", 1, "ingot gold", 1); //무기 - 코발트 addCombineInfo("bow cobalt", 1, "ingot cobalt", 2, "bow gold", 1); addCombineInfo("sword cobalt", 1, "ingot cobalt", 2, "sword gold", 1); addCombineInfo("gun III", 1, "ingot cobalt", 2, "gun II", 1); addCombineInfo("magic cobalt", 1, "ingot cobalt", 1); //무기 - 미스릴 addCombineInfo("bow mythril", 1, "ingot mythril", 2, "bow cobalt", 1); addCombineInfo("sword mythril", 1, "ingot mythril", 2, "sword cobalt", 1); addCombineInfo("gun IV", 1, "ingot mythril", 2, "gun III", 1); addCombineInfo("magic mythril", 1, "ingot mythril", 1); //무기 - 블러드 addCombineInfo("bow luna", 1, "ingot blood", 2, "bow mythril", 1); addCombineInfo("sword luna", 1, "ingot blood", 2, "sword mythril", 1); addCombineInfo("gun V", 1, "ingot blood", 2, "gun IV", 1); addCombineInfo("magic luna", 1, "ingot blood", 1); //악세서리 addCombineInfo("purple baloon", 1, "blue baloon", 1, "gray baloon", 1); addCombineInfo("gold baloon", 1, "green baloon", 1, "gray baloon", 1); addCombineInfo("master baloon", 1, "purple baloon", 1, "green baloon", 1); DATAMANAGER->saveDatabase("combine", RESOURCE("/data/combine.ini")); }
void ItemManager::inputItemInfo() { if (!DATABASE->isExistTable("item")) DATABASE->addTable("item"); //도구 addItemInfo("pickaxe", "pickaxe basic", "pickaxe basic", ITEM_TOOL_PICKAXE, EQUIP_NONE, 1, 0, 0, 0, 0, 250); //타일 addItemInfo("tile grass", "item tile grass", "item tile grass", ITEM_BLOCK_GRASS, EQUIP_NONE, 999, 0, 0, 0, 0); addItemInfo("tile stone", "item tile stone", "item tile stone", ITEM_BLOCK_STONE, EQUIP_NONE, 999, 0, 0, 0, 0); addItemInfo("tile silver", "item tile silver", "item tile silver", ITEM_BLOCK_SILVER, EQUIP_NONE, 999, 0, 0, 0, 0); addItemInfo("tile gold", "item tile gold", "item tile gold", ITEM_BLOCK_GOLD, EQUIP_NONE, 999, 0, 0, 0, 0); //방어구 //방어구 - 실버 addItemInfo("helmet silver", "helmet silver image", "helmet silver", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 20, 0, 2); addItemInfo("body silver", "body silver image", "body silver", ITEM_EQUIP, EQUIP_TOP, 1, 10, 0, 0, 1); addItemInfo("pant silver", "pant silver image", "pant silver", ITEM_EQUIP, EQUIP_PANT, 1, 10, 0, 0, 1); //방어구 - 골드 addItemInfo("helmet gold", "helmet gold image", "helmet gold", ITEM_EQUIP, EQUIP_HELMET, 1, 50, 50, 0, 3); addItemInfo("body gold", "body gold image", "body gold", ITEM_EQUIP, EQUIP_TOP, 1, 20, 0, 0, 2); addItemInfo("pant gold", "pant gold image", "pant gold", ITEM_EQUIP, EQUIP_PANT, 1, 20, 0, 0, 2); //방어구 - 코발트 addItemInfo("helmet cobalt magician", "head cobalt magic image", "head cobalt magic", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 80, 0, 2); addItemInfo("helmet cobalt ranger", "head cobalt shooter image", "head cobalt shooter", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 0, 0, 3); addItemInfo("helmet cobalt warrior", "head cobalt warrior image", "head cobalt warrior", ITEM_EQUIP, EQUIP_HELMET, 1, 80, 0, 0, 5); addItemInfo("body cobalt", "body cobalt image", "body cobalt", ITEM_EQUIP, EQUIP_TOP, 1, 50, 0, 0, 5); addItemInfo("pant cobalt", "pant cobalt image", "pant cobalt", ITEM_EQUIP, EQUIP_PANT, 1, 30, 0, 0, 3); //방어구 - 미스릴 addItemInfo("helmet mythril magician", "head mythril magic image", "head mythril magic", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 100, 0, 4); addItemInfo("helmet mythril ranger", "head mythril shooter image", "head mythril shooter", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 0, 0, 5); addItemInfo("helmet mythril warrior", "head mythril warrior image", "head mythril warrior", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 0, 0, 10); addItemInfo("body mythril", "body mythril image", "body mythril", ITEM_EQUIP, EQUIP_TOP, 1, 100, 0, 0, 10); addItemInfo("pant mythril", "pant mythril image", "pant mythril", ITEM_EQUIP, EQUIP_PANT, 1, 50, 0, 0, 5); //방어구 - 블러드 addItemInfo("helmet blood magician", "head blood magic image", "head blood magic", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 150, 0, 10); addItemInfo("helmet blood ranger", "head blood shooter image", "head blood shooter", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 0, 0, 14); addItemInfo("helmet blood warrior", "head blood warrior image", "head blood warrior", ITEM_EQUIP, EQUIP_HELMET, 1, 20, 0, 0, 20); addItemInfo("body blood", "body blood image", "body blood", ITEM_EQUIP, EQUIP_TOP, 1, 150, 0, 0, 20); addItemInfo("pant blood", "pant blood image", "pant blood", ITEM_EQUIP, EQUIP_PANT, 1, 100, 0, 0, 10); //방어구 - 코스튬 addItemInfo("body test", "body 46 image", "body 46", ITEM_EQUIP, EQUIP_TOP, 1, 10, 0, 0, 10); addItemInfo("pant test", "pant 46 image", "pant 46", ITEM_EQUIP, EQUIP_PANT, 1, 10, 0, 0, 10); addItemInfo("body costume", "body costume image", "body costume", ITEM_EQUIP, EQUIP_TOP, 1, 0, 0, 0, 0); //무기 addItemInfo("bow basic", "bow basic", "bow basic", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 10, 0, 200, 1); addItemInfo("sword basic", "sword basic", "sword basic", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 20, 0, 250); addItemInfo("magic basic", "magic basic", "magic basic", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 200, 0, 5); //무기 - 실버 addItemInfo("bow silver", "bow silver", "bow silver", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 15, 0, 190, 1); addItemInfo("sword silver", "sword silver", "sword silver", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 30, 0, 240); addItemInfo("gun I", "gun basic", "gun basic", ITEM_WEAPON_GUN, EQUIP_NONE, 1, 0, 0, 15, 0, 150, 1); addItemInfo("magic silver", "magic silver", "magic silver", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 200, 0, 8); //무기 - 골드 addItemInfo("bow gold", "bow gold", "bow gold", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 15, 0, 180, 2); addItemInfo("sword gold", "sword gold", "sword gold", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 40, 0, 230); addItemInfo("gun II", "gun basic", "gun basic", ITEM_WEAPON_GUN, EQUIP_NONE, 1, 0, 0, 25, 0, 135, 1); addItemInfo("magic gold", "magic gold", "magic gold", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 200, 0, 10); //무기 - 코발트 addItemInfo("bow cobalt", "bow cobalt", "bow cobalt", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 20, 0, 170, 2); addItemInfo("sword cobalt", "sword cobalt", "sword cobalt", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 50, 0, 220); addItemInfo("gun III", "gun basic", "gun basic", ITEM_WEAPON_GUN, EQUIP_NONE, 1, 0, 0, 35, 0, 110, 1); addItemInfo("magic cobalt", "magic cobalt", "magic cobalt", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 200, 0, 15); //무기 - 미스릴 addItemInfo("bow mythril", "bow mythril", "bow mythril", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 25, 0, 160, 3); addItemInfo("sword mythril", "sword mythril", "sword mythril", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 60, 0, 210); addItemInfo("gun IV", "gun basic", "gun basic", ITEM_WEAPON_GUN, EQUIP_NONE, 1, 0, 0, 45, 0, 95, 1); addItemInfo("magic mythril", "magic mythril", "magic mythril", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 100, 0, 10); //무기 - 블러드 addItemInfo("bow luna", "bow luna", "bow luna", ITEM_WEAPON_BOW, EQUIP_NONE, 1, 0, 0, 30, 0, 150, 4); addItemInfo("sword luna", "sword luna", "sword luna", ITEM_WEAPON_SWORD, EQUIP_NONE, 1, 0, 0, 70, 0, 200); addItemInfo("gun V", "gun basic", "gun basic", ITEM_WEAPON_GUN, EQUIP_NONE, 1, 0, 0, 55, 0, 80, 1); addItemInfo("magic luna", "magic luna", "magic luna", ITEM_WEAPON_MAGIC, EQUIP_NONE, 1, 0, 0, 12, 0, 200, 0, 20); //악세서리 addItemInfo("blue baloon", "blue baloon image", "blue baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, true); addItemInfo("gray baloon", "gray baloon image", "gray baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, false, true); addItemInfo("green baloon", "green baloon image", "green baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, false, false, true); addItemInfo("purple baloon", "purple baloon image", "purple baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, true, true); addItemInfo("gold baloon", "gold baloon image", "gold baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, false, true, true); addItemInfo("master baloon", "master baloon image", "master baloon", ITEM_EQUIP, EQUIP_ACCESSORY, 0, 0, 0, 0, 0, 250, 0, 0, true, true, true); //탄환 addItemInfo("arrow", "arrow", "arrow image", ITEM_AMMO_ARROW, EQUIP_NONE, 999, 0, 0, 0, 0, 0); addItemInfo("bullet", "bullet", "bullet image", ITEM_AMMO_BULLET, EQUIP_NONE, 999, 0, 0, 0, 0, 0); //잉곳 addItemInfo("ingot silver", "ingot silver", "ingot silver", ITEM_MATERIAL, EQUIP_NONE, 999, 0, 0, 0, 0, 0); addItemInfo("ingot gold", "ingot gold", "ingot gold", ITEM_MATERIAL, EQUIP_NONE, 999, 0, 0, 0, 0, 0); addItemInfo("ingot cobalt", "ingot cobalt", "ingot cobalt", ITEM_MATERIAL, EQUIP_NONE, 999, 0, 0, 0, 0, 0); addItemInfo("ingot mythril", "ingot mythril", "ingot mythril", ITEM_MATERIAL, EQUIP_NONE, 999, 0, 0, 0, 0, 0); addItemInfo("ingot blood", "ingot blood", "ingot blood", ITEM_MATERIAL, EQUIP_NONE, 999, 0, 0, 0, 0, 0); DATAMANAGER->saveDatabase("item", RESOURCE("/data/item.ini")); }
void CUIRadioButton::Create(const CREATESTRUCT& cs) { super::Create(cs); static bool s_bRegistered = false; if ( !s_bRegistered ) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; wc.hIcon = LoadIcon(g_hInstance, NULL); wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "CUIRadioButton"; if ( !RegisterClass(&wc) ) { _ASSERT(false); } s_bRegistered = true; } m_hWnd = CreateWindow("CUIRadioButton", "CUIRadioButton", WS_CHILD|WS_VISIBLE, cs.x, cs.y, cs.cx, cs.cy, m_hWndParent, NULL, g_hInstance, NULL); Map(m_hWnd) = this; // char szRadioButton[128]; for ( uint32 iRadioButton = 0 ; true ; ++iRadioButton ) { sprintf(szRadioButton, "radiobutton%d", iRadioButton); if ( !cs.dict.Exists(szRadioButton) ) break; CUIRadioButton* pUIRadioButton = (CUIRadioButton*)cs.dict.GetUint32(szRadioButton); m_listRadioButtons.push_back(pUIRadioButton); } // if ( cs.dict.Exists("disabled") ) { m_bDisabled = cs.dict.GetBool("disabled"); } // if ( cs.dict.Exists("value") ) { m_bValue = cs.dict.GetBool("value"); } // if ( cs.dict.Exists("text") ) { m_hFont = CreateFont(9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, cs.dict.GetString("font").c_str()); m_sText = cs.dict.GetString("text"); RECT rect; HDC hDC = GetDC(m_hWnd); SelectObject(hDC, m_hFont); DrawText(hDC, m_sText.c_str(), -1, &rect, DT_CALCRECT); ReleaseDC(m_hWnd, hDC); MoveWindow(m_hWnd, cs.x, cs.y, 13 + rect.right - rect.left, 9, TRUE); } else if ( cs.dict.Exists("image") ) { m_hBitmapImage = RESOURCE(cs.dict.GetString("image")).LoadBitmap(); } // if ( cs.dict.Exists("imageon") ) { m_hBitmapOn = RESOURCE(cs.dict.GetString("imageon")).LoadBitmap(); } else { // m_hBitmapOn = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_RADIOBUTTON_ON)); } // if ( cs.dict.Exists("imageoff") ) { m_hBitmapOff = RESOURCE(cs.dict.GetString("imageoff")).LoadBitmap(); } else { // m_hBitmapOff = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_RADIOBUTTON_OFF)); } if ( m_hBitmapImage ) { BITMAP bm; GetObject(m_hBitmapImage, sizeof(BITMAP), &bm); MoveWindow(m_hWnd, cs.x, cs.y, 13 + bm.bmWidth, 9, TRUE); } // SetCapture(m_hWnd); // SetFocus(m_hWnd); }