Exemple #1
0
 private void UnBindPathTextField()
 {
     ContainerElement.Q <TextField>("action-path-field-area").Unbind();
     ContainerElement.Q <TextField>("transitions-path-field-area").Unbind();
     ContainerElement.Q <TextField>("character-path-field-area").Unbind();
     ContainerElement.Q <TextField>("savedGraphs-path-field-area").Unbind();
 }
Exemple #2
0
 private void BindPathTextField()
 {
     ContainerElement.Q <TextField>("action-path-field-area").BindProperty(m_viewData.ActionsPathProp);
     ContainerElement.Q <TextField>("transitions-path-field-area").BindProperty(m_viewData.TransitionsPathProperty);
     ContainerElement.Q <TextField>("character-path-field-area").BindProperty(m_viewData.CharacterDataPathProperty);
     ContainerElement.Q <TextField>("savedGraphs-path-field-area").BindProperty(m_viewData.SavedGraphsPathProperty);
 }
 private void LinkControls()
 {
     m_newStateButton         = ContainerElement.Q <ToolbarButton>("new-state-button");
     m_copyPasteStateButton   = ContainerElement.Q <ToolbarButton>("copy-state-button");
     m_stateTemplateEnumField = ContainerElement.Q <EnumField>("new-state-template");
     m_saveGraphButton        = ContainerElement.Q <ToolbarButton>("save-graph-button");
 }
        private void CreateBreadcrumbs()
        {
            m_breadcrums           = new ToolbarBreadcrumbs();
            m_availableBreadcrumbs = new Stack <BreadcrumbData>();
            m_availableBreadcrumbs.Push(new BreadcrumbData()
            {
                Label = "Character Summary", Order = 3, Callback = null, Slide = new CharacterSummarySlide(m_creationData)
            });
            m_availableBreadcrumbs.Push(new BreadcrumbData()
            {
                Label = "Character Model", Order = 2, Callback = () => { while (m_breadcrums.childCount > 2)
                                                                         {
                                                                             SubstractBreadcrumb();
                                                                         }
                }, Slide = new CharacterModelSlide(m_creationData)
            });
            m_availableBreadcrumbs.Push(new BreadcrumbData()
            {
                Label = "Character Name", Order = 1, Callback = () => { while (m_breadcrums.childCount > 1)
                                                                        {
                                                                            SubstractBreadcrumb();
                                                                        }
                }, Slide = new CharacterNameSlide(m_creationData)
            });

            m_currentBreadcrumbs = new Stack <BreadcrumbData>();



            ContainerElement.Q <Toolbar>("new-character-toolbar").Add(m_breadcrums);
        }
        private void PopulateReorderableList(SerializedObject _owner, SerializedProperty _listItems, string _listName)
        {
            OTGReorderableListViewElement roList = new OTGReorderableListViewElement(_owner, _listItems, _listName);

            roList.Bind(_owner);
            ContainerElement.Q <VisualElement>("state-details-area").Add(roList);
        }
Exemple #6
0
 private void CleanupSubviewToolbarCallbacks()
 {
     ContainerElement.Q <ToolbarButton>("details-sub-view-button").clickable.clicked   -= SwitchToDetailsSubView;
     ContainerElement.Q <ToolbarButton>("state-sub-view-button").clickable.clicked     -= SwitchToStateSubview;
     ContainerElement.Q <ToolbarButton>("graph-sub-view-button").clickable.clicked     -= SwitchToGraphsubView;
     ContainerElement.Q <ToolbarButton>("animation-sub-view-button").clickable.clicked -= SwitchToAnimationSubView;
 }
 private void UnSubscribeFromButtonCallBacks()
 {
     ContainerElement.Q <Button>("refresh-actions-button").clickable.clicked     -= OnRefreshActions;
     ContainerElement.Q <Button>("refresh-transitions-button").clickable.clicked -= OnRefreshTransitions;
     m_saveGraphButton.clickable.clicked -= OnSaveGraph;
     m_newStateButton.clickable.clicked  -= OnNewStateClicked;
 }
        private void DisplayAnimationPropertyField(SerializedObject _targetState)
        {
            PropertyField animProp = new PropertyField(_targetState.FindProperty("m_combatAnim").FindPropertyRelative("m_animClip"));

            animProp.Bind(_targetState);
            ContainerElement.Q <VisualElement>("state-details-area").Add(animProp);
        }
        private void PopulateTransitionList(SerializedObject _owner, SerializedProperty _listItems, string _listName)
        {
            OTGStateTransitionListView transList = new OTGStateTransitionListView(_owner, _listItems, _listName);

            transList.Bind(_owner);
            ContainerElement.Q <VisualElement>("state-details-area").Add(transList);
        }
 private void SubscribeToButtonCallbacks()
 {
     ContainerElement.Q <Button>("refresh-actions-button").clickable.clicked     += OnRefreshActions;
     ContainerElement.Q <Button>("refresh-transitions-button").clickable.clicked += OnRefreshTransitions;
     m_newStateButton.clickable.clicked  += OnNewStateClicked;
     m_saveGraphButton.clickable.clicked += OnSaveGraph;
     m_stateTemplateEnumField.RegisterCallback <ChangeEvent <System.Enum> >(evt => { SetTemplateData(evt.newValue); });
 }
        private void CreateNewGraph()
        {
            m_stateGraph = new CharacterStateGraph(m_charViewData, this)
            {
                name = "State Graph"
            };

            m_stateGraph.StretchToParentSize();
            ContainerElement.Q <VisualElement>("graph-area").Add(m_stateGraph);
        }
 private void CleanupGraph()
 {
     if (m_stateGraph == null)
     {
         return;
     }
     m_selectedNode = null;
     m_stateGraph.OnGraphHidden();
     ContainerElement.Q <VisualElement>("graph-area").Remove(m_stateGraph);
     m_stateGraph = null;
 }
 private void ChangeSlide(NewCharacterSlideBase _newSlide)
 {
     if (m_currentSlide != null)
     {
         m_currentSlide.OnSlideInvisible();
         ContainerElement.Q <VisualElement>("new-character-workflow-slides").Remove(m_currentSlide.ContainerElement);
     }
     m_currentSlide = _newSlide;
     m_currentSlide.OnSlideVisible();
     ContainerElement.Q <VisualElement>("new-character-workflow-slides").Add(m_currentSlide.ContainerElement);
 }
        private void PopulateDetails()
        {
            ContainerElement.Q <VisualElement>("state-details-area").Clear();
            PopulateReorderableList(m_viewData.SelectedCombatState, m_viewData.CurrentStateEnterActions, "On Enter Actions");
            PopulateReorderableList(m_viewData.SelectedCombatState, m_viewData.CurrentStateUpdateActions, "On Update Actions");
            PopulateReorderableList(m_viewData.SelectedCombatState, m_viewData.CurrentStateAnimMoveActions, "On Animator Move Actions");
            PopulateReorderableList(m_viewData.SelectedCombatState, m_viewData.CurrentStateOnExitActions, "On Exit Actions");
            PopulateTransitionList(m_viewData.SelectedCombatState, m_viewData.CurrentStateTransitions, "Transitions");

            CreateActionsListView();
        }
        private void OnNewStateClicked()
        {
            string textBoxValue = ContainerElement.Q <TextField>("new-state-name-textfield").text;

            if (string.IsNullOrEmpty(textBoxValue))
            {
                return;
            }

            CreateNewState(textBoxValue);
        }
        private void PopulateStateDetailsView(SerializedObject _targetState)
        {
            //"state-details-area"
            ContainerElement.Q <VisualElement>("state-details-area").Clear();

            DisplayAnimationPropertyField(_targetState);
            PopulateReorderableList(_targetState, _targetState.FindProperty("m_onEnterActions"), "On Enter Actions");
            PopulateReorderableList(_targetState, _targetState.FindProperty("m_onUpdateActions"), "On Update Actions");
            PopulateReorderableList(_targetState, _targetState.FindProperty("m_animUpdateActions"), "On Animator Move Actions");
            PopulateReorderableList(_targetState, _targetState.FindProperty("m_onExitActions"), "On Exit Actions");
            PopulateTransitionList(_targetState, _targetState.FindProperty("m_stateTransitions"), "Transitions");
        }
        private void SetTemplateData(System.Enum _incEnum)
        {
            if (_incEnum.GetType() == typeof(E_NewCombatStateTemplate))
            {
                E_NewCombatStateTemplate template = (E_NewCombatStateTemplate)_incEnum;
                m_copiedStateCache?.Cleanup();
                m_copiedStateCache = new StateDataCache();

                OTGEditorUtility.PopulateStateByTemplate(template, ref m_copiedStateCache, m_editorConfig);
                ContainerElement.Q <TextField>("new-state-name-textfield").value = template.ToString() + "template selected";
            }
        }
        private void OnPasteState()
        {
            string textBoxValue = ContainerElement.Q <TextField>("new-state-name-textfield").text;

            if (string.IsNullOrEmpty(textBoxValue))
            {
                return;
            }

            CreateNewState(textBoxValue);

            m_copiedStateCache.Cleanup();
            m_copiedStateCache = null;
            DisplayCopyPasteButton();
        }
Exemple #19
0
        private void SwitchSubViews(CharacterSubViewBase _newView)
        {
            if (_newView == null)
            {
                Debug.LogWarning("You tried to switch to a vew that is null");
                return;
            }
            if (m_currentSubView == _newView)
            {
                return;
            }

            if (m_currentSubView != null)
            {
                m_currentSubView.OnViewLostFocus();
                ContainerElement.Q <VisualElement>("workflow-area").Remove(m_currentSubView.ContainerElement);
            }

            m_currentSubView = _newView;
            m_currentSubView.OnViewFocused();
            ContainerElement.Q <VisualElement>("workflow-area").Add(m_currentSubView.ContainerElement);
        }
        protected override void HandleViewLostFocus()
        {
            RemoveCallbacksFromListView(ref m_actionListView);
            RemoveCallbacksFromListView(ref m_transitionListView);
            RemoveCallbacksFromListView(ref m_availabeStatesListView);
            RemoveCallbacksFromListView(ref m_animationListView);

            m_actionListView.onSelectionChange     -= OnActionListItemSelected;
            m_transitionListView.onSelectionChange -= OnActionListItemSelected;

            m_animationListView.onSelectionChange -= OnAnimationListItemSelected;

            if (m_availabeStatesListView != null)
            {
                m_availabeStatesListView.onSelectionChange -= OnActionListItemSelected;
            }
            ContainerElement.Q <VisualElement>("state-details-area").Clear();
            CleanupGraph();
            UnSubscribeFromButtonCallBacks();
            CleanupControls();

            m_animFilterField.UnregisterValueChangedCallback(OnTextChanged);
        }
 private void UpdateData()
 {
     m_creationData.CharacterName = ContainerElement.Q <TextField>("charcter-name-text").value;
     m_creationData.CharacterType = (e_CombatantType)ContainerElement.Q <EnumField>("character-type-filter").value;
 }
 private void FindDataBoxes()
 {
     m_animDataBox = ContainerElement.Q("animation-data-work-area");
 }
 private void CreateAnimationEventListView()
 {
     m_availableAnimationEventList = ContainerElement.Q <ListView>("animation-event-list");
 }
Exemple #24
0
        private void UnregisterDropAreaCallbacks()
        {
            VisualElement dropArea = ContainerElement.Q <VisualElement>("character-model-drop-area");

            dropArea.UnregisterCallback <DragEnterEvent>(OnDragEnterEvent);
        }
 private void CreateAnimationListView()
 {
     m_animationsListView = ContainerElement.Q <ListView>("animation-list-view");
 }
Exemple #26
0
 private void UpdateModelDetails(Object _obj)
 {
     ContainerElement.Q <Label>("model-name-string").text = _obj.name;
 }
 public void UpdateViewHeight(float _height)
 {
     ContainerElement.Q <VisualElement>(ContainerStyleName).style.height = new StyleLength(_height);
 }
 private void RegisterEnumFieldCallbacks()
 {
     ContainerElement.Q <EnumField>("action-filter").RegisterCallback <ChangeEvent <System.Enum> >(evt => { FilterLists(evt.newValue); });
     ContainerElement.Q <EnumField>("transition-filter").RegisterCallback <ChangeEvent <System.Enum> >(evt => { FilterLists(evt.newValue); });
 }
Exemple #29
0
 private void CleanupCharacterToolBar()
 {
     ContainerElement.Q <ToolbarButton>("new-char-button").clickable.clicked -= OnNewCharacterClicked;
 }
Exemple #30
0
 private void FindDataBox(ref VisualElement _target, string _boxName)
 {
     _target = ContainerElement.Q <VisualElement>(_boxName);
 }