public byte[] GenerateHelpBoxParam(HelpBox helpBox, int n) { byte[] data = new byte[15]; data[0] = 0x1B; data[1] = 0x1E; data[2] = (byte)n; int idx = 3; data[idx++] = (byte)(helpBox.Top & 0xFF); data[idx++] = (byte)((helpBox.Top >> 8) & 0xFF); data[idx++] = (byte)(helpBox.Left & 0xFF); data[idx++] = (byte)((helpBox.Left >> 8) & 0xFF); data[idx++] = (byte)(helpBox.Height & 0xFF); data[idx++] = (byte)((helpBox.Height >> 8) & 0xFF); data[idx++] = (byte)(helpBox.Width & 0xFF); data[idx++] = (byte)((helpBox.Width >> 8) & 0xFF); data[idx++] = (byte)(helpBox.CLineOffset & 0xFF); data[idx++] = (byte)((helpBox.CLineOffset >> 8) & 0xFF); data[idx++] = (byte)(helpBox.TLineOffset & 0xFF); data[idx++] = (byte)((helpBox.TLineOffset >> 8) & 0xFF); return(data); }
public Main() { InitializeComponent(); //Version this.Text += " v." + GlobalConstants.VERSION; //Loading ProjectManager _ProjectManager = new SmashProjectManager(); _ProjectManager.LoadConfig(); //Loading configuration if (!File.Exists(_ProjectManager._Config.LastProject)) { if (!CreateProject()) { this.Close(); return; } } LoadProject(); //Console Redirection _ConsoleText = new ConsoleRedirText(textConsole); _ConsoleProgress = new ConsoleRedirProgress(backgroundWorker); HelpBox.Initialize(_ProjectManager); Rendering.OpenTKSharedResources.InitializeSharedResources(); _MainLoaded = true; }
public ItemBaseInfoBlock(SerializedObject serializedObject, string IDPrefix) { contentContainer.style.paddingRight = 0; this.serializedObject = serializedObject; this.IDPrefix = IDPrefix; ID = serializedObject.FindAutoProperty("ID"); Name = serializedObject.FindAutoProperty("Name"); Icon = serializedObject.FindAutoProperty("Icon"); Description = serializedObject.FindAutoProperty("Description"); type = serializedObject.FindProperty("type"); quality = serializedObject.FindProperty("quality"); Weight = serializedObject.FindAutoProperty("Weight"); StackLimit = serializedObject.FindAutoProperty("StackLimit"); Discardable = serializedObject.FindAutoProperty("Discardable"); text = "基本信息"; RefreshCache(); helpBox = new HelpBox(); helpBox.text = "无错误"; helpBox.messageType = HelpBoxMessageType.Info; Add(helpBox); IMGUIContainer inspector = new IMGUIContainer(() => { if (serializedObject.targetObject) { OnInspectorGUI(serializedObject); } }); Add(inspector); CheckError(); }
public void ShowAboutBox() { HelpBox hb = new HelpBox(_WorkItem, true); hb.Owner = _WorkItem.MainWindow; hb.Show(); }
public override void Execute(object parameter) { #if SILVERLIGHT HelpBox helpBox = new HelpBox(); helpBox.ShowDialog(); #else #endif }
private void CreateAllSceneTemplateListsUI(VisualElement rootContainer) { if (m_SceneTemplateInfos == null) { return; } var templateItems = CreateGridViewItems(); m_GridView = new GridView(templateItems, L10n.Tr("Scene Templates in Project"), k_ListViewRowHeight, k_MinTileSize, k_MaxTileSize, k_ShowThumbnailTileSizeThreshold, m_DefaultThumbnail, 4f / 3f); m_GridView.wrapAroundKeyboardNavigation = true; m_GridView.sizeLevel = EditorPrefs.GetFloat(GetKeyName(nameof(m_GridView.sizeLevel)), 128); rootContainer.Add(m_GridView); m_GridView.SetPinned(m_SceneTemplateInfos.Where(template => template.isPinned).Select(template => template.GetHashCode())); m_GridView.onSelectionChanged += OnTemplateListViewSelectionChanged; m_GridView.onPinnedChanged += OnPinnedChanged; m_GridView.onItemsActivated += objects => { var sceneTemplateInfo = objects.First().userData as SceneTemplateInfo; if (sceneTemplateInfo == null) { return; } if (m_SelectedButtonIndex != -1) { m_Buttons[m_SelectedButtonIndex].callback(sceneTemplateInfo); } }; var toSelect = templateItems.FirstOrDefault(item => item.userData.Equals(m_LastSelectedTemplate)); if (toSelect != null) { m_GridView.SetSelection(toSelect); } else { m_GridView.SetSelection(templateItems.First()); } m_NoUserTemplateHelpBox = new HelpBox(L10n.Tr("To begin using a template, create a template from an existing scene in your project. Click to see Scene template documentation."), HelpBoxMessageType.Info); m_NoUserTemplateHelpBox.AddToClassList(Styles.sceneTemplateNoTemplateHelpBox); m_NoUserTemplateHelpBox.RegisterCallback <MouseDownEvent>(e => { SceneTemplateUtils.OpenDocumentationUrl(); }); m_NoUserTemplateHelpBox.style.display = m_SceneTemplateInfos.All(t => t.IsInMemoryScene) ? DisplayStyle.Flex : DisplayStyle.None; m_GridView.Insert(2, m_NoUserTemplateHelpBox); EditorApplication.delayCall += () => { m_GridView.SetFocus(); }; }
void UpdateParameters() { if (root == null) { root = new VisualElement(); } if (parameters == null || !root.Contains(parameters)) { parameters = new VisualElement(); root.Add(parameters); } SyncParameters(); var serializedInspector = new SerializedObject(this); parameters.Clear(); bool header = true; bool showUpdateButton = false; foreach (var param in visibleParameters) { if (param.settings.isHidden) { continue; } if (header) { var headerLabel = new Label("Exposed Parameters"); headerLabel.AddToClassList("Header"); parameters.Add(headerLabel); header = false; showUpdateButton = true; } var field = CreateParameterVariantView(param, serializedInspector); parameters.Add(field); } if (showUpdateButton) { updateNeededInfoBox = new HelpBox("Parameters have changed, please update the texture to apply the changes.", HelpBoxMessageType.Warning); UpdateIsDirtyAndPreview(); parameters.Add(updateNeededInfoBox); var updateButton = new Button(UpdateAllVariantTextures) { text = "Update Texture(s)" }; updateButton.AddToClassList("UpdateTextureButton"); parameters.Add(updateButton); } }
internal override void Apply(VisualElement container) { /// <sample> // Get a reference to the help box from UXML and update its text. var uxmlHelpBox = container.Q <HelpBox>("the-uxml-help-box"); uxmlHelpBox.text += " (Updated in C#)"; // Create a new help box and give it a style class. var csharpHelpBox = new HelpBox("This is a help box", HelpBoxMessageType.Warning); csharpHelpBox.AddToClassList("some-styled-help-box"); container.Add(csharpHelpBox); /// </sample> }
public void LoadProjectCompleted() { if (_ProjectManager.CurrentProject == null) { MessageBox.Show(UIStrings.ERROR_LOADING_GAME_LOAD_FOLDER, UIStrings.CAPTION_ERROR_LOADING_GAME_FOLDER); Application.Exit(); return; } this.Enabled = true; Console.SetOut(_ConsoleText); //Check if project directories exist if (!Directory.Exists(PathHelper.FolderExplorerFullPath)) { Directory.CreateDirectory(PathHelper.FolderExplorerFullPath); } if (!Directory.Exists(PathHelper.FolderStageMods)) { Directory.CreateDirectory(PathHelper.FolderStageMods); } if (!Directory.Exists(PathHelper.FolderGeneralMods)) { Directory.CreateDirectory(PathHelper.FolderGeneralMods); } if (!Directory.Exists(PathHelper.FolderEditorMods)) { Directory.CreateDirectory(PathHelper.FolderEditorMods); } foreach (DB.Fighter fighter in DB.FightersDB.Fighters) { string path = PathHelper.GetCharacterSlotsFolder(fighter.name); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = PathHelper.GetCharacterGeneralFolder(fighter.name); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } _ProjectManager.RefreshTabViews(); HelpBox.Show(0); }
public override VisualElement CreateInspectorGUI() { var container = new VisualElement(); var defaultAsset = (DefaultAsset)target; if (defaultAsset.message.Length > 0) { var helpBox = new HelpBox( defaultAsset.message, defaultAsset.isWarning ? HelpBoxMessageType.Warning : HelpBoxMessageType.Info); container.Add(helpBox); } return(container); }
private void ConfigureFields() { // Using MandatoryQ instead of just Q to make sure modifications of the UXML file don't make the // necessary elements disappear unintentionally. m_DrivenByParentWarning = m_RootVisualElement.MandatoryQ <HelpBox>("driven-by-parent-warning"); m_MissingPanelSettings = m_RootVisualElement.MandatoryQ <HelpBox>("missing-panel-warning"); m_PanelSettingsField = m_RootVisualElement.MandatoryQ <ObjectField>("panel-settings-field"); m_PanelSettingsField.objectType = typeof(PanelSettings); m_ParentField = m_RootVisualElement.MandatoryQ <ObjectField>("parent-field"); m_ParentField.objectType = typeof(UIDocument); m_ParentField.SetEnabled(false); m_SourceAssetField = m_RootVisualElement.MandatoryQ <ObjectField>("source-asset-field"); m_SourceAssetField.objectType = typeof(VisualTreeAsset); }
public void Initialize() { flowLayoutPanelNames.HorizontalScroll.Enabled = true; flowLayoutPanelNames.HorizontalScroll.Maximum = 10000; flowLayoutPanelNames.HorizontalScroll.Visible = false; haslxx = _CurrentFighter.lowPolySlots != Fighter.LowPolySlots.None; int haslxxNum = haslxx ? 1 : 0; int modelPartsCount = _CurrentFighter.modelParts.Count; slotCount = (int)Math.Ceiling((float)ModelNutDirectories.Length / (float)(modelPartsCount + haslxxNum)); ComboBoxList_ModelNutDirectories = GetComboBoxStrings(ModelNutDirectories, true); ComboBoxList_Files_chr_00 = GetComboBoxStrings(Files_chr_00, false); ComboBoxList_Files_chr_11 = GetComboBoxStrings(Files_chr_11, false); ComboBoxList_Files_chr_13 = GetComboBoxStrings(Files_chr_13, false); ComboBoxList_Files_stock_90 = GetComboBoxStrings(Files_stock_90, false); ComboBoxList_Files_chrn_11 = GetComboBoxStrings(Files_chrn_11, false); ComboBoxList_Files_Sound_Nus3bank = GetComboBoxStrings(Files_Sound_Nus3bank, false); ComboBoxList_Files_Voice_Nus3bank = GetComboBoxStrings(Files_Voice_Nus3bank, false); //Add rows and fill in starting data for (int i = 0; i < slotCount; ++i) { SlotColumn newSlot = new SlotColumn(this, "New Mod", haslxx, _CurrentFighter.modelParts.ToArray()); slotColumns.Add(newSlot); newSlot.comboBox_body.SelectedIndex = 1 + i < ComboBoxList_ModelNutDirectories.Length ? 1 + i : 0; for (int k = 1; k < modelPartsCount; ++k) { newSlot.comboBox_parts[k - 1].SelectedIndex = (i + 1 + ((k + (k < 1 ? 0 : haslxxNum)) * slotCount) < ComboBoxList_ModelNutDirectories.Length) ? i + 1 + ((k + (k < 1 ? 0 : haslxxNum)) * slotCount) : 0; } if (haslxx) { newSlot.comboBox_body_lxx.SelectedIndex = (i + 1 + slotCount < ComboBoxList_ModelNutDirectories.Length) ? i + 1 + slotCount : 0; } newSlot.comboBox_chr_00.SelectedIndex = (i + 1 < ComboBoxList_Files_chr_00.Length) ? i + 1 : 0; newSlot.comboBox_chr_11.SelectedIndex = (i + 1 < ComboBoxList_Files_chr_11.Length) ? i + 1 : 0; newSlot.comboBox_chr_13.SelectedIndex = (i + 1 < ComboBoxList_Files_chr_13.Length) ? i + 1 : 0; newSlot.comboBox_stock_90.SelectedIndex = (i + 1 < ComboBoxList_Files_stock_90.Length) ? i + 1 : 0; newSlot.comboBox_chrn_11.SelectedIndex = (i + 1 < ComboBoxList_Files_chrn_11.Length) ? i + 1 : 0; newSlot.comboBox_sound.SelectedIndex = (i + 1 < ComboBoxList_Files_Sound_Nus3bank.Length) ? i + 1 : 0; newSlot.comboBox_voice.SelectedIndex = (i + 1 < ComboBoxList_Files_Voice_Nus3bank.Length) ? i + 1 : 0; } HelpBox.Show(6); }
public override void Execute(object parameter) { if (_HelpWnd != null) { if (_HelpWnd.WindowState == WindowState.Minimized) { _HelpWnd.WindowState = WindowState.Normal; } _HelpWnd.Activate(); return; } _HelpWnd = new HelpBox(_WorkItem, (bool)parameter); _HelpWnd.Owner = _WorkItem.MainWindow; _HelpWnd.Closed += HelpWnd_Closed; _HelpWnd.Show(); }
private VisualElement GenerateCode() { var container = new VisualElement(); container.style.flexDirection = FlexDirection.Column; var header = new BorderedRectangle(HUMEditorColor.DefaultEditorBackground.Darken(0.1f), Color.black, 2); header.style.height = 24; header.style.marginBottom = 4; header.style.unityTextAlign = TextAnchor.MiddleCenter; header.style.marginTop = 6; var label = new Label(); label.text = "Compile Assets"; label.style.flexGrow = 1; var hint = new HelpBox("Clicking 'Compile' will generate C# scripts for Defined Events, Funcs, and Actions to ensure complete AOT Safety on all platforms.", HelpBoxMessageType.Info); hint.Set().Padding(6); var buttonContainer = new VisualElement(); buttonContainer.style.flexDirection = FlexDirection.Row; buttonContainer.style.height = 24; var compileButton = new Button(() => { AssetCompiler.Compile(); }) { text = "Compile" }; compileButton.style.flexGrow = 1; buttonContainer.Add(compileButton); header.Add(label); container.Add(header); container.Add(hint); container.Add(buttonContainer); return(container); }
private void ConfigureFields() { // Using MandatoryQ instead of just Q to make sure modifications of the UXML file don't make the // necessary elements disappear unintentionally. m_MissingThemeHelpBox = m_RootVisualElement.MandatoryQ <HelpBox>("missing-theme-warning"); m_ThemeStyleSheetField = m_RootVisualElement.MandatoryQ <ObjectField>("theme-style-sheet"); m_ThemeStyleSheetField.objectType = typeof(ThemeStyleSheet); m_UITKTextSettings = m_RootVisualElement.MandatoryQ <ObjectField>("text-settings"); m_UITKTextSettings.objectType = typeof(PanelTextSettings); m_TargetTextureField = m_RootVisualElement.MandatoryQ <ObjectField>("target-texture"); m_TargetTextureField.objectType = typeof(RenderTexture); m_ScaleModeField = m_RootVisualElement.MandatoryQ <EnumField>("scale-mode"); m_ScreenMatchModeField = m_RootVisualElement.MandatoryQ <EnumField>("screen-match-mode"); m_ScaleModeConstantPixelSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-constant-pixel-size"); m_ScaleModeScaleWithScreenSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-scale-with-screen-size"); m_ScaleModeContantPhysicalSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-constant-physical-size"); m_ReferencePixelsPerUnit = m_RootVisualElement.MandatoryQ("reference-pixels-per-unit"); m_ScreenMatchModeMatchWidthOrHeightGroup = m_RootVisualElement.MandatoryQ("screen-match-mode-match-width-or-height"); m_ClearColorField = m_RootVisualElement.MandatoryQ <PropertyField>("clear-color"); m_ColorClearValueField = m_RootVisualElement.MandatoryQ <PropertyField>("color-clear-value"); var choices = new List <int> { 0, 1, 2, 3, 4, 5, 6, 7 }; var targetDisplayField = new PopupField <int>("Target Display", choices, 0, i => $"Display {i + 1}", i => $"Display {i + 1}"); targetDisplayField.bindingPath = "m_TargetDisplay"; m_TargetTextureField.parent.Add(targetDisplayField); targetDisplayField.PlaceInFront(m_TargetTextureField); }
public TemplateBaseInfoBlock(SerializedObject serializedObject) { this.serializedObject = serializedObject; text = "基本信息"; helpBox = new HelpBox(); Add(helpBox); helpBox.text = "无错误"; helpBox.messageType = HelpBoxMessageType.Info; IMGUIContainer inspector = new IMGUIContainer(() => { if (serializedObject.targetObject) { EditorGUI.BeginChangeCheck(); serializedObject.UpdateIfRequiredOrScript(); SerializedProperty iterator = serializedObject.GetIterator(); if (iterator != null) { bool enterChildren = true; while (iterator.NextVisible(enterChildren) && iterator.propertyPath != "modules") { if ("m_Script" != iterator.propertyPath) { EditorGUILayout.PropertyField(iterator, true); } enterChildren = false; } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); CheckError(); onInspectorChanged?.Invoke(); } } }); Add(inspector); CheckError(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton2_Click(object sender, EventArgs e) { using (HelpBox b = new HelpBox(HelpText)) b.ShowDialog(); }
private void CreateUI() { Label label = AddControl <Label>(); { label.Content.Text = "Dynamic C# Installer"; label.Style = new VisualStyle(EditorStyle.BoldLabel); } AddControl <Spacer>(); HelpBox help = AddControl <HelpBox>(); { help.Content.Text = "This installer is only required if you need support for runtime script compilation. If you are using managed assemblies only then you can skip this install process. You can always come back to this installer at a later date from 'Tools -> Dynamic C# -> Installer'"; help.HelpType = HelpBoxType.Info; } AddControl <Spacer>(); Label helpLabel = AddControl <Label>(); { helpLabel.Content.Text = "The following actions need to be performed:"; helpLabel.Style = new VisualStyle(EditorStyle.BoldLabel); helpLabel.Layout.Size = new Vector2(0, 0); } HorizontalLayout compatibilityLayout = AddControl <HorizontalLayout>(); { // Tab spacer compatibilityLayout.AddControl <Spacer>().Spacing = 20; // Image Image img = compatibilityLayout.AddControl <Image>(); { img.Content.Texture = (IsCompatibilitySet() == true) ? tick : cross; img.Layout.Size = new Vector2(12, 12); } Label text = compatibilityLayout.AddControl <Label>(); { text.Content.Text = "-Change API compatibility level to '.NET 2.0'"; text.Layout.Size = new Vector2(0, 0); } } HorizontalLayout compilerLayout = AddControl <HorizontalLayout>(); { // Tab spacer compilerLayout.AddControl <Spacer>().Spacing = 20; // Image Image img = compilerLayout.AddControl <Image>(); { img.Content.Texture = (IsCompilerInstalled() == true) ? tick : cross; img.Layout.Size = new Vector2(12, 12); } Label text = compilerLayout.AddControl <Label>(); { text.Content.Text = "-Import the compiler package"; text.Layout.Size = new Vector2(0, 0); } } AddControl <FlexibleSpacer>(); CenterLayout center = AddControl <CenterLayout>(); { Button button = center.AddControl <Button>(); { button.Content.Text = "Install"; button.Layout.Size = new Vector2(100, 30); button.Enabled = !(IsCompatibilitySet() && IsCompilerInstalled()); button.OnClicked += InstallCompiler; } } }
private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { if (!_UserControlsLoaded) { return; } switch (tabControl.SelectedIndex) { case 0: if (_ProjectManager._CharacterModsPage != null) { return; } LoadCharacterModsPage(); UnloadStageModsPage(); UnloadGeneralModsPage(); UnloadExplorerModsPage(); break; case 1: if (_ProjectManager._StageModsPage != null) { return; } UnloadCharacterModsPage(); LoadStageModsPage(); UnloadGeneralModsPage(); UnloadExplorerModsPage(); break; case 2: if (_ProjectManager._GeneralModsPage != null) { return; } UnloadCharacterModsPage(); UnloadStageModsPage(); LoadGeneralModsPage(); UnloadExplorerModsPage(); break; case 3: case 4: if (_ProjectManager._Sm4shMusic == null) { LoadMusicPages(); } UnloadCharacterModsPage(); UnloadStageModsPage(); UnloadGeneralModsPage(); UnloadExplorerModsPage(); break; case 5: if (_ProjectManager._ExplorerPage != null) { return; } UnloadCharacterModsPage(); UnloadStageModsPage(); UnloadGeneralModsPage(); LoadExplorerModsPage(); break; } HelpBox.Show(tabControl.SelectedIndex); }
private void CreateUI() { _Panel = new StackPanel() { Padding = new Skill.Framework.UI.Thickness(2, 4, 2, 0) }; _TextureField = new Skill.Editor.UI.ObjectField <Texture2D>() { Object = _PaintColor.Texture, HorizontalAlignment = Skill.Framework.UI.HorizontalAlignment.Center, Width = 80, Height = 80, Margin = new Skill.Framework.UI.Thickness(2) }; #region _TbChannels _TbChannels = new UI.TabHeader(4, true) { Margin = new Thickness(0, 2, 0, 10), HorizontalAlignment = HorizontalAlignment.Center, Width = 200, Height = 20 }; _TbChannels[0].text = "R"; _TbChannels[1].text = "G"; _TbChannels[2].text = "B"; _TbChannels[3].text = "A"; _TbChannels.SetTabSelected(0, _PaintColor.ChannelR); _TbChannels.SetTabSelected(1, _PaintColor.ChannelG); _TbChannels.SetTabSelected(2, _PaintColor.ChannelB); _TbChannels.SetTabSelected(3, _PaintColor.ChannelA); #endregion #region _LayersField and _PUV and _TbBrush Grid layersPanel = new Grid() { Height = 32, Padding = new Thickness(2, 6) }; layersPanel.ColumnDefinitions.Add(90, GridUnitType.Pixel); layersPanel.ColumnDefinitions.Add(50, GridUnitType.Pixel); layersPanel.ColumnDefinitions.Add(10, GridUnitType.Pixel); layersPanel.ColumnDefinitions.Add(45, GridUnitType.Pixel); layersPanel.ColumnDefinitions.Add(1, GridUnitType.Star); _TbBrush = new UI.ToggleButton() { Column = 0, IsChecked = _PaintColor.Brush, Left = true }; _TbBrush.Label.text = "Brush View"; layersPanel.Controls.Add(_TbBrush); _PUV = new Popup() { Row = 0, Column = 1 }; PopupOption uv1 = new PopupOption(0) { Name = "UV1" }; uv1.Content.text = "UV 1"; PopupOption uv2 = new PopupOption(1) { Name = "UV2" }; uv2.Content.text = "UV 2"; _PUV.Options.Add(uv1); _PUV.Options.Add(uv2); _PUV.SelectedIndex = _PaintColor.UV2 ? 1 : 0; layersPanel.Controls.Add(_PUV); Label lbl = new Label() { Text = "Layers", Column = 3 }; layersPanel.Controls.Add(lbl); _LayersField = new LayerMaskField() { Row = 0, Column = 4 }; _LayersField.Layers = _PaintColor.LayerMask; _LayersField.Label.text = string.Empty; layersPanel.Controls.Add(_LayersField); #endregion _PnlFavoriteColors = new Grid() { Height = 22, Margin = new Thickness(0, 2) }; _FavoriteColors = new Color[] { new Color(1.0f, 0.0f, 0.0f, 0.0f), // red new Color(0.0f, 1.0f, 0.0f, 0.0f), // green new Color(0.0f, 0.0f, 1.0f, 0.0f), // blue new Color(0.0f, 0.0f, 0.0f, 1.0f), // Alpha new Color(1.0f, 1.0f, 1.0f, 1.0f), // white new Color(0.0f, 0.0f, 0.0f, 0.0f) }; // black _PnlFavoriteColors.Controls.Add(new Box() { Row = 0, Column = 0, ColumnSpan = _FavoriteColors.Length }); for (int i = 0; i < _FavoriteColors.Length; i++) { _PnlFavoriteColors.ColumnDefinitions.Add(1, GridUnitType.Star); Skill.Framework.UI.Button btn = new Skill.Framework.UI.Button() { Tag = i.ToString(), Margin = new Thickness(4), Style = new GUIStyle(), Column = i }; string toolTip = string.Empty; Texture2D background = null; if (i == 0) { background = Skill.Editor.Resources.UITextures.Colors.Red; toolTip = "Red"; } else if (i == 1) { background = Skill.Editor.Resources.UITextures.Colors.Green; toolTip = "Green"; } else if (i == 2) { background = Skill.Editor.Resources.UITextures.Colors.Blue; toolTip = "Blue"; } else if (i == 3) { background = Skill.Editor.Resources.UITextures.Colors.Transparent; toolTip = "Alpha"; } else if (i == 4) { background = Skill.Editor.Resources.UITextures.Colors.White; toolTip = "White"; } else if (i == 5) { background = Skill.Editor.Resources.UITextures.Colors.Black; toolTip = "Black"; } btn.Style.normal.background = btn.Style.focused.background = btn.Style.hover.background = btn.Style.active.background = background; btn.Content.tooltip = toolTip; btn.Click += btn_Click; _PnlFavoriteColors.Controls.Add(btn); } _ColorField = new ColorField() { Color = _PaintColor.Color, Margin = new Thickness(2) }; _SliRadius = new Skill.Editor.UI.Slider() { Value = _PaintColor.Radius, MinValue = 1, MaxValue = 40, Margin = new Thickness(2), Height = 16 }; _SliRadius.Label.text = "Radius"; _SliRadius.Label.tooltip = "Shift + (A/D)"; _SliStrength = new Skill.Editor.UI.Slider() { Value = _PaintColor.Strength, MinValue = 1f, MaxValue = 100f, Margin = new Thickness(2), Height = 16 }; _SliStrength.Label.text = "Strength"; _SliFalloff = new Skill.Editor.UI.Slider() { Value = _PaintColor.Falloff, MinValue = 0.0f, MaxValue = 1.0f, Margin = new Thickness(2), Height = 16 }; _SliFalloff.Label.text = "Falloff"; _HelpBox = new HelpBox() { Height = 60, Message = "Hold CTRL and drag with Right Click to paint.\nTexture must be read/write enable\nValid texture format:\n ARGB32, RGBA32, RGB24 and Alpha8" }; _BtnSaveTexture = new Skill.Framework.UI.Button() { Margin = new Thickness(2), Height = 40 }; _BtnSaveTexture.Content.text = "Save Texture"; _TbShadowMode = new UI.ToggleButton() { Left = false, Margin = new Thickness(2), Height = 20 }; _TbShadowMode.Label.text = "Shadow Mode"; _Panel.Controls.Add(_TextureField); _Panel.Controls.Add(_TbChannels); _Panel.Controls.Add(_PnlFavoriteColors); _Panel.Controls.Add(_ColorField); _Panel.Controls.Add(layersPanel); _Panel.Controls.Add(_SliRadius); _Panel.Controls.Add(_SliStrength); _Panel.Controls.Add(_SliFalloff); _Panel.Controls.Add(_TbShadowMode); _Panel.Controls.Add(_HelpBox); _Panel.Controls.Add(_BtnSaveTexture); _Frame = new Frame("Frame"); _Frame.Grid.Controls.Add(_Panel); _TextureField.ObjectChanged += _TextureField_ObjectChanged; _TbBrush.Changed += _TbBrush_Changed; _TbShadowMode.Changed += _TbShadowMode_Changed; _TbChannels.TabChanged += Channel_Changed; _LayersField.LayersChanged += _LayersField_LayersChanged; _PUV.OptionChanged += _PUV_OptionChanged; _ColorField.ColorChanged += _ColorField_ColorChanged; _SliRadius.ValueChanged += _SliRadius_ValueChanged; _SliStrength.ValueChanged += _SliStrength_ValueChanged; _SliFalloff.ValueChanged += _SliFalloff_ValueChanged; _BtnSaveTexture.Click += _BtnSaveTexture_Click; }
private void HelpMenu_OnClick(object sender, RoutedEventArgs e) { var helpWindow = new HelpBox(); helpWindow.ShowDialog(); }
private void Initialize() { if (Selection.activeObject == null) { return; } visualTree = Resources.Load <VisualTreeAsset>("AssetReferenceViewer"); var rootView = rootVisualElement; var root = visualTree.CloneTree().Q <VisualElement>("Root"); rootView.Clear(); rootView.Add(root); graphViewer = new GraphViewer(); graphViewer.Initialize(Selection.activeObject); var graph = rootView.Q <VisualElement>("Graph"); graph.Add(graphViewer); var helpBox = root.Q <VisualElement>("HelpBox"); helpBox.style.display = DisplayStyle.None; string selectedPath = AssetDatabase.GetAssetPath(Selection.activeObject); var objName = root.Q <Label>("ObjName"); objName.text = Selection.activeObject.name; var objPath = root.Q <Label>("Path"); objPath.text = selectedPath; var icon = root.Q <VisualElement>("AssetIcon"); icon.style.backgroundImage = new StyleBackground((Texture2D)AssetDatabase.GetCachedIcon(selectedPath)); if (!selectedPath.StartsWith("Assets/")) { var helpB = new HelpBox("This asset is outside Assets folder or you selected something in the scene", HelpBoxMessageType.Warning); graphViewer.Add(helpB); return; } var scroll = root.Q <ScrollView>("Scroll"); if (Directory.Exists(selectedPath)) { return; } AssetInfo selectedAssetInfo = AssetReferenceViewer.GetAsset(selectedPath); if (selectedAssetInfo == null) { AssetReferenceViewer.RebuildDatabase(); EditorApplication.delayCall = Initialize; return; } var buildStatusIcon = root.Q <VisualElement>("BuildStatusIcon"); buildStatusIcon.style.backgroundImage = selectedAssetInfo.IsIncludedInBuild ? ProjectIcons.LinkBlue : ProjectIcons.LinkBlack; buildStatusIcon.tooltip = selectedAssetInfo.IncludedStatus.ToString(); var dependenciesFoldout = root.Q <Foldout>("Dependencies"); dependenciesFoldout.Clear(); dependenciesFoldout.text = "Dependencies (" + selectedAssetInfo.dependencies.Count + ")"; scroll.Add(dependenciesFoldout); var referencesFoldout = root.Q <Foldout>("References"); referencesFoldout.Clear(); referencesFoldout.text = "References (" + selectedAssetInfo.references.Count + ")"; scroll.Add(referencesFoldout); foreach (var d in selectedAssetInfo.dependencies) { var item = visualTree.CloneTree().Q <VisualElement>("Item"); var itemIcon = item.Q <VisualElement>("ItemIcon"); var itemLabel = item.Q <Label>("ItemLabel"); var inBuildIcon = item.Q <VisualElement>("InBuildIcon"); itemLabel.text = Path.GetFileName(d); item.RegisterCallback <MouseUpEvent>(e => { Selection.activeObject = AssetDatabase.LoadAssetAtPath <Object>(d); }); itemIcon.style.backgroundImage = AssetDatabase.GetCachedIcon(d) as Texture2D; AssetInfo depInfo = AssetReferenceViewer.GetAsset(d); inBuildIcon.style.backgroundImage = depInfo.IsIncludedInBuild ? ProjectIcons.LinkBlue : ProjectIcons.LinkBlack; inBuildIcon.tooltip = depInfo.IncludedStatus.ToString(); item.style.display = DisplayStyle.Flex; dependenciesFoldout.contentContainer.Add(item); } foreach (var r in selectedAssetInfo.references) { var item = visualTree.CloneTree().Q <VisualElement>("Item"); var itemIcon = item.Q <VisualElement>("ItemIcon"); var itemLabel = item.Q <Label>("ItemLabel"); var inBuildIcon = item.Q <VisualElement>("InBuildIcon"); itemLabel.text = Path.GetFileName(r); item.RegisterCallback <MouseUpEvent>(e => { Selection.activeObject = AssetDatabase.LoadAssetAtPath <Object>(r); }); itemIcon.style.backgroundImage = AssetDatabase.GetCachedIcon(r) as Texture2D; AssetInfo depInfo = AssetReferenceViewer.GetAsset(r); inBuildIcon.style.backgroundImage = depInfo.IsIncludedInBuild ? ProjectIcons.LinkBlue : ProjectIcons.LinkBlack; inBuildIcon.tooltip = depInfo.IncludedStatus.ToString(); item.style.display = DisplayStyle.Flex; referencesFoldout.contentContainer.Add(item); } if (!selectedAssetInfo.IsIncludedInBuild) { helpBox.style.display = DisplayStyle.Flex; var helpLabel = root.Q <Label>("HelpBoxLabel"); var helpButton = root.Q <Button>("HelpButton"); var helpIcon = root.Q <VisualElement>("HelpIcon"); helpButton.text = "Delete Asset"; helpButton.style.display = DisplayStyle.Flex; helpLabel.text = "This asset is not referenced and never used. Would you like to delete it ?"; helpIcon.style.backgroundImage = (Texture2D)EditorGUIUtility.IconContent("console.warnicon").image; helpButton.clicked += () => { File.Delete(selectedPath); AssetDatabase.Refresh(); AssetReferenceViewer.RemoveAssetFromDatabase(selectedPath); }; } EditorApplication.delayCall = () => { graphViewer.FrameAll(); }; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (null == _item) { return; } _MAX_CAM = Global.deviceHole.SxtCount - 1; _listSampleNum = new List <TextBox>(); int sampleNum = _item.SampleNum; int holeUse = 0; // 添加布局 for (int i = 0; i < Global.deviceHole.SxtCount; ++i) { UIElement element = GenerateChannelLayout(i, String.Format("{0:D5}", sampleNum), _item.Hole[i].SampleName); WrapPanelChannel.Children.Add(element); if (_item.Hole[i].Use) { holeUse += 1; sampleNum++; _listSampleNum.Add(UIUtils.GetChildObject <TextBox>(element, "sampleNum")); } else { element.Visibility = System.Windows.Visibility.Collapsed; _listSampleNum.Add(null); } } if (holeUse < 4) { if (holeUse == 1) { this.WrapPanelChannel.Width = 190; } else if (holeUse == 2) { this.WrapPanelChannel.Width = 380; } else if (holeUse == 3) { this.WrapPanelChannel.Width = 570; } } // 初始化辅助方框及TC线的参数 _bTCLineNeedSetting = new bool[Global.deviceHole.SxtCount]; _helpBoxes = new HelpBox[Global.deviceHole.SxtCount]; for (int i = 0; i < _bTCLineNeedSetting.Length; ++i) { _bTCLineNeedSetting[i] = false; _helpBoxes[i] = new HelpBox(); } // 初始化灰阶值存储位置 _bRGBValuesNeedRead = new bool[Global.deviceHole.SxtCount]; _listRGBValues = new List <byte[]>(); for (int i = 0; i < _bRGBValuesNeedRead.Length; ++i) { _bRGBValuesNeedRead[i] = false; _listRGBValues.Add(null); } // 启动线程 _updateCAMThread = new UpdateCAMThread(this); _updateCAMThread.Start(); _bTimerWork = true; _msgReadCAMReplyed = true; _timerThread = new TimerThread(this); _timerThread.Start(); Message msg = new Message() { what = MsgCode.MSG_TIMER_WORK }; _timerThread.SendMessage(msg, null); }
private void HelpWnd_Closed(object sender, EventArgs e) { _HelpWnd = null; }
private void createUI() { Toolbar toolbar = AddControl <Toolbar>(); { Label label = toolbar.AddControl <Label>(); { label.Content.Text = "Update Rate: "; label.Layout.Size = new Vector2(0, 0); } ToggleButton slow = toolbar.AddControl <ToggleButton>("0"); { slow.Style = new VisualStyle(EditorStyle.ToolbarButton); slow.Content.Text = "Slow Update"; slow.Content.Tooltip = "Set the refresh mode to slow. Less updates per frame"; slow.OnClicked += (object sender) => { setUpdateRate(0); }; } ToggleButton medium = toolbar.AddControl <ToggleButton>("1"); { medium.Style = new VisualStyle(EditorStyle.ToolbarButton); medium.Content.Text = "Medium Update"; medium.Content.Tooltip = "Set the refresh mode to medium. The default settings"; medium.OnClicked += (object sender) => { setUpdateRate(1); }; } ToggleButton fast = toolbar.AddControl <ToggleButton>("2"); { fast.Style = new VisualStyle(EditorStyle.ToolbarButton); fast.Content.Text = "Fast Update"; fast.Content.Tooltip = "Set the refresh mode to fast. More updates per frames for more accurate data"; fast.OnClicked += (object sender) => { setUpdateRate(2); }; } toolbar.AddControl <FlexibleSpacer>(); // Set the mode setUpdateRate(-1); } parent = AddControl <VerticalLayout>(); { HelpBox timingHelp = parent.AddControl <HelpBox>(); { timingHelp.Content.Text = "Shows the average and peek time taken to complete the algorithm"; } Chart timingChart = parent.AddControl <Chart>(); { timingChart.Layout.MinSize = new Vector2(0, 0); timingChart.SetChartAxis(ChartAxis.Horizontal, 0, 1, "Update (Frame Step)"); timingChart.SetChartAxis(ChartAxis.Vertical, 0, 1, "Time (ms)"); timingChart.SetDatasetCount(2); timingChart.SetDataset(0, timingData); timingChart.SetDataset(1, timingPeekData); timingData.Name = "Average Time (Per sample)"; timingPeekData.Name = "Highest Time (Per sample)"; } HelpBox usageHelp = parent.AddControl <HelpBox>(); { usageHelp.Content.Text = "Shows the current usages value for all worker threads (When active)"; } HorizontalLayout usageLayout = parent.AddControl <HorizontalLayout>(); { Chart usageChart = usageLayout.AddControl <Chart>(); { usageChart.Layout.MinSize = new Vector2(0, 0); usageChart.SetChartAxis(ChartAxis.Horizontal, 0, 1, "Update (Frame Step)"); usageChart.SetChartAxis(ChartAxis.Vertical, 0, 1, "Usage (%)"); // Set data usageChart.SetDatasetCount(3); for (int i = 0; i < ThreadManager.maxAllowedWorkerThreads; i++) { usageData[i] = new ChartDynamicDataset(); usageData[i].Name = string.Format("Thread {0}", i + 1); usageChart.SetDataset(i, usageData[i]); } } usageView = usageLayout.AddControl <ThreadViewCollectionControl>(); { usageView.Layout.Size = new Vector2(230, 0); } } } hint = AddControl <HelpBox>(); { hint.HelpType = HelpBoxType.Info; hint.Content.Text = "Waiting for game to launch. Timing and usage statistics can only be gathered in play mode"; } }