示例#1
0
    void RaceDialog::onSelectNextGender(MyGUI::Widget*)
    {
        mGenderIndex = wrap(mGenderIndex + 1, 2);

        recountParts();
        updatePreview();
    }
示例#2
0
    void RaceDialog::open()
    {
        WindowModal::open();

        updateRaces();
        updateSkills();
        updateSpellPowers();

        mPreview = new MWRender::RaceSelectionPreview();
        mPreview->setup();
        mPreview->update (0);

        const ESM::NPC proto = mPreview->getPrototype();
        setRaceId(proto.mRace);
        recountParts();

        std::string index = proto.mHead.substr(proto.mHead.size() - 2, 2);
        mFaceIndex = boost::lexical_cast<int>(index) - 1;

        index = proto.mHair.substr(proto.mHair.size() - 2, 2);
        mHairIndex = boost::lexical_cast<int>(index) - 1;

        mPreviewImage->setImageTexture ("CharacterHeadPreview");

        mPreviewDirty = true;
    }
示例#3
0
    void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index)
    {
        if (_index == MyGUI::ITEM_NONE)
            return;

        const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
        if (Misc::StringUtils::ciEqual(mCurrentRaceId, *raceId))
            return;

        mCurrentRaceId = *raceId;

        recountParts();

        updatePreview();
        updateSkills();
        updateSpellPowers();
    }
示例#4
0
文件: race.cpp 项目: OpenMW/openmw
    void RaceDialog::onOpen()
    {
        WindowModal::onOpen();

        updateRaces();
        updateSkills();
        updateSpellPowers();

        mPreviewImage->setRenderItemTexture(nullptr);

        mPreview.reset(nullptr);
        mPreviewTexture.reset(nullptr);

        mPreview.reset(new MWRender::RaceSelectionPreview(mParent, mResourceSystem));
        mPreview->rebuild();
        mPreview->setAngle (mCurrentAngle);

        mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));
        mPreviewImage->setRenderItemTexture(mPreviewTexture.get());
        mPreviewImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f));

        const ESM::NPC& proto = mPreview->getPrototype();
        setRaceId(proto.mRace);
        setGender(proto.isMale() ? GM_Male : GM_Female);
        recountParts();

        for (unsigned int i=0; i<mAvailableHeads.size(); ++i)
        {
            if (Misc::StringUtils::ciEqual(mAvailableHeads[i], proto.mHead))
                mFaceIndex = i;
        }

        for (unsigned int i=0; i<mAvailableHairs.size(); ++i)
        {
            if (Misc::StringUtils::ciEqual(mAvailableHairs[i], proto.mHair))
                mHairIndex = i;
        }

        mPreviewDirty = true;

        size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10;
        mHeadRotate->setScrollPosition(initialPos);
        onHeadRotate(mHeadRotate, initialPos);

        MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mRaceList);
    }
示例#5
0
文件: race.cpp 项目: Digmaster/openmw
    void RaceDialog::open()
    {
        WindowModal::open();

        updateRaces();
        updateSkills();
        updateSpellPowers();

        mPreview.reset(NULL);

        mPreviewImage->setImageTexture("");

        const std::string textureName = "CharacterHeadPreview";
        MyGUI::RenderManager::getInstance().destroyTexture(MyGUI::RenderManager::getInstance().getTexture(textureName));

        mPreview.reset(new MWRender::RaceSelectionPreview());
        mPreview->setup();
        mPreview->update (mCurrentAngle);

        const ESM::NPC proto = mPreview->getPrototype();
        setRaceId(proto.mRace);
        recountParts();

        for (unsigned int i=0; i<mAvailableHeads.size(); ++i)
        {
            if (mAvailableHeads[i] == proto.mHead)
                mFaceIndex = i;
        }

        for (unsigned int i=0; i<mAvailableHairs.size(); ++i)
        {
            if (mAvailableHairs[i] == proto.mHair)
                mHairIndex = i;
        }

        mPreviewImage->setImageTexture (textureName);

        mPreviewDirty = true;

        size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10;
        mHeadRotate->setScrollPosition(initialPos);
        onHeadRotate(mHeadRotate, initialPos);
    }