Example #1
0
    private void renderRelationshipsNPC(Graphics g, int x, int y, int width, int height)
    {
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        SimData            simData            = canvas.getSimData();
        int simCareer1       = simData.getSimCareer(0);
        int num1             = simCareer1 != -1 ? simData.getCareerBoss(simCareer1) : -1;
        int focusItem        = this.m_focusItem;
        int simPortraitAnim  = simData.getSimPortraitAnim(focusItem);
        int simPartner       = simData.getSimPartner(focusItem);
        int strId            = simPartner >= 0 ? simData.getSimName(simPartner) : -1;
        int simCareer2       = simData.getSimCareer(focusItem);
        int careerDescString = simData.getCareerDescString(simCareer2);
        int relState1        = simData.getRelState(focusItem);

        int[] tempInt10 = this.m_tempInt10;
        simData.getRelationshipLevels(focusItem, tempInt10);
        bool flag1     = simCareer1 != -1 && simCareer2 == simCareer1;
        bool flag2     = num1 == focusItem;
        int  num2      = x + (width >> 1);
        int  num3      = y + (height >> 1);
        int  num4      = x + num2 >> 1;
        int  num5      = y + 18;
        int  num6      = 30;
        int  x1        = num4;
        int  width1    = width >> 1;
        int  width2    = width * 3 >> 2;
        int  x2        = x1 + (width2 - width1 >> 1);
        int  num7      = num2 + 42;
        int  num8      = y - 42;
        int  num9      = width >> 1;
        int  num10     = height >> 1;
        int  num11     = num7 + (num9 >> 1);
        int  num12     = num8 + (num10 >> 1);
        int  num13     = num2 + 5;
        int  num14     = y + 5 + 50;
        int  num15     = (width >> 1) - 10;
        int  num16     = (int)(0.75 * (double)height);
        int  x3        = num13 + (num15 >> 1);
        int  num17     = num14 + 8;
        int  num18     = 2 * textManager.getLineHeight(3);
        int  num19     = width >> 1;
        int  x4        = x + 4;
        int  x5        = num2 - 4;
        int  num20     = num3 + 5;
        int  num21     = 2 * textManager.getLineHeight(3) + 4;
        int  num22     = x4 + x5 >> 1;
        int  num23     = num20 + 47;
        int  num24     = (int)((double)num19 / (double)animationManager2D.getAnimWidth(126));
        int  x6        = num22 + 22;
        int  num25     = num22 - 44;
        int  y1        = num23 + (y + height - num23 >> 1);
        int  lineWidth = num19 >> 1;

        animationManager2D.submitAnim(simPortraitAnim, (float)num11, (float)num12);
        animationManager2D.submitAnimGrid(233, 234, 235, 236, 237, 238, 239, 240, 241, (float)num13, (float)num14, (float)num15, (float)num16, 1f);
        animationManager2D.submitAnim(126, (float)num22, (float)num23, 1f, (float)num24, 1f);
        if (flag1)
        {
            animationManager2D.submitAnim(182, (float)num25, (float)y1);
        }
        int y2 = num5;

        UIInfoScreen.drawRelBar(g, animationManager2D, x2, y2, width2, relState1, 65536, true);
        int y3 = y2 + num6;

        for (int index = 0; index < 4; index += 2)
        {
            int relState2 = tempInt10[index];
            if (relState2 != -1)
            {
                int levelF = tempInt10[index + 1];
                UIInfoScreen.drawRelBar(g, animationManager2D, x1, y3, width1, relState2, levelF, false);
                y3 += 24;
            }
            else
            {
                break;
            }
        }
        animationManager2D.flushAnims(g);
        int y4 = num5;

        UIInfoScreen.drawRelBar(g, (AnimationManager2D)null, x2, y4, width1, relState1, 65536, true);
        int y5 = y4 + num6;

        for (int index = 0; index < 4; index += 2)
        {
            int relState2 = tempInt10[index];
            if (relState2 != -1)
            {
                int levelF = tempInt10[index + 1];
                UIInfoScreen.drawRelBar(g, (AnimationManager2D)null, x1, y5, width1, relState2, levelF, false);
                y5 += 24;
            }
            else
            {
                break;
            }
        }
        g.Begin();
        int simTraitCount = simData.getSimTraitCount(focusItem);
        int y6            = num17;

        textManager.drawString(g, 967, 3, x3, y6, 17);
        int y7 = y6 + num18;

        for (int index = 0; index < simTraitCount; ++index)
        {
            int simTrait = simData.getSimTrait(focusItem, index);
            int stringId = (int)simData.getTraitDescString(simTrait);
            if (!simData.isTraitDiscovered(focusItem, simTrait))
            {
                stringId = 968;
            }
            textManager.drawWrappedStringChunk(g, 0, stringId, 3, num15 - 10, x3, y7, 18);
            y7 += num18;
        }
        int y8 = num20;

        textManager.drawString(g, 975, 3, x4, y8, 10);
        textManager.drawWrappedStringChunk(g, 1, careerDescString, 3, num19 >> 1, x5, y8, 34);
        int y9 = y8 + num21;

        if (simPartner != -1)
        {
            textManager.drawString(g, 971, 3, x4, y9, 9);
            textManager.drawString(g, strId, 3, x5, y9, 33);
        }
        int num26 = y9 + num21;

        if (flag1)
        {
            int stringId = 973;
            if (flag2)
            {
                stringId = 972;
            }
            textManager.drawWrappedStringChunk(g, 2, stringId, 3, lineWidth, x6, y1, 18);
        }
        g.End();
    }
Example #2
0
    private void renderCareer(Graphics g, int x, int y, int width, int height)
    {
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        SimData            simData            = canvas.getSimData();
        SimWorld           simWorld           = canvas.getSimWorld();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        int simCareer = simData.getSimCareer(0);

        if (simCareer == -1)
        {
            int   x1     = x + (width >> 1);
            int   num    = y + 68;
            float scaleX = 200f / animationManager2D.getAnimWidth(126);
            int   y1     = y + 34;
            int   y2     = y + 68 + (height - 68 >> 1);
            animationManager2D.submitAnim(126, (float)x1, (float)num, 1f, scaleX, 1f);
            animationManager2D.flushAnims(g);
            g.Begin();
            textManager.drawString(g, 997, 3, x1, y1, 18);
            textManager.drawWrappedStringChunk(g, 0, 998, 3, 200, x1, y2, 18);
            g.End();
        }
        else
        {
            int   simCareerLevel        = simData.getSimCareerLevel(0);
            int   careerLevelFlags      = simData.getCareerLevelFlags(simCareer, simCareerLevel);
            int   careerLevelIncome     = simData.getCareerLevelIncome(simCareer, simCareerLevel);
            int   careerIcon            = simData.getCareerIcon(simCareer);
            int   careerDescString      = simData.getCareerDescString(simCareer);
            int   careerLevelDescString = simData.getCareerLevelDescString(simCareer, simCareerLevel);
            int   careerRabbitHole      = simData.getCareerRabbitHole(simCareer);
            int   objectStringId        = simWorld.getObjectStringId(careerRabbitHole);
            int   careerBoss            = simData.getCareerBoss(simCareer);
            int   simName   = simData.getSimName(careerBoss);
            int   num1      = x + (width >> 1);
            int   num2      = x + 251;
            int   num3      = y + 27;
            int   x1        = x + num2 >> 1;
            int   y1        = y + 27;
            int   num4      = x + (width >> 1);
            int   num5      = y + 55;
            float animWidth = animationManager2D.getAnimWidth(188);
            int   num6      = num4;
            int   num7      = (int)((double)(y + height - 25) + (double)animationManager2D.getAnimHeight((int)sbyte.MaxValue));
            float scaleX    = animWidth / animationManager2D.getAnimWidth((int)sbyte.MaxValue);
            int   num8      = (width >> 1) - 10;
            int   num9      = height - 55 - 25;
            int   num10     = y + 55;
            int   num11     = x;
            int   num12     = num1 + 5;
            int   x2        = num11 + (num8 >> 1);
            int   x3        = num12;
            int   x4        = num12 + num8;
            animationManager2D.submitAnimGrid(233, 234, 235, 236, 237, 238, 239, 240, 241, (float)num11, (float)num10, (float)num8, (float)num9);
            animationManager2D.submitAnim(188, (float)num4, (float)num5);
            animationManager2D.submitAnim(careerIcon, (float)num2, (float)num3);
            animationManager2D.submitAnim((int)sbyte.MaxValue, (float)num6, (float)num7, 1f, scaleX, -1f);
            animationManager2D.flushAnims(g);
            g.Begin();
            textManager.drawString(g, careerLevelDescString, 3, x1, y1, 18);
            int font       = 3;
            int lineHeight = textManager.getLineHeight(font);
            int num13      = 4 * lineHeight + 4;
            int y2         = num10 + (num9 - num13 >> 1);
            textManager.drawString(g, 981, font, x2, y2, 18);
            int          y3         = y2 + lineHeight;
            StringBuffer strBuffer1 = textManager.clearStringBuffer();
            int          num14      = 0;
            for (int index = 0; index < SimData.DAY_FLAGS.Length; ++index)
            {
                if ((careerLevelFlags & SimData.DAY_FLAGS[index]) != 0)
                {
                    if (num14 > 0)
                    {
                        textManager.appendStringIdToBuffer(11);
                    }
                    textManager.appendStringIdToBuffer(SimData.DAY_STRINGS[index]);
                    ++num14;
                }
            }
            textManager.drawString(g, strBuffer1, font, x2, y3, 18);
            int y4 = y3 + (lineHeight + 4);
            textManager.drawString(g, 990, font, x2, y4, 18);
            int          y5                    = y4 + lineHeight;
            StringBuffer strBuffer2            = textManager.clearStringBuffer();
            int          careerLevelHoursStart = simData.getCareerLevelHoursStart(simCareer, simCareerLevel);
            textManager.appendTimeToBuffer24Hour(careerLevelHoursStart);
            textManager.appendStringIdToBuffer(991);
            int careerLevelHoursEnd = simData.getCareerLevelHoursEnd(simCareer, simCareerLevel);
            textManager.appendTimeToBuffer24Hour(careerLevelHoursEnd);
            textManager.drawString(g, strBuffer2, font, x2, y5, 18);
            int num15 = 4 * lineHeight + 12;
            int y6    = num10 + (num9 - num15 >> 1);
            textManager.drawString(g, 975, font, x3, y6, 10);
            textManager.drawString(g, careerDescString, font, x4, y6, 34);
            int y7 = y6 + (lineHeight + 4);
            textManager.drawString(g, 977, font, x3, y7, 10);
            StringBuffer strBuffer3 = textManager.clearStringBuffer();
            textManager.appendMoneyToBuffer(careerLevelIncome);
            textManager.drawString(g, strBuffer3, font, x4, y7, 34);
            int y8 = y7 + (lineHeight + 4);
            textManager.drawString(g, 979, font, x3, y8, 10);
            textManager.drawString(g, objectStringId, font, x4, y8, 34);
            int y9 = y8 + (lineHeight + 4);
            textManager.drawString(g, 980, font, x3, y9, 10);
            textManager.drawString(g, simName, font, x4, y9, 34);
            int num16 = y9 + lineHeight;
            g.End();
        }
    }