static void _BuildPropertyTabView(EditorControl parent) { VBoxCtrl vb0 = new VBoxCtrl(); vb0.Caption = "属性"; parent.Add(vb0); ComboBoxCtrl <int> deathTypeComboBox = new ComboBoxCtrl <int>(); deathTypeComboBox.Name = s_deathTypeComboBoxName; deathTypeComboBox.Caption = "死亡类型"; deathTypeComboBox.onValueChange = OnDeathTypeComboBoxValueChange; vb0.Add(deathTypeComboBox); VBoxCtrl vb1 = new VBoxCtrl(); vb1.Caption = "骨骼绑定"; parent.Add(vb1); ComboBoxCtrl <int> bindingTargetComboBox = new ComboBoxCtrl <int>(); bindingTargetComboBox.Name = s_bindingTargetComboBoxName; bindingTargetComboBox.Caption = "绑定骨骼"; bindingTargetComboBox.onValueChange = OnBindingTargetComboBoxValueChange; vb1.Add(bindingTargetComboBox); TextBoxCtrl bindingTargetTextBox = new TextBoxCtrl(); bindingTargetTextBox.Name = s_bindingTargetTextBoxName; bindingTargetTextBox.Caption = "绑定骨骼路径"; bindingTargetTextBox.Enable = false; vb1.Add(bindingTargetTextBox); }
public static ActionResult SqlServerListUI(Session session) { var Ctx = session; var SrvList = new ComboBoxCtrl(Ctx, "DB_SERVER"); foreach (var Srv in GetSqlInstances()) { SrvList.AddItem(Srv); } return(ActionResult.Success); }
static void UpdateDebugCombobox() { ComboBoxCtrl <int> debugCombo = s_root.FindControl("_DebugCombo") as ComboBoxCtrl <int>; if (null == debugCombo) { return; } if (EditorHelper.IsDebugMode()) { debugCombo.CurrValue = 0; } else { debugCombo.CurrValue = 1; } }
/* * 搜索框 */ //Modify by lteng for 追加共通控件 At 2015/2/26 static void OnSearchTextBoxChange(EditorControl c, object value) { TextBoxCtrl searchBox = s_root.FindControl("_SearchBox") as TextBoxCtrl; ComboBoxCtrl <int> typeFilterComboBox = s_root.FindControl("_AssetTypeCombo") as ComboBoxCtrl <int>; typeFilterComboBox.CurrValue = 0; if (searchBox.Text.Length == 0) { ResourceManageToolModel.GetInstance().SetFilter(0); } else { AssetNameFilter nameFilter = new AssetNameFilter(); nameFilter.SearchText = searchBox.Text; ResourceManageToolModel.GetInstance().SetFilter(nameFilter); } RequestRepaint(); }
public static ActionResult DbListUI(Session session) { string tmp; var Ctrl = new ComboBoxCtrl(session, "DB_SELECT"); if (CheckConnection(session["DB_CONN"], out tmp)) { foreach (var Db in GetDbList(ConnStr: session["DB_CONN"], ForbiddenNames: SysDb)) { Ctrl.AddItem(Db); session["DB_SELECT"] = Db; // Adds available DBs to installer log and selects latest. } } else { session["DB_SELECT"] = ""; } return(ActionResult.Success); }
public ComboBoxCtrl Ctrl; ///< Contaons the element's controller. /// <summary> /// Called by framework. Do not call directly. /// </summary> public void OnAwake() { BgPanel = SceneObject.Instantiate <Panel> (this); BgPanel.Background.Source = ResourceManager.ImageFromFile(Application.UIPath + "" + "button.png", false); BgPanel.Background.SliceType = SliceType.Nine; BgPanel.Background.Color = Color.Gray.WithAlpha(0.75f); BgPanel.RectTransform.Alignment = Alignment.Stretch; BgPanel.RectTransform.Spacing = new Rect() { w = 20 }; BgPanel.RectTransform.ClampMode = ClampMode.Full; Ctrl = AddComponent <ComboBoxCtrl> (); _button = SceneObject.Instantiate <Button> (this); _button.RectTransform.Alignment = Alignment.Right; _button.RectTransform.Size = new Point(25, 22); _button.RectTransform.Padding = new Padding(-13, 0); _button.RectTransform.Spacing = new Rect() { x = 6 }; _button.RectTransform.ClampMode = ClampMode.Full; _button.Image = ResourceManager.ImageFromFile(Application.UIPath + "" + "arrow_dn.png"); RectTransform.Alignment = Alignment.TopHStretch; RectTransform.Size = new Point(0, 22); RectTransform.ClampMode = ClampMode.Full; _frame = SceneObject.Instantiate <Panel>(this); _frame.Background.Source = ResourceManager.ImageFromFile(Application.UIPath + "frame.png", false); _frame.Background.SliceType = SliceType.Nine; _frame.Background.Color = Color.SkyBlue; _frame.RectTransform.Alignment = Alignment.Stretch; _frame.RectTransform.ClampMode = ClampMode.Full; _frame.Active = false; _frame.RectTransform.Padding = new Padding(2, 2, 3, 2); _button.Ctrl.Enabled = false; Ctrl.OnFocusEnter += EnterFocus; Ctrl.OnFocusLost += LeaveFocus; }
public static ActionResult DbListUI(Session session) { string tmp; var Ctrl = new ComboBoxCtrl(session, "DB_SELECT"); if (Adapter.CheckConnectionInfo(session["DB_CONN"], out tmp)) foreach (var Db in GetDbList(ConnStr: session["DB_CONN"], ForbiddenNames: SysDb)) { Ctrl.AddItem(Db); session["DB_SELECT"] = Db; // Adds available DBs to installer log and selects latest. } else session["DB_SELECT"] = ""; return ActionResult.Success; }
public static ActionResult SqlServerListUI(Session session) { var Ctx = session; var SrvList = new ComboBoxCtrl(Ctx, "DB_SERVER"); foreach (var Srv in GetSqlInstances()) SrvList.AddItem(Srv); return ActionResult.Success; }
public static void InitControls(EditorRoot editorRoot) { s_root = editorRoot; //s_root.position = new Rect(100f, 100f, 1024, 768f); s_root.onDestroy = OnDestroy; s_root.onEnable = OnEnable; Rect btnRect = new Rect(0, 0, 80, 20); Rect comboBoxRect = new Rect(0, 0, 100, 20); //Modify by liteng for 发布工具改善Start #region 创建布置窗口元素 #region 第一级 HSpliterCtrl hs1 = new HSpliterCtrl(); hs1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f); HSpliterCtrl hs2 = new HSpliterCtrl(); hs2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true); HBoxCtrl hb1 = new HBoxCtrl(); //布置上方菜单条 HBoxCtrl hb2 = new HBoxCtrl(); //布置主窗口 HBoxCtrl hb3 = new HBoxCtrl(); //布置下方状态栏 #endregion #region 第二级 VSpliterCtrl vs2_1 = new VSpliterCtrl(); vs2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f); vs2_1.Dragable = true; VBoxCtrl vb2_1 = new VBoxCtrl(); //资源视图 VBoxCtrl vb2_2 = new VBoxCtrl(); //发布信息视图 #endregion #endregion #region 布置窗口(由高至低布置) #region 第二级 TreeViewCtrl m_treeView = new TreeViewCtrl(); //资源列表 m_treeView.Name = "_MainTreeView"; m_treeView.onValueChange = OnTreeViewNodeToggle; InspectorViewCtrl m_inspector = new InspectorViewCtrl(); //发布信息视图 m_inspector.Name = "_Inspector"; m_inspector.onInspector = OnInspector; vb2_1.Add(m_treeView); vb2_2.Add(m_inspector); vs2_1.Add(vb2_1); vs2_1.Add(vb2_2); hb2.Add(vs2_1); #endregion #region 第一级 //[导出]按钮 ButtonCtrl exportBtn = new ButtonCtrl(); exportBtn.Caption = "导出"; exportBtn.Name = "_ExportButton"; exportBtn.Size = btnRect; exportBtn.onClick = OnExportBtnClick; //[发布]按钮 //ButtonCtrl publishBtn = new ButtonCtrl(); //publishBtn.Caption = "发布"; //publishBtn.Name = "_PublishButton"; //publishBtn.Size = btnRect; //publishBtn.onClick = OnPublishBtnClick; //[配置AB路径]按钮 //ButtonCtrl configPublishBtn = new ButtonCtrl(); //configPublishBtn.Caption = "配置AB路径"; //configPublishBtn.Name = "_ConfigPublishButton"; //configPublishBtn.Size = btnRect; //configPublishBtn.onClick = OnConfigPublishPathBtnClick; //版本下拉菜单 ComboBoxCtrl <int> debugCombo = new ComboBoxCtrl <int>(0); debugCombo.Size = comboBoxRect; debugCombo.Name = "_DebugCombo"; debugCombo.onValueChange = OnDebugComboSelect; debugCombo.AddItem(new ComboItem("Debug", 0)); debugCombo.AddItem(new ComboItem("Release", 1)); hb1.Add(exportBtn); //hb1.Add(publishBtn); //hb1.Add(configPublishBtn); hb1.Add(debugCombo); hs1.Add(hb1); hs1.Add(hs2); hs2.Add(hb2); hs2.Add(hb3); #endregion #endregion s_root.RootCtrl = hs1; UpdateDebugCombobox(); PackageExportToolModel.GetInstance().onExportComplete = OnExportComplete; //Modify by liteng for 发布工具改善 end #region 原有代码 //HSpliterCtrl hspliter = new HSpliterCtrl(); //hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true); //上方树状视图 //VBoxCtrl vb0 = new VBoxCtrl(); //hspliter.Add(vb0); ////下方工具条 //HBoxCtrl hb0 = new HBoxCtrl(); //hspliter.Add(hb0); //TreeViewCtrl treeView = new TreeViewCtrl(); //treeView.Name = "_MainTreeView"; //vb0.Add(treeView); //TextBoxCtrl tbVersion = new TextBoxCtrl(); //tbVersion.Size = new Rect(0, 0, 30, 20); //tbVersion.Name = "_VersionBox"; //tbVersion.Caption = "版本号"; //tbVersion.Enable = true; //tbVersion.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50); //TextBoxCtrl tbFileName = new TextBoxCtrl(); //tbFileName.Size = new Rect(0, 0, 60, 20); //tbFileName.Name = "_SaveFileName"; //tbFileName.Caption = "输出文件"; //tbFileName.Enable = true; //tbFileName.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50); //Rect btnRect = new Rect(0, 0, 60, 20); //ButtonCtrl ChooseFileBtn = new ButtonCtrl(); //ChooseFileBtn.Caption = "选择"; //ChooseFileBtn.Name = "_ChooseFileName"; //ChooseFileBtn.Size = btnRect; //ChooseFileBtn.onClick = OnChooseFileNameButtonClick; //ButtonCtrl okBtn = new ButtonCtrl(); //okBtn.Caption = "确定"; //okBtn.Name = "_OkButton"; //okBtn.Size = btnRect; //okBtn.onClick = OnOkButtonClick; //ButtonCtrl cancelBtn = new ButtonCtrl(); //cancelBtn.Caption = "取消"; //cancelBtn.Name = "_CancelButton"; //cancelBtn.Size = btnRect; //cancelBtn.onClick = OnCancelButtonClick; //hb0.Add(tbVersion); //hb0.Add(tbFileName); //hb0.Add(ChooseFileBtn); //hb0.Add(okBtn); //hb0.Add(cancelBtn); #endregion }
public static void InitControls(EditorRoot root) { /*将编辑器分为上下两个区域*/ HSpliterCtrl Upanddown = new HSpliterCtrl(); root.RootCtrl = Upanddown; Upanddown.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f); #region 编辑器事件回调 /*编辑器初始化事件*/ root.onEnable += EditorWindowOnEnable; /*编辑器关闭事件*/ root.onDestroy += EditorWindowOnDestroy; #endregion #region 编辑器的上边 /*存放上方资源的容器*/ HBoxCtrl upspliter = new HBoxCtrl(); Upanddown.Add(upspliter); /*扫描资源按钮*/ Rect SearchBtnRect = new Rect(0, 0, 160, 20); ButtonCtrl SearchBtn = new ButtonCtrl(); SearchBtn.onClick = SearchBtnClickEvent; SearchBtn.Size = SearchBtnRect; SearchBtn.Visiable = true; SearchBtn.Caption = "扫描资源"; SearchBtn.Name = "_SearchButton"; /*下拉菜单,过滤器*/ Rect ComboxFliterRect = new Rect(0, 0, 120, 20); ComboBoxCtrl <int> TypeFliter = new ComboBoxCtrl <int>(0); TypeFliter.Size = ComboxFliterRect; TypeFliter.Name = "_TypeFliter"; TypeFliter.onValueChange += FilterOnchange; for (int i = 0; i <= 3; i++) { TypeFliter.AddItem(new ComboItem("选项0", 0)); TypeFliter.AddItem(new ComboItem("选项1", 1)); TypeFliter.AddItem(new ComboItem("选项2", 2)); TypeFliter.AddItem(new ComboItem("选项3", 3)); } TypeFliter.CurrValue = 0; /*数据库状态显示*/ LabelCtrl StateLabel = new LabelCtrl(); StateLabel.Caption = "数据库没有更新,请点击刷新资源数据库"; StateLabel.Name = "_StateLabel"; /*将控件放入上方资源*/ upspliter.Add(SearchBtn); upspliter.Add(TypeFliter); upspliter.Add(StateLabel); #endregion #region 编辑器的下边 /*将下放资源分为左右两个区域*/ VSpliterCtrl downspliter = new VSpliterCtrl(); Upanddown.Add(downspliter); downspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f); downspliter.Dragable = true; /*存放左侧资源列表和无引用资源的容器*/ VBoxCtrl LeftAssetContainer = new VBoxCtrl(); downspliter.Add(LeftAssetContainer); /*左侧两枚选项卡*/ TabViewCtrl leftTabView = new TabViewCtrl(); LeftAssetContainer.Add(leftTabView); /*资源列表*/ TreeViewCtrl AssetsTreeView = new TreeViewCtrl(); AssetsTreeView.Caption = "资源列表"; AssetsTreeView.Name = "_AssetList"; leftTabView.Add(AssetsTreeView); /*无用资源列表*/ ListViewCtrl UseLessAssetsList = new ListViewCtrl(); UseLessAssetsList.Caption = "无用资源"; UseLessAssetsList.Name = "_UseLessAssetsList"; leftTabView.Add(UseLessAssetsList); /*存放正向反向资源依赖关系的容器*/ VBoxCtrl RightAssetDependceContainer = new VBoxCtrl(); downspliter.Add(RightAssetDependceContainer); /*右侧两枚选项卡*/ TabViewCtrl rightTabView = new TabViewCtrl(); RightAssetDependceContainer.Add(rightTabView); /*资源正向依赖关系列表*/ ListViewCtrl DependcyAssetsList = new ListViewCtrl(); DependcyAssetsList.Caption = "正向依赖关系"; DependcyAssetsList.Name = "_DependAssetsList"; rightTabView.Add(DependcyAssetsList); /*资源反向依赖关系列表*/ ListViewCtrl DedependcyAssetsList = new ListViewCtrl(); DedependcyAssetsList.Caption = "反向依赖关系"; DedependcyAssetsList.Name = "_DedependcyAssetsList"; rightTabView.Add(DedependcyAssetsList); #endregion }
//这个方法就是利用EditorManager回调回来的一个EditorRoot实例; //构建了一个树形结构; public static void InitControls(EditorRoot editorRoot) { //将之前实例化的那个EditorWindow赋值给s_root s_root = editorRoot; //s_root.position = new Rect(100f, 100f, 1024, 768f); {//对编辑器全局消息响应; EditorApplication.projectWindowItemOnGUI += OnProjectWindowItem; EditorApplication.projectWindowChanged += OnProjectWindowChanged; } {//协程回调 s_root.onCoroutineMessage = OnCoroutineMessage; s_root.onCoroutineTaskFinished = OnCoroutineTaskFinished; s_root.onDestroy = OnDestroy; s_root.onEnable = OnEnable; } {//注册数据库变化回调 ResourceManageToolModel.GetInstance().onResourceDBUpdate = OnAssetDatabaseUpdate; ResourceManageToolModel.GetInstance().onResrouceDBStateChange = OnAssetDatabaseStateChange; } HSpliterCtrl hspliter = new HSpliterCtrl(); s_root.RootCtrl = hspliter; hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f); //用来放置上方菜单 HBoxCtrl hb0 = new HBoxCtrl(); VSpliterCtrl vspliter = new VSpliterCtrl(); vspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f); vspliter.Dragable = true; hspliter.Add(hb0); hspliter.Add(vspliter); //用来存放 资源列表、无引用资源列表 VBoxCtrl vb0 = new VBoxCtrl(); //用来存放 资源依赖项、反向引用 VBoxCtrl vb1 = new VBoxCtrl(); vspliter.Add(vb0); vspliter.Add(vb1); //左侧TabView TabViewCtrl leftTabView = new TabViewCtrl(); //右侧TabView TabViewCtrl rightTabView = new TabViewCtrl(); vb0.Add(leftTabView); vb1.Add(rightTabView); //资源列表 TreeViewCtrl resTreeList = new TreeViewCtrl(); resTreeList.Caption = "资源列表"; resTreeList.Name = "_ResTreeList"; resTreeList.onItemSelected = OnResourcesTreeViewSelectChanged; //无引用资源列表 ListViewCtrl unUsedList = new ListViewCtrl(); unUsedList.Caption = "无引用资源"; unUsedList.Name = "_UnUsedResList"; unUsedList.onItemSelected = OnUnUsedResourcesListViewSelectChanged; leftTabView.Add(resTreeList); leftTabView.Add(unUsedList); //资源依赖项 TreeViewCtrl resRefTreeView = new TreeViewCtrl(); resRefTreeView.Caption = "资源依赖项"; resRefTreeView.Name = "_ResRefTreeView"; //反向引用 TreeViewCtrl resReverseRefTreeView = new TreeViewCtrl(); resReverseRefTreeView.Caption = "反向引用"; resReverseRefTreeView.Name = "_ResReverseRefTreeView"; rightTabView.Add(resRefTreeView); rightTabView.Add(resReverseRefTreeView); Rect btnRect = new Rect(0, 0, 120, 20); ButtonCtrl searchBtn = new ButtonCtrl(); searchBtn.Name = "_SearchAllResources"; searchBtn.Caption = "扫描资源!"; searchBtn.Size = btnRect; searchBtn.onClick += OnSearchAllAssets; searchBtn.BtnColor = Color.green; searchBtn.Visiable = true; Rect comboBoxRect = new Rect(0, 0, 100, 20); ComboBoxCtrl <int> assetTypeCombo = new ComboBoxCtrl <int>(0); assetTypeCombo.Size = comboBoxRect; assetTypeCombo.Name = "_AssetTypeCombo"; assetTypeCombo.onValueChange = OnFilterComboSelectChanged; List <IAssetFilter> assetFilters = ResourceManageToolModel.GetInstance().AssetFilterList; foreach (var filter in assetFilters) { AssetTypeFilter f = filter as AssetTypeFilter; assetTypeCombo.AddItem(new ComboItem(f.DisplayTypeName, f.TypeIndex)); } assetTypeCombo.CurrValue = 0; TextBoxCtrl searchTextBox = new TextBoxCtrl(); searchTextBox.Size = comboBoxRect; searchTextBox.Icon = UnityInternalIconCache.GetInstance().GetCacheIcon("d_ViewToolZoom"); searchTextBox.Name = "_SearchBox"; searchTextBox.Caption = "搜索"; searchTextBox.Visiable = true; searchTextBox.onValueChange = OnSearchTextBoxChange; ButtonCtrl helpBtn = new ButtonCtrl(); helpBtn.Name = "_HelpButton"; helpBtn.Caption = "帮助文档"; helpBtn.onClick = OnHelp; helpBtn.Size = btnRect; helpBtn.Visiable = true; LabelCtrl stateLabel = new LabelCtrl(); stateLabel.Name = "_StateLabel"; stateLabel.textColor = Color.red; stateLabel.Caption = "数据库没有更新,无法查看无用资源列表与反向引用!"; stateLabel.layoutConstraint = LayoutConstraint.GetExtensibleViewConstraint(); hb0.Add(searchBtn); hb0.Add(assetTypeCombo); hb0.Add(searchTextBox); hb0.Add(helpBtn); hb0.Add(stateLabel); }