private void GenerationCallback(GameObject element, LevelData levelData, int x, int y) { levelData.levelStructure[x, y] = new Element(); EditorCell editorCell = element.GetComponent <EditorCell>(); editorCell.SetElement(levelData.levelStructure[x, y]); }
/// <summary> /// Launches a "clip" comboBox to let the user select the /// cell clip. It does this by temporarily setting the /// appropriate cell-level EditorType - and resets it when /// editing is complete. /// </summary> /// <param name="e"></param> private void LaunchCombo(KeyEventArgs e) { // Set a new cell-level EditorType, and initialize // the combo dropdown with the available audio clips EditorCell.EditorType = typeof(MyGridComboBoxExEditControl); GridComboBoxExEditControl cb = EditorCell.EditControl as GridComboBoxExEditControl; if (cb != null) { cb.DisableInternalDrawing = true; cb.DropDownStyle = ComboBoxStyle.DropDownList; foreach (string clip in _Clips) { cb.Items.Add(clip); } cb.DrawItem += GridClipControlDrawItem; } // Deactivate the current active editor, and initiate // an edit session on the newly set modal combo editor. EditorCell.SuperGrid.DeactivateNonModalEditor(); EditorCell.BeginEdit(true, e); }
private void OnSelectedTokensChanged(object sender, EventArgs e) { if (SuspendUpdate == false) { EditorCell.Value = SelectedTokens?.Select(x => x.Value).TagConcat(); EditorCell.EditorValueChanged(this); } }
private void Register(GameLine l, int x, int y) { var key = GetCellKey(x, y); EditorCell cell; if (!Cells.TryGetValue(key, out cell)) { cell = new EditorCell(); Cells[key] = cell; } cell.AddLine(l); }
/// <summary> /// Renders the given item /// </summary> /// <param name="g"></param> /// <param name="bounds"></param> /// <param name="text"></param> private void RenderItem(Graphics g, Rectangle bounds, string text) { CellVisualStyle style = EditorCell.GetEffectiveStyle(); using (StringFormat sf = new StringFormat()) { g.SmoothingMode = SmoothingMode.AntiAlias; sf.LineAlignment = StringAlignment.Center; using (Brush br = new SolidBrush(style.TextColor)) g.DrawString(text, style.Font, br, bounds, sf); } }
public virtual string GetValue(object value) { GridPanel panel = EditorCell.GridPanel; if (value == null || (panel.NullValue == NullValue.DBNull && value == DBNull.Value)) { return(""); } if (EditorCell.IsValueExpression) { value = EditorCell.GetExpValue((string)value); } return(Convert.ToString(value)); }
private void CreateNewGrid() { SetupArrayCells(); for (int i = 0; i < GridController3D.gridController3D.EditorGridData.HorizontalDim; i++) { for (int j = 0; j < GridController3D.gridController3D.EditorGridData.VerticalDim; j++) { GameObject tempCell = Instantiate(Cell2DPrefab, MapSpace); RectTransform tempCellTransform = tempCell.GetComponent <RectTransform>(); tempCell.SetActive(true); tempCellTransform.sizeDelta = new Vector2(XMod, YMod); tempCellTransform.anchoredPosition = new Vector2(XMod * i, YMod * j); EditorCell tempEditorCell = tempCell.AddComponent <EditorCell>(); tempEditorCell.X = i; tempEditorCell.Y = j; tempEditorCell.gridController = this; } } }
public EditorCell LinesInRect(DoubleRect rect) { int starty = (int)Math.Floor(rect.Top / CellSize); int startx = (int)Math.Floor(rect.Left / CellSize); int endy = (int)Math.Floor((rect.Top + rect.Height) / CellSize); int endx = (int)Math.Floor((rect.Left + rect.Width) / CellSize); EditorCell ret = new EditorCell(); using (Sync.AcquireWrite()) { for (int x = startx; x <= endx; x++) { for (int y = starty; y <= endy; y++) { var cell = GetCell(x, y); if (cell != null) { ret.Combine(cell); } } } } return(ret); }
protected override void OnPaintBackground(PaintEventArgs e) { EditorCell.PaintEditorBackground(e, this); }