public Selector(EditorBase editor) { this.editor = editor; InitializeComponent(); foreach (var i in editor.GetSelector()) listBox1.Items.Add(i); }
protected EditorBase CloneInto(EditorBase other) { other.AllowEdit = AllowEdit; other.ApplyNewValue = ApplyNewValue; other.ParseNewInputValue_SecondPass = ParseNewInputValue_SecondPass; return(other); }
public override void Enter() { editorBase = MainGame.Instance.GetState <EditorBase>() ?? throw new InvalidOperationException("The map editor must be stacked on top of the editor base."); currentMode = Emulate; MainGame.Instance.Push(tilePicker); }
/// <summary> /// 创建控件 /// </summary> private void CreateItems() { _propertyUIConfig = new Dictionary <string, EditorBase>(); List <ConfigItem> lstItem = _config.ConfigItems; tabPanel.ColumnCount = 2; tabPanel.RowCount = (int)Math.Ceiling((double)lstItem.Count / (double)2) + 1; tabPanel.RowStyles.Clear(); tabPanel.ColumnStyles.Clear(); AddCellStyle(); _configItemInfo = new Dictionary <string, ConfigItem>(); for (int i = 0; i < lstItem.Count; i++) { ConfigItem curItem = lstItem[i]; _configItemInfo[curItem.Name] = curItem; EditorBase editor = NewItem(curItem); int col = i % 2; int row = i / 2; tabPanel.Controls.Add(editor, col, row); tabPanel.Controls.SetChildIndex(editor, i); editor.OnValueChange += new ValueChangeHandle(editor_OnValueChange); editor.Dock = DockStyle.Left; _propertyUIConfig[editor.BindPropertyName] = editor; } }
private static string GetPrintableText(TSgrdDataGrid AGrid, int AGridColumnId, object ADataColumn) { string ReturnValue; EditorBase editor = AGrid.Columns[AGridColumnId].DataCell.Editor; if (editor != null) { System.ComponentModel.TypeConverter tc = editor.TypeConverter; if (tc is TSgrdDataGrid.PartnerKeyConverter || tc is TypeConverter.TDecimalConverter || tc is TypeConverter.TCurrencyConverter || tc is TypeConverter.TDateConverter || tc is TypeConverter.TShortTimeConverter || tc is TypeConverter.TLongTimeConverter) { ReturnValue = (string)tc.ConvertTo(ADataColumn, typeof(System.String)); } else { // Including Boolean - in a grid that is a checkbox but we want simple text ReturnValue = ADataColumn.ToString(); } } else { // Simple cell with no special editor ReturnValue = ADataColumn.ToString(); } return(ReturnValue); }
public Editor(EditorBase editor) { this.editor = editor; InitializeComponent(); Text = editor.ToString(); this.editor.Update += euh = new EventHandler(editor_Update); }
public ParameterValueEditor(EditorBase editor) { InitializeComponent(); EditorPanel.Controls.Add(editor); editor.Dock = DockStyle.Fill; _editor = editor; }
public DataGridColumn Add(string property, string caption, EditorBase editor) { SourceGrid.Cells.DataGrid.Cell cell = new SourceGrid.Cells.DataGrid.Cell(); cell.Editor = editor; return(Add(property, caption, cell)); }
static void OnLoad() { var x = new EditorBase { content = "asdfadsf" }; x.render("#editor"); YUI.Current.one("#close-button").on("click", () => alert("Hello")); }
public PingGridColumn Add(string property, string caption, EditorBase editor) { var cell = new SourceGrid.Extensions.PingGrids.Cells.Cell(); cell.Editor = editor; return(Add(property, caption, cell)); }
void editorClass_OnValueChange(object sender, object oldValue, object newValue) { EditorBase editor = sender as EditorBase; if (editor == null) { return; } _classInfo.CheckItem[editor.BindPropertyName] = editor.Value; }
public void init() { registeAllFrameComponents(); EditorBase.notifyConstructDone(); int count = mFrameComponentList.Count; for (int i = 0; i < count; ++i) { mFrameComponentList[i].init(); } }
protected virtual FrameworkElement GetItemEditor(EditorBase editor, string category) { return(new Border() { Name = Guid.NewGuid().ToString("N"), Margin = new Thickness(1, 0, 0, 0), BorderThickness = new Thickness(0, 0, 0, 1), BorderBrush = CommonBackground, Child = editor, Tag = category }); }
/// <summary> /// 创建新的设置项 /// </summary> /// <param name="item"></param> /// <returns></returns> private EditorBase NewItem(ConfigItem item) { EditorBase editor = item.GetEditor(); editor.BindPropertyName = item.Name; editor.LableText = item.Summary; editor.LableFont = new Font(editor.LableFont.FontFamily, 9, FontStyle.Bold); editor.LableWidth = 80; editor.Width = 250; return(editor); }
public void destroy() { int count = mFrameComponentList.Count; for (int i = 0; i < count; ++i) { mFrameComponentList[i].destroy(); mFrameComponentList[i] = null; } mFrameComponentList.Clear(); mFrameComponentMap.Clear(); EditorBase.notifyFrameDestroy(); }
private void SetClip(AudioClip clip) { GameObject[] prefabs = EditorBase.GetSelectedPrefabs(); Debug.Log(prefabs.Length); foreach (GameObject obj in prefabs) { //string path = AssetDatabase.GetAssetPath(obj); GameObject prefab = obj as GameObject; EditorUtility.SetDirty(prefab); } }
void editor_OnValueChange(object sender, object oldValue, object newValue) { EditorBase editor = sender as EditorBase; if (editor == null) { return; } if (_currentItem == null) { return; } _currentItem.CheckItem[editor.BindPropertyName] = editor.Value; }
public Brewster_WAR_Brewer(SoundFile <ISoundFile> fileToOpen, MainWindow mainWindow, EditorBase otherEditor = null) : base(typeof(SoundWaveArchive), "Wave Archive", "war", "Brewster's War Brewer", fileToOpen, mainWindow) { InitializeComponent(); string name = ExtFile.FileName; if (name == null) { name = "{ Null File Name }"; } Text = EditorName + " - " + name + "." + ExtFile.FileExtension; Icon = Properties.Resources.Brewster; OtherEditor = otherEditor; toolsWarToolStripMenuItem.Visible = true; waveOut.Stopped += new EventHandler <PlaybackStoppedEventArgs>(this.WaveEnded); new Thread(PlayNext).Start(); }
public SelectMultipleValueView(EditorBase editor) { InitializeComponent(); Text = Resources.SelectMultipleValueView; _editor = editor; if (editor != null) { InitializeEditor(editor); ControlPanel.Visible = true; } else { ControlPanel.Visible = false; } }
/// <summary> /// 显示数据里面的变量 /// </summary> /// <param name="_editor"></param> /// <param name="serializedObject"></param> /// <returns></returns> public static bool DrawInspectorGUI(EditorBase _editor, SerializedObject serializedObject) { serializedObject.Update(); EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.LabelField("名称", new GUILayoutOption[] { GUILayout.Width(120f) }); _editor.Data.Name = EditorGUILayout.TextField(_editor.Data.Name, new GUILayoutOption[0]); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); return true; } return false; }
/// <summary> /// 创建类级别信息 /// </summary> private void CreateClassItem() { _classUIConfig = new Dictionary <string, EditorBase>(); List <ConfigItem> lstItem = _config.ClassItems; pnlClassConfig.Controls.Clear(); _configClassInfo = new Dictionary <string, ConfigItem>(); for (int i = 0; i < lstItem.Count; i++) { ConfigItem curItem = lstItem[i]; _configClassInfo[curItem.Name] = curItem; EditorBase editor = NewItem(curItem); pnlClassConfig.Controls.Add(editor); //tabPanel.Controls.SetChildIndex(editor, i); editor.OnValueChange += new ValueChangeHandle(editorClass_OnValueChange); _classUIConfig[editor.BindPropertyName] = editor; } }
private void SetFont(Object f) { Font font = f as Font; GameObject[] prefabs = EditorBase.GetSelectedPrefabs(); foreach (GameObject obj in prefabs) { //string path = AssetDatabase.GetAssetPath(obj); GameObject prefab = obj as GameObject; Text [] label = prefab.GetComponentsInChildren <Text>(true); for (int i = 0; i < label.Length; i++) { label[i].font = font; } EditorUtility.SetDirty(prefab); } }
public PropertyRow(PropertyGridView view, PropertyItem property, PropertyLabel label, EditorBase editor) { Requires.NotNull <PropertyGridView>(view, "view"); Requires.NotNull <PropertyItem>(property, "property"); Requires.NotNull <PropertyLabel>(label, "label"); Requires.NotNull <EditorBase>(editor, "editor"); this.View = view; this.Property = property; this.Label = label; this.Editor = editor; label.Name = "lbl" + property.Name; label.Foreground = property.CanWrite ? Brushes.Black : Brushes.Gray; label.MouseLeftButtonDown += LabelMouseLeftButtonDown; label.MouseLeftButtonUp += LabelMouseLeftButtonUp; editor.GotFocus += EditorGotFocus; editor.LostFocus += EditorLostFocus; }
// 写入一个二进制文件,fileName为绝对路径 public static bool writeFile(string fileName, byte[] buffer, int size, bool appenData = false) { // 检测路径是否存在,如果不存在就创建一个 createDir(StringUtility.getFilePath(fileName)); try { FileStream file = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); if (appenData) { file.Seek(0, SeekOrigin.End); } file.Write(buffer, 0, size); file.Flush(); file.Close(); } catch (Exception e) { EditorBase.logConsole("exception!! write file : " + fileName + "----thread : " + Thread.CurrentThread.ManagedThreadId + ", message : " + e.Message); return(false); } return(true); }
protected virtual void CreatePropertyRow(PropertyItem property, ref int rowIndex) { #region Create Display Objects PropertyLabel label = CreateLabel(property.DisplayName); EditorBase editor = EditorService.GetEditor(property, label); if (editor == null) { return; } this.rows.Add(new PropertyRow(this, property, label, editor)); #endregion rowIndex++; this.RowDefinitions.Add(new RowDefinition()); //string category = property.Category; string category = property.Name; #region Column 0 - Margin FrameworkElement brd = GetItemMargin(category); this.Children.Add(brd); Grid.SetRow(brd, rowIndex); Grid.SetColumn(brd, 0); #endregion #region Column 1 - Label brd = GetItemLabel(label, category); this.Children.Add(brd); Grid.SetRow(brd, rowIndex); Grid.SetColumn(brd, 1); #endregion #region Column 2 - Editor brd = GetItemEditor(editor, category); this.Children.Add(brd); Grid.SetRow(brd, rowIndex); Grid.SetColumn(brd, 2); #endregion }
public Static_Sequencer(SoundFile <ISoundFile> fileToOpen, MainWindow mainWindow, EditorBase otherEditor = null) : base(typeof(SoundSequence), "Sequence", "seq", "Static's Sequencer", fileToOpen, mainWindow) { string name = ExtFile.FileName; if (name == null) { name = "{ Null File Name }"; } Text = EditorName + " - " + name + "." + ExtFile.FileExtension; Icon = Properties.Resources.Wolfgang; sequenceEditorPanel.BringToFront(); sequenceEditorPanel.Show(); OtherEditor = otherEditor; sequenceEditor.Insert += scintilla_Insert; sequenceEditor.Delete += scintilla_Delete; Load += new System.EventHandler(this.SequenceEditor_Load); string ext = "F"; if (fileToOpen.File != null) { ext = fileToOpen.File.GetExtension().Substring(1, 1); } }
public static EditorBase GetEditor(PropertyItem propertyItem, PropertyLabel label) { if (propertyItem == null) { throw new ArgumentNullException("propertyItem"); } EditorAttribute attribute = propertyItem.GetAttribute <EditorAttribute>(); if (attribute != null) { Type editorType = Type.GetType(attribute.EditorTypeName, false); if (editorType != null) { return(Activator.CreateInstance(editorType, label, propertyItem) as EditorBase); } } var registeredEditor = GetRegisteredEditor(label, propertyItem); if (registeredEditor != null) { return(registeredEditor); } Type propertyType = propertyItem.PropertyType; EditorBase editor = GetEditor(propertyType, label, propertyItem); while (editor == null && propertyType.BaseType != null) { propertyType = propertyType.BaseType; editor = GetEditor(propertyType, label, propertyItem); } return(editor); }
static void Main(string[] args) { //SoundArchive a = SoundArchiveReader.ReadSoundArchive("BigRedSound.bcsar"); //SoundArchiveWriter.WriteSoundArchive(a, "", "BigRedSoundOUT.bcsar"); //SoundSequence s = new SoundSequence(); //s = (SoundSequence)SoundArchiveReader.ReadFile(File.ReadAllBytes("credit.bfseq")); //File.WriteAllBytes("creditBAD.bfseq", SoundArchiveWriter.WriteFile(s)); //Vibration v = new Vibration(); //v.Load(File.ReadAllBytes("bonus.bnvib")); //File.WriteAllBytes("OUT.wav", RiffWaveFactory.CreateRiffWave(v).ToBytes()); //Application set up. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //No arguments. if (args.Length < 1) { Application.Run(new MainWindow()); } //Arguments. else { //Main window. if (args[0].ToLower().EndsWith("sar")) { Application.Run(new MainWindow(args[0])); } //Other file. else { //Editor base. EditorBase e = null; //Switch ending. switch (args[0].Substring(args[0].Length - 3, 3).ToLower()) { //Wave archive editor. case "war": e = new Brewster_WAR_Brewer(args[0], null); break; //Sequence editor. case "seq": e = new Static_Sequencer(args[0], null); break; //Group editor. case "grp": e = new Goldi_GRP_Grouper(args[0], null); break; //Wave sound data editor. case "wsd": e = new Wolfgang_WSD_Writer(args[0], null); break; //Isabelle. case "stm": case "wav": case "isp": IsabelleSoundEditor i = new IsabelleSoundEditor(args[0]); Application.Run(i); break; } //Run editor if type is defined. if (e != null) { Application.Run(e); } } } }
private void AgregarEditor(AccesorValor accesor) { if (accesor.ShowInEditor) { EditorBase controlEditor = null; if (controles.TryGetValue(accesor.ValueName, out controlEditor) == false) { Type tipo = accesor.ValueType; if (tipo == typeof(Vector3)) { controlEditor = new EditoresValores.EditorVector3(accesor); } if (tipo == typeof(OpenTK.Graphics.Color4)) { controlEditor = new EditoresValores.EditorColor4(accesor); } else if (tipo == typeof(Quaternion)) { controlEditor = new EditoresValores.EditorQuaternion(accesor); } else if (tipo == typeof(Boolean)) { controlEditor = new EditoresValores.EditorBoolean(accesor); } else if (tipo == typeof(String)) { controlEditor = new EditoresValores.EditorString(accesor); } else if (tipo == typeof(int) || tipo == typeof(float)) { controlEditor = new EditoresValores.EditorNumber(accesor); } else if (tipo.IsEnum) { controlEditor = new EditoresValores.EditorEnum(accesor, new EnumConverter(tipo)); } else if (tipo == typeof(Bitmap)) { controlEditor = new EditoresValores.EditorBimap(accesor); } else if (typeof(Component).IsAssignableFrom(tipo) || typeof(Resource).IsAssignableFrom(tipo)) { controlEditor = new EditoresValores.EditorType(accesor); } if (controlEditor != null) { controles.Add(accesor.ValueName, controlEditor); Label labelNombre = new Label(); labelNombre.AutoSize = true; labelNombre.Text = ProcesarNombreCampo(accesor.ValueName); labelNombre.Anchor = AnchorStyles.Left; controlEditor.Anchor = AnchorStyles.Left; tableLayoutPanel1.RowCount++; tableLayoutPanel1.Controls.Add(labelNombre, 0, tableLayoutPanel1.RowCount - 1); tableLayoutPanel1.Controls.Add(controlEditor, 1, tableLayoutPanel1.RowCount - 1); } } else { controlEditor.accesor = accesor; controlEditor.Update(); } } }
public override void OnInspectorGUI() { instance = (EditorBase)target; EditorGUILayout.LabelField("", "Hi"); EditorGUILayout.Space(); GUILayout.BeginVertical("box"); GUILayout.Space(5); GUILayout.BeginHorizontal(); //GUILayout.Space(10); EditorGUILayout.LabelField("Total Enemy Types: " + instance.enemyTypes.Count, GUILayout.MaxWidth(140)); if (GUILayout.Button("Create New Enemy Type")) { AddNewEnemyType(); } GUILayout.Space(10); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.EndVertical(); GUILayout.Space(20); PrimsOrAssets = EditorGUILayout.Toggle("Spawn Primitive", PrimsOrAssets); if (PrimsOrAssets) { shapeChoose = (PrimitiveShapes)EditorGUILayout.EnumPopup("Primitive to Spawn", shapeChoose); } else { assetNamesSelect = EditorGUILayout.Popup(assetNamesSelect, assetNames.ToArray()); } if (instance.enemyTypes.Count > 0) { GUIStyle style = new GUIStyle(); //style.fontSize = 30; style.normal.textColor = Color.white; style.contentOffset = new Vector2(120, 0); EditorGUILayout.LabelField("Created Objects", style); } EditorGUILayout.BeginVertical(); for (int i = 0; i < instance.enemyTypes.Count; i++) { EditorGUILayout.BeginHorizontal(); Color col = new Color(0, 0, 0); col = EditorGUILayout.ColorField(col); if (GUILayout.Button("Spawn")) { if (PrimsOrAssets) { SpawnEnemyPrim(i, col, shapeChoose); } else { SpawnEnemyAsset(col, assetNamesSelect); } } if (GUILayout.Button("Despawn")) { DeleteEnemy(i); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginVertical(); for (int k = 0; k < instance.enemyTypes[i].transform.childCount; k++) { EditorGUILayout.BeginHorizontal(); instance.enemyTypes[i].transform.GetChild(k).name = GUILayout.TextField(instance.enemyTypes[i].transform.GetChild(k).name); if (GUILayout.Button("Despawn")) { DestroyImmediate(instance.enemyTypes[i].transform.GetChild(k).gameObject); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); }
public SaveQuitDialog(EditorBase parent2) { InitializeComponent(); parentTwo = parent2; }
public DataSource(EditorBase owner) { Owner = owner; }
public MetaDataColumn(EditorBase Editor, int?Colspan = null) { this.Editor = Editor; this.Colspan = Colspan; }
/// <summary> /// 初始化该节点 /// </summary> /// <param name="task"></param> /// <param name="behaviorSource"></param> /// <param name="position"></param> /// <param name="id"></param> public void loadNode(ActionBase _action, DataSource behaviorSource, Vector2 position, ref int id) { action = _action; Owner = behaviorSource.Owner; FieldInfo[] fields = action.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);//只返回公开的字段 for (int i = 0; i < fields.Length; i++) { if (fields[i].FieldType.IsSubclassOf(typeof(SharedVariable))) {//该类型是 共享数据 SharedVariable sharedVariable = fields[i].GetValue(action) as SharedVariable; if (sharedVariable == null) { sharedVariable = (ScriptableObject.CreateInstance(fields[i].FieldType) as SharedVariable); fields[i].SetValue(action, sharedVariable); } } } action.ID = id++; action.NodeData = new NodeData(); action.NodeData.Position = position; action.NodeData.NodeDesigner = this; //this.loadTaskIcon(); this.init(); //this.mTask.NodeData.FriendlyName = this.taskName; }
/// <summary> /// Processes the edit binding. /// </summary> /// <param name="uiElement">The UI element.</param> /// <param name="gridColumn">Currency Column</param> private void InitializeEditUIElement(EditorBase uiElement, GridColumn gridColumn) { uiElement.TextSelectionOnFocus = false; var currencyColumn = (GridCurrencyColumn)gridColumn; var bind = currencyColumn.ValueBinding.CreateEditBinding(currencyColumn.GridValidationMode != GridValidationMode.None, gridColumn); uiElement.SetBinding(CurrencyTextBox.ValueProperty, bind); bind = new Binding { Path = new PropertyPath("AllowScrollingOnCircle"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(EditorBase.IsScrollingOnCircleProperty, bind); bind = new Binding { Path = new PropertyPath("MinValue"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.MinValueProperty, bind); bind = new Binding { Path = new PropertyPath("MaxValue"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.MaxValueProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyDecimalDigits"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyDecimalDigitsProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyGroupSeparator"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyGroupSeparatorProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencySymbol"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencySymbolProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyDecimalSeparator"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyDecimalSeparatorProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyGroupSizes"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyGroupSizesProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyPositivePattern"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyPositivePatternProperty, bind); bind = new Binding { Path = new PropertyPath("CurrencyNegativePattern"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.CurrencyNegativePatternProperty, bind); bind = new Binding { Path = new PropertyPath("MaxValidation"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(EditorBase.MaxValidationProperty, bind); bind = new Binding { Path = new PropertyPath("MinValidation"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(EditorBase.MinValidationProperty, bind); bind = new Binding { Path = new PropertyPath("AllowNullValue"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(EditorBase.UseNullOptionProperty, bind); bind = new Binding { Path = new PropertyPath("NullValue"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.NullValueProperty, bind); uiElement.WatermarkTextIsVisible = true; bind = new Binding { Path = new PropertyPath("NullText"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.WatermarkTextProperty, bind); #if WPF bind = new Binding { Path = new PropertyPath("TextDecorations"), Mode = BindingMode.TwoWay, Source = currencyColumn }; uiElement.SetBinding(CurrencyTextBox.TextDecorationsProperty, bind); #endif }