public void submitAnim(
        int animId,
        float x,
        float y,
        float alpha,
        float scaleX,
        float scaleY,
        float angle)
    {
        int instanceIndex = (int)this.m_instanceIndexes[animId];
        int length        = this.m_instances[animId].Length;

        if (instanceIndex >= length)
        {
            this.increaseAnimInstanceCount(animId, instanceIndex + 1);
        }
        this.m_instanceIndexes[animId] = (short)(instanceIndex + 1);
        float num1 = (float)this.m_viewportW * 0.5f;
        float num2 = (float)this.m_viewportH * 0.5f;
        Node  node = this.m_instances[animId][instanceIndex];

        node.setTranslation(-num1 + x, num2 - y, this.m_worldDepth);
        node.setOrientation(angle, 0.0f, 0.0f, 1f);
        node.setScale(scaleX, scaleY, 1f);
        AnimationManager2D.applyAlphaAndLayer(node, this.m_globalAlpha * alpha, this.m_worldLayer);
        this.m_group.addChild(node);
        this.m_worldDepth += 0.1f;
        ++this.m_worldLayer;
    }
    public static void duplicateAppearances(Node node)
    {
        if (node == null)
        {
            return;
        }
        Group group = Group.m3g_cast((Object3D)node);

        if (group != null)
        {
            int childCount = group.getChildCount();
            for (int index = 0; index < childCount; ++index)
            {
                AnimationManager2D.duplicateAppearances(group.getChild(index));
            }
        }
        Mesh mesh = Mesh.m3g_cast((Object3D)node);

        if (mesh == null)
        {
            return;
        }
        int submeshCount = mesh.getSubmeshCount();

        for (int index = 0; index < submeshCount; ++index)
        {
            Appearance appearance = mesh.getAppearance(index);
            mesh.setAppearance(index, (Appearance)appearance.duplicate());
        }
    }
    public static void applyAlphaAndLayer(Node node, float alpha, int layer)
    {
        if (node == null)
        {
            return;
        }
        Group group = Group.m3g_cast((Object3D)node);

        if (group != null)
        {
            int childCount = group.getChildCount();
            for (int index = 0; index < childCount; ++index)
            {
                AnimationManager2D.applyAlphaAndLayer(group.getChild(index), alpha, layer);
            }
        }
        Mesh mesh = Mesh.m3g_cast((Object3D)node);

        if (mesh == null)
        {
            return;
        }
        mesh.setAlphaFactor(alpha);
        mesh.getAppearance(0).setLayer(layer);
    }
Пример #4
0
    public static void renderOptionsBG(
        Graphics g,
        int x,
        int y,
        int width,
        int height,
        int buttonId)
    {
        AppEngine          canvas             = AppEngine.getCanvas();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();

        animationManager2D.submitAnimGrid(71, 72, 73, 74, 75, 76, 77, 78, 79, (float)x, (float)y, (float)width, (float)height);
        if (buttonId != -1)
        {
            float x1 = (float)x + 23f;
            float y1 = (float)y + 33f;
            animationManager2D.submitAnim(80, x1, y1);
            float num1 = x1 - 5f;
            float num2 = y1 - 5f;
            canvas.getScene().getUIButton(buttonId).submit(ref animationManager2D, (int)num1, (int)num2);
        }
        float x2 = (float)x + 55f;
        float y2 = (float)y + 22f;
        float w  = (float)width - 90f;
        float h  = (float)height - 50f;

        animationManager2D.submitAnimGrid(102, 103, 104, 105, 106, 107, 108, 109, 110, x2, y2, w, h);
        animationManager2D.flushAnims(g);
    }
Пример #5
0
    public void setMessageCustom(
        int messageStringId,
        int titleStringId,
        int commandTop,
        int commandLeft,
        int commandRight,
        int type)
    {
        AnimationManager2D animationManager2D = AppEngine.getCanvas().getAnimationManager2D();

        this.m_type           = type;
        this.m_titleStringId  = titleStringId;
        this.m_messagePanelId = -1;
        this.m_commandTop     = commandTop;
        this.m_commandLeft    = commandLeft;
        this.m_commandRight   = commandRight;
        if (type == 3)
        {
            this.m_popupWidth   = 500;
            this.m_contentWidth = 410;
        }
        else
        {
            this.m_popupWidth   = (int)animationManager2D.getAnimWidth(96);
            this.m_contentWidth = 200;
        }
        this.setWrappedString(messageStringId, false);
        this.stateTransition(0);
    }
    // Use this for initialization
    void Start()
    {
        animationManager = this.GetComponentInChildren <AnimationManager2D>();
        animationManager.Initialize();

        originalPosition = this.transform.position;

        MoveTo();
    }
Пример #7
0
    public virtual void Awake()
    {
        jumpComponent = GetComponent <JumpComponent>();
        jumpComponent.AddEventListener(this.gameObject);

        bodyControl = GetComponent <BodyControl>();
        bodyControl.AddEventListener(this.gameObject);

        animationManager = this.transform.Find("BodyContainer/Animations").GetComponent <AnimationManager2D>();
    }
Пример #8
0
    public void submitScrollbar(
        ref AnimationManager2D am2d,
        int scrollValue,
        int scrollVisible,
        int scrollTotal,
        float barX,
        float barY,
        float barHeight)
    {
        float h = barHeight * (float)JMath.min(scrollVisible, scrollTotal) / (float)scrollTotal;
        float y = (float)((double)barY + ((double)barHeight - (double)h) * (double)scrollValue / (double)(scrollTotal - scrollVisible) + (double)h * 0.5 - (double)barHeight * 0.5);

        am2d.submitAnimVBar(128, 129, 130, barX, barY, barHeight);
        am2d.submitAnimVBar(131, 132, 133, barX, y, h);
    }
Пример #9
0
    public void setMessage(int messageStringId, int titleStringId, int commandTop)
    {
        AnimationManager2D animationManager2D = AppEngine.getCanvas().getAnimationManager2D();

        this.m_type           = 1;
        this.m_titleStringId  = titleStringId;
        this.m_messagePanelId = -1;
        this.m_commandTop     = commandTop;
        this.m_commandLeft    = -1;
        this.m_commandRight   = -1;
        this.m_popupWidth     = (int)animationManager2D.getAnimWidth(96);
        this.m_contentWidth   = 200;
        this.setWrappedString(messageStringId, false);
        this.stateTransition(0);
    }
Пример #10
0
    private void increaseAnimInstanceCount(int animId, int numInstances)
    {
        if (this.m_instances[animId].Length == numInstances)
        {
            return;
        }
        Node[] nodeArray = new Node[numInstances];
        for (int index = 0; index < this.m_instances[animId].Length; ++index)
        {
            nodeArray[index] = this.m_instances[animId][index];
        }
        Node node = this.m_instances[animId][0];

        for (int length = this.m_instances[animId].Length; length < numInstances; ++length)
        {
            nodeArray[length] = (Node)node.duplicate();
            AnimationManager2D.duplicateAppearances(nodeArray[length]);
        }
        this.m_instances[animId] = nodeArray;
    }
Пример #11
0
    // Use this for initialization
    public virtual void Start()
    {
        alienTargetManager = SceneUtils.FindObject <AlienTargetManager>();
        alienInputActions  = AlienInputActions.CreateWithDefaultBindings();
        leftStickControl   = SceneUtils.FindObject <LeftStickControl>();
        animationManager   = GetComponentInChildren <AnimationManager2D>();

        if (this.transform.Find("Sounds"))
        {
            if (this.transform.Find("Sounds/ExplosionSound"))
            {
                explosionSound = this.transform.Find("Sounds/ExplosionSound").GetComponent <SoundObject>();
            }

            if (this.transform.Find("Sounds/FlingSound"))
            {
                flingSound = this.transform.Find("Sounds/FlingSound").GetComponent <SoundObject>();
            }
        }
        if (this.transform.Find("ShootPosition"))
        {
            shootPosition = this.transform.Find("ShootPosition");
        }
        else
        {
            shootPosition = this.transform;
        }

        if (isControlled)
        {
            OnControlled();
        }

        if (this.transform.Find("BloodAnimations"))
        {
            bloodAnimations =
                this.transform.Find("BloodAnimations")
                .GetComponentsInChildren <Animation2D>();
        }
    }
Пример #12
0
    public void submit(ref AnimationManager2D am2d, int x, int y, bool enabled)
    {
        if (enabled)
        {
            this.setup();
        }
        this.m_posX = x;
        this.m_posY = y;
        bool flag = this.m_state == 1 || this.m_state == 3 && (double)this.m_animTimer.getValue() > 0.5;

        if (this.m_animBackground != -1)
        {
            am2d.submitAnim(this.m_animBackground, (float)x, (float)y);
        }
        if (enabled)
        {
            if (this.m_animForeground != -1 && ((this.m_flags & 1) == 0 || !flag))
            {
                am2d.submitAnim(this.m_animForeground, (float)x, (float)y, 1f, this.m_foregroundScaleX, this.m_foregroundScaleY);
            }
        }
        else if (this.m_animForegroundDisabled != -1)
        {
            am2d.submitAnim(this.m_animForegroundDisabled, (float)x, (float)y, 1f, this.m_foregroundScaleX, this.m_foregroundScaleY);
        }
        if (!flag)
        {
            return;
        }
        int animId = this.m_animHighlight;

        if (animId == -1)
        {
            animId = 120;
        }
        am2d.submitAnim(animId, (float)x + this.m_highlightOffsetX, (float)y + this.m_highlightOffsetY, this.m_highlightAlpha, this.m_highlightScale, this.m_highlightScale);
    }
Пример #13
0
    public static void renderOptionsFG(
        Graphics g,
        int x,
        int y,
        int width,
        int height,
        int titleStringId)
    {
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        float num1        = (float)x + 55f;
        float num2        = (float)y + 22f;
        float num3        = (float)width - 90f;
        float num4        = (float)height - 50f;
        float x1          = num1;
        float y1          = num2;
        float w1          = num3;
        float animHeight1 = animationManager2D.getAnimHeight(113);

        animationManager2D.submitAnimStretched(113, x1, y1, w1, animHeight1);
        float w2          = num3 - 20f;
        float animHeight2 = animationManager2D.getAnimHeight(112);
        float x2          = num1 + (float)(((double)num3 - (double)w2) * 0.5);
        float y2          = num2 + num4 - animHeight2;

        animationManager2D.submitAnimStretched(112, x2, y2, w2, animHeight2);
        animationManager2D.flushAnims(g);
        g.Begin();
        int num5 = 8;
        int x3   = (int)((double)x1 + (double)w1 * 0.5);
        int y3   = (int)((double)y1 + (double)animHeight1 * 0.5 - (double)(num5 >> 1));

        textManager.drawString(g, titleStringId, 6, x3, y3, 18);
        g.End();
    }
Пример #14
0
    public void render(Graphics g)
    {
        this.setup();
        AppEngine          canvas             = AppEngine.getCanvas();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        float halfWidth  = (float)canvas.getHalfWidth();
        float halfHeight = (float)canvas.getHalfHeight();

        animationManager2D.submitAnim(175, halfWidth, halfHeight);
        if (this.m_dotIndex >= 0 && this.m_dotIndex < 7)
        {
            float num = 32f;
            float x   = (float)((double)halfWidth - 108.0 + (double)num * (double)this.m_dotIndex);
            float y   = halfHeight + 128f;
            animationManager2D.submitAnim(177, x, y);
        }
        int x1 = (int)((double)halfWidth - 202.0);
        int y1 = (int)((double)halfHeight - 95.0);

        this.getScene().getUIButton(128).submit(ref animationManager2D, x1, y1);
        bool enabled1 = canvas.getSimData().isTimeForWork((MapObject)null, 0);
        int  x2       = (int)((double)halfWidth + 197.0);
        int  y2       = (int)((double)halfHeight - 48.0);

        this.getScene().getUIButton(256).submit(ref animationManager2D, x2, y2, enabled1);
        bool enabled2 = !canvas.getSceneGame().isMapMode();
        int  x3       = (int)((double)halfWidth + 192.0);
        int  y3       = (int)((double)halfHeight + 32.0);

        this.getScene().getUIButton(512).submit(ref animationManager2D, x3, y3, enabled2);
        SceneGame sceneGame = canvas.getSceneGame();
        bool      enabled3  = sceneGame.isMapMode() || sceneGame.isZoomMapMode();
        int       x4        = (int)((double)halfWidth + 186.0);
        int       y4        = (int)((double)halfHeight + 78.0);

        this.getScene().getUIButton(1024).submit(ref animationManager2D, x4, y4, enabled3);
        if (this.m_subType == -1)
        {
            if (this.itemsLeft())
            {
                float x5 = halfWidth - 185f;
                float y5 = halfHeight;
                animationManager2D.submitAnim(178, x5, y5);
            }
            if (this.itemsRight())
            {
                float x5 = halfWidth + 163f;
                float y5 = halfHeight;
                animationManager2D.submitAnim(179, x5, y5);
            }
        }
        if (this.m_subType != -1)
        {
            float x5 = halfWidth - 188f;
            float y5 = halfHeight + 17f;
            animationManager2D.submitAnim(176, x5, y5);
            float num1 = x5;
            float num2 = y5 - 16f;
            this.getScene().getUIButton(1048576).submit(ref animationManager2D, (int)num1, (int)num2);
        }
        animationManager2D.flushAnims(g);
        g.Begin();
        int x6 = (int)((double)halfWidth - 15.0);
        int y6 = (int)((double)halfHeight - 118.0);

        canvas.getTextManager().drawString(g, this.m_titleId, 6, x6, y6, 18);
        g.End();
        int num3 = (int)((double)halfWidth - 165.0 - 11.0);
        int y7   = (int)((double)halfHeight - 95.0 + 14.0);

        if (this.m_subType != -1)
        {
            int x5 = num3 + 15;
            this.renderContents(g, this.m_subType, x5, y7, 315, 190);
        }
        else
        {
            this.setDragArea(num3, y7, 330, 190);
            int clipX      = g.getClipX();
            int clipY      = g.getClipY();
            int clipWidth  = g.getClipWidth();
            int clipHeight = g.getClipHeight();
            g.setClip(320 - y7 - 190, num3, 190, 330);
            int swipeOffset = (int)this.getSwipeOffset();
            int num1        = swipeOffset + this.m_type * 330;
            int x5          = num3 + num1;
            this.renderContents(g, this.m_type, x5, y7, 330, 190);
            float swipeNotchOffset = this.getSwipeNotchOffset(this.getSwipeOffset());
            if ((double)swipeOffset != (double)swipeNotchOffset)
            {
                int type = this.m_screenLeft;
                int num2 = -330;
                if ((double)swipeOffset < (double)swipeNotchOffset)
                {
                    type = this.m_screenRight;
                    num2 = 330;
                }
                if (type != -1)
                {
                    int x7 = num3 + num2 + num1;
                    this.renderContents(g, type, x7, y7, 330, 190);
                }
            }
            g.setClip(clipX, clipY, clipWidth, clipHeight);
        }
    }
Пример #15
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();
    }
Пример #16
0
 void Start()
 {
     animationManager = gameObject.GetComponent <AnimationManager2D>();
 }
Пример #17
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();
        }
    }
Пример #18
0
    private void renderStatus(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 motiveCount = simData.getMotiveCount();

        if (this.m_longestStringMotive == 0)
        {
            int num = 0;
            for (int motive = 0; motive < motiveCount; ++motive)
            {
                int motiveDescString = (int)simData.getMotiveDescString(motive);
                int stringWidth      = textManager.getStringWidth(motiveDescString, 3);
                if (stringWidth > num)
                {
                    num = stringWidth;
                }
            }
            this.m_longestStringMotive = num;
        }
        int   num1  = y + height - 32;
        int   num2  = x + 10;
        int   num3  = width - 20;
        int   x1    = num2 + (num3 >> 1);
        int   y1    = num1 + 16;
        int   num4  = (height - 32 - 5 - 5) / motiveCount;
        float num5  = (float)(y + 5);
        float num6  = (float)num4;
        int   x2    = x + 10 + this.m_longestStringMotive;
        int   num7  = num4 >> 1;
        int   num8  = x2 + 12;
        int   num9  = x + width - 40 - num8;
        int   num10 = num8 + (num9 >> 1);
        int   num11 = num7;
        int   num12 = num8 + num9 + 20;
        int   num13 = num7;
        float num14 = num5;

        for (int motive = 0; motive < motiveCount; ++motive)
        {
            int   motiveLevel = simData.getMotiveLevel(motive);
            float num15       = (float)MathExt.Fdiv(motiveLevel, 6553600) * 1.525879E-05f;
            float y2          = num14 + (float)num11;
            animationManager2D.submitAnimHBar(46, 47, 48, (float)num10, y2, (float)num9);
            int num16   = 49;
            int animMid = 50;
            int num17   = 51;
            int animId  = (int)simData.getMotiveHighAnim(motive);
            if (motiveLevel < 2293760)
            {
                num16   = 52;
                animMid = 53;
                num17   = 54;
                animId  = (int)simData.getMotiveLowAnim(motive);
            }
            else if (motiveLevel < 4259840)
            {
                animId = (int)simData.getMotiveMidAnim(motive);
            }
            int   num18 = (int)((double)animationManager2D.getAnimWidth(num16) + (double)animationManager2D.getAnimWidth(num17) - 8.0);
            float w     = (float)num18 + num15 * (float)(num9 - num18);
            float x3    = (float)num8 + w * 0.5f;
            animationManager2D.submitAnimHBar(num16, animMid, num17, x3, y2, w);
            float y3 = num14 + (float)num13;
            animationManager2D.submitAnim(animId, (float)num12, y3);
            num14 += num6;
        }
        animationManager2D.submitAnimGrid(233, 234, 235, 236, 237, 238, 239, 240, 241, (float)num2, (float)num1, (float)num3, 32f);
        animationManager2D.flushAnims(g);
        g.Begin();
        int num19 = (int)num5;

        for (int motive = 0; motive < motiveCount; ++motive)
        {
            int motiveDescString = (int)simData.getMotiveDescString(motive);
            int y2 = num19 + num7;
            textManager.drawString(g, motiveDescString, 3, x2, y2, 34);
            num19 += (int)num6;
        }
        StringBuffer strBuffer = textManager.clearStringBuffer();

        textManager.appendStringIdToBuffer(767);
        textManager.appendStringIdToBuffer(simData.getMoodDescStringId());
        textManager.drawString(g, strBuffer, 3, x1, y1, 18);
        g.End();
    }
Пример #19
0
    private void renderDreams(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   dream     = simData.getDream();
        int   num1      = x + (width >> 1);
        int   x1        = num1;
        int   y1        = y + 4;
        int   num2      = x + 50;
        int   x2        = num2 + 28;
        int   lineWidth = x + width - x2 - 50;
        int   num3      = y1 + 13;
        float x3        = (float)num1;
        float scaleX1   = (float)lineWidth / animationManager2D.getAnimWidth((int)sbyte.MaxValue);
        float scaleX2   = (float)lineWidth / animationManager2D.getAnimWidth(126);
        int   num4      = num3;
        int   num5      = num1;
        int   num6      = y + height + (num4 + 112) >> 1;
        int   num7      = width - 20;
        int   y2        = num6 - 16;
        int   num8      = y2 + 8;
        int   num9      = num5 + 25;
        int   y3        = num8 + 3;
        int   x4        = num5 - 125;
        int   y4        = num6;

        animationManager2D.submitAnim((int)sbyte.MaxValue, x3, (float)num3, 1f, scaleX1, 1f);
        int num10 = num4;

        for (int index = 0; index < 4; ++index)
        {
            animationManager2D.submitAnim(135, (float)num2, (float)(num10 + 14), 1f, 1.8f, 1.8f);
            if (simData.getPromise(index) != -1)
            {
                animationManager2D.submitAnim(40, (float)num2, (float)(num10 + 14));
            }
            num10 += 28;
            animationManager2D.submitAnim(126, x3, (float)num10, 1f, scaleX2, 1f);
        }
        animationManager2D.submitAnimHBar(189, 190, 191, (float)num5, (float)num6, (float)num7);
        animationManager2D.submitAnim(126, (float)num9, (float)num8, 1f, scaleX2, 1f);
        if (dream != -1)
        {
            this.getScene().getUIButton(16384).submit(ref animationManager2D, x4, y4);
        }
        animationManager2D.flushAnims(g);
        g.Begin();
        textManager.drawString(g, 799, 3, x1, y1, 18);
        int chunk = 0;
        int num11 = num4;

        for (int index = 0; index < 4; ++index)
        {
            int promise  = simData.getPromise(index);
            int stringId = 805;
            if (promise != -1)
            {
                stringId = simData.getDreamDescString(promise);
            }
            textManager.drawWrappedStringChunk(g, chunk, stringId, 3, lineWidth, x2, num11 + 14, 10);
            ++chunk;
            num11 += 28;
        }
        textManager.drawString(g, 800, 3, x2, y2, 10);
        int stringId1 = 806;

        if (dream != -1)
        {
            stringId1 = simData.getDreamDescString(dream);
        }
        textManager.drawWrappedStringChunk(g, chunk, stringId1, 3, lineWidth, x2, y3, 9);
        g.End();
    }
Пример #20
0
    private void renderItem(
        Graphics g,
        AnimationManager2D am2d,
        int index,
        int x,
        int y,
        int width,
        int height)
    {
        AppEngine   canvas      = AppEngine.getCanvas();
        TextManager textManager = canvas.getTextManager();
        SimData     simData     = canvas.getSimData();
        SimWorld    simWorld    = canvas.getSimWorld();
        DLCManager  instance    = DLCManager.getInstance();
        SceneGame   sceneGame   = canvas.getSceneGame();

        switch (this.m_listId)
        {
        case 0:
            bool rmsActiveGame = canvas.getRMSActiveGame(index);
            bool flag1         = canvas.getSceneMenu().isDeletingSaveGame();
            int  lineHeight    = textManager.getLineHeight(4);
            int  y1            = y + height - 10 - lineHeight;
            int  x1            = x + (width >> 1);
            int  num1          = x + (width >> 1);
            int  num2          = y + (y1 - y >> 1);
            if (g != null)
            {
                if (rmsActiveGame)
                {
                    SceneMenu sceneMenu  = canvas.getSceneMenu();
                    int       clipX      = g.getClipX();
                    int       clipY      = g.getClipY();
                    int       clipWidth  = g.getClipWidth();
                    int       clipHeight = g.getClipHeight();
                    sceneMenu.getHudPlumbBob().render(g, num1 - 75, num2 - 75, 150, 150);
                    g.setClip(clipX, clipY, clipWidth, clipHeight);
                }
                if (!rmsActiveGame && flag1)
                {
                    break;
                }
                string simName = canvas.getSimName(index);
                if (simName != null && simName != "" && simName != " ")
                {
                    g.Begin();
                    textManager.drawString(g, simName, 4, x1, y1, 17);
                    g.End();
                    break;
                }
                g.Begin();
                textManager.drawString(g, 40, 4, x1, y1, 17);
                g.End();
                break;
            }
            int   num3   = width;
            int   num4   = height;
            int   num5   = x + (width - num3 >> 1);
            int   num6   = y + (height - num4 >> 1) + 1;
            float alpha1 = rmsActiveGame || !flag1 ? 1f : 0.2f;
            am2d.submitAnimGrid(340, 341, 342, 343, 344, 345, 346, 347, 348, (float)num5, (float)num6, (float)num3, (float)num4, alpha1);
            am2d.submitAnim(rmsActiveGame ? 403 : 402, (float)num1, (float)num2, alpha1);
            if (this.m_state != 1 || index != this.m_itemSelected || flag1 && !rmsActiveGame)
            {
                break;
            }
            float alpha2 = this.m_animTimer.getValue();
            am2d.submitAnimGrid(250, 253, 256, 251, 254, 257, 252, (int)byte.MaxValue, 258, (float)num5, (float)num6, (float)num3, (float)num4, alpha2);
            break;

        case 1:
            if (g != null)
            {
                g.Begin();
                int x2 = x + (width >> 1);
                int y2 = y + 96;
                int personaDescString = (int)simData.getPersonaDescString(index);
                textManager.drawString(g, personaDescString, 4, x2, y2, 18);
                int personaLongDescString = (int)simData.getPersonaLongDescString(index);
                int x3 = x2;
                int y3 = y + 143;
                textManager.drawWrappedStringChunk(g, 0, personaLongDescString, 4, width - 12, x3, y3, 18);
                g.End();
                break;
            }
            int num7  = width;
            int num8  = (int)(0.65 * (double)height);
            int num9  = x + (width - num7 >> 1);
            int num10 = y;
            int num11 = num9 + (width >> 1);
            am2d.submitAnimGrid(340, 341, 342, 343, 344, 345, 346, 347, 348, (float)num9, (float)num10, (float)num7, (float)num8);
            am2d.submitAnim(181, (float)num11, (float)(num10 + 50));
            int   num12  = num9 + (num7 >> 1);
            int   num13  = num10 + 115;
            float scaleX = (float)width / am2d.getAnimWidth((int)sbyte.MaxValue);
            am2d.submitAnim((int)sbyte.MaxValue, (float)num12, (float)num13, 1f, scaleX, 1f);
            break;

        case 2:
            if (g != null)
            {
                int x2              = x + 35;
                int num14           = height >> 1;
                int y2              = y + num14;
                int traitDescString = (int)simData.getTraitDescString(index);
                g.Begin();
                textManager.drawWrappedStringChunk(g, 0, traitDescString, 4, width - 35, x2, y2, 2);
                g.End();
                break;
            }
            int  num15 = height >> 1;
            int  num16 = (height >> 1) - 5;
            bool flag2 = simData.hasSimGotTrait(0, index) != -1;
            if (this.m_state == 1 && this.m_itemSelected == index)
            {
                float num14 = this.m_animTimer.getValue();
                if (this.m_selectionResult == 0)
                {
                    am2d.submitAnim(171, (float)(x + num16), (float)(y + num15), 1f, num14, num14);
                }
                else if (this.m_selectionResult != 1)
                {
                    int selectionResult = this.m_selectionResult;
                }
            }
            if (!flag2)
            {
                break;
            }
            am2d.submitAnim(114, (float)(x + num16), (float)(y + num15));
            break;

        case 3:
            int x4         = x + 55;
            int lineWidth1 = this.m_width - 110;
            int num17      = (height >> 1) + 1;
            int y4         = y + num17;
            int dream      = this.remapGlobalGoalIndex(index);
            int num18      = -1;
            int stringId1;
            if (canvas.isDreamDiscovered(dream))
            {
                stringId1 = simData.getDreamDescString(dream);
                if (canvas.isGoalCompleted(dream))
                {
                    num18 = 134;
                }
            }
            else
            {
                stringId1 = 807;
            }
            if (g != null)
            {
                g.Begin();
                textManager.drawWrappedStringChunk(g, this.m_stringChunk, stringId1, 3, lineWidth1, x4, y4, 10);
                g.End();
            }
            else
            {
                float x2 = (float)x + 30f;
                float y2 = (float)y + (float)height * 0.5f;
                am2d.submitAnim(135, x2, y2);
                if (num18 != -1)
                {
                    am2d.submitAnim(134, x2, y2);
                }
            }
            ++this.m_stringChunk;
            break;

        case 4:
            int x5    = x + 32;
            int num19 = (height >> 1) + 1;
            int y5    = y + num19;
            int x6    = x + width - 12;
            int y6    = y5;
            int num20 = x5 + this.m_offsetCol + 12;
            int num21 = x6 - 12 - num20;
            int x7    = num20 + (num21 >> 1);
            int num22 = y5 - 9;
            int y7    = y5 + 9;
            if (g != null)
            {
                int skillDesc = simData.getSkillDesc(index);
                g.Begin();
                textManager.drawString(g, skillDesc, 3, x5, y5, 10);
                StringBuffer strBuffer = textManager.clearStringBuffer();
                textManager.appendIntToBuffer(simData.getSkillLevel(index) >> 16);
                textManager.drawString(g, strBuffer, 3, x6, y6, 10);
                textManager.drawString(g, simData.getSkillLevelDesc(index), 3, x7, y7, 18);
                g.End();
                break;
            }
            int   num23 = (int)((double)am2d.getAnimWidth(199) + (double)am2d.getAnimWidth(201));
            float num24 = (float)MathExt.Fdiv(simData.getSkillLevel(index), 327680) * 1.525879E-05f;
            am2d.submitAnimHBar(202, 203, 204, (float)x7, (float)num22, (float)num21);
            float w1 = (float)num23 + num24 * (float)(num21 - num23);
            float x8 = (float)num20 + w1 * 0.5f;
            am2d.submitAnimHBar(199, 200, 201, x8, (float)num22, w1);
            am2d.submitAnimHBar(205, 206, 207, (float)x7, (float)y7, (float)num21);
            break;

        case 5:
        case 7:
            bool flag3 = this.m_listId == 7;
            int  num25 = this.m_listId == 5 ? simData.getInventoryNthItem(index) : sceneGame.getShoppingItemId(index);
            int  num26 = height >> 1;
            if (g != null)
            {
                int num14          = x + 42;
                int y2             = y + num26;
                int num27          = width - 15;
                int x2             = x + num27;
                int y3             = y2;
                int itemDescString = simWorld.getItemDescString(num25);
                int lineWidth2     = flag3 ? width >> 1 : 120;
                g.Begin();
                textManager.drawWrappedStringChunk(g, 0, itemDescString, 3, lineWidth2, num14 + 4, y2, 10);
                if (this.m_listId == 5)
                {
                    if ((simWorld.getItemFlags(num25) & 4) == 0)
                    {
                        int          inventoryCount   = simData.getInventoryCount(num25);
                        int          itemMaxInventory = simWorld.getItemMaxInventory(num25);
                        StringBuffer strBuffer        = textManager.clearStringBuffer();
                        textManager.appendIntToBuffer(inventoryCount);
                        textManager.appendStringIdToBuffer(11);
                        textManager.appendIntToBuffer(itemMaxInventory);
                        textManager.drawString(g, strBuffer, 3, x2, y3, 34);
                    }
                }
                else
                {
                    int          shoppingQty      = sceneGame.getShoppingQty(index);
                    int          itemMaxInventory = simWorld.getItemMaxInventory(num25);
                    StringBuffer strBuffer        = textManager.clearStringBuffer();
                    textManager.appendIntToBuffer(shoppingQty);
                    textManager.appendStringIdToBuffer(11);
                    textManager.appendIntToBuffer(itemMaxInventory);
                    textManager.drawString(g, strBuffer, 3, x2, y3, 34);
                }
                int itemPackId = simWorld.getItemPackId(num25);
                if (itemPackId != -1)
                {
                    Image packTag = instance.getPackTag(itemPackId);
                    if (packTag != null)
                    {
                        int num28 = x + width - 50;
                        int num29 = y + 20;
                        g.drawImage(packTag, (float)num28, (float)num29, 18);
                    }
                }
                g.End();
                break;
            }
            if (this.m_listId == 7 && this.m_itemSelected == index)
            {
                int num14 = width;
                int num27 = height - 4;
                int num28 = (int)((double)x + (double)(width - num14) * 0.5 + 4.0);
                int num29 = (int)((double)y + (double)(height - num27) * 0.5);
                am2d.submitAnimGrid(224, 225, 226, 227, 228, 229, 230, 231, 232, (float)num28, (float)num29, (float)num14, (float)num27);
            }
            if ((simWorld.getItemFlags(num25) & 4) != 0 && !flag3)
            {
                if (this.m_state != 1 || this.m_itemSelected != index || (double)this.m_animTimer.getValue() > 0.5)
                {
                    int num14 = width;
                    int num27 = height - 4;
                    int num28 = x + (width - num14 >> 1) + 4;
                    int num29 = y + (height - num27 >> 1) + 1;
                    am2d.submitAnimGrid(224, 225, 226, 227, 228, 229, 230, 231, 232, (float)num28, (float)num29, (float)num14, (float)num27);
                    int recipeForItem         = simWorld.getRecipeForItem(num25);
                    int recipeIngredientCount = simWorld.getRecipeIngredientCount(recipeForItem);
                    int num30 = (int)((double)am2d.getAnimHeight(simWorld.getItemIcon(simWorld.getRecipeIngredient(recipeForItem, 0))) * 0.5 - 2.0);
                    int num31 = (int)((double)am2d.getAnimWidth(simWorld.getItemIcon(simWorld.getRecipeIngredient(recipeForItem, 0))) * 0.5);
                    int num32 = -(num30 >> 1);
                    int num33 = x + (width >> 1) + 20;
                    int num34 = y + (height >> 1) + (recipeIngredientCount > 4 ? num32 : 0);
                    int num35 = num33;
                    int num36 = num34;
                    for (int index1 = 0; index1 < recipeIngredientCount; ++index1)
                    {
                        int   recipeIngredient = simWorld.getRecipeIngredient(recipeForItem, index1);
                        int   itemIcon         = simWorld.getItemIcon(recipeIngredient);
                        float alpha3           = simData.getInventoryCount(recipeIngredient) > 0 ? 1f : 0.4f;
                        am2d.submitAnim(itemIcon, (float)num35, (float)num36, alpha3, 0.5f, 0.5f);
                        if (index1 == 3)
                        {
                            num36 += num30;
                            num35  = num33;
                        }
                        else
                        {
                            num35 += num31;
                        }
                    }
                }
                int num37 = width - 35;
                int num38 = x + num37;
                int num39 = (int)((double)y + (double)height * 0.5);
                am2d.submitAnim(180, (float)num38, (float)num39);
            }
            int num40     = x + 21;
            int num41     = y + num26;
            int itemIcon1 = simWorld.getItemIcon(num25);
            am2d.submitAnim(itemIcon1, (float)num40, (float)num41);
            break;

        case 6:
            int x9    = x + 20;
            int num42 = height >> 1;
            int num43 = y + num42;
            int relationshipNthItem = simData.getRelationshipNthItem(index);
            int simName1            = simData.getSimName(relationshipNthItem);
            int relState            = simData.getRelState(relationshipNthItem);
            int x10 = x + (width >> 1) + 20;
            int y8  = num43;
            if (g != null)
            {
                g.Begin();
                textManager.drawString(g, simName1, 4, x9, num43 - 3, 10);
                g.End();
            }
            else
            {
                if (this.m_state != 1 || this.m_itemSelected != index || (double)this.m_animTimer.getValue() > 0.5)
                {
                    int num14 = height - 2;
                    int num27 = (int)((double)y + (double)(height - num14) * 0.5);
                    int num28 = x10 - x - 75;
                    int num29 = x;
                    int num30 = x + width - (x10 + 75);
                    int num31 = x10 + 75;
                    int num32 = num31 - (num29 + num28);
                    int num33 = height - 16;
                    int num34 = num29 + num28;
                    int num35 = y + (height - num33 >> 1);
                    am2d.submitAnimGrid(224, 225, 226, 227, 228, 229, 230, 231, 232, (float)num29, (float)num27, (float)num28, (float)num14);
                    am2d.submitAnimGrid(224, 225, 226, 227, 228, 229, 230, 231, 232, (float)num31, (float)num27, (float)num30, (float)num14);
                    am2d.submitAnimStretched(228, (float)num34, (float)num35, (float)num32, (float)num33);
                }
                int num36 = width - 35;
                int num37 = x + num36;
                int num38 = (int)((double)y + (double)height * 0.5);
                am2d.submitAnim(180, (float)num37, (float)num38);
            }
            UIInfoScreen.drawRelBar(g, am2d, x10, y8, 150, relState, 65536, false);
            break;

        case 8:
            int nthItemOfCategory = simWorld.getFurnitureNthItemOfCategory(index, sceneGame.getCurFurnitureCategory());
            int objectStringId    = simWorld.getObjectStringId(nthItemOfCategory);
            int num44             = 173;
            int x11 = x + 5;
            int y9  = y + 5;
            int w2  = num44 - 10;
            if (g == null)
            {
                am2d.submitAnimGrid(340, 341, 342, 343, 344, 345, 346, 347, 348, (float)x, (float)y, (float)num44, 195f);
                if (!simWorld.isFurnitureAvailable(nthItemOfCategory))
                {
                    am2d.submitAnim(320, (float)(x11 + (w2 >> 1)), (float)(y9 + 65));
                }
            }
            else
            {
                int clipX      = g.getClipX();
                int clipY      = g.getClipY();
                int clipWidth  = g.getClipWidth();
                int clipHeight = g.getClipHeight();
                if (simWorld.isFurnitureAvailable(nthItemOfCategory))
                {
                    int index1 = -1;
                    for (int index2 = 0; index2 < 5; ++index2)
                    {
                        if (this.m_previewToIndexMap[index2] == index)
                        {
                            index1 = index2;
                            break;
                        }
                    }
                    if (index1 == -1)
                    {
                        int num14 = -this.getSwipeNotch(this.getSwipeOffset());
                        int num27 = num14 == this.m_lastMid ? this.m_lastDir : JMath.min(1, JMath.max(-1, num14 - this.m_lastMid));
                        this.m_lastMid = num14;
                        this.m_lastDir = num27;
                        int num28 = 0;
                        for (int index2 = 0; index2 < 5; ++index2)
                        {
                            int a     = this.m_previewToIndexMap[index2] - num14;
                            int num29 = JMath.abs(a);
                            if (a * num27 < 0 && num29 >= 2 || (num29 >= 4 || this.m_previewToIndexMap[index2] == -1))
                            {
                                this.m_previewToIndexMap[index2] = -1;
                                ++num28;
                            }
                        }
                        int index3     = index;
                        int objectType = nthItemOfCategory;
                        for (int index2 = 0; index2 < 5; ++index2)
                        {
                            if (this.m_previewToIndexMap[index2] == -1)
                            {
                                this.m_objectPreviews[index2].loadObject(objectType);
                                this.m_objectPreviews[index2].getModel().disableFurnitureShadows();
                                this.m_previewToIndexMap[index2] = index3;
                                --num28;
                                if (index3 == index)
                                {
                                    index1 = index2;
                                }
                                index3    += num27;
                                objectType = simWorld.getFurnitureNthItemOfCategory(index3, sceneGame.getCurFurnitureCategory());
                                if (index3 < 0 || index3 >= this.m_itemNum || num28 == 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    this.m_objectPreviews[index1].render(g, x11, y9, w2, 130);
                    g.setClip(clipX, clipY, clipWidth, clipHeight);
                }
                int x2 = x + (num44 >> 1);
                int y2 = y9 + 130;
                g.Begin();
                textManager.drawWrappedStringChunk(g, this.m_stringChunk, objectStringId, 4, num44 - 10, x2, y2, 17);
                int          y3             = y + 195 - 10;
                int          x3             = x + (num44 >> 1);
                int          objectBuyPrice = simWorld.getObjectBuyPrice(nthItemOfCategory);
                StringBuffer strBuffer      = textManager.clearStringBuffer();
                textManager.appendMoneyToBuffer(objectBuyPrice);
                textManager.drawString(g, strBuffer, 4, x3, y3, 20);
                int objectPackId = simWorld.getObjectPackId(nthItemOfCategory);
                if (objectPackId != -1)
                {
                    Image packTag = instance.getPackTag(objectPackId);
                    if (packTag != null)
                    {
                        int num14 = x + width - 27;
                        int num27 = y + 21;
                        g.drawImage(packTag, (float)num14, (float)num27, 18);
                    }
                }
                g.End();
            }
            ++this.m_stringChunk;
            break;

        case 9:
            if (g == null)
            {
                break;
            }
            int font1           = 3;
            int x12             = x;
            int x13             = x + width - 30;
            int num45           = sceneGame.shoppingListItem(index);
            int num46           = sceneGame.shoppingListQty(index);
            int itemDescString1 = simWorld.getItemDescString(num45);
            g.Begin();
            textManager.drawString(g, itemDescString1, font1, x12, y, 9);
            StringBuffer strBuffer1 = textManager.clearStringBuffer();
            textManager.appendStringIdToBuffer(1085);
            textManager.appendIntToBuffer(num46);
            textManager.drawString(g, strBuffer1, font1, x13, y, 9);
            g.End();
            break;

        case 10:
        case 11:
        case 12:
        case 13:
            if (g != null)
            {
                int  font2               = 4;
                int  font3               = 3;
                int  x2                  = x + (width >> 1);
                int  y2                  = y + (height - textManager.getLineHeight(font2) >> 1);
                int  y3                  = y + height - textManager.getLineHeight(font3);
                int  lineWidth2          = width - 25;
                int  buildModeOldSetting = canvas.getSceneGame().getBuildModeOldSetting();
                int  stringId2           = -1;
                int  packId              = -1;
                int  num14               = 0;
                bool flag4               = false;
                switch (this.m_listId)
                {
                case 10:
                    int unlockedFloorNthId = simWorld.getUnlockedFloorNthId(index);
                    stringId2 = simWorld.getFloorStringId(unlockedFloorNthId);
                    packId    = simWorld.getFloorPackId(unlockedFloorNthId);
                    flag4     = unlockedFloorNthId == buildModeOldSetting;
                    num14     = 50;
                    break;

                case 11:
                    int unlockedWallNthId = simWorld.getUnlockedWallNthId(index);
                    stringId2 = simWorld.getWallStringId(unlockedWallNthId);
                    packId    = simWorld.getWallPackId(unlockedWallNthId);
                    flag4     = unlockedWallNthId == buildModeOldSetting;
                    num14     = 50;
                    break;

                case 12:
                    int objectFootprintHeight = simWorld.getObjectFootprintHeight(buildModeOldSetting);
                    int windowNthType         = simWorld.getWindowNthType(index, objectFootprintHeight);
                    stringId2 = simWorld.getObjectStringId(windowNthType);
                    flag4     = windowNthType == buildModeOldSetting;
                    break;

                case 13:
                    int doorNthType = simWorld.getDoorNthType(index);
                    stringId2 = simWorld.getObjectStringId(doorNthType);
                    flag4     = doorNthType == buildModeOldSetting;
                    break;
                }
                g.Begin();
                textManager.drawWrappedStringChunk(g, this.m_stringChunk, stringId2, font2, lineWidth2, x2, y2, 18);
                ++this.m_stringChunk;
                if (flag4)
                {
                    textManager.drawString(g, 1078, font3, x2, y3, 18);
                }
                else
                {
                    StringBuffer strBuffer2 = textManager.clearStringBuffer();
                    textManager.appendMoneyToBuffer(num14);
                    textManager.drawString(g, strBuffer2, font3, x2, y3, 18);
                }
                if (packId != -1)
                {
                    Image packTag = instance.getPackTag(packId);
                    if (packTag != null)
                    {
                        int num27 = x + width - 12;
                        int num28 = y + 42;
                        g.drawImage(packTag, (float)num27, (float)num28, 18);
                    }
                }
                g.End();
                break;
            }
            if (index == this.m_itemSelected)
            {
                am2d.submitAnimGrid(349, 350, 351, 352, 353, 354, 355, 356, 357, (float)x, (float)y, (float)width, (float)height);
                break;
            }
            am2d.submitAnimGrid(331, 332, 333, 334, 335, 336, 337, 338, 339, (float)x, (float)y, (float)width, (float)height);
            break;
        }
    }
Пример #21
0
    private void renderPersona(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   sim                 = 0;
        int   persona             = simData.getPersona();
        int   personaDescString   = (int)simData.getPersonaDescString(persona);
        int   personaNthGoalCount = simData.getPersonaNthGoalCount();
        int   num1                = x + (width >> 1);
        int   num2                = num1;
        int   num3                = y;
        int   num4                = width >> 1;
        int   num5                = num1 - (width >> 2);
        int   num6                = y + 25;
        int   x1         = num5;
        int   y1         = num6 + 35;
        int   x2         = x1;
        int   y2         = y1 + 16;
        int   x3         = x1;
        int   y3         = y2 + 15;
        int   x4         = num2 + 10;
        int   x5         = num2 + (num4 >> 1);
        int   num7       = num3 + 8;
        int   lineHeight = textManager.getLineHeight(3);
        int   x6         = num1;
        int   y4         = num3 + 100 + 11;
        int   x7         = x + 60;
        int   num8       = x7 - 16;
        int   num9       = y4 + 20;
        int   num10      = 16;
        int   num11      = x6;
        float scaleX     = (float)width * 0.9f / animationManager2D.getAnimWidth(126);
        int   num12      = -(num10 >> 1);

        animationManager2D.submitAnim(181, (float)num5, (float)num6);
        animationManager2D.submitAnimGrid(233, 234, 235, 236, 237, 238, 239, 240, 241, (float)num2, (float)num3, (float)num4, 100f, 1f);
        int num13 = num9;

        for (int index = 0; index < personaNthGoalCount; ++index)
        {
            bool flag = simData.isPersonaGoalsCompleted(index);
            animationManager2D.submitAnim(135, (float)num8, (float)num13);
            if (flag)
            {
                animationManager2D.submitAnim(134, (float)num8, (float)num13);
            }
            animationManager2D.submitAnim(126, (float)num11, (float)(num13 + num12), 1f, scaleX, 1f);
            num13 += num10;
        }
        animationManager2D.flushAnims(g);
        g.Begin();
        string simName = canvas.getSimName();

        textManager.drawString(g, simName, 6, x1, y1, 18);
        textManager.drawString(g, 969, 3, x2, y2, 18);
        textManager.drawString(g, personaDescString, 3, x3, y3, 18);
        int numPlayerTraits = simData.getNumPlayerTraits();
        int y5 = num7;

        textManager.drawString(g, 967, 3, x5, y5, 17);
        int y6 = y5 + lineHeight;

        for (int index = 0; index < numPlayerTraits; ++index)
        {
            int simTrait        = simData.getSimTrait(sim, index);
            int traitDescString = (int)simData.getTraitDescString(simTrait);
            textManager.drawString(g, traitDescString, 3, x4, y6, 9);
            y6 += lineHeight;
        }
        textManager.drawString(g, 970, 3, x6, y4, 18);
        int y7 = num9;

        for (int index = 0; index < personaNthGoalCount; ++index)
        {
            int personaNthGoalItem = simData.getPersonaNthGoalItem(index);
            int dreamDescString    = simData.getDreamDescString(personaNthGoalItem);
            textManager.drawString(g, dreamDescString, 3, x7, y7, 10);
            y7 += num10;
        }
        g.End();
    }
Пример #22
0
 public void submit(ref AnimationManager2D am2d, int x, int y)
 {
     this.submit(ref am2d, x, y, true);
 }
Пример #23
0
    public void render(Graphics g)
    {
        this.setup();
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        float num1 = (float)canvas.getWidth() - 120f;
        float num2 = (float)canvas.getHeight() - 70f;
        float num3 = (float)(((double)canvas.getWidth() - (double)num1) * 0.5);
        float num4 = (float)(((double)canvas.getHeight() - (double)num2) * 0.5);

        UIOptionMenu.renderOptionsBG(g, (int)num3, (int)num4, (int)num1, (int)num2, 2);
        float num5       = num3 + 55f;
        float num6       = num4 + 22f;
        float num7       = num1 - 90f;
        float num8       = num2 - 50f;
        int   num9       = this.m_items[0];
        float num10      = num5 + num7 * 0.5f;
        float num11      = 100f;
        float x1         = num10 + num11;
        float x2         = num10 - num11;
        float num12      = 37f;
        float num13      = num8 - num12;
        float num14      = num6 + num8 - num13;
        float w          = num7 * 0.9f;
        float animHeight = animationManager2D.getAnimHeight(126);
        float x3         = num10 - w * 0.5f;

        for (int index = 0; index < num9; ++index)
        {
            int   @string = this.m_items[5 + index];
            float y1      = (float)((double)num14 + (double)this.getScrollOffset() + (double)index * 36.6666679382324 + 18.3333339691162);
            if ((double)y1 >= (double)num14 - 18.3333339691162 && (double)y1 <= (double)num14 + (double)num13 + 18.3333339691162)
            {
                int num15 = canvas.getRMSOptionState(@string);
                if (this.m_items[1] == 7)
                {
                    num15 = index != canvas.getTextManager().getCurrentLanguage() ? 3 : 2;
                }
                if (num15 != -1)
                {
                    int animId1 = 116;
                    if (num15 == 1 || num15 == 2)
                    {
                        animId1 = 114;
                    }
                    int animId2 = -1;
                    switch (num15)
                    {
                    case 0:
                        animId2 = 115;
                        break;

                    case 1:
                        animId2 = 117;
                        break;
                    }
                    float num16 = 1f;
                    float num17 = 1f;
                    if (index == this.m_cursor)
                    {
                        if (this.m_state == 2 || this.m_state == 4)
                        {
                            num16 = this.m_animTimer.getValue();
                        }
                        else if (this.m_state == 3)
                        {
                            num17 = this.m_animTimer.getValue();
                        }
                    }
                    animationManager2D.submitAnim(animId1, x1, y1, 1f, num16, num16);
                    if (animId2 != -1)
                    {
                        animationManager2D.submitAnim(animId2, x2, y1, 1f, num17, num17);
                    }
                }
                if (index == this.m_cursor && this.m_state == 1)
                {
                    double num18 = (double)this.m_animTimer.getValue();
                }
                float y2 = (float)((double)y1 + 18.3333339691162 - (double)animHeight * 0.5);
                animationManager2D.submitAnimStretched(126, x3, y2, w, animHeight);
            }
        }
        int clipX      = g.getClipX();
        int clipY      = g.getClipY();
        int clipWidth  = g.getClipWidth();
        int clipHeight = g.getClipHeight();

        g.setClip(320 - (int)num14 - (int)num13, clipY, (int)num13, clipHeight);
        animationManager2D.flushAnims(g);
        for (int index = 0; index < num9; ++index)
        {
            float num15 = (float)((double)num14 + (double)this.getScrollOffset() + (double)index * 36.6666679382324 + 18.3333339691162);
            if ((double)num15 >= (double)num14 - 18.3333339691162 && (double)num15 <= (double)num14 + (double)num13 + 18.3333339691162)
            {
                if (index == this.m_cursor)
                {
                    float num16 = 0.5f;
                    if (this.m_state == 1)
                    {
                        num16 = this.m_animTimer.getValue();
                    }
                    if ((double)num16 < 0.5)
                    {
                        continue;
                    }
                }
                g.Begin();
                if (this.m_itemStrings.Length == 0)
                {
                    int strId = this.m_items[5 + index];
                    textManager.drawString(g, strId, 4, (int)num10, (int)num15, 18);
                }
                else
                {
                    string itemString = this.m_itemStrings[index];
                    textManager.drawString(g, itemString, 4, (int)num10, (int)num15, 18);
                }
                g.End();
            }
        }
        g.setClip(clipX, clipY, clipWidth, clipHeight);
        float barHeight = (float)((double)num8 - (double)num12 - 10.0 - 20.0);
        float barX      = (float)((double)num5 + (double)num7 - 10.0);
        float barY      = (float)((double)num6 + (double)num12 + 10.0 + (double)barHeight * 0.5);
        float num19     = num13;
        float num20     = 36.66667f * (float)num9;
        float num21     = -this.getScrollOffset();

        this.submitScrollbar(ref animationManager2D, (int)num21, (int)num19, (int)num20, barX, barY, barHeight);
        animationManager2D.flushAnims(g);
        UIOptionMenu.renderOptionsFG(g, (int)num3, (int)num4, (int)num1, (int)num2, this.m_items[1]);
        this.setScrollRange((float)-this.m_items[0] * 36.66667f + num13, 0.0f);
        this.setDragArea((int)num5, (int)num14, (int)num7, (int)num13);
        this.m_itemsPosX = (int)num5;
        this.m_itemsPosY = (int)num14;
    }
Пример #24
0
    public void render(Graphics g, bool mainMenu, bool enabled)
    {
        this.setup();
        this.m_enabled = enabled;
        Scene              scene              = AppEngine.getCanvas().getScene();
        bool               flag               = scene.getSceneID() == 1;
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        float              w      = (float)canvas.getWidth() - 80f;
        float              h      = (float)canvas.getHeight() - (mainMenu ? 10f : 30f);
        float              x1     = (float)(((double)canvas.getWidth() - (double)w) * 0.5);
        float              y1     = (float)(((double)canvas.getHeight() - (double)h) * 0.5 + 10.0);
        float              alpha1 = flag ? 0.6f : 1f;

        animationManager2D.submitAnimGrid(71, 72, 73, 74, 75, 76, 77, 78, 79, x1, y1, w, h, alpha1);
        if (this.m_showBack)
        {
            float x2 = x1 + 23f;
            float y2 = y1 + 33f;
            animationManager2D.submitAnim(80, x2, y2);
            float num1 = x2 - 5f;
            float num2 = y2 - 5f;
            this.getScene().getUIButton(2).submit(ref animationManager2D, (int)num1, (int)num2);
        }
        float x3 = (float)((double)x1 + (double)w + (mainMenu ? -23.0 : -18.0));
        float y3 = y1 + (mainMenu ? 50f : 28f);

        animationManager2D.submitAnim(530, x3, y3);
        int num3             = (int)((double)x3 - 39.0);
        int num4             = (int)y3;
        int theTheTheTheAnim = scene.getTheTheTheTheAnim();

        animationManager2D.submitAnim(theTheTheTheAnim, (float)num3, (float)num4, 1f, 0.4f, 0.4f);
        int   num5 = this.m_items[0];
        float x4   = (float)((double)x1 + (double)w * 0.5 + (mainMenu ? -75.0 : 0.0));
        float num6 = (float)((double)y1 - 4.0 + ((double)h - (double)(num5 - 1) * 36.6666679382324) * 0.5);

        for (int index = 0; index < num5; ++index)
        {
            float y2 = num6 + (float)index * 36.66667f;
            animationManager2D.submitAnimHBar(81, 82, 83, x4, y2, 200f, 1f);
            if (index == this.m_items[2])
            {
                float alpha2 = 0.5f;
                if (this.m_state == 1)
                {
                    alpha2 = this.m_animTimer.getValue();
                }
                animationManager2D.submitAnimHBar(84, 85, 86, x4, y2, 200f, alpha2);
            }
        }
        if (mainMenu)
        {
            float num1 = (float)((double)x1 + (double)w * 0.5 + 112.0);
            float num2 = y1 + 105f;
            scene.getUIButton(2097152).submit(ref animationManager2D, (int)num1, (int)num2, this.m_enabled);
            animationManager2D.flushAnims(g);
            g.Begin();
            int y2 = (int)((double)num2 + 42.0);
            textManager.drawString(g, 39, 5, (int)num1, y2, 18);
            g.End();
        }
        else
        {
            animationManager2D.flushAnims(g);
        }
        for (int index = 0; index < num5; ++index)
        {
            int y2    = (int)((double)num6 + (double)index * 36.6666679382324);
            int strId = this.m_items[5 + index];
            g.Begin();
            textManager.drawString(g, strId, 4, (int)x4, y2, 18);
            g.End();
            if (strId == 52)
            {
                animationManager2D.submitAnim(164, (float)((double)x4 + 35.0 - 100.0), (float)(y2 - 2));
                animationManager2D.submitAnim(164, (float)((double)x4 - 35.0 + 100.0), (float)(y2 - 2));
            }
        }
        this.m_posX   = (int)((double)x4 - 120.000007629395);
        this.m_posY   = (int)((double)num6 - 18.3333339691162);
        this.m_width  = 240;
        this.m_height = (int)(36.6666679382324 * (double)num5);
        animationManager2D.flushAnims(g);
    }
Пример #25
0
    public void render(Graphics g)
    {
        this.setup();
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        int   num1 = this.m_items[0];
        float num2 = -132f;
        float num3 = -110f;
        float num4 = 110f;
        float num5 = 132f;

        for (int index = 0; index < num1; ++index)
        {
            float num6 = this.getScrollOffset() + (float)index * 36.66667f;
            if ((double)num6 >= (double)num2 && (double)num6 <= (double)num5)
            {
                float num7 = 1f;
                if ((double)num6 > (double)num4)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num4) / ((double)num5 - (double)num4));
                }
                else if ((double)num6 < (double)num3)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num3) / ((double)num2 - (double)num3));
                }
                float x = (float)(115.0 + (double)((float)System.Math.Cos(System.Math.Asin((double)num6 / 155.0)) * 155f) + 100.0);
                float y = 138f + num6;
                animationManager2D.submitAnimHBar(287, 288, 289, x, y, 200f, num7, num7);
            }
        }
        float x1 = 77f;
        float y1 = 40f;

        animationManager2D.submitAnim(296, x1, y1);
        float x2 = x1 + 87f;
        float y2 = y1 - 11f;

        animationManager2D.submitAnim(297, x2, y2, 1f, 2f, 1f);
        float x3 = x1 + 145f;
        float y3 = y1 - 8f;

        animationManager2D.submitAnim(298, x3, y3);
        float x4 = x1 + 180f;
        float y4 = y1 + 88f;

        animationManager2D.submitAnim(299, x4, y4);
        float num8 = x1 - 1f;
        float num9 = y1 + 2f;

        this.getScene().getUIButton(this.m_commandId).submit(ref animationManager2D, (int)num8, (int)num9);
        float num10 = this.getScrollRangeMax() - this.getScrollRangeMin();
        float num11 = this.getScrollRangeMax() - this.getScrollOffset();
        float num12;
        float num13;

        if ((double)num10 != 0.0)
        {
            num12 = 0.6801548f;
            num13 = (float)((1.36030960083008 - (double)num12 * 1.13329994678497) * (double)num11 / (double)num10 - 0.581194639205933);
        }
        else
        {
            num12 = 1.36031f;
            num13 = -37f * (float)System.Math.PI / 200f;
        }
        float num14 = 135f;
        float num15 = 136f;
        float num16 = 138f;
        float num17 = num12 / 7f;

        for (int index = 0; index < 7; ++index)
        {
            int   num6    = index == 0 ? 0 : (index == 1 ? 6 : index - 1);
            float radians = num13 + num17 * (float)num6;
            float degrees = MathExt.radiansToDegrees(radians);
            float num7    = (float)System.Math.Cos((double)radians) * num16;
            float num18   = (float)System.Math.Sin((double)radians) * num16;
            float x5      = num14 + num7;
            float y5      = num15 + num18;
            int   animId  = 304;
            if (index == 0 || index == 1)
            {
                animId = 302;
            }
            animationManager2D.submitAnim(animId, x5, y5, 1f, 1f, 1f, -degrees);
        }
        int num19      = 253;
        int num20      = 137;
        int animHeight = (int)animationManager2D.getAnimHeight(300);
        int num21      = num20 - (animHeight >> 1);
        int num22      = num20 + (animHeight >> 1) - 1;

        animationManager2D.submitAnim(300, (float)num19, (float)num21, 1f, 1f, -1f);
        animationManager2D.submitAnim(301, (float)num19, (float)num22);
        for (int index = 0; index < num1; ++index)
        {
            float num6 = this.getScrollOffset() + (float)index * 36.66667f;
            if ((double)num6 >= (double)num2 && (double)num6 <= (double)num5)
            {
                float num7 = 1f;
                if ((double)num6 > (double)num4)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num4) / ((double)num5 - (double)num4));
                }
                else if ((double)num6 < (double)num3)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num3) / ((double)num2 - (double)num3));
                }
                float x5 = (float)(115.0 + (double)((float)System.Math.Cos(System.Math.Asin((double)num6 / 155.0)) * 155f) + 100.0);
                float y5 = 138f + num6;
                animationManager2D.submitAnimHBar(290, 291, 292, x5, y5, 200f, num7, num7);
                if (index == this.m_items[2])
                {
                    float num18 = 0.5f;
                    if (this.m_animTimer.isAnimating())
                    {
                        num18 = this.m_animTimer.getValue();
                    }
                    animationManager2D.submitAnimHBar(293, 294, 295, x5, y5, 200f, num18 * num7, num7);
                }
            }
        }
        animationManager2D.flushAnims(g);
        g.Begin();
        int       x6                = 160;
        int       y6                = 30;
        int       stringId          = this.m_items[1];
        MapObject contextMenuObject = canvas.getSceneGame().getContextMenuObject();

        if (contextMenuObject != null)
        {
            stringId = contextMenuObject.getTypeString();
            if (contextMenuObject.getType() == 0)
            {
                string simName = canvas.getSimName();
                textManager.drawString(g, simName, 4, x6, y6, 18);
                stringId = -1;
            }
        }
        if (stringId != -1)
        {
            textManager.wrapStringChunk(0, stringId, 4, 116);
            textManager.drawWrappedStringChunk(g, 0, 4, x6, y6, 18);
        }
        g.End();
        for (int index1 = 0; index1 < num1; ++index1)
        {
            float num6 = this.getScrollOffset() + (float)index1 * 36.66667f;
            if ((double)num6 >= (double)num2 && (double)num6 <= (double)num5)
            {
                float num7 = 1f;
                if ((double)num6 > (double)num4)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num4) / ((double)num5 - (double)num4));
                }
                else if ((double)num6 < (double)num3)
                {
                    num7 = (float)(1.0 - ((double)num6 - (double)num3) / ((double)num2 - (double)num3));
                }
                if ((double)num7 > 0.5)
                {
                    float num18  = 115f + (float)System.Math.Cos(System.Math.Asin((double)num6 / 155.0)) * 155f;
                    float num23  = 138f + num6;
                    int   index2 = 5 + index1;
                    int   x5     = (int)((double)num18 + 100.0);
                    int   y5     = (int)num23;
                    int   strId  = this.m_items[index2];
                    g.Begin();
                    textManager.drawString(g, strId, 4, x5, y5, 18);
                    if (index2 < this.m_actions.Length)
                    {
                        int action       = this.m_actions[index2];
                        int actionPackId = canvas.getSimData().getActionPackId(action);
                        if (actionPackId != -1)
                        {
                            Image packTag = DLCManager.getInstance().getPackTag(actionPackId);
                            if (packTag != null)
                            {
                                int num24 = x5 + 90;
                                int num25 = y5 - 10;
                                g.drawImage(packTag, (float)num24, (float)num25, 18);
                            }
                        }
                    }
                    g.End();
                }
            }
        }
        animationManager2D.flushAnims(g);
        this.setDragArea((int)byte.MaxValue, 0, 200, 320);
    }
Пример #26
0
    public void render(Graphics g)
    {
        this.setup();
        AppEngine          canvas             = AppEngine.getCanvas();
        TextManager        textManager        = canvas.getTextManager();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();
        bool enabled = this.m_state == 1;
        int  num1    = 0;
        int  num2    = 0;

        switch (this.m_type)
        {
        case 1:
            num1 = 70;
            num2 = 30;
            break;

        case 2:
            num1 = 60;
            num2 = 75;
            break;

        case 3:
            num1 = 70;
            num2 = 19;
            break;

        case 4:
            num1 = 20;
            num2 = 20;
            break;
        }
        float popupWidth = (float)this.m_popupWidth;
        float h          = (float)(this.m_contentHeightVisible + num1 + num2);
        float halfWidth  = (float)canvas.getHalfWidth();
        float x1         = halfWidth - (float)(((double)popupWidth - 8.0) * 0.5);
        float y1         = (float)canvas.getHalfHeight() - h * 0.5f;

        if (this.m_state == 0)
        {
            float valueLinear = this.m_animTimer.getValueLinear();
            float valuePopup  = this.m_animTimer.getValuePopup();
            animationManager2D.setGlobalAlpha(valueLinear);
            animationManager2D.setGlobalScale(x1 + popupWidth * 0.5f, y1 + h * 0.5f, valuePopup, valuePopup);
        }
        switch (this.m_type)
        {
        case 1:
            animationManager2D.submitAnimGrid(87, 88, 89, 90, 91, 92, 93, 94, 95, x1, y1, popupWidth, h, 1f);
            float x2 = x1 + 10f;
            float y2 = y1 + 26f;
            animationManager2D.submitAnim(99, x2, y2);
            float num3 = x2 - 3f;
            float num4 = y2 - 3f;
            this.getScene().getUIButton(this.m_commandTop).submit(ref animationManager2D, (int)num3, (int)num4, enabled);
            break;

        case 2:
            float x3 = x1 + popupWidth * 0.5f;
            float y3 = y1 + h * 0.5f;
            animationManager2D.submitAnimVBar(96, 97, 98, x3, y3, h);
            int x4 = (int)((double)x1 + (double)popupWidth * 0.5 - 52.0);
            int y4 = (int)((double)y1 + (double)h - 36.0);
            this.getScene().getUIButton(this.m_commandLeft).submit(ref animationManager2D, x4, y4, enabled);
            int x5 = (int)((double)x1 + (double)popupWidth * 0.5 + 44.0);
            int y5 = (int)((double)y1 + (double)h - 36.0);
            this.getScene().getUIButton(this.m_commandRight).submit(ref animationManager2D, x5, y5, enabled);
            float x6          = x1 + 7f;
            float y6          = y1 + 11f;
            float w1          = popupWidth - 22f;
            float animHeight1 = animationManager2D.getAnimHeight(113);
            animationManager2D.submitAnimStretched(113, x6, y6, w1, animHeight1);
            break;

        case 3:
            UIOptionMenu.renderOptionsBG(g, (int)x1, (int)y1, (int)popupWidth, (int)h, this.m_commandTop);
            break;
        }
        if (this.m_contentHeight > this.m_contentHeightVisible)
        {
            float barHeight            = (float)this.m_contentHeightVisible - 10f;
            float barX                 = (float)((double)x1 + (double)popupWidth - 32.0);
            float barY                 = (float)((double)y1 + (double)num1 + (double)barHeight * 0.5);
            float contentHeightVisible = (float)this.m_contentHeightVisible;
            float contentHeight        = (float)this.m_contentHeight;
            float num5                 = -this.getScrollOffset();
            this.submitScrollbar(ref animationManager2D, (int)num5, (int)contentHeightVisible, (int)contentHeight, barX, barY, barHeight);
        }
        animationManager2D.flushAnims(g);
        animationManager2D.resetGlobal();
        if (this.m_state != 1)
        {
            return;
        }
        g.Begin();
        if (this.m_type == 1 || this.m_type == 2)
        {
            int x7 = (int)halfWidth;
            int y7 = (int)((double)y1 + (double)num1 * 0.5);
            textManager.drawString(g, this.m_titleStringId, 6, x7, y7, 18);
        }
        int x8   = (int)((double)halfWidth - (double)(this.m_contentWidth >> 1));
        int y8   = (int)((double)y1 + (double)num1);
        int num6 = 0;
        int num7 = 0;

        if (this.m_type == 3)
        {
            x8   = (int)((double)x1 + 55.0);
            y8   = (int)((double)y1 + 59.0);
            num6 = 0;
            num7 = 8;
        }
        else if (this.m_type == 1 || this.m_type == 2)
        {
            num6 = 11;
            num7 = 18;
        }
        int num8 = this.m_contentHeightVisible + num6 + num7;
        int y9   = y8 - num6;

        g.End();
        if (this.m_messagePanelId == -1)
        {
            int clipX      = g.getClipX();
            int clipY      = g.getClipY();
            int clipWidth  = g.getClipWidth();
            int clipHeight = g.getClipHeight();
            int x7         = x8 + (this.m_contentWidth >> 1);
            int y7         = (int)((double)y8 + (double)this.getScrollOffset());
            g.setClip(320 - y9 - num8, clipY, num8, clipHeight);
            g.Begin();
            textManager.drawWrappedString(g, 3, x7, y7, 17);
            g.End();
            g.setClip(clipX, clipY, clipWidth, clipHeight);
        }
        else
        {
            this.getScene().drawUIPanel(g, this.m_messagePanelId, x8, y8, this.m_contentWidth, this.m_contentHeightVisible);
        }
        this.setDragArea(x8, y9, this.m_contentWidth, num8);
        switch (this.m_type)
        {
        case 1:
            float w2          = popupWidth * 0.8f;
            float animHeight2 = animationManager2D.getAnimHeight((int)sbyte.MaxValue);
            float x9          = halfWidth - w2 * 0.5f;
            float y10         = (float)((double)y1 + (double)num1 - (double)animHeight2 - 5.0);
            animationManager2D.submitAnimStretched((int)sbyte.MaxValue, x9, y10, w2, animHeight2);
            if (this.m_contentHeight != this.m_contentHeightVisible)
            {
                float w3          = popupWidth - 35f;
                float animHeight3 = animationManager2D.getAnimHeight(101);
                float x7          = (float)((double)x1 + (double)popupWidth * 0.5 - (double)w3 * 0.5 - 8.0);
                float y7          = (float)((double)y1 + (double)h - (double)animHeight3 * 0.5 - 20.0);
                animationManager2D.submitAnimStretched(101, x7, y7, w3, animHeight3);
            }
            animationManager2D.flushAnims(g);
            break;

        case 3:
            int titleStringId = this.m_state == 1 ? this.m_titleStringId : -1;
            UIOptionMenu.renderOptionsFG(g, (int)x1, (int)y1, (int)popupWidth, (int)h, titleStringId);
            break;
        }
    }
Пример #27
0
    public static void drawRelBar(
        Graphics g,
        AnimationManager2D am2d,
        int x,
        int y,
        int width,
        int relState,
        int levelF,
        bool big)
    {
        AppEngine   canvas      = AppEngine.getCanvas();
        TextManager textManager = canvas.getTextManager();
        SimData     simData     = canvas.getSimData();

        if (am2d == null)
        {
            int relStateDescString = simData.getRelStateDescString(relState);
            int font = big ? 3 : 3;
            g.Begin();
            textManager.drawString(g, relStateDescString, font, x, y - 3, 18);
            g.End();
        }
        else
        {
            int animLeft  = 208;
            int animMid   = 209;
            int animRight = 210;
            if ((simData.getRelStateFlags(relState) & 1) != 0)
            {
                animLeft  = 211;
                animMid   = 212;
                animRight = 213;
            }
            else if ((simData.getRelStateFlags(relState) & 2) != 0)
            {
                animLeft  = 214;
                animMid   = 215;
                animRight = 216;
            }
            float w       = (float)(width - 25);
            float scaleY1 = big ? 1.33333f : 1f;
            float scaleY2 = big ? 1f : 0.75f;
            am2d.submitAnimHBar(217, 218, 219, (float)x, (float)y, (float)width, 1f, scaleY1);
            if (levelF != 65536)
            {
                am2d.flushAnims(g);
                int clipX      = g.getClipX();
                int clipY      = g.getClipY();
                int clipWidth  = g.getClipWidth();
                int clipHeight = g.getClipHeight();
                int y1         = x - (width >> 1);
                int h          = MathExt.Fmul(width, levelF);
                g.setClip(clipY, y1, clipHeight, h);
                am2d.submitAnimHBar(animLeft, animMid, animRight, (float)x, (float)y, (float)width, 1f, scaleY1);
                am2d.flushAnims(g);
                g.setClip(clipX, clipY, clipWidth, clipHeight);
            }
            else
            {
                am2d.submitAnimHBar(animLeft, animMid, animRight, (float)x, (float)y, (float)width, 1f, scaleY1);
            }
            am2d.submitAnimHBar(220, 221, 222, (float)x, (float)y, w, 1f, scaleY2);
        }
    }
Пример #28
0
    private void renderInventoryRecipe(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();
        SimWorld           simWorld           = canvas.getSimWorld();
        int   focusItem              = this.m_focusItem;
        int   recipeForItem          = simWorld.getRecipeForItem(focusItem);
        int   recipeIngredientCount1 = simWorld.getRecipeIngredientCount(recipeForItem);
        int   num1    = x + 25;
        int   num2    = y + 10;
        int   x1      = x + 45;
        int   y1      = num2;
        int   num3    = x + 25;
        int   x2      = num3 + 15;
        int   num4    = 200;
        int   num5    = x + (num4 >> 1);
        float scaleX1 = (float)num4 / animationManager2D.getAnimWidth(126);
        float scaleX2 = (float)num4 / animationManager2D.getAnimWidth((int)sbyte.MaxValue);
        int   num6    = y + 25;
        int   num7    = num5 + (num4 >> 1) + 10;
        int   num8    = num6;
        int   num9    = x + width - num7 - 10;
        int   num10   = y + height - num8 - 10;

        animationManager2D.submitAnim(180, (float)num1, (float)num2);
        animationManager2D.submitAnim((int)sbyte.MaxValue, (float)num5, (float)num6, 1f, scaleX2, 1f);
        animationManager2D.submitAnimGrid(233, 234, 235, 236, 237, 238, 239, 240, 241, (float)num7, (float)num8, (float)num9, (float)num10);
        int recipe = recipeForItem;
        int recipeIngredientCount2 = simWorld.getRecipeIngredientCount(recipe);
        int animHeight             = (int)animationManager2D.getAnimHeight(simWorld.getItemIcon(simWorld.getRecipeIngredient(recipe, 0)));
        int animWidth = (int)animationManager2D.getAnimWidth(simWorld.getItemIcon(simWorld.getRecipeIngredient(recipe, 0)));
        int num11     = num7 + (num9 >> 1) - (recipeIngredientCount2 > 4 ? animWidth >> 1 : 0);
        int num12     = JMath.min(4, recipeIngredientCount2);
        int num13     = num8 + (num10 >> 1) - (num12 * animHeight >> 1) + (animHeight >> 1);
        int num14     = num11;
        int num15     = num13;

        for (int index = 0; index < recipeIngredientCount2; ++index)
        {
            int   recipeIngredient = simWorld.getRecipeIngredient(recipe, index);
            int   itemIcon         = simWorld.getItemIcon(recipeIngredient);
            float alpha            = simData.getInventoryCount(recipeIngredient) > 0 ? 1f : 0.4f;
            animationManager2D.submitAnim(itemIcon, (float)num14, (float)num15, alpha);
            if (index == 3)
            {
                num15  = num13;
                num14 += animWidth;
            }
            else
            {
                num15 += animHeight;
            }
        }
        int num16 = num6;

        for (int index = 0; index < recipeIngredientCount1; ++index)
        {
            if (index > 0)
            {
                animationManager2D.submitAnim(126, (float)num5, (float)num16, 1f, scaleX1, 1f);
            }
            animationManager2D.submitAnim(135, (float)num3, (float)(num16 + 10));
            int recipeIngredient = simWorld.getRecipeIngredient(recipeForItem, index);
            if (simData.getInventoryCount(recipeIngredient) > 0)
            {
                animationManager2D.submitAnim(134, (float)num3, (float)(num16 + 10));
            }
            num16 += 20;
        }
        animationManager2D.flushAnims(g);
        g.Begin();
        textManager.drawString(g, 393, 4, x1, y1, 10);
        int num17 = num6;

        for (int index = 0; index < recipeIngredientCount1; ++index)
        {
            int recipeIngredient = simWorld.getRecipeIngredient(recipeForItem, index);
            int itemDescString   = simWorld.getItemDescString(recipeIngredient);
            textManager.drawString(g, itemDescString, 3, x2, num17 + 10, 10);
            num17 += 20;
        }
        g.End();
    }
Пример #29
0
 public void SetAnimationOnTalking(string animationNameOnTalk, AnimationManager2D animationManagerToUseForTalking)
 {
     this.animationManagerToUseForTalking = animationManagerToUseForTalking;
     this.animationNameOnTalk             = animationNameOnTalk;
 }
Пример #30
0
    public void render(Graphics g, bool clipSet)
    {
        AnimationManager2D animationManager2D = AppEngine.getCanvas().getAnimationManager2D();
        int   clipPosX    = this.m_clipPosX;
        int   clipPosY    = this.m_clipPosY;
        int   clipWidth1  = this.m_clipWidth;
        int   clipHeight1 = this.m_clipHeight;
        int   posX        = this.m_posX;
        int   num1        = this.m_width - 20;
        int   num2        = this.m_posX + (int)this.getSwipeOffset();
        int   num3        = this.m_posY + (int)this.getScrollOffset();
        int   itemH       = this.m_itemH;
        float num4        = (float)num1;
        float x1          = (float)posX + num4 * 0.5f;
        float scaleX      = num4 / animationManager2D.getAnimWidth(126);
        int   x2          = num2;
        int   y1          = num3;

        for (int index = 0; index < this.m_itemNum; ++index)
        {
            if (!this.m_swipeList && y1 > clipPosY - this.m_itemH && y1 < clipPosY + clipHeight1 + this.m_itemH || this.m_swipeList && x2 + this.m_itemW > clipPosX && x2 < clipPosX + clipWidth1)
            {
                this.renderItem((Graphics)null, animationManager2D, index, x2, y1, this.m_itemW, this.m_itemH);
                if (this.m_itemNumX == 1 && index < this.m_itemNum - 1 && this.m_listId != 9)
                {
                    animationManager2D.submitAnim(126, x1, (float)(y1 + itemH), 1f, scaleX, 1f);
                }
            }
            if (index % this.m_itemNumX == this.m_itemNumX - 1)
            {
                y1 += this.m_itemH;
                x2  = num2;
            }
            else
            {
                x2 += this.m_itemW;
            }
        }
        int clipX       = g.getClipX();
        int clipY       = g.getClipY();
        int clipWidth2  = g.getClipWidth();
        int clipHeight2 = g.getClipHeight();

        if (!clipSet)
        {
            g.clipRect(320 - clipPosY - clipHeight1, clipPosX, clipHeight1, clipWidth1);
        }
        animationManager2D.flushAnims(g);
        this.m_stringChunk = 0;
        int x3 = num2;
        int y2 = num3;

        for (int index = 0; index < this.m_itemNum; ++index)
        {
            if (!this.m_swipeList && y2 > clipPosY - this.m_itemH && y2 < clipPosY + clipHeight1 + this.m_itemH || this.m_swipeList && x3 + this.m_itemW > clipPosX && x3 < clipPosX + clipWidth1)
            {
                this.renderItem(g, (AnimationManager2D)null, index, x3, y2, this.m_itemW, this.m_itemH);
            }
            if (index % this.m_itemNumX == this.m_itemNumX - 1)
            {
                y2 += this.m_itemH;
                x3  = num2;
            }
            else
            {
                x3 += this.m_itemW;
            }
        }
        if (!clipSet)
        {
            g.setClip(clipX, clipY, clipWidth2, clipHeight2);
        }
        if (this.m_swipeList)
        {
            return;
        }
        float num5    = 10f;
        float height1 = (float)this.m_height;
        float barX    = (float)(this.m_posX + this.m_width) - num5;
        float barY    = (float)this.m_posY + height1 * 0.5f;
        float height2 = (float)this.m_height;
        float num6    = (float)(this.m_itemH * this.m_itemNumY);
        float num7    = -this.getScrollOffset();

        this.submitScrollbar(ref animationManager2D, (int)num7, (int)height2, (int)num6, barX, barY, height1);
        animationManager2D.flushAnims(g);
    }