示例#1
0
    /// <summary>
    /// Loads all the groups.
    /// </summary>
    public static void LoadGroups()
    {
        // Load Settings
        allGroups = new Dictionary <PerformanceGroup, BasePerformanceHUDComponent[]>();

        List <PerformanceGroup> groups = PrototypeManager.PerformanceHUD.Values;

        allGroups.Add(new PerformanceGroup("None", new List <UIComponent>()), new BasePerformanceHUDComponent[0]);
        List <BasePerformanceHUDComponent> elements = new List <BasePerformanceHUDComponent>();

        // Convert the dictionary of specialised elements to a more generalised format
        for (int i = 0; i < groups.Count; i++)
        {
            for (int j = 0; j < groups[i].componentData.Count; j++)
            {
                BasePerformanceHUDComponent element = FunctionsManager.PerformanceHUD.CreateInstance <BasePerformanceHUDComponent>(groups[i].componentData[j].Type, true);
                element.parameterData = groups[i].componentData[j].Parameters;
                element.InitializeLUA();
                elements.Add(element);
            }

            allGroups.Add(groups[i], elements.ToArray());
            elements.Clear();
        }
    }
示例#2
0
    /// <summary>
    /// Loads all the groups.
    /// </summary>
    public static void LoadGroups()
    {
        // Load Settings
        allGroups = new Dictionary <PerformanceGroup, BasePerformanceHUDComponent[]>();

        List <PerformanceGroup> groups = PrototypeManager.PerformanceHUD.Values;

        allGroups.Add(new PerformanceGroup("None", new List <UIClassData>()), new BasePerformanceHUDComponent[0]);
        List <BasePerformanceHUDComponent> elements = new List <BasePerformanceHUDComponent>();

        // Convert the dictionary of specialised elements to a more generalised format
        for (int i = 0; i < groups.Count; i++)
        {
            for (int j = 0; j < groups[i].classData.Count; j++)
            {
                if (FunctionsManager.PerformanceHUD.HasFunction("Get" + groups[i].classData[j].ClassName))
                {
                    BasePerformanceHUDComponent element = FunctionsManager.PerformanceHUD.Call("Get" + groups[i].classData[j].ClassName).ToObject <BasePerformanceHUDComponent>();
                    element.parameterData = groups[i].classData[j].ParameterData;
                    element.InitializeLUA();
                    elements.Add(element);
                }
                else
                {
                    Debug.LogWarning("Get" + groups[i] + groups[i].classData[j].ClassName + "() Doesn't exist");
                }
            }

            allGroups.Add(groups[i], elements.ToArray());
            elements.Clear();
        }
    }