Esempio n. 1
0
    public void initList(int startSelection)
    {
        if (!this.getFlag(1))
        {
            this.m_startSelection = startSelection;
            this.unsetFlag(2);
        }
        else
        {
            AppEngine   canvas      = AppEngine.getCanvas();
            TextManager textManager = canvas.getTextManager();
            SimWorld    simWorld    = canvas.getSimWorld();
            SimData     simData     = canvas.getSimData();
            SceneGame   sceneGame   = canvas.getSceneGame();
            this.setFlag(2);
            this.m_itemNumX     = 1;
            this.m_itemW        = this.m_width - 20;
            this.m_itemSelected = startSelection;
            switch (this.m_listId)
            {
            case 0:
                this.m_selectPreSend = false;
                this.m_itemSelected  = canvas.getRMSGameSlotIndex();
                this.m_itemNum       = 7;
                this.m_itemNumX      = this.m_itemNum;
                this.m_itemNumY      = 1;
                this.m_itemW         = 118;
                this.m_itemH         = this.m_height;
                break;

            case 1:
                this.m_selectPreSend = true;
                this.m_itemNum       = simData.getPersonaCount();
                this.m_itemSelected  = simData.getPersona();
                this.m_itemNumX      = this.m_itemNum;
                this.m_itemH         = 40;
                this.m_itemNumY      = 1;
                this.m_itemW         = 160;
                this.m_itemH         = this.m_height;
                break;

            case 2:
                this.m_itemNum = simData.getTraitCount();
                this.m_itemH   = 40;
                break;

            case 3:
                this.m_itemNum = simData.getTaskCount();
                this.m_itemH   = 28;
                break;

            case 4:
                this.m_itemNum = simData.getSkillCount();
                this.m_itemH   = 45;
                int num1 = 0;
                for (int skill = simData.getSkillCount() - 1; skill >= 0; --skill)
                {
                    int skillDesc   = simData.getSkillDesc(skill);
                    int stringWidth = textManager.getStringWidth(skillDesc, 3);
                    if (stringWidth > num1)
                    {
                        num1 = stringWidth;
                    }
                }
                this.m_offsetCol = num1;
                break;

            case 5:
                this.m_itemNum = simData.getInventoryNthCount();
                this.m_itemH   = 40;
                break;

            case 6:
                this.m_itemNum = simData.getRelationshipNthCount();
                this.m_itemH   = 40;
                break;

            case 7:
                this.m_itemSelected = 0;
                this.m_itemNum      = sceneGame.getShoppingItemCount();
                this.m_itemH        = 40;
                break;

            case 8:
                this.m_itemSelected = 0;
                this.m_itemNum      = simWorld.getFurnitureCountOfCategory(sceneGame.getCurFurnitureCategory());
                this.m_itemH        = 40;
                this.m_itemNumY     = 1;
                this.m_itemW        = 180;
                for (int index = 0; index < 5; ++index)
                {
                    int nthItemOfCategory = simWorld.getFurnitureNthItemOfCategory(index, sceneGame.getCurFurnitureCategory());
                    this.m_objectPreviews[index] = new UIObjectPreview();
                    this.m_objectPreviews[index].loadObject(nthItemOfCategory);
                    this.m_objectPreviews[index].getModel().disableFurnitureShadows();
                    this.m_previewToIndexMap[index] = index;
                }
                break;

            case 9:
                this.m_itemSelected = 0;
                this.m_itemH        = textManager.getLineHeight(3);
                this.m_itemNum      = sceneGame.shoppingListSize();
                break;

            case 10:
                this.m_itemNum  = simWorld.getUnlockedFloorNthCount();
                this.m_itemNumX = this.m_itemNum;
                this.m_itemNumY = 1;
                this.m_itemW    = 160;
                this.m_itemH    = this.m_height;
                break;

            case 11:
                this.m_itemNum  = simWorld.getUnlockedWallNthCount();
                this.m_itemNumX = this.m_itemNum;
                this.m_itemNumY = 1;
                this.m_itemW    = 160;
                this.m_itemH    = this.m_height;
                break;

            case 12:
                int buildModeOldSetting   = canvas.getSceneGame().getBuildModeOldSetting();
                int objectFootprintHeight = simWorld.getObjectFootprintHeight(buildModeOldSetting);
                this.m_itemNum  = simWorld.getWindowNthTypeCount(objectFootprintHeight);
                this.m_itemNumX = this.m_itemNum;
                this.m_itemNumY = 1;
                this.m_itemW    = 160;
                this.m_itemH    = this.m_height;
                break;

            case 13:
                this.m_itemNum  = simWorld.getDoorNthTypeCount();
                this.m_itemNumX = this.m_itemNum;
                this.m_itemNumY = 1;
                this.m_itemW    = 160;
                this.m_itemH    = this.m_height;
                break;
            }
            if (this.m_swipeList)
            {
                this.m_width    = this.m_itemW;
                this.m_posX     = this.m_clipPosX + (this.m_clipWidth - this.m_width >> 1);
                this.m_itemNumX = this.m_itemNum / this.m_itemNumY + (this.m_itemNum % this.m_itemNumY > 0 ? 1 : 0);
                int   num2 = this.m_itemSelected >= 0 ? this.m_itemSelected : 0;
                int   num3 = (this.m_itemNumX - 1) * this.m_itemW;
                float min  = (float)JMath.min(0, -num3);
                float max  = 0.0f;
                if (this.m_listId == 0)
                {
                    min += (float)this.m_itemW;
                    max -= (float)this.m_itemW;
                    if (num2 == 0)
                    {
                        num2 = 1;
                    }
                    else if (num2 == this.m_itemNumX - 1)
                    {
                        num2 = this.m_itemNumX - 2;
                    }
                }
                this.setSwipeRange(min, max, (float)this.m_itemW);
                this.resetSwiping(num3 >= this.m_width);
                this.setSwipeOffset((float)(-num2 * this.m_itemW));
            }
            else
            {
                this.m_itemNumY = this.m_itemNum / this.m_itemNumX + (this.m_itemNum % this.m_itemNumX > 0 ? 1 : 0);
                int num2 = this.m_itemNumY * this.m_itemH;
                this.setScrollRange((float)JMath.min(0, -num2 + this.m_height), 0.0f);
                this.resetScrolling(num2 > this.m_height);
                this.setScrollOffset(0.0f);
            }
        }
    }