public void ProcessColumn(ColumnWrapper col) { if (ProcessColumnObject != null) ProcessColumnObject(col); foreach (var obj in col.Children) obj.AcceptVisitor(this); }
private void Init() { var flightParameters = ApplicationContext.Instance.GetFlightParameters( ApplicationContext.Instance.CurrentAircraftModel); List<ColumnWrapper> temp = new List<ColumnWrapper>(); if (flightParameters != null && flightParameters.Parameters != null && flightParameters.Parameters.Length > 0) { var ps = from par in flightParameters.Parameters where par.ParameterID != "(NULL)" orderby par.Index ascending, par.SubIndex descending select par; foreach (var pm in ps)//flightParameters.Parameters) { ColumnWrapper wrap = new ColumnWrapper(pm); //this.grdData.Columns.Add(wrap.GridColumn); if (wrap.ParameterID != "(NULL)") temp.Add(wrap); //this.ComboBoxParameterIDSource.Add(wrap); } } this.ComboBoxParameterIDSource = new ObservableCollection<ColumnWrapper>(temp); }
static public void SaveLevel(Map t_map, string t_fileName, Dictionary <string, Sprite> t_tileSprites, Dictionary <string, MapObject> t_mapObjects) { LevelSaveData saveData = new LevelSaveData(); saveData.m_mapWidth = t_map.m_width; saveData.m_mapHeight = t_map.m_hight; foreach (KeyValuePair <string, Sprite> tileSprite in t_tileSprites) { saveData.m_tileSpritePaths.Add(tileSprite.Key); } for (int x = 0; x < saveData.m_mapWidth; x++) { ColumnWrapper col = new ColumnWrapper(); for (int y = 0; y < saveData.m_mapHeight; y++) { col.m_spriteNames.Add(t_map.GetTile(new MapIndex(x, y)).GetSprite().name); } saveData.m_spriteNames.Add(col); } foreach (KeyValuePair <string, MapObject> mapObject in t_mapObjects) { SaveObjectData saveMapPrefabData = new SaveObjectData(); saveMapPrefabData.m_name = mapObject.Value.m_name; saveMapPrefabData.m_prefabPath = mapObject.Value.m_prefabPath; saveMapPrefabData.m_width = mapObject.Value.m_width; saveMapPrefabData.m_height = mapObject.Value.m_height; saveData.m_objectsData.Add(saveMapPrefabData); } List <GameObject> placedPrefabs = t_map.GetAllEnteties(); foreach (GameObject placedPrefab in placedPrefabs) { PlacedObjectData mapPrefab = new PlacedObjectData(); mapPrefab.m_name = placedPrefab.name; mapPrefab.m_position = placedPrefab.transform.position; saveData.m_placedObjects.Add(mapPrefab); } string jsonData = JsonUtility.ToJson(saveData, true); string fullPath = s_jsonPath + t_fileName + ".json"; System.IO.File.WriteAllText(fullPath, jsonData); }
private void InitButtonColumn() { unboundModelColumn = gridListEditor.Model.Columns.GetNode <IModelColumn>(ButtonColumnName); if (unboundModelColumn == null) { unboundModelColumn = gridListEditor.Model.Columns.AddNode <IModelColumn>(ButtonColumnName); unboundModelColumn.PropertyName = ButtonColumnName; unboundModelColumn.PropertyEditorType = typeof(DefaultPropertyEditor); for (int i = gridListEditor.Columns.Count - 1; i >= 0; i--) { ColumnWrapper cw = gridListEditor.Columns[i]; if (cw.PropertyName == unboundModelColumn.PropertyName) { gridListEditor.RemoveColumn(cw); break; } } gridListEditor.AddColumn(unboundModelColumn); } GridColumn buttonColumn = gridListEditor.GridView.Columns[unboundModelColumn.PropertyName]; if (buttonColumn != null) { buttonColumn.UnboundType = UnboundColumnType.Boolean; buttonColumn.Caption = ButtonColumnCaption; buttonColumn.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; buttonColumn.VisibleIndex = 0; buttonColumn.Width = 50; buttonColumn.OptionsColumn.AllowEdit = true; buttonColumn.OptionsColumn.AllowGroup = DefaultBoolean.False; buttonColumn.OptionsColumn.AllowMove = false; buttonColumn.OptionsColumn.AllowShowHide = false; buttonColumn.OptionsColumn.AllowSize = false; buttonColumn.OptionsColumn.AllowSort = DefaultBoolean.False; buttonColumn.OptionsColumn.FixedWidth = true; buttonColumn.OptionsColumn.ShowInCustomizationForm = false; buttonColumn.OptionsFilter.AllowFilter = false; InitButtonEditor(); } }
public MyASPxGridViewColumnModelSynchronizer(ColumnWrapper gridColumn, IModelColumn model, CollectionSourceDataAccessMode dataAccessMode, bool isProtectedContent) : base(gridColumn, model, dataAccessMode, isProtectedContent) { }
public override void RemoveColumn(ColumnWrapper column) { IXafGridColumn gridColumn = ((XpandGridColumnWrapper)column).Column; if (GridView != null && GridView.Columns.Contains((GridColumn)gridColumn)) { RemoveColumnInfo(gridColumn); GridView.Columns.Remove((GridColumn)gridColumn); } else { throw new ArgumentException(string.Format(SystemExceptionLocalizer.GetExceptionMessage(ExceptionId.GridColumnDoesNotExist), column.PropertyName), "PropertyName"); } }
public static GridColumn Column(this ColumnWrapper columnWrapper) { return(columnWrapper.GetPropertyValue("Column") as GridColumn); }
/// <summary> /// Loads in the data from the a file who's name matches the passed in /// name. If the file fails to load false is returned otherwise the /// map editor data is populated. If the level editor is not null its /// UI data is populated. If the passed in bool is true then the real /// prefabs are instanciated within the scene instead of the map objects. /// </summary> /// <param name="t_fileName">The name of the file that is to be loaded</param> /// <param name="t_loadRealObjects">Bool for it the original prefabs should be placed or the fake ones</param> /// <returns>Bool for if the file was loaded succesfuly or not</returns> public bool LoadLevel(string t_fileName, bool t_loadRealObjects) { if (t_fileName != "") { LevelSaveData saveData = LevelSave.LoadLevel(t_fileName); if (saveData != null) { ClearAllData(); CreateMap(saveData.m_mapWidth, saveData.m_mapHeight); foreach (string path in saveData.m_tileSpritePaths) { LoadtTileSprite(path); if (m_levelEditor != null) { m_levelEditor.CreateSpriteButton(path); } } for (int x = 0; x < saveData.m_spriteNames.Count; x++) { ColumnWrapper wrapperClass = saveData.m_spriteNames[x]; for (int y = 0; y < wrapperClass.m_spriteNames.Count; y++) { Sprite sprite = m_map.GetTile(new MapIndex(x, y)).GetSprite(); foreach (string path in m_tileSprites.Keys) { if (path.Contains(wrapperClass.m_spriteNames[y])) { sprite = m_tileSprites[path]; break; } } m_map.GetTile(new MapIndex(x, y)).SetSprite(sprite); } } for (int i = 0; i < saveData.m_objectsData.Count; i++) { LoadMapObject(saveData.m_objectsData[i].m_name, saveData.m_objectsData[i].m_width, saveData.m_objectsData[i].m_height); if (m_levelEditor != null) { m_levelEditor.CreateObjectButton(m_mapObjects[saveData.m_objectsData[i].m_name]); } } for (int i = 0; i < saveData.m_placedObjects.Count; i++) { if (m_mapObjects.ContainsKey(saveData.m_placedObjects[i].m_name)) { MapObject mapObject = m_mapObjects[saveData.m_placedObjects[i].m_name]; Vector2 position = saveData.m_placedObjects[i].m_position; position.x = position.x - ((mapObject.m_width - 1) * m_map.m_tileSize) / 2; position.y = position.y - ((mapObject.m_height - 1) * m_map.m_tileSize) / 2; MapIndex mapIndex = m_map.WorldPositionToMapIndex(position); if (t_loadRealObjects) { InstantiateRealObject(mapIndex, mapObject); } else { InstantiateMapObject(mapIndex, mapObject); } } } return(true); } } return(false); }
public Node GetNode() { if (node == null) { node = new Node(); } ColumnWrapper cw = getBranchingColumn(); node.Column = cw.Column; node.Threshold = cw.Threshold; if (node.Column != null) { if (node.Column.IsNominal) { IDictionary <string, int> count = new Dictionary <string, int>(); Column decisionColumn = Columns.Last(); foreach (string val in decisionColumn.Values) { count.Add(val, 0); } foreach (IList <string> row in Data) { count[row[decisionColumn.Index]]++; } string mostAppearResult = count.First().Key; foreach (string val in decisionColumn.Values) { if (count[val] > count[mostAppearResult]) { mostAppearResult = val; } } node.DecideFunc = row => node.Childs.ContainsKey(row[node.Column.Index]) ? node.Childs[row[node.Column.Index]].Decide(row) : mostAppearResult; } else { node.DecideFunc = row => double.Parse(row[node.Column.Index]) > node.Threshold ? node.Childs[true.ToString()].Decide(row) : node.Childs[false.ToString()].Decide(row); } } else { IDictionary <string, int> count = new Dictionary <string, int>(); Column decisionColumn = Columns.Last(); foreach (string val in decisionColumn.Values) { count.Add(val, 0); } foreach (IList <string> row in Data) { count[row[decisionColumn.Index]]++; } string mostAppearResult = count.First().Key; foreach (string val in decisionColumn.Values) { if (count[val] > count[mostAppearResult]) { mostAppearResult = val; } } node.DecideFunc = row => mostAppearResult; } return(node); }