public void Render(TableAuthoring tableAuthoring, CoilListData data, Rect cellRect, int column, Action <CoilListData> updateAction) { switch ((CoilListColumn)column) { case CoilListColumn.Id: RenderId(ref data.Id, id => data.Id = id, data, cellRect, updateAction); break; case CoilListColumn.Description: RenderDescription(data, cellRect, updateAction); break; case CoilListColumn.Destination: RenderDestination(data, cellRect, updateAction); break; case CoilListColumn.Element: RenderElement(tableAuthoring, data, cellRect, updateAction); break; case CoilListColumn.Type: RenderType(data, cellRect, updateAction); break; case CoilListColumn.HoldCoilId: if (data.Type == CoilType.DualWound) { RenderId(ref data.HoldCoilId, id => data.HoldCoilId = id, data, cellRect, updateAction); } break; } }
public void Render(TableAuthoring tableAuthoring, SwitchListData data, Rect cellRect, int column, Action <SwitchListData> updateAction) { switch ((SwitchListColumn)column) { case SwitchListColumn.ID: RenderID(data, cellRect, updateAction); break; case SwitchListColumn.Description: RenderDescription(data, cellRect, updateAction); break; case SwitchListColumn.Source: RenderSource(data, cellRect, updateAction); break; case SwitchListColumn.Element: RenderElement(tableAuthoring, data, cellRect, updateAction); break; case SwitchListColumn.Type: RenderType(data, cellRect, updateAction); break; case SwitchListColumn.Off: RenderOff(data, cellRect, updateAction); break; } }
public ItemSearchableDropdown(AdvancedDropdownState state, TableAuthoring tableAuthoring, string title, Action <T> onElementSelected) : base(state) { _onElementSelected = onElementSelected; _tableAuthoring = tableAuthoring; minimumSize = new Vector2(200, 300); _title = title; }
public void Render(TableAuthoring tableAuthoring, SwitchListData data, Rect cellRect, int column, Action <SwitchListData> updateAction) { switch ((SwitchListColumn)column) { case SwitchListColumn.Id: RenderId(data, cellRect, updateAction); break; case SwitchListColumn.Description: RenderDescription(data, cellRect, updateAction); break; case SwitchListColumn.Source: RenderSource(data, cellRect, updateAction); break; case SwitchListColumn.Element: RenderElement(tableAuthoring, data, cellRect, updateAction); break; case SwitchListColumn.PulseDelay: RenderPulseDelay(data, cellRect, updateAction); break; } }
private void RenderDestinationElement(TableAuthoring tableAuthoring, WireListData wireListData, Rect cellRect, Action <WireListData> updateAction) { var icon = GetDestinationIcon(wireListData); if (icon != null) { var iconRect = cellRect; iconRect.width = 20; var guiColor = GUI.color; GUI.color = Color.clear; EditorGUI.DrawTextureTransparent(iconRect, icon, ScaleMode.ScaleToFit); GUI.color = guiColor; } cellRect.x += 25; cellRect.width -= 25; switch (wireListData.Destination) { case CoilDestination.Playfield: RenderDestinationElementPlayfield(tableAuthoring, wireListData, cellRect, updateAction); break; case CoilDestination.Device: cellRect.width = cellRect.width / 2f - 5f; RenderDestinationElementDevice(tableAuthoring, wireListData, cellRect, updateAction); cellRect.x += cellRect.width + 10f; RenderDestinationElementDeviceItem(wireListData, cellRect, updateAction); break; } }
private void RenderElement(TableAuthoring tableAuthoring, SwitchListData switchListData, Rect cellRect, Action <SwitchListData> updateAction) { var icon = GetIcon(switchListData); if (icon != null) { var iconRect = cellRect; iconRect.width = 20; var guiColor = GUI.color; GUI.color = Color.clear; EditorGUI.DrawTextureTransparent(iconRect, icon, ScaleMode.ScaleToFit); GUI.color = guiColor; } cellRect.x += 25; cellRect.width -= 25; switch (switchListData.Source) { case SwitchSource.InputSystem: RenderInputSystemElement(switchListData, cellRect, updateAction); break; case SwitchSource.Playfield: RenderPlayfieldElement(tableAuthoring, switchListData, cellRect, updateAction); break; case SwitchSource.Constant: RenderConstantElement(switchListData, cellRect, updateAction); break; } }
public void Render(TableAuthoring tableAuthoring, WireListData data, Rect cellRect, int column, Action <WireListData> updateAction) { switch ((WireListColumn)column) { case WireListColumn.Description: RenderDescription(data, cellRect, updateAction); break; case WireListColumn.Source: RenderSource(data, cellRect, updateAction); break; case WireListColumn.SourceElement: RenderSourceElement(tableAuthoring, data, cellRect, updateAction); break; case WireListColumn.Destination: RenderDestination(data, cellRect, updateAction); break; case WireListColumn.DestinationElement: RenderDestinationElement(tableAuthoring, data, cellRect, updateAction); break; case WireListColumn.PulseDelay: RenderPulseDelay(data, cellRect, updateAction); break; } }
private void OnEnable() { _mpfEngine = target as MpfGamelogicEngine; if (_mpfEngine != null) { _tableAuthoring = _mpfEngine.gameObject.GetComponentInParent <TableAuthoring>(); } }
protected override void SetTable(TableAuthoring table) { if (_layerHandler == null) { _layerHandler = new LayerHandler(); } _layerHandler.SetTable(table); }
private void OnTableSelected(object sender, EventArgs e) { if (!_windowLocked) { _tableAuthoring = TableSelector.Instance.SelectedTable; SetTable(_tableAuthoring); Repaint(); } }
protected override void SetTable(TableAuthoring table) { _data.Clear(); if (_table != null) { _data = CollectData(); } _listView = new ManagerListView <T>(_treeViewState, _data, ItemSelected); }
protected void FindTable() { SetTableFromSelection(); if (_tableAuthoring == null) { // nothing was selected, just use the first found table _tableAuthoring = FindObjectOfType <TableAuthoring>(); SetTable(_tableAuthoring); } }
private void FindTable() { _table = FindObjectOfType <TableAuthoring>(); _data.Clear(); if (_table != null) { _data = CollectData(); } _listView = new ManagerListView <T>(_treeViewState, _data, ItemSelected); }
/// <summary> /// Populates the layer data from the given table /// </summary> /// <param name="tableAuthoring"></param> public void SetTable(TableAuthoring tableAuthoring) { var tableChanged = _tableAuthoring != tableAuthoring; _tableAuthoring = tableAuthoring; _layers.Clear(); Rebuild(); if (tableChanged) { TableChanged?.Invoke(); } }
protected void SetTableFromSelection() { if (Selection.activeGameObject == null) { return; } // check to see if the selection's table is different from the current one being used by this manager var selectedTable = Selection.activeGameObject.GetComponentInParent <TableAuthoring>(); if (selectedTable != null) { _tableAuthoring = selectedTable; SetTable(selectedTable); } }
/// <summary> /// This is called by unity as part of the GUI pass, its an undocumented feature /// that gives us the ability to draw UI in the upper right of the tab bar, so we'll /// use it to add the little lock toggle just like inspectors /// </summary> /// <param name="position"></param> protected virtual void ShowButton(Rect position) { if (_lockButtonStyle == null) { _lockButtonStyle = "IN LockButton"; // undocumented ui style for the tab bar lock button } bool wasLocked = _windowLocked; _windowLocked = GUI.Toggle(position, _windowLocked, GUIContent.none, _lockButtonStyle); if (wasLocked && !_windowLocked) { _tableAuthoring = TableSelector.Instance.SelectedTable; SetTable(_tableAuthoring); Repaint(); } }
protected virtual void OnEnable() { #if UNITY_EDITOR // for convenience move item behavior to the top of the list // we're opting to due this here as opposed to at import time since modifying objects // in this way caused them to not be part of the created object undo stack if (target != null && target is MonoBehaviour mb) { int numComp = mb.GetComponents <MonoBehaviour>().Length; for (int i = 0; i <= numComp; i++) { UnityEditorInternal.ComponentUtility.MoveComponentUp(mb); } } #endif _table = (target as MonoBehaviour)?.gameObject.GetComponentInParent <TableAuthoring>(); PopulateDropDownOptions(); }
private void RenderPlayfieldElement(TableAuthoring tableAuthoring, SwitchListData switchListData, Rect cellRect, Action <SwitchListData> updateAction) { if (GUI.Button(cellRect, switchListData.PlayfieldItem, EditorStyles.objectField) || GUI.Button(cellRect, "", GUI.skin.GetStyle("IN ObjectField"))) { if (_itemPickDropdownState == null) { _itemPickDropdownState = new AdvancedDropdownState(); } var dropdown = new ItemSearchableDropdown <ISwitchableAuthoring>( _itemPickDropdownState, tableAuthoring, "Switchable Items", item => { switchListData.PlayfieldItem = item.Name; updateAction(switchListData); } ); dropdown.Show(cellRect); } }
private void RenderSourceElementPlayfield(TableAuthoring tableAuthoring, WireListData wireListData, Rect cellRect, Action <WireListData> updateAction) { if (GUI.Button(cellRect, wireListData.SourcePlayfieldItem, EditorStyles.objectField) || GUI.Button(cellRect, "", GUI.skin.GetStyle("IN ObjectField"))) { if (_sourceElementDeviceDropdownState == null) { _sourceElementDeviceDropdownState = new AdvancedDropdownState(); } var dropdown = new ItemSearchableDropdown <ISwitchAuthoring>( _sourceElementDeviceDropdownState, tableAuthoring, "Switch Items", item => { wireListData.SourcePlayfieldItem = item.Name; updateAction(wireListData); } ); dropdown.Show(cellRect); } }
private void RenderDestinationElementDevice(TableAuthoring tableAuthoring, WireListData wireListData, Rect cellRect, Action <WireListData> updateAction) { if (GUI.Button(cellRect, wireListData.DestinationDevice, EditorStyles.objectField) || GUI.Button(cellRect, "", GUI.skin.GetStyle("IN ObjectField"))) { if (_destinationElementDeviceDropdownState == null) { _destinationElementDeviceDropdownState = new AdvancedDropdownState(); } var dropdown = new ItemSearchableDropdown <ICoilDeviceAuthoring>( _destinationElementDeviceDropdownState, tableAuthoring, "Coil Devices", item => { wireListData.DestinationDevice = item.Name; updateAction(wireListData); } ); dropdown.Show(cellRect); } }
private void RenderElement(TableAuthoring tableAuthoring, CoilListData coilListData, Rect cellRect, Action <CoilListData> updateAction) { var icon = GetIcon(coilListData); if (icon != null) { var iconRect = cellRect; iconRect.width = 20; var guiColor = GUI.color; GUI.color = Color.clear; EditorGUI.DrawTextureTransparent(iconRect, icon, ScaleMode.ScaleToFit); GUI.color = guiColor; } cellRect.x += 25; cellRect.width -= 25; switch (coilListData.Destination) { case CoilDestination.Playfield: RenderPlayfieldElement(tableAuthoring, coilListData, cellRect, updateAction); break; } }
protected virtual void OnEnable() { _table = (target as MonoBehaviour)?.gameObject.GetComponentInParent <TableAuthoring>(); PopulateDropDownOptions(); EditorApplication.hierarchyChanged += OnHierarchyChange; }
protected abstract void SetTable(TableAuthoring table);
protected override void SetTable(TableAuthoring table) { _layerHandler.SetTable(table); }
/// <summary> /// Called when the selected table changes /// </summary> /// <param name="table"></param> protected override void SetTable(TableAuthoring table) { }