コード例 #1
0
ファイル: GameMode.cs プロジェクト: dptug/TerrariaXDK
        public static void Draw(WorldView view)
        {
            Rectangle rect = default(Rectangle);

            rect.X      = (view.viewWidth >> 1) - 190;
            rect.Y      = 210;
            rect.Width  = 380;
            rect.Height = 168;
            Main.DrawRect(451, rect, 64);
            Color c    = Color.White;
            int   num  = (view.viewWidth >> 1) - 100;
            int   num2 = 230;
            bool  flag = UI.main.CanPlayOnline();

            if (cursorY == 0)
            {
                view.ui.DrawInventoryCursor(num, num2, 1.0);
            }
            else
            {
                c = (flag ? Color.White : new Color(128, 128, 128, 255));
                SpriteSheet <_sheetSprites> .Draw(451, num, num2, c);
            }
            if (UI.main.isOnline)
            {
                SpriteSheet <_sheetSprites> .Draw(202, num + 10, num2 + 10, c);
            }
            UI.DrawStringLC(UI.fontSmall, Lang.menu[6], num + 60, num2 + 26, c);
            num2 += 64;
            if (cursorY == 1)
            {
                view.ui.DrawInventoryCursor(num, num2, 1.0);
            }
            else
            {
                c = ((flag && UI.main.isOnline) ? Color.White : new Color(128, 128, 128, 255));
                SpriteSheet <_sheetSprites> .Draw(451, num, num2, c);
            }
            if (UI.main.isInviteOnly)
            {
                SpriteSheet <_sheetSprites> .Draw(202, num + 10, num2 + 10, c);
            }
            UI.DrawStringLC(UI.fontSmall, Lang.menu[7], num + 60, num2 + 26, c);
            string text = (WorldSelect.WorldName() != null) ? Lang.menu[10] : Lang.menu[11];
            float  num3 = 1f;

            if (cursorY != 2)
            {
                c = new Color(240, 240, 240, 240);
            }
            else
            {
                num3 *= 1f + UI.cursorAlpha * 0.1f;
                c     = new Color(UI.cursorColor.A, UI.cursorColor.A, 100, 255);
            }
            Vector2 pivot = UI.MeasureString(UI.fontBig, text);

            pivot.X *= 0.5f;
            pivot.Y *= 0.5f;
            UI.DrawStringScaled(pos: new Vector2(view.viewWidth >> 1, 454f), font: UI.fontBig, s: text, c: c, pivot: pivot, scale: num3);
        }
コード例 #2
0
ファイル: WorldSelect.cs プロジェクト: dptug/TerrariaXDK
        public static void Draw(WorldView view)
        {
            Rectangle rect  = default(Rectangle);
            Color     white = Color.White;

            rect.X      = view.SAFE_AREA_OFFSET_L;
            rect.Y      = view.SAFE_AREA_OFFSET_T;
            rect.Width  = 416;
            rect.Height = 446;
            Main.DrawRect(451, rect, 64);
            rect.X += 448;
            Main.DrawRect(451, rect, 64);
            UI.DrawStringCC(UI.fontBig, Lang.menu[83], view.SAFE_AREA_OFFSET_L + (rect.Width >> 1), rect.Y + 32, white);
            UI.DrawStringCC(UI.fontBig, Lang.menu[84], rect.Center.X, rect.Y + 32, white);
            int count = Netplay.availableSessions.Count;

            if (count == 0)
            {
                UI.DrawStringCC(s: (!Netplay.IsFindingSessions()) ? Lang.menu[77] : Lang.menu[76], font: UI.fontSmall, x: rect.Center.X, y: rect.Center.Y, c: UI.mouseTextColor);
            }
            else
            {
                rect.X     += 8;
                rect.Y     += 80;
                rect.Width  = 400;
                rect.Height = 24;
                int num = Math.Min(count, sessionListTop + 8);
                lock (Netplay.availableSessions)
                {
                    for (int i = sessionListTop; i < num; i++)
                    {
                        int texId = 450;
                        int alpha = 255;
                        if (i == selectedSession && cursorX == 1)
                        {
                            alpha = UI.mouseTextBrightness;
                            texId = 448;
                        }
                        Main.DrawRect(texId, rect, alpha);
                        rect.Y += 48;
                    }
                    rect.Y -= 48 * Math.Min(count, 8);
                    white   = Color.White;
                    for (int j = sessionListTop; j < num; j++)
                    {
                        JoinableSession joinableSession = Netplay.availableSessions[j];
                        string          s2 = (j + 1).ToStringLookup() + ".";
                        UI.DrawStringLC(UI.fontSmallOutline, s2, rect.X, rect.Center.Y, white);
                        UI.DrawStringLC(UI.fontSmallOutline, joinableSession.host, rect.X + 32, rect.Center.Y, white);
                        s2 = Lang.menu[78] + joinableSession.players.ToStringLookup() + "/8";
                        UI.DrawStringRC(UI.fontSmallOutline, s2, rect.Right, rect.Center.Y, white);
                        rect.Y += 48;
                    }
                }
            }
            rect.X      = view.SAFE_AREA_OFFSET_L + 8;
            rect.Y      = view.SAFE_AREA_OFFSET_T + 80;
            rect.Width  = 400;
            rect.Height = 24;
            for (int k = 0; k < 8; k++)
            {
                int texId2 = 450;
                int alpha2 = 255;
                if (k == selectedWorld && cursorX == 0)
                {
                    alpha2 = UI.mouseTextBrightness;
                    texId2 = 448;
                }
                else if (worldNames[k] == null)
                {
                    alpha2 = 212;
                    texId2 = 451;
                }
                Main.DrawRect(texId2, rect, alpha2);
                rect.Y += 48;
            }
            rect.Y -= 384;
            for (int l = 0; l < 8; l++)
            {
                string s3 = (worldNames[l] == null) ? Lang.menu[79] : worldNames[l];
                white = ((worldNames[l] == null) ? new Color(200, 200, 220, 255) : new Color(255, 255, 255, 255));
                UI.DrawStringCC(UI.fontSmallOutline, s3, rect.Center.X, rect.Center.Y, white);
                rect.Y += 48;
            }
        }