private void Draw_Splash() { GUILayout.Label("Tina X6 Framework", mStyle_Title); GUILayout.BeginHorizontal(); if (GUILayout.Button("文档", mStyle_ButtonText)) { Application.OpenURL(FrameworkInfo.Framework_Url_Doc); } if (GUILayout.Button("安装", mStyle_ButtonText)) { mPageIndex = E_PageIndex.install; } GUILayout.EndHorizontal(); GUILayout.Space(200); }
private Dictionary <string, bool> mDict_Install_Selectable_Tag = new Dictionary <string, bool>(); //如果一个项目是可选安装,就会存放在这里,来表示用户选择是否安装 private void Draw_Install() { GUILayout.Space(10); //绘制安装项目 foreach (var item in SystemInstallRegister.RegItems) { if (!mDict_Install_status.ContainsKey(item.Name)) { mDict_Install_status.Add(item.Name, false); if (item.IsInstalled != null) { mDict_Install_status[item.Name] = item.IsInstalled(); } } if (item.Selectable) { //可选安装 if (!mDict_Install_Selectable_Tag.ContainsKey(item.Name)) //初始值 { mDict_Install_Selectable_Tag.Add(item.Name, item.DefaultSelect); } if (mDict_Install_status[item.Name]) { //已安装 GUILayout.Label("-" + item.Name + " [√]"); } else { //未安装 GUILayout.BeginHorizontal(); GUILayout.Label("-" + item.Name + " [-]"); if (mDict_Install_Selectable_Tag[item.Name]) { //选择了安装 GUILayout.Label("计划:安装"); if (GUILayout.Button("不要安装", GUILayout.MaxWidth(80))) { mDict_Install_Selectable_Tag[item.Name] = false; } } else { //选择了不安装 GUILayout.Label("计划:不安装"); if (GUILayout.Button("安装", GUILayout.MaxWidth(80))) { mDict_Install_Selectable_Tag[item.Name] = true; } } GUILayout.EndHorizontal(); } } else { if (mDict_Install_status[item.Name]) { //已安装 GUILayout.Label("-" + item.Name + " [√]"); } else { //未安装 GUILayout.Label("-" + item.Name + " [-]"); } } } GUILayout.Space(20); if (GUILayout.Button("开始安装", mStyle_ButtonText)) { Folder.CreateFolder("Assets/Resources/" + TinaX.Setup.Framework_Config_Path); foreach (var item in SystemInstallRegister.RegItems) { //检查是否已安装 if (!mDict_Install_status[item.Name]) { //没安装,看看是否是可选安装 if (item.Selectable) { //是 if (mDict_Install_Selectable_Tag[item.Name]) { //要安装 item.DoInstall(); mDict_Install_status[item.Name] = true; } } else { //不是,无脑装 item.DoInstall(); mDict_Install_status[item.Name] = true; } } } //然后我们来处理一下base_config Config.CreateIfNotExist <TinaX.Core.XBaseConfig>(TinaX.Conf.ConfigPath.base_config); mPageIndex = E_PageIndex.install_success; } }