Esempio n. 1
0
    private void OnClickSlot(int slot, GroupData category)
    {
        for (int i = 0; i < slots.Length; i++)
        {
            slots[i].UnselectSlot();
        }

        if (category == sub_bar.GetCurrentCategory())
        {
            sub_bar.Hide();
        }
        else
        {
            selected_slot = slot;
            slots[slot].SelectSlot();
            sub_bar.ShowCategory(category);
        }

        CategorySlot cslot = GetSlot(slot);

        if (onClickSlot != null && cslot != null)
        {
            onClickSlot.Invoke(cslot);
        }
    }
Esempio n. 2
0
    private void OnClickSlotRight(int slot, GroupData category)
    {
        CategorySlot cslot = GetSlot(slot);

        if (onRightClickSlot != null && cslot != null)
        {
            onRightClickSlot.Invoke(cslot);
        }
    }
Esempio n. 3
0
        /// <summary>
        ///     Loads each type in the assembly, finds all tech, and shoves them into a list
        ///     that defines what categories (and tech) should be defined in the weapon wheel.
        /// </summary>
        /// <param name="assembly"></param>
        /// <returns></returns>
        private List <CategorySlot> GetCategorySlotsFromAssembly(Assembly assembly)
        {
            var retVal  = new List <CategorySlot>();
            var types   = assembly.GetTypes();
            var idCount = 0;

            foreach (var type in types)
            {
                if (type.BaseType != typeof(Tech))
                {
                    continue;
                }
                if (!(type.GetCustomAttribute(typeof(WebTechAttribute)) is WebTechAttribute att))
                {
                    continue;
                }
                var tech = (Tech)Activator.CreateInstance(type, Profile);
                var cat  = att.CategoryName;
                var find = retVal.Find(x => x.CategoryName == cat);

                if (find == null)
                {
                    var add = new CategorySlot(cat, idCount, new List <Tech> {
                        tech
                    }, tech);
                    retVal.Add(add);
                    idCount++;
                }
                else
                {
                    find.Tech.Add(tech);
                    find.Tech = find.Tech.OrderByDescending(x => GetWebTechAttribute(x).IsDefault).ToList();
                    find.m_ActivateTech?.Deactivate();
                    find.m_ActivateTech = find.Tech[0];
                }
            }

            return(retVal);
        }