Ejemplo n.º 1
0
 protected void change_craft_source(string save_name)
 {
     if (save_name == "kerbalx_remote")
     {
         KerbalX.load_remote_craft();
         adjust_save_menu_width();
     }
     else
     {
         if (kerbalx_mode)
         {
             KerbalX.load_local();
         }
         if (active_save_dir != save_name)
         {
             active_save_dir = save_name;
             adjust_save_menu_width();
             Tags.load(active_save_dir);
             stock_craft_loaded = false;
             refresh();
         }
     }
 }
Ejemplo n.º 2
0
        protected void populate_new_save_dialog()
        {
            KerbalX.get_craft_ids_by_version((craft_by_version, versions) => {
                string v1                 = versions[0].ToString();
                string v2                 = versions[1].ToString();
                string resp               = "";
                Version ksp_version       = CraftManager.game_version; //new Version(Versioning.GetVersionString());
                KerbalX.log_scroll        = new Vector2();
                KerbalX.bulk_download_log = "";

                show_dialog("Import Craft From KerbalX", "", d => {
                    label("You don't have any craft in this save yet.", "h2");
                    label("Do you want to fetch your craft from KerbalX?", "h2");

                    if (versions[0] == ksp_version)
                    {
                        button("download " + craft_by_version[v1].Count + " craft built in KSP " + ksp_version, () => {
                            KerbalX.bulk_download(craft_by_version[v1], current_save_dir, () => {});
                        });
                    }
                    else
                    {
                        label("You don't have any craft made in this version of KSP");
                        if (v1 != null || v2 != null)
                        {
                            label("get craft from previous versions:");
                            section(() => {
                                if (v1 != null && craft_by_version[v1] != null)
                                {
                                    button("download " + craft_by_version[v1].Count + " craft built in KSP " + v1, () => {
                                        KerbalX.bulk_download(craft_by_version[v1], current_save_dir, () => {});
                                    });
                                }
                                if (v2 != null && craft_by_version[v2] != null)
                                {
                                    button("download " + craft_by_version[v2].Count + " craft built in KSP " + v2, () => {
                                        KerbalX.bulk_download(craft_by_version[v2], current_save_dir, () => {});
                                    });
                                }
                            });
                        }
                    }


                    if (!String.IsNullOrEmpty(KerbalX.bulk_download_log))
                    {
                        KerbalX.log_scroll = scroll(KerbalX.log_scroll, d.window_pos.width, 80f, (w) => {
                            label(KerbalX.bulk_download_log);
                        });
                    }

                    button("OR cherry pick the ones you want", () => {
                        close_dialog();
                        exit_kerbalx_mode_after_close = true;
                        CraftManager.main_ui.show();
                        KerbalX.load_remote_craft();
                    });
                    button("Close", close_dialog);

                    return(resp);
                });
            });
        }