Пример #1
0
    public void InitOptionMenu(Transform centerTs, Camera uiCamera)
    {
        GameObject obj = GameObject.Instantiate(mOptionMenuPrefab) as GameObject;

        obj.transform.parent        = centerTs;
        obj.transform.localPosition = new Vector3(0, 0, -20);
        obj.transform.localScale    = Vector3.one;
        mOptionMenu = obj.GetComponent <UIOptionMenu>();
        mOptionMenu.Init(uiCamera);
        mOptionMenu.Hide();
    }
Пример #2
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;
    }
Пример #3
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;
        }
    }