public Dictionary <int, string> MapToColId(Type type, List <List <string> > data) { Dictionary <string, string> map = new Dictionary <string, string>(); foreach (var field in type.GetFields()) { GColumn columnAttr = (GColumn)field.GetCustomAttribute(typeof(GColumn)); if (columnAttr != null) { map[columnAttr.ColumnName] = field.Name; } } Dictionary <int, string> columnIdToFieldMap = new Dictionary <int, string>(map.Count); for (int colId = 0; colId < data[0].Count; colId++) { string columnName = data[0][colId]; if (map.ContainsKey(columnName)) { columnIdToFieldMap[colId] = map[columnName]; } } return(columnIdToFieldMap); }
/// <summary> /// Try to grab match object from fill path /// </summary> /// <param name="completeCallBack"></param> internal void FillGrab(Action completeCallBack) { GameObject mObject = null; GridCell gCell = null; if (spawner) { MatchObject mo = spawner.Get(); mObject = (mo) ? mo.gameObject : null; } else { if (fillPath != null && fillPath.Count > 0) { gCell = fillPath[0]; } else // try to get at top { gCell = GColumn.GetTopCell(Row); } mObject = gCell.DynamicObject; } if (mObject && gCell && (gCell.PhysStep)) { return; } GrabDynamicObject(mObject, (MBoard.fillType == FillType.Fast), completeCallBack); }
/// <summary> /// return true if have fillpath to spawner or (if fillpath == null) have dynamic object at top /// </summary> /// <returns></returns> public bool HaveFillPath() { GridCell top = GColumn.GetTopCell(Row); return(((!Blocked && !IsDisabled && !StaticBlocker && spawner) || (!Blocked && !IsDisabled && !StaticBlocker && fillPath != null && fillPath.Count > 0)) || (!Blocked && !IsDisabled && !StaticBlocker && !top.Blocked && !top.IsDisabled && top.DynamicObject)); }
public override void GetControlAdminInfo(object objectControl, DataTable dataTable) { if (GColumn != null) { dataTable.Rows.Add(GColumn.Name, MainSettings.GetRussianName(GColumn.GetType() .Name), string.IsNullOrEmpty(GColumn.Caption) ? GColumn.FieldName : GColumn.Caption, GColumn, GColumn.View.GridControl.Name); } else if (TreeColumn != null) { dataTable.Rows.Add(TreeColumn.Name, MainSettings.GetRussianName(TreeColumn.GetType() .Name), string.IsNullOrEmpty(TreeColumn.Caption) ? TreeColumn.FieldName : TreeColumn.Caption, TreeColumn, TreeColumn.TreeList.Name); } }