public void KeyPressed(Keys KeyCode, bool ShiftPressed) { if (m_UIElements.Count == 0) { return; } if (KeyCode == Keys.Tab) { if (ShiftPressed) { m_activeElementIndex--; if (m_activeElementIndex < 0) { m_activeElementIndex += m_Selectibles.Count; } } else { m_activeElementIndex++; if (m_activeElementIndex >= m_Selectibles.Count) { m_activeElementIndex %= m_Selectibles.Count; } } m_activeElement = m_Selectibles[m_activeElementIndex]; } else { m_activeElement.SendKey(KeyCode, ShiftPressed); } }
public void SetActiveElement(string name) { var element = m_Selectibles.Where(x => x.Name == name); if (element.Count() != 0) { m_activeElement = element.First(); m_activeElementIndex = m_Selectibles.IndexOf(m_activeElement); } }
public void SetPage(Page content) { m_UIElements = content.GetElements(); m_activeElement = null; if (m_Selectibles.Count > 0) { m_activeElement = m_Selectibles[0]; } Tools.SetCamera(content.CameraPosition, content.CameraDirection, content.CameraFOV); Tools.SetWeather(content.Weather); Tools.SetDaytime(content.Daytime); }
public void DeselectUnit() { if (SelectedUnit == null) { return; } SelectableBase sb = SelectedUnit.GetComponent <SelectableBase>(); if (sb != null) { sb.Deselect(); } else { Debug.LogWarning("No Selectable Base Available on Deselect"); } SelectedUnit = null; }
public void SetSelectedUnit(GameObject go) { SelectableBase sb = go.GetComponent <SelectableBase>(); if (sb != null) { if (go == SelectedUnit) { return; } if (SelectedUnit != null) { SelectedUnit.GetComponent <SelectableBase>().Deselect(true); } sb.Select(); } else { Debug.LogWarning("No Selectable Base Available on Select", go); } SelectedUnit = go; }
protected SelectableElementViewModel(TElement source, SelectableBase parent) : base(source, parent) { this.Element = source; }
protected SelectableObjectViewModel(object source, SelectableBase parent) : base(parent) { this.Source = source; }