Exemple #1
0
        partial void InitProjSpecific()
        {
            useOnSelfButton = new GUIButton[2];

            if (icons == null)
            {
                icons = TextureLoader.FromFile("Content/UI/inventoryIcons.png");
            }

            SlotPositions = new Vector2[limbSlots.Length];

            int rectWidth = 40, rectHeight = 40;
            int spacing = 10;

            for (int i = 0; i < SlotPositions.Length; i++)
            {
                switch (i)
                {
                //head, torso, legs
                case 0:
                case 1:
                case 2:
                    SlotPositions[i] = new Vector2(
                        spacing,
                        GameMain.GraphicsHeight - (spacing + rectHeight) * (3 - i));
                    break;

                //lefthand, righthand
                case 3:
                case 4:
                    SlotPositions[i] = new Vector2(
                        spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 1),
                        GameMain.GraphicsHeight - (spacing + rectHeight) * 3);

                    useOnSelfButton[i - 3] = new GUIButton(
                        new Rectangle((int)SlotPositions[i].X, (int)(SlotPositions[i].Y - spacing - rectHeight),
                                      rectWidth, rectHeight), TextManager.Get("UseItemButton"), "")
                    {
                        UserData  = i,
                        OnClicked = UseItemOnSelf
                    };


                    break;

                //face
                case 5:
                    SlotPositions[i] = new Vector2(
                        spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5),
                        GameMain.GraphicsHeight - (spacing + rectHeight) * 3);

                    break;

                //id card
                case 6:
                    SlotPositions[i] = new Vector2(
                        spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5),
                        GameMain.GraphicsHeight - (spacing + rectHeight) * 3);

                    break;

                default:
                    SlotPositions[i] = new Vector2(
                        spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 7) % 5),
                        GameMain.GraphicsHeight - (spacing + rectHeight) * ((i > 11) ? 2 : 1));
                    break;
                }
            }
        }