예제 #1
0
bool MailWritePopUpView::initWithGift(int giftID,int propID) {
    if(!PopupBaseView::init()) {
        return false;
    }
    setIsHDPanel(true);
    mPropID = propID;
    mType = 1;
//    auto cf = CCLoadSprite::getSF("Mail_diban.png");
    auto cf = CCLoadSprite::getSF("Mail_BG1.png");
    if (cf==NULL) {
        CCLoadSprite::doResourceByCommonIndex(11, true);
        CCLoadSprite::doResourceByCommonIndex(6, true);
        setCleanFunction([]() {
            CCLoadSprite::doResourceByCommonIndex(11, false);
            CCLoadSprite::doResourceByCommonIndex(6, false);
        });
    }
    else {
        CCLoadSprite::doResourceByCommonIndex(11, true);
        setCleanFunction([]() {
            CCLoadSprite::doResourceByCommonIndex(11, false);
        });
    }

    auto bg = CCBLoadFile("NEWMailWriteView", this, this);
    if (CCCommonUtils::isIosAndroidPad()) {
        this->setContentSize(CCDirector::sharedDirector()->getWinSize());
    }
    else
        this->setContentSize(bg->getContentSize());
//    setTitleName(_lang("105513"));
    m_titleText->setString(_lang("105513"));
    if (CCCommonUtils::isIosAndroidPad()) {
        int extH = getExtendHeight();
        this->m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + extH));
        m_downNode->setPositionY(m_downNode->getPositionY() - extH);
        m_bgNode->setPositionY(m_bgNode->getPositionY() - extH);
//        m_nodeContent->setPositionY(m_nodeContent->getPositionY() - extH);
        auto tbg = CCLoadSprite::loadResource("Mail_diban.png");
        auto tBatchNode = CCSpriteBatchNode::createWithTexture(tbg->getTexture());
        auto picBg1 = CCLoadSprite::createSprite("Mail_diban.png");
        picBg1->setAnchorPoint(ccp(0, 0));
        picBg1->setPosition(ccp(0, 0));
        picBg1->setScaleX(2.4);
        tBatchNode->addChild(picBg1);
        int maxHeight = CCDirector::sharedDirector()->getWinSize().height;
        int curHeight = picBg1->getContentSize().height;
        while(curHeight < maxHeight)
        {
            auto picBg2 = CCLoadSprite::createSprite("Mail_diban.png");
            picBg2->setAnchorPoint(ccp(0, 0));
            picBg2->setPosition(ccp(0, curHeight));
            picBg2->setScaleX(2.4);
            tBatchNode->addChild(picBg2);
            curHeight += picBg2->getContentSize().height;
        }
        m_bgNode->addChild(tBatchNode);
    }
    else {
        int extH = getExtendHeight();
        this->m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + extH));
        m_downNode->setPositionY(m_downNode->getPositionY() - extH);
        m_bgNode->setPositionY(m_bgNode->getPositionY() - extH);
//        m_nodeContent->setPositionY(m_nodeContent->getPositionY() - extH);
        auto tbg = CCLoadSprite::loadResource("Mail_diban.png");
        auto tBatchNode = CCSpriteBatchNode::createWithTexture(tbg->getTexture());
        auto picBg1 = CCLoadSprite::createSprite("Mail_diban.png");
        picBg1->setAnchorPoint(ccp(0, 0));
        picBg1->setPosition(ccp(0, 0));
        tBatchNode->addChild(picBg1);
        int maxHeight = CCDirector::sharedDirector()->getWinSize().height;
        int curHeight = picBg1->getContentSize().height;
        while(curHeight < maxHeight)
        {
            auto picBg2 = CCLoadSprite::createSprite("Mail_diban.png");
            picBg2->setAnchorPoint(ccp(0, 0));
            picBg2->setPosition(ccp(0, curHeight));
            tBatchNode->addChild(picBg2);
            curHeight += picBg2->getContentSize().height;
        }
        m_bgNode->addChild(tBatchNode);
    }
//    CCSize wNodeSize = this->m_waitingNode->getContentSize();
//    m_waitingNode->setContentSize(CCSize(wNodeSize.width,wNodeSize.height + dh));
//    m_waitingNode->setPositionY(m_waitingNode->getPositionY() - dh*0.5);

//    this->m_nameText->setString(_lang("105505").c_str());
    //    this->m_titleText->setString(_lang("105503").c_str());
//    this->m_contentText->setString(_lang("105504").c_str());

    CCNode *searchnode = CCNode::create();
    auto spr1 = CCLoadSprite::createScale9Sprite("button_dark.png");
    CCControlButton *shareBtn = CCControlButton::create(spr1);
    searchnode->addChild(shareBtn);
    shareBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(MailWritePopUpView::onChooseName), CCControlEventTouchUpInside);
    CCSprite* sprIcon = CCLoadSprite::createSprite("search_icon.png");
    CCSize sprSize = sprIcon->getContentSize();
    searchnode->addChild(sprIcon);
    CCCommonUtils::setSpriteMaxSize(sprIcon, 40);
    shareBtn->setPreferredSize(CCSize(60, 60));
    this->m_nameContainer->addChild(searchnode);
    searchnode->setPosition(440, 0);

    CCScrollView *scrollView = CCScrollView::create(m_listNode->getContentSize());
    scrollView->setTouchPriority(Touch_Popup_Item);
    scrollView->setDirection(kCCScrollViewDirectionVertical);
    m_nodeContent->removeFromParentAndCleanup(false);
    scrollView->addChild(m_nodeContent);
    scrollView->setTag(10000);
    m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(380,40),"Mail_write.png",24);
//    m_nameEditBox->setTouchPriority(Touch_Default);
    m_nameEditBox->setMaxChars(30);
    m_nameEditBox->setPosition(ccp(0, -20));
    m_nameEditBox->setLineNumber(1);
    m_nameEditBox->setFontColor({63,44,27});

    this->m_nameContainer->addChild(m_nameEditBox);
    m_nameEditBox->m_enabled = (mPropID == ITEM_SEND_GIFTALLIANCE || mPropID == ITEM_SEND_GIFT || mPropID == ITEM_SEND_GIFTMORE)?false:true;

    m_contentEditBox = InputFieldMultiLine::create(m_contentContainer->getContentSize(),"Mail_write.png",24);
    m_contentEditBox->setTouchPriority(Touch_Default);
    m_contentEditBox->setMaxChars(300);
    m_contentEditBox->setLineNumber(5);
    m_contentEditBox->setPosition(ccp(0, 0));
    m_contentEditBox->setFontColor({63,44,27});
    this->m_contentContainer->addChild(m_contentEditBox);
    m_contentEditBox->setText(_lang("101383"));
    CCSize liseNodeSize = this->m_listNode->getContentSize() * m_listNode->getScale();
    MailGiftCell *mailGiftCell = MailGiftCell::create(CCSize(liseNodeSize.width, liseNodeSize.height - 110),mPropID,giftID);
    scrollView->addChild(mailGiftCell);
    mailGiftCell->setTag(10000);
    CCSize cellSize = mailGiftCell->getContentSize();
    int needH = ceil(cellSize.height + 400);
    int nowH = m_listNode->getContentSize().height;
    m_nodeContent->setPosition(ccp(300,cellSize.height + 100));
    mailGiftCell->setPosition(ccp(0,0));
    m_listNode->addChild(scrollView);
    scrollView->setContentSize(CCSize(600,400 + cellSize.height));
    scrollView->setContentOffset(ccp(0, nowH - needH));

    if(needH>nowH) {
        scrollView->setTouchEnabled(true);
    } else {
        scrollView->setTouchEnabled(false);
    }

    if(!m_toName.empty()) {
        m_nameEditBox->setText(m_toName.c_str());
        m_nameEditBox->setEnabled(false);
    }
    updateBtnStatus();

    return true;
}
예제 #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    /*UI Para Init*/

    /*Data Para*/

    ui->DataPatternsEdit->setText("1000");

    ui->DataPatternsEdit->setDisabled(1);

    ui->TrainDataPatternsEdit->setText("900");

    ui->TrainDataPatternsEdit->setDisabled(1);

    ui->TestDataPattensEdit->setText("100");

    ui->TestDataPattensEdit->setDisabled(1);

    /*Network Para*/

    ui->InEdit->setText("20");

    ui->InEdit->setDisabled(1);

    ui->NeuronEdit->setText("10");

    ui->OutEdit->setText("1");

    ui->OutEdit->setDisabled(1);

    ui->LREdit->setText("0.3");

    ui->MomentumEdit->setText("0.3");

    /*Train End Para*/

    ui->EpochsEdit->setText("1000");

    ui->AccuracyEdit->setText("0.90");

    /*File Para*/

    ui->InputFileEdit->setText("/Users/zhangjun/Documents/C++Work/BPNN/data/german.dat");

    ui->WEdit->setText("/Users/zhangjun/Documents/C++Work/BPNN/data/InputToHiddenWeights.dat");

    ui->VEdit->setText("/Users/zhangjun/Documents/C++Work/BPNN/data/HiddenToOutputWeights.dat");

    ui->LogEdit->setText("/Users/zhangjun/Documents/C++Work/BPNN/data/log.dat");

    /*Signals Slots Connect */

    connect(&worker,SIGNAL(emitStatus(QString)),this,SLOT(updateStatus(QString)));

    connect(this,SIGNAL(emitPara(Para)),&worker,SLOT(updatePara(Para)));

    connect(&worker,SIGNAL(emitFinished()),this,SLOT(updateBtnStatus()));

   // connect(&bp,SIGNAL(emitLog(QString)),this,SLOT(updateStatus(QString)));

}
예제 #3
0
bool MailWritePopUpView::init() {
    if(!PopupBaseView::init()) {
        return false;
    }
    setIsHDPanel(true);
    mType = 0;
//    auto cf = CCLoadSprite::getSF("Mail_diban.png");
    auto cf = CCLoadSprite::getSF("Mail_BG1.png");
    if (cf==NULL) {
        CCLoadSprite::doResourceByCommonIndex(6, true);
        setCleanFunction([]() {
            CCLoadSprite::doResourceByCommonIndex(6, false);
        });
    }

    auto bg = CCBLoadFile("NEWMailWriteView", this, this);
    if (CCCommonUtils::isIosAndroidPad()) {
        this->setContentSize(CCDirector::sharedDirector()->getWinSize());
    }
    else
        this->setContentSize(bg->getContentSize());
//    setTitleName(_lang("105513"));
    m_titleText->setString(_lang("105513"));
    if (CCCommonUtils::isIosAndroidPad()) {
        int extH = getExtendHeight();
        this->m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + extH));
        m_downNode->setPositionY(m_downNode->getPositionY() - extH);
        m_bgNode->setPositionY(m_bgNode->getPositionY() - extH);
        auto tbg = CCLoadSprite::loadResource("Mail_diban.png");
        auto tBatchNode = CCSpriteBatchNode::createWithTexture(tbg->getTexture());
        auto picBg1 = CCLoadSprite::createSprite("Mail_diban.png");
        picBg1->setAnchorPoint(ccp(0, 0));
        picBg1->setPosition(ccp(0, 0));
        picBg1->setScaleX(2.4);
        tBatchNode->addChild(picBg1);
        int maxHeight = CCDirector::sharedDirector()->getWinSize().height;
        int curHeight = picBg1->getContentSize().height;
        while(curHeight < maxHeight)
        {
            auto picBg2 = CCLoadSprite::createSprite("Mail_diban.png");
            picBg2->setAnchorPoint(ccp(0, 0));
            picBg2->setPosition(ccp(0, curHeight));
            picBg2->setScaleX(2.4);
            tBatchNode->addChild(picBg2);
            curHeight += picBg2->getContentSize().height;
        }
        m_bgNode->addChild(tBatchNode);
    }
    else {
        int extH = getExtendHeight();
        this->m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + extH));
        m_downNode->setPositionY(m_downNode->getPositionY() - extH);
        m_bgNode->setPositionY(m_bgNode->getPositionY() - extH);
        auto tbg = CCLoadSprite::loadResource("Mail_diban.png");
        auto tBatchNode = CCSpriteBatchNode::createWithTexture(tbg->getTexture());
        auto picBg1 = CCLoadSprite::createSprite("Mail_diban.png");
        picBg1->setAnchorPoint(ccp(0, 0));
        picBg1->setPosition(ccp(0, 0));
        tBatchNode->addChild(picBg1);
        int maxHeight = CCDirector::sharedDirector()->getWinSize().height;
        int curHeight = picBg1->getContentSize().height;
        while(curHeight < maxHeight)
        {
            auto picBg2 = CCLoadSprite::createSprite("Mail_diban.png");
            picBg2->setAnchorPoint(ccp(0, 0));
            picBg2->setPosition(ccp(0, curHeight));
            tBatchNode->addChild(picBg2);
            curHeight += picBg2->getContentSize().height;
        }
        m_bgNode->addChild(tBatchNode);
    }
//    this->m_bg->setContentSize(CCSize(m_bg->getContentSize().width, m_bg->getContentSize().height + dh));

//    this->m_nameText->setString(_lang("105505").c_str());
//    this->m_titleText->setString(_lang("105503").c_str());
//    this->m_contentText->setString(_lang("105504").c_str());

//    m_nameEditBox->setReturnType(kKeyboardReturnTypeDone);
//    m_nameEditBox->setInputFlag(kEditBoxInputFlagInitialCapsSentence);
#if (CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID)
    if(MailController::getInstance()->getChatRoomEnable() && GlobalData::shared()->playerInfo.isInAlliance())
    {
        m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(410,40),"Mail_write.png",24);
        m_nameEditBox->setMaxChars(300);
        m_nameEditBox->setPosition(ccp(0, -20));
        m_nameEditBox->setLineNumber(1);
        m_nameEditBox->setFontColor({63,44,27});

        auto inviteImg = CCLoadSprite::createScale9Sprite("icon_add_mumber.png");
        m_inviteBtn = CCControlButton::create(inviteImg);
        m_inviteBtn->setPreferredSize(CCSize(40, 40));
        m_inviteBtn->setPosition(ccp(430,0));
        m_inviteBtn->setAnchorPoint(ccp(0,0.5));
        m_inviteBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(MailWritePopUpView::onInvitePlayer), CCControlEventTouchUpInside);
        this->m_nameContainer->addChild(m_inviteBtn);
    }
    else
    {
        m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(475,40),"Mail_write.png",24);
        m_nameEditBox->setMaxChars(30);
        m_nameEditBox->setPosition(ccp(0, -20));
        m_nameEditBox->setLineNumber(1);
        m_nameEditBox->setFontColor({63,44,27});
    }
#elif (CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
    if (!ChatServiceCocos2dx::enableChatRoom) {
        m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(475,40),"Mail_write.png",24);
        m_nameEditBox->setMaxChars(30);
        m_nameEditBox->setPosition(ccp(0, -20));
        m_nameEditBox->setLineNumber(1);
        m_nameEditBox->setFontColor({63,44,27});
    } else {
        if(GlobalData::shared()->playerInfo.isInAlliance())
        {
            m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(410,40),"Mail_write.png",24);
            m_nameEditBox->setMaxChars(300);
            m_nameEditBox->setPosition(ccp(0, -20));
            m_nameEditBox->setLineNumber(1);
            m_nameEditBox->setFontColor({63,44,27});
            //显示加号按钮
            auto inviteImg = CCLoadSprite::createScale9Sprite("icon_add_mumber.png");
            m_inviteBtn = CCControlButton::create(inviteImg);
            m_inviteBtn->setPreferredSize(CCSize(40, 40));
            m_inviteBtn->setPosition(ccp(430,0));
            m_inviteBtn->setAnchorPoint(ccp(0,0.5));
            m_inviteBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(MailWritePopUpView::onInvitePlayer), CCControlEventTouchUpInside);
            this->m_nameContainer->addChild(m_inviteBtn);
        }
        else
        {
            m_nameEditBox = InputFieldMultiLine::create(CCSizeMake(475,40),"Mail_write.png",24);
            m_nameEditBox->setMaxChars(30);
            m_nameEditBox->setPosition(ccp(0, -20));
            m_nameEditBox->setLineNumber(1);
            m_nameEditBox->setFontColor({63,44,27});
        }

    }

#endif

    this->m_nameContainer->addChild(m_nameEditBox);

//    m_titleEditBox = InputFieldMultiLine::create(CCSizeMake(475,40),"UI_Alliance_TextBox.png",24);
//    m_titleEditBox->setMaxChars(30);
//    m_titleEditBox->setLineNumber(1);
//    m_titleEditBox->setPosition(ccp(0, -20));
//    m_titleEditBox->setFontColor({63,44,27});
////    m_titleEditBox->setReturnType(kKeyboardReturnTypeDone);
////    m_titleEditBox->setInputFlag(kEditBoxInputFlagInitialCapsSentence);
//    this->m_titleContainer->addChild(m_titleEditBox);

    m_contentEditBox = InputFieldMultiLine::create(m_contentContainer->getContentSize(),"Mail_write.png",24);
    m_contentEditBox->setMaxChars(300);
    m_contentEditBox->setLineNumber(5);
    m_contentEditBox->setPosition(ccp(0, 0));
//    m_contentEditBox->setFontSize(24);
//    m_contentEditBox->setMaxLength(300);
    m_contentEditBox->setFontColor({63,44,27});
//    m_contentEditBox->setReturnType(kKeyboardReturnTypeDone);
//    m_contentEditBox->setInputFlag(kEditBoxInputFlagInitialCapsSentence);
    this->m_contentContainer->addChild(m_contentEditBox);

    if(!m_toName.empty()) {
        m_nameEditBox->setText(m_toName.c_str());
        if(!m_allianceId.empty() || !m_thanksMail.empty()) {
            m_nameEditBox->setEnabled(false);
        }
    }
    if(!m_thanksMail.empty()) {
        m_contentEditBox->setText(_lang("101387"));
    }
    if(m_title != "") {
//        m_titleEditBox->setText(LocalController::shared()->TextINIManager()->getObjectByKey("105511", "1", m_title.c_str()).c_str());
    }
    updateBtnStatus();
//    m_waitInterface = NULL;
    return true;
}