コード例 #1
0
    private void LoadAllQuestsData()
    {
        //Load all questlines
        FindAllSOByType(out QuestlineSO[] questLineSOs);
        RefreshListView(out ListView allQuestlinesListView, "questlines-list", questLineSOs);
        ClearElements(SelectionType.Questline);
        allQuestlinesListView.onSelectionChange += (questlineEnumerable) =>
        {
            _currentSelectedQuestLine = GetDataFromListViewItem <QuestlineSO>(questlineEnumerable);
            ClearElements(SelectionType.Questline);
            _idQuestlineSelected = allQuestlinesListView.selectedIndex;

            if (_currentSelectedQuestLine.Quests != null)
            {
                RefreshListView(out ListView allQuestsListView, "quests-list", _currentSelectedQuestLine.Quests.ToArray());

                allQuestsListView.onSelectionChange += (questEnumerable) =>
                {
                    _idQuestSelected = allQuestsListView.selectedIndex;

                    _currentSeletedQuest = GetDataFromListViewItem <QuestSO>(questEnumerable);
                    ClearElements(SelectionType.Quest);
                    if (_currentSeletedQuest != null && _currentSeletedQuest.Steps != null)
                    {
                        RefreshListView(out ListView allStepsListView, "steps-list", _currentSeletedQuest.Steps.ToArray());

                        SetUpQuestPreview(_currentSeletedQuest);

                        allStepsListView.onSelectionChange += (stepEnumerable) =>
                        {
                            _idStepSelected      = allStepsListView.selectedIndex;
                            _currentSelectedStep = GetDataFromListViewItem <StepSO>(stepEnumerable);
                            DisplayAllProperties(_currentSelectedStep, "step-info-scroll");
                            ClearElements(SelectionType.Step);
                            //Find all DialogueDataSOs in the same folder of the StepSO
                            FindAllDialogueInStep(_currentSelectedStep, out DialogueDataSO[] dialogueDataSOs);
                            if (dialogueDataSOs != null)
                            {
                                RefreshListView(out ListView dialoguesListView, "dialogues-list", dialogueDataSOs);

                                dialoguesListView.onSelectionChange += (dialogueEnumerable) =>
                                {
                                    DialogueDataSO dialogueData = GetDataFromListViewItem <DialogueDataSO>(dialogueEnumerable);
                                    DisplayAllProperties(dialogueData, "dialogue-info-scroll");
                                };
                            }
                            VisualElement DialogueList = rootVisualElement.Q <VisualElement>("dialogues-list");
                            SetAddDialogueButtonsForStep(out VisualElement ButtonsPanel);
                            //DialogueList.Q<VisualElement>("buttons-panel").Clear();
                            DialogueList.Add(ButtonsPanel);
                        };
                    }
                };
            }
        };
    }
コード例 #2
0
 void StartStep()
 {
     if (_currentQuest.Steps != null)
     {
         if (_currentQuest.Steps.Count > _currentStepIndex)
         {
             _currentStep = _currentQuest.Steps[_currentStepIndex];
         }
     }
 }
コード例 #3
0
    private void LoadAndInitStepUXML(StepSO step)
    {
        //Clear actor conversations area
        ScrollView actorConversationsVE = rootVisualElement.Q <ScrollView>("actor-conversations");
        // Import UXML
        var           stepVisualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Scripts/Quests/Editor/StepDetail.uxml");
        VisualElement stepVE         = stepVisualTree.CloneTree();
        VisualElement dialogueAreaVE = stepVE.Q <VisualElement>("dialogue-area");

        //Title
        if (step != null)
        {
            stepVE.Q <Label>("step-title-label").text = "Step" + step.name[1];
        }

        //IsDone
        Toggle isDoneToggle = stepVE.Q <Toggle>("step-done-toggle");

        isDoneToggle.value = step.IsDone;
        isDoneToggle.SetEnabled(false);

        DialogueDataSO dialogueToPreview = default;

        dialogueToPreview = step.StepToDialogue();
        if (dialogueToPreview != null)
        {
            //setPreview Actor for each step
            if (step.Actor != null)
            {
                Image actorPreview = LoadActorImage(step.Actor.name);
                //Add Image
                VisualElement preview = stepVE.Q <VisualElement>("actor-preview");
                preview.Add(actorPreview);
            }
            VisualElement VE = CreateDialoguePreviewWithBranching(dialogueToPreview);
            dialogueAreaVE.Add(VE);
        }

        //Type (Check Item etc)
        if (step.Type == StepType.Dialogue)
        {
            VisualElement itemValidateVE = stepVE.Q <VisualElement>("item-validate");
            itemValidateVE.style.display = DisplayStyle.None;
        }
        else
        {
            stepVE.Q <Label>("step-type").text = step.Type + ":";
            if (step.Item != null)
            {
                stepVE.Q <Label>("item-to-validate").text = step.Item.ToString();
            }
        }

        actorConversationsVE.Add(stepVE);
    }
コード例 #4
0
    private void LoadAllQuestsData()
    {
        Debug.Log("LoadAllQuestsData");
        //Load all questlines
        FindAllSOByType(out QuestlineSO[] questLineSOs);
        RefreshListView(out ListView allQuestlinesListView, "questlines-list", questLineSOs);

        allQuestlinesListView.onSelectionChange += (questlineEnumerable) =>
        {
            selectedQuestLine = GetDataFromListViewItem <QuestlineSO>(questlineEnumerable);
            ClearElements(selectionType.Questline);
            idQuestlineSelected = allQuestlinesListView.selectedIndex;

            if (selectedQuestLine.Quests != null)
            {
                RefreshListView(out ListView allQuestsListView, "quests-list", selectedQuestLine.Quests.ToArray());



                allQuestsListView.onSelectionChange += (questEnumerable) =>
                {
                    idQuestSelected = allQuestsListView.selectedIndex;

                    currentSeletedQuest = GetDataFromListViewItem <QuestSO>(questEnumerable);
                    ClearElements(selectionType.Quest);
                    if (currentSeletedQuest != null && currentSeletedQuest.Steps != null)
                    {
                        RefreshListView(out ListView allStepsListView, "steps-list", currentSeletedQuest.Steps.ToArray());

                        SetUpQuestPreview(currentSeletedQuest);

                        allStepsListView.onSelectionChange += (stepEnumerable) =>
                        {
                            StepSO step = GetDataFromListViewItem <StepSO>(stepEnumerable);
                            DisplayAllProperties(step, "step-info-scroll");
                            ClearElements(selectionType.Step);
                            //Find all DialogueDataSOs in the same folder of the StepSO
                            FindAllDialogueInStep(step, out DialogueDataSO[] dialogueDataSOs);
                            if (dialogueDataSOs != null)
                            {
                                RefreshListView(out ListView dialoguesListView, "dialogues-list", dialogueDataSOs);

                                dialoguesListView.onSelectionChange += (dialogueEnumerable) =>
                                {
                                    DialogueDataSO dialogueData = GetDataFromListViewItem <DialogueDataSO>(dialogueEnumerable);

                                    DisplayAllProperties(dialogueData, "dialogue-info-scroll");
                                };
                            }
                        };
                    }
                };
            }
        };
    }
コード例 #5
0
 private void CheckNumber(int number)
 {
     if (currentStep.nextSteps.Length > number)
     {
         if (currentStep.nextSteps[number] != null)
         {
             currentStep = currentStep.nextSteps[number];
             UpdateElements();
         }
     }
 }
コード例 #6
0
    private void LoadAndInitStepUXML(StepSO step)
    {
        //Clear actor conversations area
        VisualElement actorConversationsVE = rootVisualElement.Q <VisualElement>("actor-conversations");

        // Import UXML
        var           stepVisualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Scripts/Quests/Editor/StepDetail.uxml");
        VisualElement stepVE         = stepVisualTree.CloneTree();
        VisualElement dialogueAreaVE = stepVE.Q <VisualElement>("dialogue-area");

        //Title
        stepVE.Q <Label>("step-title-label").text = "Step" + step.name[1];

        //IsDone
        Toggle isDoneToggle = stepVE.Q <Toggle>("step-done-toggle");

        isDoneToggle.value = step.IsDone;
        isDoneToggle.SetEnabled(false);

        //SD
        if (step.DialogueBeforeStep != null)
        {
            LoadAndInitStartDialogueLineUXML(step.DialogueBeforeStep, dialogueAreaVE);
        }

        //CD ID if any
        if (step.CompleteDialogue != null)
        {
            LoadAndInitOptionsDialogueLineUXML(step.CompleteDialogue, step.IncompleteDialogue, dialogueAreaVE);
        }

        //Type (Check Item etc)
        if (step.Type == StepType.Dialogue)
        {
            VisualElement itemValidateVE = stepVE.Q <VisualElement>("item-validate");
            itemValidateVE.style.display = DisplayStyle.None;
        }
        else
        {
            stepVE.Q <Label>("step-type").text = step.Type + ":";
            if (step.Item != null)
            {
                stepVE.Q <Label>("item-to-validate").text = step.Item.ToString();
            }
        }

        actorConversationsVE.Add(stepVE);
    }
コード例 #7
0
    private void Action(StepSO step)
    {
        if (isTyping)
        {
            StopCoroutine(currentCoroutine);
            contentText.text = currentStep.content;
            isTyping         = false;
            return;
        }

        isTyping             = true;
        contentText.text     = string.Empty;
        currentStep          = step;
        currentLocation.text = currentStep.location;
        currentSprite.sprite = currentStep.imageLocation;
        currentCoroutine     = StartCoroutine(TypeSentence(currentStep.content));
    }
コード例 #8
0
    void AddStep()
    {
        StepSO asset       = ScriptableObject.CreateInstance <StepSO>();
        int    questlineId = 0;

        questlineId = selectedQuestLine.IdQuestline;
        int questId = 0;

        questId = currentSeletedQuest.IdQuest;
        int stepId = 0;

        stepId = currentSeletedQuest.Steps.Count + 1;
        AssetDatabase.CreateFolder("Assets/ScriptableObjects/Quests/Questline" + questlineId + "/Quest" + questId, "Step" + stepId);
        AssetDatabase.CreateAsset(asset, "Assets/ScriptableObjects/Quests/Questline" + questlineId + "/Quest" + questId + "/Step" + stepId + "/S" + stepId + "-Q" + questId + "-QL" + questlineId + ".asset");
        AssetDatabase.SaveAssets();
        currentSeletedQuest.Steps.Add(asset);
        //refresh
        rootVisualElement.Q <VisualElement>("quests-list").Q <ListView>().SetSelection(idQuestSelected);
    }
コード例 #9
0
    void EndStep()
    {
        _currentStep = null;

        if (_currentQuest != null)
        {
            if (_currentQuest.Steps.Count > _currentStepIndex)
            {
                _currentQuest.Steps[_currentStepIndex].FinishStep();
                if (_currentQuest.Steps.Count > _currentStepIndex + 1)
                {
                    _currentStepIndex++;
                    StartStep();
                }
                else
                {
                    EndQuest();
                }
            }
        }
    }
コード例 #10
0
 void RemoveStep(StepSO stepToRemove)
 {
     if ((stepToRemove == null))
     {
         return;
     }
     //when removing a step remove its dialogues
     if (stepToRemove.DialogueBeforeStep != null)
     {
         RemoveDialogue(stepToRemove.DialogueBeforeStep);
         stepToRemove.DialogueBeforeStep = null;
     }
     if (stepToRemove.CompleteDialogue != null)
     {
         RemoveDialogue(stepToRemove.CompleteDialogue);
         stepToRemove.CompleteDialogue = null;
     }
     if (stepToRemove.IncompleteDialogue != null)
     {
         RemoveDialogue(stepToRemove.IncompleteDialogue);
         stepToRemove.IncompleteDialogue = null;
     }
     AssetDatabase.DeleteAsset(stepToRemove.GetPath());
 }
コード例 #11
0
    void RemoveQuest()
    {
        if (_currentSeletedQuest == null)
        {
            return;
        }
        //When removing a step, remove its references in the parent quest
        if (_currentSelectedQuestLine.Quests.Exists(o => o == _currentSeletedQuest))
        {
            _currentSelectedQuestLine.Quests.Remove(_currentSelectedQuestLine.Quests.Find(o => o == _currentSeletedQuest));
        }
        //when removing a step remove its dialogues
        while (_currentSeletedQuest.Steps.Count > 0)
        {
            StepSO step = _currentSeletedQuest.Steps[0];
            RemoveStep(step);
            _currentSeletedQuest.Steps.RemoveAt(0);
        }

        AssetDatabase.DeleteAsset(_currentSeletedQuest.GetPath());
        _idQuestSelected = -1;
        //refresh List
        rootVisualElement.Q <VisualElement>("questlines-list").Q <ListView>().SetSelection(_idQuestlineSelected);
    }
コード例 #12
0
ファイル: GUIController.cs プロジェクト: JPoker98/love
    public void SolveBeat(bool perfect, int currentScore)
    {
        Step   step   = gm.currentStep;
        StepSO stepSO = gm.currentStepSO;

        P1Silouette.ChangePose(stepSO.pose[0]);
        P2Silouette.ChangePose(stepSO.pose[1]);
        if (stepSO.animationTrigger != null)
        {
            canvasAnimator.SetTrigger(stepSO.animationTrigger);
        }

        if (stepSO.changeColor)
        {
            ChooseBackground();
        }
        cameraAnimator.SetTrigger("Shake");
        score.text = currentScore.ToString();

        if (perfect)
        {
            //cosas de perfect
        }
    }
コード例 #13
0
ファイル: GUIController.cs プロジェクト: JPoker98/love
    public void PlayOrderSound(StepSO step)
    {
        int affectedPlayer = step.affectedPlayers;

        switch (affectedPlayer)
        {
        case 0:
            P1Audio.clip = step.audioStep;
            P1Audio.Play();
            break;

        case 1:
            P2Audio.clip = step.audioStep;
            P2Audio.Play();
            break;

        case 2:
            P1Audio.clip = step.audioStep;
            P1Audio.Play();
            P2Audio.clip = step.audioStep;
            P2Audio.Play();
            break;
        }
    }
コード例 #14
0
 // Start is called before the first frame update
 void Start()
 {
     currentStep = startStep;
     UpdateElements();
 }
コード例 #15
0
 void NumberCheck(int number)
 {
     currentStep = currentStep.nextSteps[number];
     UpdateStep();
 }
コード例 #16
0
 void Start()
 {
     currentStep            = startStep;
     contentText.text       = startStep.content;
     backgroundImage.sprite = startStep.nextImages;
 }