Exemplo n.º 1
0
    void Liste()
    {
        GUI.Box(MultiResolutions.Rectangle(0.59f, 0, 0.20f, 1.0f), "");
        GUI.Label(MultiResolutions.Rectangle(0.67f, 0.3f, 1f, 1f), MultiResolutions.Font(20) + "<b><color=red>List</color></b></size>");
        GUI.Box(MultiResolutions.Rectangle(0.61f, 0.35f, 0.17f, 0.45f), "");

        int filtreLength = 0;

        for (short i = 0; i < inventory.Items.Count; i++)
        {
            if ((((filtre & ItemExtension.FiltreAll) != 0) || (filtre & inventory.Items[i].FiltreSkill) != 0) && inventory.Items[i] is Cast <TModuleType> )
            {
                ++filtreLength;
            }
        }

        itemSelectedIndex = 0;
        scrollPosition    = GUI.BeginScrollView(MultiResolutions.Rectangle(0.61f, 0.35f, 0.17f, 0.45f), scrollPosition,
                                                MultiResolutions.Rectangle(0f, 0f, 0.18f, 0.05f * filtreLength));

        int[] indexes = new int[((int)e_itemCategory.SIZE)];
        for (int offset = 0, i = 0; i < inventory.Items.Count; i++)
        {
            if (((filtre & ItemExtension.FiltreAll) != 0) || (filtre == inventory.Items[i].FiltreSkill))
            {
                string equippedString = "";
                //var stuff = inventory.stuffs[indexes[((int)e_itemCategory.Stuff)]] as AStuff;
                var stuff = inventory.Items[i] as Cast <TModuleType>;


                if (stuff != null)
                {
                    equippedString = StuffGUI <TModuleType> .GetEquippedString(stuff);

                    if (GUI.Button(MultiResolutions.Rectangle(0, offset * 0.05f, 0.17f, 0.05f), MultiResolutions.Font(16) +
                                   equippedString + inventory.Items[i].Name + "</size>"))
                    {
                        AStuff <TModuleType> stuffEquipped = inventory.Items[i] as AStuff <TModuleType>;
                        if (null != stuffEquipped && stuffEquipped is Cast <TModuleType> && stuff.Selected && stuffEquipped.equipmentEmplacement != e_equipmentEmplacement.Both_Hand)
                        {
                            if (rightClick)
                            {
                                stuff.equipmentEmplacement = e_equipmentEmplacement.Left_Hand;
                            }
                            else
                            {
                                stuff.equipmentEmplacement = e_equipmentEmplacement.Right_Hand;
                            }

                            itemMgr.Equip(stuff);
                            stuff.Selected = false;
                        }
                        inventory.Select(i);
                    }
                    offset++;
                }

                if (inventory.Items[i].Selected)
                {
                    itemSelectedIndex = i;
                }
            }
            inventory.Items[i].ModifyItemCategoryIndexes(ref indexes);
        }
        GUI.EndScrollView();
    }