private void CreateActionsListView()
        {
            ListView targetListView = ContainerElement.Query <ListView>("actions-list").First();

            targetListView.Clear();
            targetListView.makeItem = () => new Label();

            targetListView.RegisterCallback <MouseDownEvent>(OnMouseDownEvent);
            targetListView.RegisterCallback <MouseMoveEvent>(OnMouseMoveEvent);
            targetListView.RegisterCallback <MouseUpEvent>(OnMouseUpEvent);


            targetListView.bindItem      = (element, i) => (element as Label).text = m_viewData.AllActionsAvailable[i].name;
            targetListView.itemsSource   = m_viewData.AllActionsAvailable;
            targetListView.itemHeight    = 16;
            targetListView.selectionType = SelectionType.Single;


            targetListView.onSelectionChange += (enumerable) =>
            {
                foreach (Object actionCandidate in enumerable)
                {
                    if (Event.current.type == EventType.MouseDown)
                    {
                        m_selectedAction    = actionCandidate as OTGCombatAction;
                        m_actionsDragged[0] = m_selectedAction;
                    }
                    if (Event.current.type == EventType.MouseUp)
                    {
                        m_selectedAction = null;
                    }
                }
            };
        }
        private void CreateCombatantList()
        {
            m_combatantsInScene = null;



            m_combatantList = ContainerElement.Query<ListView>("combatant-list").First();
            m_combatantList.makeItem = () => new Label();
            m_combatantList.bindItem = (element, i) => (element as Label).text = m_combatantsInScene[i].name;

            m_combatantList.itemsSource = m_combatantsInScene;
            m_combatantList.itemHeight = 16;
            m_combatantList.selectionType = SelectionType.Single;

        }
Beispiel #3
0
 private void GatherVisualElements()
 {
     m_charListView = ContainerElement.Query <ListView>("character-list").First();
 }