Exemplo n.º 1
0
        private void ReloadCompartments()
        {
            targ.compartments.Clear();

            for (int i = 0; i < targ.frame.compartments.Length; i++)
            {
                CompartmentBlueprint newPrint = new CompartmentBlueprint(targ.frame.compartments[i]);
                targ.compartments.Add(newPrint);
            }
        }
Exemplo n.º 2
0
        private void OnDisplayCompartments()
        {
            showCompartments = EditorGUILayout.Foldout(showCompartments, "Show Compartments and Gear");
            if (!showCompartments)
            {
                return;
            }

            if (targ.compartments == null)
            {
                return;
            }

            for (int compInd = 0; compInd < targ.compartments.Count; compInd++)
            {
                CompartmentBlueprint currComp = targ.compartments[compInd];
                GUILayout.BeginVertical("Compartment " + compInd + ", " + currComp.settings.displayName, "window");

                int totalSlots = currComp.TotalSlots;
                int usedSlots  = currComp.UsedSlots;

                // Turn text red if using too many slots
                GUIStyle slotsLabelStyle = new GUIStyle(EditorStyles.label);
                if (usedSlots > totalSlots)
                {
                    slotsLabelStyle.normal.textColor = Color.red;
                }

                EditorGUILayout.LabelField("Slots, used/total:  " + usedSlots + " / " + totalSlots, slotsLabelStyle);
                EditorGUILayout.Space();

                if (GUILayout.Button("Add Gear"))
                {
                    currComp.gears.Add(null);
                }

                EditorGUILayout.Space();

                for (int gearInd = 0; gearInd < currComp.gears.Count; gearInd++)
                {
                    DisplayGear(currComp.gears, gearInd);
                }

                GUILayout.EndVertical();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
        }