//删除好友 void LayerUserInfo::handle_delete_friend(cmd_data_pointer data) { ClearError(); std::shared_ptr<net_data_recv_package> rec = dynamic_pointer_cast<net_data_recv_package>(data); if (!check_request(rec)) return; auto processor = PM->response_down(rec); switch (processor.status()) { case msg::Status::SUCCESS: { Toast::ToastShow(tools::local_string("delete_friend_successed","删除好友成功")); InitNormal(); break; } case msg::Status::FAILED: Toast::ToastShow(processor.message()); break; default: break; } }
SelectWeightsDlg::SelectWeightsDlg(Project* project, wxWindow* parent, const wxString& caption, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, caption, pos, size, style), w_man_int(project->GetWManInt()), w_list(0), ok_btn(0), cancel_btn(0) { LOG_MSG("Entering SelectWeightsDlg::SelectWeightsDlg"); w_man_int->GetIds(ids); no_weights = ids.size() == 0 ? true : false; if (no_weights) { InitNoWeights(); } else { InitNormal(); } LOG_MSG("Exiting SelectWeightsDlg::SelectWeightsDlg"); }
void LayerUserInfo::handle_deal_request(cmd_data_pointer data) { std::shared_ptr<net_data_recv_package> rec = dynamic_pointer_cast<net_data_recv_package>(data); if (!check_request(rec)) return; auto processor = PM->DealRequest_down(rec); switch (processor.response().status()) { case msg::Status::SUCCESS: Toast::ToastShow(tools::local_string("request_has_aready_send","已发送请求")); IM->deal_request(processor.requestid(), processor.accepted()); break; case msg::Status::FAILED: Toast::ToastShow(tools::local_string("request_failed","请求失败")); break; default: break; } InitNormal(); }
bool LayerUserInfo::init() { if(!BaseLayer::init()) { return false; } auto root = CSLoader::createNode("LayerFriendDetails.csb"); addChild(root); auto btnBack = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_back")); auto tmpImgIcon = dynamic_cast<ImageView*>(CSLoader::seekNodeByName(root, "image_user_avatar")); auto imgHead = ShaderSprite::createAndDownload("Default/image_defualt_user_icon_large.png", "Default/image_defualt_user_icon_large.png", "Default/image_mask_circle.png"); imgHead->setPosition(tmpImgIcon->getPosition()); root->addChild(imgHead, tmpImgIcon->getLocalZOrder()); tmpImgIcon->removeFromParent(); auto text_title= dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_title")); auto nickName = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "title_nick_name")); auto account = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "title_account")); auto spriteSex = dynamic_cast<Sprite*>(CSLoader::seekNodeByName(root, "sprite_sex")); auto textNickname = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_nike_name")); auto textAccount = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_account")); auto textSex = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "title_friend_session")); auto titleDiamond = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "title_diamond")); auto imgTextfieldBg = dynamic_cast<ImageView*>(CSLoader::seekNodeByName(root, "img_diamond_bg")); auto textfieldDiamond = dynamic_cast<TextField*>(CSLoader::seekNodeByName(root, "textfield_diamond")); mBtnConfirm = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_diamond")); text_title->setString(tools::local_string("personal_info","个人资料")); nickName->setString(tools::local_string("nickname","昵称")); account->setString(tools::local_string("account","账号")); mBtnConfirm->setTitleText(tools::local_string("confirm_change_password","确定")); titleDiamond->setString(tools::local_string("give_diamond","赠送钻石")); mCheckboxHiteMoments = dynamic_cast<CheckBox*>(CSLoader::seekNodeByName(root, "checkbox_friend_session")); mBtnSendMsg = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_send_message")); mBtnDeleteFriend = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_delete_friend")); btnBack->addClickEventListener([&](Ref *ref) { if(IsInvitation) { auto layer = dynamic_cast<LayerInvitationList*>(this->getParent()); if(layer) { layer->refresh_deal_data(); } } this->removeFromParent(); }); imgHead->setSpriteTexture(mInfo.picname()); spriteSex->setTexture(mInfo.sex() == msg::Sex::MALE ? gMaleIcon : gFemaleIcon); textSex->setString(mInfo.sex() == msg::Sex::MALE ? tools::local_string("block_his_moment", "屏蔽他的朋友圈") : tools::local_string("block_her_moment", "屏蔽她的朋友圈")); textNickname->setString(mInfo.nickname()); spriteSex->setPositionX(textNickname->getPositionX() - textNickname->getContentSize().width - 30); textAccount->setString(tools::to_string(mInfo.userid())); mCheckboxHiteMoments->setSelected(false); setCheckBoxTextures(mCheckboxHiteMoments); mCheckboxHiteMoments->addClickEventListener([&](Ref *ref) { auto checkbox = dynamic_cast<CheckBox*>(ref); bool isSelect = checkbox->isSelected(); int userId = mInfo.userid(); log("屏蔽userId = %d", userId); auto processor = PM->BlockUser_up(userId, isSelect); send_data(processor, REQ_SHIELD_FRIEND); }); mEditboxtDiamond = GameTools::createEditBoxFromTextField(imgTextfieldBg, textfieldDiamond); mEditboxtDiamond->setInputMode(EditBox::InputMode::NUMERIC); mEditboxtDiamond->setReturnType(EditBox::KeyboardReturnType::DONE); mEditboxtDiamond->setMaxLength(10); mEditboxtDiamond->setFontColor(Color3B::WHITE); mEditboxtDiamond->setPlaceHolder("0"); mEditboxtDiamond->setDelegate(this); mBtnConfirm->addClickEventListener([&](Ref *ref){ log("send Diamond: %s, len = %d", mEditboxtDiamond->getText(), strlen(mEditboxtDiamond->getText())); if(strlen(mEditboxtDiamond->getText()) <= 0 || !GameTools::isRegexMath(mEditboxtDiamond->getText(), GameTools::INPUT_TYPE::NUMBER)) { Toast::ToastShow(tools::local_string("input_whole","只支持数字")); return; } GameTools::editBoxLoseInputFocus(); requestDiamond(); }); //处理搜索消息 if(!IsInvitation) InitNormal(); else { //处理请求消息 mBtnSendMsg->setTitleText(tools::local_string("operate", "同意")); mBtnSendMsg->addClickEventListener([&](Ref *ref) { sendInvitationFriend(true); }); mBtnDeleteFriend->setTitleText(tools::local_string("disagree_friend_request", "拒绝")); mBtnDeleteFriend->addClickEventListener([&](Ref *ref) { sendInvitationFriend(false); }); } send_data(PM->null_up(), REQ_MOMENT_BLOCK_LIST);//每次都请求已屏蔽的朋友圈列表 return true; }
BOOL Setup() { InitMaterial(); D3DXCreateTeapot( g_pDevice, &g_pMesh, 0 ); ////////////////////////////////////////////////////////////////////////////// D3DXVECTOR3 pos(0,0,-5); D3DXVECTOR3 target(0,0,0); D3DXVECTOR3 up(0,1,0); D3DXMatrixLookAtLH( &g_mCamera, &pos, &target, &up ); g_pDevice->SetTransform( D3DTS_VIEW, &g_mCamera ); D3DXMATRIX proj; // D3DXMatrixPerspectiveFovLH( &proj, D3DX_PI *.5f, (float)WIDTH/(float)HEIGHT, 1.0f, 1000.0f ); D3DXMatrixPerspectiveFovLH( &proj, D3DX_PI *.25f, (float)WIDTH/(float)HEIGHT, 1.0f, 1000.0f ); g_pDevice->SetTransform( D3DTS_PROJECTION, &proj ); D3DXCreateTextureFromFile( g_pDevice, "crate.jpg", &g_pTex1); D3DXCreateTextureFromFile( g_pDevice, "Maksim022.bmp", &g_pTex2); InitAlphaTexture(); g_pDevice->CreateVertexBuffer( vertexSize*sizeof(SVtxNormTex), 0, D3DLVERTEX::FVF, D3DPOOL_MANAGED, &g_pvtxBuff1, NULL ); g_pDevice->CreateVertexBuffer( vertexSize*sizeof(SVtxNormTex), 0, D3DLVERTEX::FVF, D3DPOOL_MANAGED, &g_pvtxBuff2, NULL ); D3DLVERTEX *pv; // A vertex g_pvtxBuff1->Lock(0, 0, (void**)&pv, 0); pv[ 0] = D3DLVERTEX(Vector3(-1.0f, -1.0f, .25f), Vector3(0,0,-1), D3DXCOLOR(1,0,0,0), 0, 1); pv[ 1] = D3DLVERTEX(Vector3(-1.0f, 1.0f, .25f), Vector3(0,0,-1), D3DXCOLOR(1,0,0,0), 0, 0); pv[ 2] = D3DLVERTEX(Vector3( 0.0f, 0.0f, -1.25f), Vector3(0,0,-1), D3DXCOLOR(1,0,0,0), 0.5f, 0.5f); pv[ 3] = D3DLVERTEX(Vector3( 1.0f, 1.0f, .25f), Vector3(0,0,-1), D3DXCOLOR(1,0,0,0), 1, 0); pv[ 4] = D3DLVERTEX(Vector3( 1.0f, -1.0f, .25f), Vector3(0,0,-1), D3DXCOLOR(1,0,0,0), 1, 1); g_pvtxBuff1->Unlock(); // B vertex g_pvtxBuff2->Lock(0, 0, (void**)&pv, 0); pv[ 0] = D3DLVERTEX(Vector3(1.0f, -1.0f, 1.25f), Vector3(0,0,-1), D3DXCOLOR(0,0,1,0), 0, 1); pv[ 1] = D3DLVERTEX(Vector3(1.0f, 1.0f, 1.25f), Vector3(0,0,-1), D3DXCOLOR(0,0,1,0), 0, 0); pv[ 2] = D3DLVERTEX(Vector3(3.0f, 1.0f, 1.25f), Vector3(0,0,-1), D3DXCOLOR(0,0,1,0), 1, 0); pv[ 3] = D3DLVERTEX(Vector3(3.0f, -1.0f, 1.25f), Vector3(0,0,-1), D3DXCOLOR(0,0,1,0), 1, 1); g_pvtxBuff2->Unlock(); // // 1 3 // 2 // 0 4 // g_pDevice->CreateIndexBuffer( indexSize*sizeof(WORD), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &g_pidxBuff1, NULL ); WORD *pi = NULL; g_pidxBuff1->Lock(0, 0, (void**)&pi, 0); pi[ 0] = 0; pi[ 1] = 1; pi[ 2] = 2; pi[ 3] = 1; pi[ 4] = 3; pi[ 5] = 2; pi[ 6] = 2; pi[ 7] = 3; pi[ 8] = 4; pi[ 9] = 2; pi[ 10] = 4; pi[ 11] = 0; g_pidxBuff1->Unlock(); InitNormal(); return TRUE; }