public ScrewItTopDownView() { Root = new VisualElement { style = { flexGrow = 1 } }; m_ThreadSelection = new ToolbarMenu { text = "Select Thread" }; m_ToolbarItems.Add(m_ThreadSelection); m_ColumnHeader = new MultiColumnHeader(CreateHeaderState()) { canSort = false }; m_TreeView = new TopDownTreeView(new TreeViewState(), m_ColumnHeader); m_TreeView.Reload(); var treeContainer = new IMGUIContainer { style = { flexGrow = 1 } }; treeContainer.onGUIHandler = () => m_TreeView.OnGUI(treeContainer.contentRect); m_ColumnHeader.ResizeToFit(); Root.Add(treeContainer); }
private void DrawFileMenu() { VisualElement tree = mVisualTree.CloneTree(); ToolbarMenu menu = tree.Q <ToolbarMenu>("menu"); if (menu == null) { MessageBox.Error("未获取到ToolbarMenu"); return; } Type type = typeof(FILE_MENU); foreach (var temp in Enum.GetValues(type)) { var field = type.GetField(temp.ToString()); if (field == null) { menu.menu.InsertAction((int)temp, "null", FileMenuAction); continue; } var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute; menu.menu.InsertAction((int)temp, attribute.Description, FileMenuAction, MenuStatusAction, temp); } menu.styleSheets.Add(mCommonStyle); mRoot.Add(menu); }
public BuilderNewSelectorField() { AddToClassList(s_UssClassName); styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(s_UssPath)); #if UNITY_2019_2 styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(s_UssPath2019_2)); if (EditorGUIUtility.isProSkin) { styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(s_UssPathDark2019_2)); } else { styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(s_UssPathLight2019_2)); } #endif var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(s_UxmlPath); template.CloneTree(this); m_TextField = this.Q <TextField>(s_TextFieldName); var popupContainer = this.Q(s_OptionsPopupContainerName); m_OptionsPopup = new ToolbarMenu(); m_OptionsPopup.AddToClassList(s_OptionsPopupUssClassName); popupContainer.Add(m_OptionsPopup); SetUpPseudoStatesMenu(); m_OptionsPopup.text = ":"; m_OptionsPopup.SetEnabled(false); m_TextField.RegisterValueChangedCallback <string>(OnTextFieldValueChange); }
private void PopulateFileMenuDropdown(ToolbarMenu dropdown) { if (AssetDatabase.IsValidFolder(pathToResources + conversationFolder)) { DirectoryInfo directory = new DirectoryInfo(pathToResources + conversationFolder); FileInfo[] fileInfo = directory.GetFiles("*.*", SearchOption.AllDirectories); bool filesFound = false; foreach (FileInfo file in fileInfo) { if (file.Extension == ".asset") { string directoryFileName = file.Name.Remove(file.Name.Length - 6); filesFound = true; dropdown.menu.AppendAction(directoryFileName, evt => LoadFile(directoryFileName)); } } if (filesFound) { dropdown.SetEnabled(true); } else { Debug.Log("No files found at " + pathToResources + conversationFolder); dropdown.SetEnabled(false); } } else { Debug.Log("Unable to find the CONVERSATION folder at " + pathToResources + conversationFolder); dropdown.SetEnabled(false); } }
public ActionGraphView(GraphEditor window) { toolbar = new Toolbar(); runningEntityMenu = new ToolbarMenu(); runningEntityMenu.text = "None"; //menu.menu.AppendAction("abc1", action, DropdownMenuAction.Status.Checked ); //menu.menu.AppendAction("abc2", action, DropdownMenuAction.Status.Normal); toolbar.Add(runningEntityMenu); Add(toolbar); this.AddManipulator(new ContentZoomer() { minScale = 0.5f, maxScale = 1.5f }); this.AddManipulator(new ContentDragger()); this.AddManipulator(new SelectionDragger()); this.StretchToParentSize(); CurrentWindow = window; styleSheets.Add(Resources.Load <StyleSheet>("ActionFlowStyle")); // this.AddElement(new EditorActionNode()); nodeCreationRequest += creationRequestHandler; graphViewChanged += graphViewChangedHandler; viewTransformChanged += viewTransformChangedHandler; }
// Generate node creation toolbar private void GenerateNodeToolbar() { Toolbar toolbar = new Toolbar(); // Behaviour name field TextField behaviourNameField = new TextField(); behaviourNameField.label = "Behaviour Name: "; behaviourNameField.labelElement.style.color = Color.black; behaviourNameField.SetValueWithoutNotify(_newBehaviourName); behaviourNameField.MarkDirtyRepaint(); behaviourNameField.RegisterValueChangedCallback(evt => _newBehaviourName = evt.newValue); toolbar.Add(behaviourNameField); // Create new node menu ToolbarMenu menu = new ToolbarMenu(); menu.text = "Create New Behaviour"; menu.menu.AppendAction("New Behaviour", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Action); }); menu.menu.AppendAction("New Composite", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Composite); }); menu.menu.AppendAction("New Decorator", x => { _graphView.CreateNewNode(_newBehaviourName, NodeTypes.Decorator); }); toolbar.Add(menu); Button button = new Button(() => { SearchWindow.Open(new SearchWindowContext(mouseOverWindow.position.position), _graphView._addNodeSearchWindow); }); button.text = "Add existing node"; toolbar.Add(button); rootVisualElement.Add(toolbar); }
public FormMain() { InitializeComponent(); m_pMapC2 = axMapControl_Main.GetOcx() as IMapControl2; m_pMapDoc = new MapDocumentClass(); m_pToolbarMenu = new ToolbarMenu();; }
public SamplerElement(SerializedProperty property, Parameter parameter) { m_Property = property; var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>( $"{StaticData.uxmlDir}/Sampler/SamplerElement.uxml"); template.CloneTree(this); m_Parameter = parameter; m_Sampler = GetSamplerFromSerializedObject(); if (m_Sampler == null) { CreateSampler(typeof(UniformSampler)); } var samplerName = this.Q <Label>("sampler-name"); samplerName.text = UppercaseFirstLetter(m_Property.name); m_Properties = this.Q <VisualElement>("fields-container"); m_SamplerTypeDropdown = this.Q <ToolbarMenu>("sampler-type-dropdown"); m_SamplerTypeDropdown.text = SamplerUtility.GetSamplerDisplayName(m_Sampler.GetType());; foreach (var samplerType in StaticData.samplerTypes) { var displayName = SamplerUtility.GetSamplerDisplayName(samplerType);; m_SamplerTypeDropdown.menu.AppendAction( displayName, a => { ReplaceSampler(samplerType); }, a => DropdownMenuAction.Status.Normal); } CreatePropertyFields(); }
void BuildMultipleOrganizationsSection(List <string> organizationNames) { this.Query <VisualElement>("joinMultipleOrganizations").First().RemoveFromClassList("display-none"); this.SetControlText <Label>("joinMultipleOrganizationsLabel", PlasticLocalization.Name.YouBelongToSeveralOrganizations); VisualElement organizationDropdown = this.Query <VisualElement>("organizationDropdown").First(); ToolbarMenu toolbarMenu = new ToolbarMenu { text = organizationNames.FirstOrDefault() }; foreach (string name in organizationNames) { toolbarMenu.menu.AppendAction(name, x => { toolbarMenu.text = name; mOrganizationToJoin = name; }, DropdownMenuAction.AlwaysEnabled); organizationDropdown.Add(toolbarMenu); } this.SetControlText <Button>("joinMultipleOrganizationsButton", PlasticLocalization.Name.JoinButton); }
public void Initialize(EditorWindow debuggerWindow) { m_DebuggerWindow = debuggerWindow; if (m_Toolbar == null) { m_Toolbar = new Toolbar(); } // Register panel choice refresh on the toolbar so the event // is received before the ToolbarPopup clickable handle it. m_Toolbar.RegisterCallback <MouseDownEvent>((e) => { if (e.target == m_PanelSelect) { RefreshPanelChoices(); } }, TrickleDown.TrickleDown); m_PanelChoices = new List <IPanelChoice>(); m_PanelSelect = new ToolbarMenu() { name = "panelSelectPopup", variant = ToolbarMenu.Variant.Popup }; m_PanelSelect.text = "Select a panel"; m_Toolbar.Insert(0, m_PanelSelect); if (!string.IsNullOrEmpty(m_LastVisualTreeName)) { m_RestoreSelectionScheduledItem = m_Toolbar.schedule.Execute(RestorePanelSelection).Every(500); } }
public void OnEnable() { VisualElement root = rootVisualElement; var visualTree = Resources.Load <VisualTreeAsset>("MarketManager_Main"); visualTree.CloneTree(root); var styleSheet = Resources.Load <StyleSheet>("MarketManager_Style"); root.styleSheets.Add(styleSheet); catalogsVisualTree = Resources.Load <VisualTreeAsset>("Catalogs_View"); itemsVisualTree = Resources.Load <VisualTreeAsset>("Items_View"); productsVisualTree = Resources.Load <VisualTreeAsset>("Products_View"); scriptableObjectEdit_View = Resources.Load <VisualTreeAsset>("ScriptableObjectEdit_View"); ToolbarButton button = root.Q <ToolbarButton>("ItemsButton"); button.clicked += () => ChangeTab(States.Items); button = root.Q <ToolbarButton>("CatalogsButton"); button.clicked += () => ChangeTab(States.Catalogs); button = root.Q <ToolbarButton>("ProductsButton"); button.clicked += () => ChangeTab(States.Products); ToolbarMenu toolbarMenu = root.Q <ToolbarMenu>("ToolbarMenu"); toolbarMenu.variant = ToolbarMenu.Variant.Default; toolbarMenu.menu.AppendAction("ScanForAssets", x => ScanForAssets()); toolbarMenu.menu.AppendAction("New Item Type", x => OpenCreateItemType()); Render(); }
void SetupUploadTab() { List <string> existingBuildsPaths = ShareUtils.GetAllBuildsDirectories(); VisualElement buildsList = rootVisualElement.Query <VisualElement>("buildsList"); buildsList.contentContainer.Clear(); VisualTreeAsset containerTemplate = LoadUXML("BuildContainerTemplate"); VisualElement containerInstance; for (int i = 0; i < ShareUtils.MAX_DISPLAYED_BUILDS; i++) { containerInstance = containerTemplate.CloneTree().Q("buildContainer"); SetupBuildContainer(containerInstance, existingBuildsPaths[i]); buildsList.contentContainer.Add(containerInstance); } SetupButton("btnNewBuild", OnCreateABuildClicked, true); ToolbarMenu helpMenu = rootVisualElement.Q <ToolbarMenu>("menuHelp"); helpMenu.menu.AppendAction("Open Build Settings...", a => { OnOpenBuildSettingsClicked(); }, a => DropdownMenuAction.Status.Normal); helpMenu.menu.AppendAction("Locate Build...", a => { OnLocateBuildClicked(); }, a => DropdownMenuAction.Status.Normal); helpMenu.menu.AppendAction("WebGL Build Tutorial", a => { OnOpenHelpClicked(); }, a => DropdownMenuAction.Status.Normal); //hide the dropdown arrow IEnumerator <VisualElement> helpMenuChildrenEnumerator = helpMenu.Children().GetEnumerator(); helpMenuChildrenEnumerator.MoveNext(); //get to the label (to ignore) helpMenuChildrenEnumerator.MoveNext(); //get to the dropdown arrow (to hide) helpMenuChildrenEnumerator.Current.visible = false; }
protected void OnEnable() { var root = rootVisualElement; this.SetAntiAliasing(4); m_Toolbar = new UnityEditor.UIElements.Toolbar(); // Register panel choice refresh on the toolbar so the event // is received before the ToolbarPopup clickable handle it. m_Toolbar.RegisterCallback <MouseDownEvent>(e => { if (e.target == m_SelectorMenu) { RefreshPanelChoices(); } }, TrickleDown.TrickleDown); m_GraphViewChoices = new List <GraphViewChoice>(); m_SelectorMenu = new ToolbarMenu { name = "panelSelectPopup", text = "Select a panel" }; var menu = m_SelectorMenu.menu; menu.AppendAction("None", OnSelectGraphView, a => m_SelectedGraphView == null ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal); m_Toolbar.Add(m_SelectorMenu); root.Add(m_Toolbar); m_FirstUpdate = true; }
public WorldSelector() { var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(UxmlPath); template.CloneTree(this); menuElement = this.Q <ToolbarMenu>("worldSelector"); }
private void Open() { // fade menu in if already open if (m_ToolbarMenu != null && m_ToolbarMenu.IsFadingOut) { m_ToolbarMenu.fadeIn(); return; } if (m_MenuPrefab == null || m_MenuObject != null) { return; } m_MenuObject = Instantiate(m_MenuPrefab, GetAnchor(), Quaternion.identity) as GameObject; if (m_MenuObject == null) { return; } m_MenuObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform); m_ToolbarMenu = m_MenuObject.GetComponent <ToolbarMenu> (); if (m_ToolbarMenu != null) { m_ToolbarMenu.SetMenuControl(this); if (!NodeTools.patchedConicsUnlocked) { m_ToolbarMenu.DisableMainWindow(); } } GUIComponentManager.processStyle(m_MenuObject); GUIComponentManager.processLocalization(m_MenuObject); GUIComponentManager.replaceLabelsWithTMPro(m_MenuObject); }
protected void OnEnable(VisualElement toolbar) { m_Toolbar = toolbar ?? new Toolbar(); // Register panel choice refresh on the toolbar so the event // is received before the ToolbarPopup clickable handle it. m_Toolbar.RegisterCallback <MouseDownEvent>((e) => { if (e.target == m_PanelSelect) { RefreshPanelChoices(); } }, TrickleDown.TrickleDown); m_PanelToEditorWindow = new Dictionary <Panel, EditorWindow>(); m_PanelChoices = new List <PanelChoice>(); m_PanelSelect = new ToolbarMenu() { name = "panelSelectPopup", variant = ToolbarMenu.Variant.Popup }; m_PanelSelect.text = "Select a panel"; m_Toolbar.Insert(0, m_PanelSelect); if (!string.IsNullOrEmpty(m_LastVisualTreeName)) { m_RestoreSelectionScheduledItem = m_Toolbar.schedule.Execute(RestorePanelSelection).Every(500); } }
private void OnEnable() { InitializeUxmlTemplate(); InitializeLocations(); CandyCornManager = GameObject.Find("CandyCornManager").GetComponent <CandyCornManager>(); //currentLocationSelected = GameObject.Find("DebugPositions").transform.GetChild(0).GetComponent<DebugPosition>(); var root = rootVisualElement.Q("Root"); CandiesField = root.Q <IntegerField>("CandiesField"); ReloadCandiesButton = rootVisualElement.Q <Button>("ReloadCandiesButton"); ReloadCandiesButton.clicked += OnReloadCandiesPressed; ResetCandiesButton = root.Q <Button>("ResetButton"); ResetCandiesButton.clicked += OnResetCandiesPressed; AddCandiesButton = root.Q <Button>("AddButton"); AddCandiesButton.clicked += OnAddCandiesPressed; RemoveCandiesButton = root.Q <Button>("RemoveButton"); RemoveCandiesButton.clicked += OnRemoveCandiesPressed; ReloadLocationButton = rootVisualElement.Q <Button>("ReloadLocationButton"); ReloadLocationButton.clicked += OnReloadLocationPressed; LocationDropdown = root.Q <ToolbarMenu>("LocationDropdown"); PopulateLocationsDropdown(); }
void SetupUploadTab() { List <string> existingBuildsPaths = PublisherUtils.GetAllBuildsDirectories(); VisualElement buildsList = rootVisualElement.Query <VisualElement>("buildsList"); buildsList.contentContainer.Clear(); VisualTreeAsset containerTemplate = UIElementsUtils.LoadUXML("BuildContainerTemplate"); VisualElement containerInstance; for (int i = 0; i < PublisherUtils.MaxDisplayedBuilds; i++) { containerInstance = containerTemplate.CloneTree().Q("buildContainer"); SetupBuildContainer(containerInstance, existingBuildsPaths[i]); buildsList.contentContainer.Add(containerInstance); } SetupBuildButtonInUploadTab(); ToolbarMenu helpMenu = rootVisualElement.Q <ToolbarMenu>("menuHelp"); helpMenu.menu.AppendAction(Localization.Tr("UPLOAD_MENU_BUTTON_SETTINGS"), a => { OnOpenBuildSettingsClicked(); }, a => DropdownMenuAction.Status.Normal); helpMenu.menu.AppendAction(Localization.Tr("UPLOAD_MENU_BUTTON_LOCATEBUILD"), a => { OnLocateBuildClicked(); }, a => DropdownMenuAction.Status.Normal); helpMenu.menu.AppendAction(Localization.Tr("UPLOAD_MENU_BUTTON_TUTORIAL"), a => { OnOpenHelpClicked(); }, a => DropdownMenuAction.Status.Normal); helpMenu.menu.AppendAction(Localization.Tr("UPLOAD_MENU_BUTTON_AUTOPUBLISH"), a => { OnToggleAutoPublish(); }, a => { return(GetAutoPublishCheckboxStatus()); }, autoPublishSuccessfulBuilds.value); //hide the dropdown arrow IEnumerator <VisualElement> helpMenuChildrenEnumerator = helpMenu.Children().GetEnumerator(); helpMenuChildrenEnumerator.MoveNext(); //get to the label (to ignore) helpMenuChildrenEnumerator.MoveNext(); //get to the dropdown arrow (to hide) helpMenuChildrenEnumerator.Current.visible = false; SetupLabel("lblTitle", "UPLOAD_TITLE", true); }
private void CreateWindow() { var template = StyleSheets.Hierarchy; template.Template.CloneTree(rootVisualElement); rootVisualElement.AddStyleSheetSkinVariant(template.StyleSheet); m_AuthoringRoot = rootVisualElement.Q <VisualElement>(k_AuthoringRoot); m_NonAuthoringRoot = rootVisualElement.Q <VisualElement>(k_NonAuthoringRoot); m_ContentRoot = rootVisualElement.Q <VisualElement>(k_ContentRoot); m_CreateButton = rootVisualElement.Q <ToolbarMenu>(k_CreateButton); m_FooterRoot = rootVisualElement.Q <VisualElement>(k_FooterRoot); var search = rootVisualElement.Q <ToolbarSearchField>("SearchField"); search.RegisterValueChangedCallback( evt => { if (null == m_TreeView) { return; } m_TreeView.FilterString = evt.newValue; }); m_TreeViewRoot = new IMGUIContainer(UpdateTreeView); m_ContentRoot.Add(m_TreeViewRoot); var flexibleSpace = rootVisualElement.Q <VisualElement>(k_FlexibleSpace); flexibleSpace.RegisterCallback <DragUpdatedEvent>(evt => { DragAndDrop.visualMode = DragAndDropVisualMode.Move; }); flexibleSpace.RegisterCallback <DragPerformEvent>(evt => { m_TreeView.TryHandleDragAndDropFromExternalSource(); }); flexibleSpace.RegisterCallback <MouseUpEvent>(evt => { switch (evt.button) { case 0: Selection.instanceIDs = new int[0]; break; case 1: m_TreeView?.ShowEntityContextMenu(null); break; } }); m_ConfigRoot = new IMGUIContainer(UpdateConfigView); m_FooterRoot.Add(m_ConfigRoot); m_AuthoringRoot.style.display = DisplayStyle.None; m_NonAuthoringRoot.style.display = DisplayStyle.Flex; SetupCreateToolbar(); }
public FormMain() { InitializeComponent(); m_pMapC2 = axMapControl_main.Object as IMapControl2; m_pMapDoc = new MapDocumentClass(); m_pSceneCtl = axSceneControl_main.Object as ISceneControl; m_pToolbarMenu = new ToolbarMenu(); }
private void FormMain_Load(object sender, EventArgs e) { axTOCControl_main.SetBuddyControl(axMapControl_main); m_pMapC2 = axMapControl_main.Object as IMapControl2; m_pMapDoc = new MapDocumentClass(); axMapControl_main.OnMouseDown += axMapControl_main_OnMouseDown; // 清空地图选择集 btn_clearselect.Click += (object s, EventArgs ent) => { m_pMapC2.Map.ClearSelection(); (m_pMapC2.Map as IGraphicsContainer).DeleteAllElements(); m_pMapC2.Refresh(); m_isIdentify = false; m_isDraw = false; m_isAddpoint = false; }; // a. 打开地图文档功能(地图文档位于AirQuality文件夹下) LoadMxd(); // b. 退出程序并保存地图文档功能 this.FormClosing += (object s, FormClosingEventArgs ent) => { m_pMapDoc.Save(); }; // c. 在地图上点击,选择一个监测站点,并显示该监测站点的属性信息 第①步 btn_Identify.Click += Button_Click; // e. 在地图上选择一个多边形,统计该多边形内部的监测站点内数量,并高亮显示 btn_select.Click += Button_Click; // f. 将Excel中的数据匹配到监测站点 btn_link.Click += Button_Click; // g. 在地图上显示北京各个区县的名称 btn_anno.Click += Button_Click; // h. 为北京各个区县匹配一个符号 btn_symbol.Click += Button_Click; // i. 导出北京区县图层为一个新的数据 btn_outlyr.Click += Button_Click; // j. 在监测站点图层添加一个新站点 btn_addpt.Click += Button_Click; // d. 在监测站点列表中选择一个监测站点后,在地图上高亮显示,缩放至该监测站点,并显示该监测站点的属性信息 第①步 setListBox(); object[] cmds = new object[] { new OpenAttriTable() }; m_pToolbarMenu = new ToolbarMenu(); for (int i = 0; i < cmds.Length; i++) { m_pToolbarMenu.AddItem(cmds[i]); } m_pToolbarMenu.SetHook(m_pMapC2); }
void BuildComponents() { this.SetControlImage("buho", PlasticGui.Help.HelpImage.ColorBuho); VisualElement spinnerControl = this.Query <VisualElement>("gdSpinner").First(); mLoadingSpinner = new LoadingSpinner(); spinnerControl.Add(mLoadingSpinner); IEnumerable <string> datacenters = GetDatacenters(); mSelectedDatacenter = datacenters.FirstOrDefault(); mDatacenter = new ToolbarMenu { text = mSelectedDatacenter }; foreach (string datacenter in GetDatacenters()) { mDatacenter.menu.AppendAction(datacenter, DataCenterClicked, DataCenterActive); } VisualElement datacenterContainer = this.Query <VisualElement>("datacenter").First(); datacenterContainer.Add(mDatacenter); mOrganizationNameTextField = this.Query <TextField>("orgName").First(); mOrganizationNameNotification = this.Query <Label>("orgNameNotification").First(); mBackButton = this.Query <Button>("back").First(); mCreateButton = this.Query <Button>("create").First(); mEncryptLearnMoreButton = this.Query <Button>("encryptLearnMore").First(); mGettingDatacenters = this.Query <VisualElement>("gettingDatacenters").First(); mCreateButton.clicked += CreateButton_Clicked; mOrganizationNameTextField.RegisterValueChangedCallback( OnOrganizationNameTextFieldChanged); mOrganizationNameTextField.FocusOnceLoaded(); this.SetControlText <Label>("createLabel", PlasticLocalization.Name.CreateOrganizationTitle); this.SetControlLabel <TextField>("orgName", PlasticLocalization.Name.OrganizationName); this.SetControlText <Label>("datacenterLabel", PlasticLocalization.Name.Datacenter); this.SetControlText <Toggle>("encryptData", PlasticLocalization.Name.EncryptionCheckButton); this.SetControlText <Label>("encryptExplanation", PlasticLocalization.Name.EncryptionCheckButtonExplanation, ""); this.SetControlText <Button>("encryptLearnMore", PlasticLocalization.Name.LearnMore); this.SetControlText <Label>("gdLabel", PlasticLocalization.Name.GettingDatacenters); this.SetControlText <Button>("back", PlasticLocalization.Name.BackButton); this.SetControlText <Button>("create", PlasticLocalization.Name.CreateButton); }
void CreateRunInUnitySimulationUI() { var root = rootVisualElement; AssetDatabase.LoadAssetAtPath <VisualTreeAsset>( $"{StaticData.uxmlDir}/RunInUnitySimulationWindow.uxml").CloneTree(root); m_RunNameField = root.Q <TextField>("run-name"); m_TotalIterationsField = root.Q <IntegerField>("total-iterations"); m_InstanceCountField = root.Q <IntegerField>("instance-count"); m_SysParamDefinitions = API.GetSysParams(); m_SysParamMenu = root.Q <ToolbarMenu>("sys-param"); for (var i = 0; i < m_SysParamDefinitions.Length; i++) { var index = i; var param = m_SysParamDefinitions[i]; m_SysParamMenu.menu.AppendAction( param.description, action => { m_SysParamIndex = index; m_SysParamMenu.text = param.description; }); } m_ScenarioConfigField = root.Q <ObjectField>("scenario-config"); m_ScenarioConfigField.objectType = typeof(TextAsset); var configPath = PlayerPrefs.GetString("SimWindow/scenarioConfig"); if (configPath != string.Empty) { m_ScenarioConfigField.value = AssetDatabase.LoadAssetAtPath <TextAsset>(configPath); } m_RunButton = root.Q <Button>("run-button"); m_RunButton.clicked += RunInUnitySimulation; m_PrevRunNameLabel = root.Q <Label>("prev-run-name"); m_ProjectIdLabel = root.Q <Label>("project-id"); m_PrevExecutionIdLabel = root.Q <Label>("execution-id"); var copyExecutionIdButton = root.Q <Button>("copy-execution-id"); copyExecutionIdButton.clicked += () => EditorGUIUtility.systemCopyBuffer = PlayerPrefs.GetString("SimWindow/prevExecutionId"); var copyProjectIdButton = root.Q <Button>("copy-project-id"); copyProjectIdButton.clicked += () => EditorGUIUtility.systemCopyBuffer = CloudProjectSettings.projectId; SetFieldsFromPlayerPreferences(); }
private void setTOCControl(params object[] cmds) { axTOCControl_main.SetBuddyControl(axMapControl_main); axTOCControl_main.EnableLayerDragDrop = true; m_ToolbarMenu = new ToolbarMenuClass(); for (int i = 0; i < cmds.Length; i++) { m_ToolbarMenu.AddItem(cmds[i]); } m_ToolbarMenu.SetHook(m_pMapC2); }
private void InitTOCControl() { object[] cmds = new object[] { new Cmds.OpenAttriTable() }; m_pToolbarMenu = new ToolbarMenu(); for (int i = 0; i < cmds.Length; i++) { m_pToolbarMenu.AddItem(cmds[i]); } m_pToolbarMenu.SetHook(m_pMapC2); }
private void FormMain_Load(object sender, EventArgs e) { tabControl1.SelectedIndex = 1; tabControl1.SelectedIndex = 0; AeUtils.SetMapControl(m_pMapC2); AeUtils.SetMapDocument(m_pMapDoc); AeUtils.SetPageLayoutControl(axPageLayoutControl1); m_pToolbarMenu = new ToolbarMenuClass(); m_pToolbarMenu.AddItem(new OpenAttributeTable()); m_pToolbarMenu.SetHook(m_pMapC2); }
private ToolbarMenu CreateViewMenu() { var menu = new ToolbarMenu { text = "View" }; menu.menu.AppendAction("Show All _END", evt => GraphView.ShowAll()); menu.menu.AppendAction("Go To Start _HOME", evt => GraphView.GoToStart()); menu.menu.AppendAction("Zoom To Selection _TAB", evt => GraphView.GoToSelection()); menu.style.marginLeft = -1; return(menu); }
public void CreateGUI() { try { VisualElement root = this.rootVisualElement; // 加载布局文件 var visualAsset = EditorHelper.LoadWindowUXML <AssetBundleReporterWindow>(); if (visualAsset == null) { return; } visualAsset.CloneTree(root); // 导入按钮 var importBtn = root.Q <Button>("ImportButton"); importBtn.clicked += ImportBtn_onClick; // 视图模式菜单 _viewModeMenu = root.Q <ToolbarMenu>("ViewModeMenu"); _viewModeMenu.menu.AppendAction(EViewMode.Summary.ToString(), ViewModeMenuAction0, ViewModeMenuFun0); _viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), ViewModeMenuAction1, ViewModeMenuFun1); _viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), ViewModeMenuAction2, ViewModeMenuFun2); // 搜索栏 var searchField = root.Q <ToolbarSearchField>("SearchField"); searchField.RegisterValueChangedCallback(OnSearchKeyWordChange); // 加载视图 _summaryViewer = new ReporterSummaryViewer(); _summaryViewer.InitViewer(); // 加载视图 _assetListViewer = new ReporterAssetListViewer(); _assetListViewer.InitViewer(); // 加载视图 _bundleListViewer = new ReporterBundleListViewer(); _bundleListViewer.InitViewer(); // 显示视图 _viewMode = EViewMode.Summary; _viewModeMenu.text = EViewMode.Summary.ToString(); _summaryViewer.AttachParent(root); } catch (Exception e) { Debug.LogError(e.ToString()); } }
public override VisualElement CreateInspectorGUI() { root = new VisualElement(); VisualElement selectorContainer = new VisualElement() { style = { flexDirection = FlexDirection.Row, alignItems = Align.Stretch, justifyContent = Justify.FlexStart } }; //Status text/character statusLabel = new Label() { text = "?", style = { width = 20 //Constant width to stop the selector from moving } }; selectorContainer.Add(statusLabel); root.Add(selectorContainer); //Microphone source dropdown ToolbarMenu menu = new ToolbarMenu(); menu.menu.AppendAction("Off", OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); menu.menu.AppendAction("Default Device", OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); foreach (string deviceName in Microphone.devices) { menu.menu.AppendAction(deviceName, OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); } menuLabel = new Label() { text = "---" }; menu.Add(menuLabel); selectorContainer.Add(menu); //Sample rate label sampleFrequencyLabel = new Label() { text = "@ ???Hz" }; root.Add(sampleFrequencyLabel); Refresh(); editorTarget.DeviceStateChanged += Refresh; //Refresh when the device changes return(root); }
protected ToolbarMenu CreateWorldSelector() { m_WorldSelector = new ToolbarMenu { name = "worldMenu", variant = ToolbarMenu.Variant.Popup }; UpdateWorldDropDownMenu(); m_PreviousShowAdvancedWorldsValue = UserSettings <AdvancedSettings> .GetOrCreate(Constants.Settings.AdvancedSettings).ShowAdvancedWorlds; return(m_WorldSelector); }
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { #region 主窗体右键 /////地图视窗鼠标事件 IToolbarMenu mapPopMenu = null; mapPopMenu = new ToolbarMenu(); if (e.button == 2) { /* IMap pMap = axMapControl1.Map; IActiveView pActiveView = pMap as IActiveView; IEnvelope pEnv = axMapControl1.TrackRectangle(); pActiveView.Extent = pEnv; pActiveView.Refresh();*/ //地图视窗右键菜单功能 mapPopMenu.AddItem(new ControlsSelectTool(), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsMapPanTool(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsMapFullExtentCommand(), -1, 2, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsMapIdentifyTool(), -1, 3, false, esriCommandStyles.esriCommandStyleIconAndText);//识别工具 mapPopMenu.AddItem(new ControlsMapZoomInFixedCommand(), -1, 4, false, esriCommandStyles.esriCommandStyleIconAndText);// mapPopMenu.AddItem(new ControlsMapZoomInFixedCommand(), -1, 5, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsSelectFeaturesTool(), -1, 6, false, esriCommandStyles.esriCommandStyleIconAndText);//选择要素工具 mapPopMenu.AddItem(new ControlsClearSelectionCommand(), -1, 7, false, esriCommandStyles.esriCommandStyleIconAndText);//缩放所选要素 mapPopMenu.AddItem(new ControlsZoomToSelectedCommand(), -1, 8, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsMapZoomToLastExtentBackCommand(), -1, 9, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.AddItem(new ControlsMapZoomToLastExtentForwardCommand(), -1, 10, false, esriCommandStyles.esriCommandStyleIconAndText); mapPopMenu.SetHook(axMapControl1);//// 得到地图视窗右键菜单 mapPopMenu.PopupMenu(e.x, e.y, axMapControl1.hWnd);//弹出显示菜单 } /* if (e.button == 1)//左键因为右键要取消 { IMap pMap = axMapControl1.Map; IActiveView pActiveView = pMap as IActiveView; IEnvelope pEnv = axMapControl1.TrackRectangle(); pActiveView.Extent = pEnv; pActiveView.Refresh(); } * */ //此事件不会触发 if (e.button == 3)//如果鼠标中间改为ControlsMapPanTool会更好 { IMap pMap = axMapControl1.Map; IActiveView pActiveView = pMap as IActiveView; IEnvelope pEnv = axMapControl1.TrackRectangle(); pActiveView.Extent = pEnv; pActiveView.Refresh(); } #endregion //if (e.button == 2) //{ // IMap pMap = axMapControl1.Map; // IActiveView pActiveView = pMap as IActiveView; // IEnvelope pEnv = axMapControl1.TrackRectangle(); // pActiveView.Extent = pEnv; // pActiveView.Refresh(); //} //网络分析 if (clicked != true) return; IPoint ipNew; if (m_ipPoints == null) { m_ipPoints = new MultipointClass(); } ipNew = m_ipActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); object o = Type.Missing; m_ipPoints.AddPoint(ipNew, ref o, ref o); IElement element; ITextElement textelement = new TextElementClass(); element = textelement as IElement; clickedcount++; textelement.Text = clickedcount.ToString(); element.Geometry = m_ipActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); pGC.AddElement(element, 0); m_ipActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); }