示例#1
0
 private void UnSubscribeAllCallbacks()
 {
     OTGEditorUtility.UnSubscribeToolbarButtonCallback(ContainerElement, "open-actions-file-picker", OnActionFolderButton);
     OTGEditorUtility.UnSubscribeToolbarButtonCallback(ContainerElement, "open-transitions-file-picker", OnTransitionFolderButton);
     OTGEditorUtility.UnSubscribeToolbarButtonCallback(ContainerElement, "open-character-file-picker", OnCharacterDataFolderButton);
     OTGEditorUtility.UnSubscribeToolbarButtonCallback(ContainerElement, "open-savedGraphs-file-picker", OnSavedGraphFolderButton);
 }
        private void OnTextChanged(ChangeEvent <string> changeEv)
        {
            var filteredItems = OTGEditorUtility.AvailableAnimationClips.Where(x => x.ToLower().Contains(changeEv.newValue.ToLower())).ToList();

            OTGEditorUtility.AvailableAnimationClipsFilteredList.Clear();
            OTGEditorUtility.AvailableAnimationClipsFilteredList.AddRange(filteredItems);

            OTGEditorUtility.PopulateListView <string>(ref m_animationListView, ref m_containerElement, OTGEditorUtility.AvailableAnimationClipsFilteredList, "animation-list-area", true);
        }
 private void OnEnable()
 {
     InitializeLayout();
     InitializeStyleSheet();
     InitializeMenuBar();
     CreateViews();
     SubscribeButtonsToCallbacks();
     OTGEditorUtility.SetCombatTemplate(OTGEditorUtility.E_CombatTemplate.TwitchFighter, m_editorConfig);
 }
示例#4
0
        private void CreateCharacterDataFolders(NewCharacterCreationData _data, EditorConfig _config)
        {
            string rootCharfolder = OTGEditorUtility.GetCharacterRootFolder(_data.CharacterName, _config.CharacterPathRoot);


            AssetDatabase.CreateFolder(_config.CharacterPathRoot, _data.CharacterName);
            AssetDatabase.CreateFolder(rootCharfolder, "Configurations");
            AssetDatabase.CreateFolder(rootCharfolder, "Prefabs");
            AssetDatabase.CreateFolder(rootCharfolder, "States");
        }
        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";
            }
        }
示例#6
0
        private void GetCharacterSavedGraph()
        {
            string path = OTGEditorUtility.GetCharacterSavedGraphPath(SelectedCharacter.name, m_editorConfig.CharacterSavedGraphsPath);
            CharacterSavedGraph graph = AssetDatabase.LoadAssetAtPath <CharacterSavedGraph>(path);

            if (graph == null)
            {
                graph = ScriptableObject.CreateInstance <CharacterSavedGraph>();
                AssetDatabase.CreateAsset(graph, path);
            }

            CharacterStateGraph = graph;
        }
示例#7
0
        private void CreateAndAttachHandlerDataGroup(NewCharacterCreationData _data, EditorConfig _config)
        {
            HandlerDataGroup dataGrp = ScriptableObject.CreateInstance <HandlerDataGroup>();

            dataGrp.name = _data.CharacterName + "_HanderDataGroup";

            string path = OTGEditorUtility.GetCharacterConfigurationsFolder(_data.CharacterName, _config.CharacterPathRoot);

            AssetDatabase.CreateAsset(dataGrp, path + dataGrp.name + ".asset");

            m_characterSMCObj.FindProperty("m_handlerDataGroup").objectReferenceValue = dataGrp;
            m_characterSMCObj.ApplyModifiedProperties();
        }
示例#8
0
        private void CreateInitialState(NewCharacterCreationData _data, EditorConfig _config)
        {
            OTGCombatState initialState = ScriptableObject.CreateInstance <OTGCombatState>();

            initialState.name = OTGEditorUtility.GetCombatStateName(_data.CharacterName, "Inititial");

            string stateFolder      = OTGEditorUtility.GetCharacterStateFolder(_data.CharacterName, _config.CharacterPathRoot);
            string initialStateGUID = AssetDatabase.CreateFolder(stateFolder, "InitialState");
            string initialStatePath = AssetDatabase.GUIDToAssetPath(initialStateGUID);

            AssetDatabase.CreateAsset(initialState, initialStatePath + "/" + initialState.name + ".asset");

            m_characterSMCObj.FindProperty("m_startingState").objectReferenceValue = initialState;
            m_characterSMCObj.ApplyModifiedProperties();
        }
        private void CreateNewState(string _stateName)
        {
            string         folder    = OTGEditorUtility.GetCharacterStateFolder(m_charViewData.SelectedCharacter.name, m_editorConfig.CharacterPathRoot);
            string         stateName = OTGEditorUtility.GetCombatStateName(m_charViewData.SelectedCharacter.name, _stateName);
            OTGCombatState newState  = ScriptableObject.CreateInstance <OTGCombatState>();

            newState.name = stateName;

            if (m_copiedStateCache != null)
            {
                PopulateStateWithStartingActionsAndTransitions(ref newState, m_copiedStateCache);
            }

            AssetDatabase.CreateAsset(newState, folder + "/" + stateName + ".asset");

            PopulateAvailableStates();
            m_stateGraph.OnNewStateButtonPressed();
        }
        protected override void HandleOnViewFocused()
        {
            CleanupGraph();
            CreateNewGraph();
            LinkControls();
            HideCopyPasteButton();
            OTGEditorUtility.PopulateListViewScriptableObject <OTGCombatAction>(ref m_actionListView, ref m_containerElement, OTGEditorUtility.ActionsInstantiated, "action-list-area");
            OTGEditorUtility.PopulateListViewScriptableObject <OTGTransitionDecision>(ref m_transitionListView, ref m_containerElement, OTGEditorUtility.TransitionsInstantiated, "transition-list-area");
            OTGEditorUtility.PopulateListView <string>(ref m_animationListView, ref m_containerElement, OTGEditorUtility.AvailableAnimationClips, "animation-list-area", true);
            AddCallbacksToListView(ref m_actionListView);
            AddCallbacksToListView(ref m_transitionListView);
            AddCallbacksToListView(ref m_animationListView);
            m_actionListView.onSelectionChange     += OnActionListItemSelected;
            m_transitionListView.onSelectionChange += OnActionListItemSelected;
            m_animationListView.onSelectionChange  += OnAnimationListItemSelected;
            SubscribeToButtonCallbacks();

            m_animFilterField.RegisterValueChangedCallback(OnTextChanged);
        }
 private void OnRefreshTransitions()
 {
     OTGEditorUtility.RefreshProject(m_editorConfig);
     OTGEditorUtility.PopulateListViewScriptableObject <OTGTransitionDecision>(ref m_transitionListView, ref m_containerElement, OTGEditorUtility.TransitionsInstantiated, "transition-list-area");
 }
 private void OnRefreshActions()
 {
     OTGEditorUtility.RefreshProject(m_editorConfig);
     OTGEditorUtility.PopulateListViewScriptableObject <OTGCombatAction>(ref m_actionListView, ref m_containerElement, OTGEditorUtility.ActionsInstantiated, "action-list-area");
 }
 private void PopulateAvailableStates()
 {
     OTGEditorUtility.FindCharacterStates(m_charViewData.SelectedCharacter.name, m_editorConfig);
     OTGEditorUtility.PopulateListViewScriptableObject <OTGCombatState>(ref m_availabeStatesListView, ref m_containerElement, OTGEditorUtility.AvailableCharacterStates, "state-list-area");
 }
 private void PopulateAnimationListView()
 {
     m_animationsListView.Clear();
     OTGEditorUtility.PopulateListViewSerializedProp(ref m_animationsListView, ref m_containerElement, m_animationList, "animation-list-view", "m_animClip", true);
 }
 private void PopulateAnimationEventListView()
 {
     OTGEditorUtility.PopulateListViewScriptableObject <OTGAnimationEvent>(ref m_availableAnimationEventList, ref m_containerElement, OTGEditorUtility.AvailableAnimationEvents, "animation-event-list");
 }
 private void OnProjectChange()
 {
     m_currentView.OnProjectUpdated();
     OTGEditorUtility.RefreshProject(m_editorConfig);
 }