Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
    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;
    }
Ejemplo n.º 5
0
    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;
    }
Ejemplo n.º 6
0
 protected SelectableElementViewModel(TElement source, SelectableBase parent)
     : base(source, parent)
 {
     this.Element = source;
 }
Ejemplo n.º 7
0
 protected SelectableObjectViewModel(object source, SelectableBase parent)
     : base(parent)
 {
     this.Source = source;
 }