示例#1
0
    public static void Draw()
    {
        if (!MenuServers.show)
        {
            return;
        }
        float num = Time.time - MenuServers.showtime + 0.001f;

        if (num > 0.05f)
        {
            num = 0.05f;
        }
        num *= 20f;
        Matrix4x4 matrix = GUI.matrix;
        Vector3   s      = new Vector3(num, num, 1f);
        Vector3   pos    = new Vector3(MenuServers.rBack.center.x - MenuServers.rBack.center.x * num, MenuServers.rBack.center.y - MenuServers.rBack.center.y * num, 1f);

        GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, s);
        GUIM.DrawBox(MenuServers.rBack, MenuServers.tBlack);
        Rect rect = new Rect(MenuServers.rBack.x + GUIM.YRES(4f), MenuServers.rBack.y + GUIM.YRES(4f), GUIM.YRES(40f), GUIM.YRES(24f));

        GUI.DrawTexture(rect, MenuServers.tGray);
        GUIM.DrawText(rect, "#", TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
        rect.x     = rect.x + GUIM.YRES(2f) + rect.width;
        rect.width = GUIM.YRES(120f);
        GUI.DrawTexture(rect, MenuServers.tGray);
        GUIM.DrawText(rect, Lang.Get("_MODE"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
        rect.x     = rect.x + GUIM.YRES(2f) + rect.width;
        rect.width = GUIM.YRES(104f);
        GUI.DrawTexture(rect, MenuServers.tGray);
        GUIM.DrawText(rect, Lang.Get("_MAP"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
        rect.x     = rect.x + GUIM.YRES(2f) + rect.width;
        rect.width = GUIM.YRES(60f);
        GUI.DrawTexture(rect, MenuServers.tGray);
        GUIM.DrawText(rect, Lang.Get("_RATE"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
        rect.x     = rect.x + GUIM.YRES(2f) + rect.width;
        rect.width = GUIM.YRES(80f);
        GUI.DrawTexture(rect, MenuServers.tGray);
        GUIM.DrawText(rect, Lang.Get("_PLAYERS"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
        int num2 = 0;

        for (int i = 0; i < MenuServers.server.Count; i++)
        {
            if (MenuServers.server[i].channel == MenuServers.currChannel)
            {
                num2++;
            }
        }
        MenuServers.scroll = GUIM.BeginScrollView(new Rect(MenuServers.rBack.x + GUIM.YRES(4f), MenuServers.rBack.y + GUIM.YRES(32f), MenuServers.rBack.width - GUIM.YRES(8f), MenuServers.rBack.height - GUIM.YRES(40f)), MenuServers.scroll, new Rect(0f, 0f, 0f, (float)num2 * GUIM.YRES(26f)));
        int num3 = 0;

        for (int j = 16; j >= 0; j--)
        {
            for (int k = 0; k < MenuServers.server.Count; k++)
            {
                if (MenuServers.currMode != 0 || MenuServers.server[k].gamemode == 0)
                {
                    if (MenuServers.currMode != 1 || MenuServers.server[k].gamemode == 1)
                    {
                        if (MenuServers.currMode != 2 || MenuServers.server[k].gamemode == 2)
                        {
                            if (MenuServers.currMode != 3 || MenuServers.server[k].gamemode == 3)
                            {
                                if (MenuServers.server[k].channel == MenuServers.currChannel)
                                {
                                    if (MenuServers.server[k].players == j)
                                    {
                                        if (MenuServers.DrawButtonServer(MenuServers.server[k], num3))
                                        {
                                            MenuServers.currServer = MenuServers.server[k];
                                        }
                                        num3++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        GUIM.EndScrollView();
        MenuServers.rBackChannel = new Rect(MenuServers.rBack.x + MenuServers.rBack.width + GUIM.YRES(12f), MenuServers.rBack.y, GUIM.YRES(200f), GUIM.YRES(28f) * (float)(MenuServers.CServerData.maxchannel + 1) + GUIM.YRES(4f));
        GUIM.DrawBox(MenuServers.rBackChannel, MenuServers.tBlack);
        GUIM.DrawBox(MenuServers.rBackPlay, MenuServers.tBlack);
        for (int l = 0; l < MenuServers.CServerData.maxchannel + 1; l++)
        {
            MenuServers.DrawButtonChannel(l, new Rect(MenuServers.rBackChannel.x + GUIM.YRES(4f), MenuServers.rBackChannel.y + GUIM.YRES(4f) + (float)l * GUIM.YRES(28f), MenuServers.rBackChannel.width - GUIM.YRES(8f), GUIM.YRES(24f)), Lang.Get("_CHANNEL") + " " + l.ToString("00"));
        }
        MenuServers.rBackMode      = new Rect(MenuServers.rBackChannel.x, MenuServers.rBackChannel.y + MenuServers.rBackChannel.height + GUIM.YRES(28f), MenuServers.rBackChannel.width, GUIM.YRES(28f) * 4f + GUIM.YRES(4f));
        MenuServers.rButtonMode[0] = new Rect(MenuServers.rBackChannel.x + GUIM.YRES(4f), MenuServers.rBackChannel.y + MenuServers.rBackChannel.height + GUIM.YRES(28f) + GUIM.YRES(4f), MenuServers.rBackChannel.width - GUIM.YRES(8f), GUIM.YRES(24f));
        MenuServers.rButtonMode[1] = new Rect(MenuServers.rBackChannel.x + GUIM.YRES(4f), MenuServers.rBackChannel.y + MenuServers.rBackChannel.height + GUIM.YRES(28f) * 2f + GUIM.YRES(4f), MenuServers.rBackChannel.width - GUIM.YRES(8f), GUIM.YRES(24f));
        MenuServers.rButtonMode[2] = new Rect(MenuServers.rBackChannel.x + GUIM.YRES(4f), MenuServers.rBackChannel.y + MenuServers.rBackChannel.height + GUIM.YRES(28f) * 3f + GUIM.YRES(4f), MenuServers.rBackChannel.width - GUIM.YRES(8f), GUIM.YRES(24f));
        MenuServers.rButtonMode[3] = new Rect(MenuServers.rBackChannel.x + GUIM.YRES(4f), MenuServers.rBackChannel.y + MenuServers.rBackChannel.height + GUIM.YRES(28f) * 4f + GUIM.YRES(4f), MenuServers.rBackChannel.width - GUIM.YRES(8f), GUIM.YRES(24f));
        GUIM.DrawBox(MenuServers.rBackMode, MenuServers.tBlack);
        MenuServers.DrawButtonMode(0, MenuServers.rButtonMode[0], Lang.Get("_DEATHMATCH"));
        MenuServers.DrawButtonMode(1, MenuServers.rButtonMode[1], Lang.Get("_CONFRONTATION"));
        MenuServers.DrawButtonMode(2, MenuServers.rButtonMode[2], Lang.Get("_DETONATION"));
        MenuServers.DrawButtonMode(3, MenuServers.rButtonMode[3], Lang.Get("_ZOMBIEMATCH"));
        GUI.DrawTexture(MenuServers.rButtonRefresh, MenuServers.tGray);
        float  num4 = MenuServers.RefreshTime[MenuServers.currChannel] + 5f - Time.time;
        string str  = string.Empty;

        if (num4 >= 0f)
        {
            str = " " + num4.ToString("0.00");
        }
        if (GUIM.Button(MenuServers.rButtonRefresh, BaseColor.Gray, Lang.Get("_REFRESH") + str, TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false))
        {
            MenuServers.Refresh(MenuServers.currChannel);
        }
        bool flag = false;

        if (MenuServers.currServer != null)
        {
            flag = GUIM.Button(MenuServers.rButtonPlay, BaseColor.Orange, Lang.Get("_CONNECT"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
        }
        else
        {
            GUIM.Button(MenuServers.rButtonPlay, BaseColor.Black, Lang.Get("_CONNECT"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
        }
        if (flag)
        {
            PlayerPrefs.SetInt("localplay", 0);
            PlayerPrefs.SetString("autostart", "connect " + MenuServers.currServer.ip + " " + MenuServers.currServer.port.ToString());
            Application.LoadLevel("game");
        }
        GUI.matrix = matrix;
    }
示例#2
0
    public static void Draw()
    {
        if (!MenuInventory.show)
        {
            return;
        }
        float num = Time.time - MenuInventory.showtime + 0.001f;

        if (num > 0.05f)
        {
            num = 0.05f;
        }
        num *= 20f;
        Matrix4x4 matrix = GUI.matrix;
        Vector3   s      = new Vector3(num, num, 1f);
        Vector3   pos    = new Vector3(MenuInventory.rBack.center.x - MenuInventory.rBack.center.x * num, MenuInventory.rBack.center.y - MenuInventory.rBack.center.y * num, 1f);

        GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, s);
        GUIM.DrawBox(MenuInventory.rBack, MenuInventory.tBlack);
        MenuInventory.DrawButtonCategory(0, new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 0f, MenuInventory.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_ALL"), false);
        MenuInventory.DrawButtonCategory(1, new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 1f, MenuInventory.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_STOCK"), false);
        MenuInventory.DrawButtonCategory(2, new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 2f, MenuInventory.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_BADGES"), false);
        MenuInventory.DrawButtonCategory(3, new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 3f, MenuInventory.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_MASKS"), false);
        MenuInventory.DrawButtonCategory(4, new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 4f, MenuInventory.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_WEAPONS"), false);
        MenuInventory.scroll = GUIM.BeginScrollView(new Rect(MenuInventory.rBackBody.x + GUIM.YRES(4f), MenuInventory.rBackBody.y + GUIM.YRES(32f), MenuInventory.rBackBody.width - GUIM.YRES(8f), MenuInventory.rBackBody.height - GUIM.YRES(40f)), MenuInventory.scroll, new Rect(0f, 0f, 0f, (float)MenuInventory.hcount * GUIM.YRES(100f) - GUIM.YRES(4f)));
        int num2 = 0;
        int num3 = 0;

        for (int i = 0; i < 1024; i++)
        {
            if (BaseData.item[i] != 0 || i <= 127)
            {
                if (MenuShop.shopdata[i] != null)
                {
                    if (MenuInventory.currCat != 0)
                    {
                        if (MenuInventory.currCat == 1 && MenuShop.shopdata[i].section != 0)
                        {
                            goto IL_602;
                        }
                        if (MenuInventory.currCat == 2 && MenuShop.shopdata[i].section != 1 && MenuShop.shopdata[i].section != 2)
                        {
                            goto IL_602;
                        }
                        if (MenuInventory.currCat == 3 && MenuShop.shopdata[i].section != 3 && MenuShop.shopdata[i].section != 4)
                        {
                            goto IL_602;
                        }
                        if (MenuInventory.currCat == 4 && MenuShop.shopdata[i].section != 5)
                        {
                            goto IL_602;
                        }
                    }
                    if (MenuShop.DrawItem(new Rect((GUIM.YRES(96f) + GUIM.YRES(4f)) * (float)num2, (GUIM.YRES(96f) + GUIM.YRES(4f)) * (float)num3, GUIM.YRES(96f), GUIM.YRES(96f)), MenuShop.shopdata[i]))
                    {
                        if (MenuShop.shopdata[i].section == 1)
                        {
                            BaseData.badge_back = i;
                            PlayerPrefs.SetInt(BaseData.uid + "_badge_back", i);
                        }
                        else if (MenuShop.shopdata[i].section == 2)
                        {
                            BaseData.badge_icon = i;
                            PlayerPrefs.SetInt(BaseData.uid + "_badge_icon", i);
                        }
                        else if (MenuShop.shopdata[i].section == 3)
                        {
                            BaseData.mask_merc = i;
                            PlayerPrefs.SetInt(BaseData.uid + "_mask_merc", i);
                        }
                        else if (MenuShop.shopdata[i].section == 4)
                        {
                            BaseData.mask_warcorp = i;
                            PlayerPrefs.SetInt(BaseData.uid + "_mask_warcorp", i);
                        }
                        else if (MenuShop.shopdata[i].section == 5)
                        {
                            int id = WeaponData.GetId(MenuShop.shopdata[i].name2);
                            if (id > 0)
                            {
                                BaseData.profileWeapon[id] = i;
                                BaseData.currentWeapon[id] = i;
                                PlayerPrefs.SetInt(BaseData.uid + "_custom_" + MenuShop.shopdata[i].name2, i);
                            }
                        }
                    }
                    num2++;
                    if (num2 >= 6)
                    {
                        num2 = 0;
                        num3++;
                    }
                }
            }
            IL_602 :;
        }
        MenuInventory.hcount = num3 + 1;
        GUIM.EndScrollView();
        GUI.matrix = matrix;
    }
示例#3
0
    public static void Draw()
    {
        if (!MenuShop.show)
        {
            return;
        }
        float num = Time.time - MenuShop.showtime + 0.001f;

        if (num > 0.05f)
        {
            num = 0.05f;
        }
        num *= 20f;
        Matrix4x4 matrix = GUI.matrix;
        Vector3   s      = new Vector3(num, num, 1f);
        Vector3   pos    = new Vector3(MenuShop.rBack.center.x - MenuShop.rBack.center.x * num, MenuShop.rBack.center.y - MenuShop.rBack.center.y * num, 1f);

        GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, s);
        GUIM.DrawBox(MenuShop.rBackHeader, MenuShop.tBlack);
        GUIM.DrawBox(MenuShop.rBackBody, MenuShop.tBlack);
        if (MenuShop.currData != null)
        {
            if (MenuShop.currData.section == 1)
            {
                GUI.DrawTexture(new Rect(MenuShop.rBackHeader.x + GUIM.YRES(8f), MenuShop.rBackHeader.y + GUIM.YRES(8f) + GUIM.YRES(40f), GUIM.YRES(256f), GUIM.YRES(64f)), MenuShop.currData.icon);
            }
            if (MenuShop.currData.section == 2)
            {
                GUI.DrawTexture(new Rect(MenuShop.rBackHeader.x + GUIM.YRES(84f), MenuShop.rBackHeader.y + GUIM.YRES(20f), GUIM.YRES(120f), GUIM.YRES(120f)), MenuShop.currData.icon);
            }
            if (MenuShop.currData.section == 3 || MenuShop.currData.section == 4)
            {
                GUI.DrawTexture(new Rect(MenuShop.rBackHeader.x + GUIM.YRES(64f), MenuShop.rBackHeader.y + GUIM.YRES(8f), GUIM.YRES(160f), GUIM.YRES(160f)), MenuShop.currData.icon);
            }
            if (MenuShop.currData.section == 5)
            {
                GUI.DrawTexture(new Rect(MenuShop.rBackHeader.x + GUIM.YRES(16f), MenuShop.rBackHeader.y - GUIM.YRES(48f), GUIM.YRES(256f), GUIM.YRES(256f)), MenuShop.currData.icon);
                if (GUIM.Button(MenuShop.rView, BaseColor.Blue, string.Empty, TextAnchor.MiddleCenter, BaseColor.White, 0, 0, false))
                {
                    Main.HideAll();
                    MenuPreview.SetActive(true);
                    MenuPreview.Preview(MenuShop.currData);
                }
                GUI.DrawTexture(MenuShop.rView, MenuShop.view);
            }
            if (BaseData.item[MenuShop.currData.wid] == 0)
            {
                BaseColor c = BaseColor.Green;
                if (MenuShop.inbuy)
                {
                    c = BaseColor.Gray;
                }
                if (BaseData.iLevel < MenuShop.currData.level)
                {
                    c = BaseColor.Red;
                }
                if (GUIM.Button(MenuShop.rBuy, c, Lang.Get("_BUY"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true) && BaseData.iLevel >= MenuShop.currData.level)
                {
                    if (GameData.gSteam)
                    {
                        WebHandler.get_buy("&itemid=" + MenuShop.currData.wid.ToString());
                    }
                    else if (GameData.gSocial)
                    {
                        WebHandler.set_buy("&itemid=" + MenuShop.currData.wid.ToString());
                    }
                    MenuShop.inbuy = true;
                }
            }
            else
            {
                GUI.DrawTexture(MenuShop.rBuy, MenuShop.tGray);
                GUIM.DrawText(MenuShop.rBuy, Lang.Get("_ALREADY_HAVE"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, false);
            }
            GUIM.DrawText(new Rect(MenuShop.rBuy.x, MenuShop.rBuy.y - GUIM.YRES(24f), MenuShop.rBuy.width, MenuShop.rBuy.height), Lang.Get("_COST") + ":", TextAnchor.MiddleLeft, BaseColor.White, 1, 12, false);
            string text = string.Format("{0:C}", (float)MenuShop.currData.cost / 100f);
            if (GameData.gSteam)
            {
                GUIM.DrawText(new Rect(MenuShop.rBuy.x, MenuShop.rBuy.y - GUIM.YRES(24f), MenuShop.rBuy.width, MenuShop.rBuy.height), text, TextAnchor.MiddleRight, BaseColor.White, 1, 12, false);
            }
            else if (GameData.gSocial)
            {
                text = MenuShop.CentToGold(MenuShop.currData.cost).ToString();
                GUIM.DrawText(new Rect(MenuShop.rBuy.x, MenuShop.rBuy.y - GUIM.YRES(24f), MenuShop.rBuy.width - GUIM.YRES(14f), MenuShop.rBuy.height), text, TextAnchor.MiddleRight, BaseColor.White, 1, 12, false);
                GUI.DrawTexture(new Rect(MenuShop.rBuy.x + GUIM.YRES(108f), MenuShop.rBuy.y - GUIM.YRES(17f), GUIM.YRES(12f), GUIM.YRES(12f)), MenuShop.tGold);
            }
            GUIM.DrawText(new Rect(MenuShop.rBuy.x, MenuShop.rBackHeader.y + GUIM.YRES(8f), MenuShop.rBuy.width, MenuShop.rBuy.height), MenuShop.currData.name, TextAnchor.MiddleRight, BaseColor.White, 1, 12, false);
        }
        MenuShop.DrawButtonCategory(0, new Rect(MenuShop.rBackBody.x + GUIM.YRES(4f), MenuShop.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_BADGES"), false);
        MenuShop.DrawButtonCategory(1, new Rect(MenuShop.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f), MenuShop.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_MASKS"), false);
        MenuShop.DrawButtonCategory(2, new Rect(MenuShop.rBackBody.x + GUIM.YRES(4f) + GUIM.YRES(84f) * 2f, MenuShop.rBackBody.y + GUIM.YRES(4f), GUIM.YRES(80f), GUIM.YRES(24f)), Lang.Get("_WEAPONS"), false);
        MenuShop.scroll = GUIM.BeginScrollView(new Rect(MenuShop.rBackBody.x + GUIM.YRES(4f), MenuShop.rBackBody.y + GUIM.YRES(32f), MenuShop.rBackBody.width - GUIM.YRES(8f), MenuShop.rBackBody.height - GUIM.YRES(40f)), MenuShop.scroll, new Rect(0f, 0f, 0f, (float)MenuShop.hcount * GUIM.YRES(100f) - GUIM.YRES(4f)));
        int num2 = 0;
        int num3 = 0;

        for (int i = 0; i < 1024; i++)
        {
            if (MenuShop.shopdata[i] != null)
            {
                if (MenuShop.currCat != 0 || MenuShop.shopdata[i].section == 1 || MenuShop.shopdata[i].section == 2)
                {
                    if (MenuShop.currCat != 1 || MenuShop.shopdata[i].section == 3 || MenuShop.shopdata[i].section == 4)
                    {
                        if (MenuShop.currCat != 2 || MenuShop.shopdata[i].section == 5)
                        {
                            MenuShop.DrawItem(new Rect((GUIM.YRES(96f) + GUIM.YRES(4f)) * (float)num2, (GUIM.YRES(96f) + GUIM.YRES(4f)) * (float)num3, GUIM.YRES(96f), GUIM.YRES(96f)), MenuShop.shopdata[i]);
                            num2++;
                            if (num2 >= 4)
                            {
                                num2 = 0;
                                num3++;
                            }
                        }
                    }
                }
            }
        }
        MenuShop.hcount = num3;
        if (num2 != 0)
        {
            MenuShop.hcount++;
        }
        GUIM.EndScrollView();
        GUI.matrix = matrix;
    }