Exemplo n.º 1
0
        //build dropdown list of stored vessels
        void build_vessel_list(HangarMachinery hangar)
        {
            //reset stat
            vessels.Clear();
            select_vessel(null);
            //check hangar
            if (hangar == null)
            {
                return;
            }
            //build new list
            vessels = hangar.GetVessels();
            if (vessels.Count == 0)
            {
                return;
            }
            select_vessel(vessels.Find(v => v.id == vessel_id));
            if (selected_vessel == null)
            {
                select_vessel(vessels[0]);
            }
            var vessel_names = new List <string>();

            for (int i = 0; i < vessels.Count; i++)
            {
                vessel_names.Add(string.Format("{0} {1}\n", i + 1, vessels[i].name));
            }
            vessels_tooltip = string.Concat(vessel_names.ToArray());
        }
Exemplo n.º 2
0
 void select_hangar(HangarMachinery hangar)
 {
     if (selected_hangar != hangar)
     {
         if (highlight_hangar == HighlightState.Enable)
         {
             highlight_hangar = HighlightState.Disable;
             highlight_parts();
             highlight_hangar = HighlightState.Enable;
         }
         selected_hangar = hangar;
         hangar_id       = hangar.part.flightID;
         build_vessel_list(selected_hangar);
     }
 }
Exemplo n.º 3
0
        //build dropdown list of all hangars in the vessel
        void build_hangar_list(Vessel vsl)
        {
            //save selected hangar
            HangarMachinery prev_selected = selected_hangar;

            //reset state
            hangars.Clear();
            selected_hangar = null;
            //check the vessel
            if (vsl == null)
            {
                return;
            }
            //build new list
            vsl.Parts.ForEach(p => hangars.AddRange(p.Modules.OfType <HangarMachinery>().Where(h => h.enabled && !h.NoGUI)));
            if (hangars.Count > 0)
            {
                selected_hangar = hangars.Find(h => h.part.flightID == hangar_id);
                if (selected_hangar == null)
                {
                    selected_hangar = hangars[0];
                }
                var hangar_names = new List <string>();
                for (int i = 0; i < hangars.Count; i++)
                {
                    var h_name = hangars[i].HangarName == string.Empty ? "Unnamed Hangar" : hangars[i].HangarName;
                    hangar_names.Add(string.Format("{0} {1}\n", i + 1, h_name));
                }
                hangars_tooltip = string.Concat(hangar_names.ToArray());
            }
            //clear highlight of previously selected hangar
            if (highlight_hangar == HighlightState.Disable && prev_selected != null && selected_hangar != prev_selected)
            {
                prev_selected.part.SetHighlightDefault();
            }
        }
Exemplo n.º 4
0
 public static void SelectHangar(HangarMachinery hangar)
 {
     Instance.select_hangar(hangar);
 }