浏览代码

Change SO's menu asset order. Add End of dialogue event to event Data.

/main
uChema 4 年前
当前提交
2415469c
共有 12 个文件被更改,包括 61 次插入55 次删除
  1. 42
      UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs
  2. 54
      UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs
  3. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventorySO.cs
  4. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventoryTabSO.cs
  5. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemRecipeSO.cs
  6. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemSO.cs
  7. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemTypeSO.cs
  8. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/LocalizedItemSO.cs
  9. 2
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestSO.cs
  10. 2
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs
  11. 2
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/StepSO.cs
  12. 2
      UOP1_Project/Assets/Scripts/UI/ScriptableObject/InteractionSO.cs

42
UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs


[SerializeField] private List<LocalizedString> _dialogueLines = default;
[SerializeField] private List<Choice> _choices = default;
[SerializeField] private DialogueType _dialogueType = default;
[SerializeField] private VoidEventChannelSO _endOfDialogueEvent = default;
public VoidEventChannelSO EndOfDialogueEvent => _endOfDialogueEvent;
public List<Choice> Choices => _choices;
public DialogueType DialogueType
{

}
public DialogueDataSO()
{
}
public DialogueDataSO(DialogueDataSO dialogue)
{

_choices = new List<Choice>();
if(dialogue.Choices!=null)
for (int i=0; i<dialogue.Choices.Count; i++)
{
_endOfDialogueEvent = dialogue.EndOfDialogueEvent;
if (dialogue.Choices != null)
for (int i = 0; i < dialogue.Choices.Count; i++)
{
_choices.Add(new Choice(dialogue.Choices[i]));
_choices.Add(new Choice(dialogue.Choices[i]));
}
}
#if UNITY_EDITOR
public void FinishDialogue()
{
if (EndOfDialogueEvent != null)
EndOfDialogueEvent.RaiseEvent();
}
//TODO: Add support for branching conversations
// Maybe add 2 (or more) special line slots which represent a choice in a conversation
// Each line would also have an event associated, or another Dialogue
#if UNITY_EDITOR
void SetDialogueLines()
{
if (_dialogueLines == null)

}
}
public void CreateLine()
public void CreateLine()
_dialogueLines.Clear();
_dialogueLines.Clear();
StringTableCollection collection = LocalizationEditorSettings.GetStringTableCollection("Questline Dialogue");
if (collection != null)

}
}
SetDialogueLines();
}
SetDialogueLines();
}
StringTableCollection collection = LocalizationEditorSettings.GetStringTableCollection("Questline Dialogue");
if (collection != null)

do
{

if (collection.SharedData.Contains(key))
{
collection.SharedData.RemoveKey(key);
collection.SharedData.RemoveKey(key);
}
else
{

}
public Choice()
{
}
public Choice(Choice choice)
{

54
UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs


if (_gameState.CurrentGameState != GameState.Cutscene)
_gameState.UpdateGameState(GameState.Dialogue);
BeginDialogueData(dialogueDataSO);
if(_currentDialogue.DialogueLines!=null)
DisplayDialogueLine(_currentDialogue.DialogueLines[_counter], dialogueDataSO.Actor);
if (_currentDialogue.DialogueLines != null)
DisplayDialogueLine(_currentDialogue.DialogueLines[_counter], dialogueDataSO.Actor);
Debug.LogError("Check Dialogue");
Debug.LogError("Check Dialogue");
}
}

{
_openUIDialogueEvent.RaiseEvent(dialogueLine, actor);
}
private void OnAdvance()
{

private void DisplayChoices(List<Choice> choices)
{
_inputReader.advanceDialogueEvent -= OnAdvance;
_makeDialogueChoiceEvent.OnEventRaised += MakeDialogueChoice;
_showChoicesUIEvent.RaiseEvent(choices);
_makeDialogueChoiceEvent.OnEventRaised += MakeDialogueChoice;
_showChoicesUIEvent.RaiseEvent(choices);
}
private void MakeDialogueChoice(Choice choice)

switch (choice.ActionType)
{
case ChoiceActionType.continueWithStep:
if (_continueWithStep != null)
_continueWithStep.RaiseEvent();
if (choice.NextDialogue != null)
DisplayDialogueData(choice.NextDialogue);
case ChoiceActionType.continueWithStep:
if (_continueWithStep != null)
_continueWithStep.RaiseEvent();
if (choice.NextDialogue != null)
DisplayDialogueData(choice.NextDialogue);
break;
case ChoiceActionType.winningChoice:

DisplayDialogueData(choice.NextDialogue);
else
DialogueEndedAndCloseDialogueUI();
break;
case ChoiceActionType.losingChoice:

DisplayDialogueData(choice.NextDialogue);
else
DialogueEndedAndCloseDialogueUI();
if (choice.NextDialogue != null)
DisplayDialogueData(choice.NextDialogue);
else
DialogueEndedAndCloseDialogueUI();
break;
if (choice.NextDialogue != null)
DisplayDialogueData(choice.NextDialogue);
else
DialogueEndedAndCloseDialogueUI();
break;
}
void DialogueEnded()
{

}
public void DialogueEndedAndCloseDialogueUI()
{
//raise the special event for end of dialogue if any
_currentDialogue.FinishDialogue();
//raise end dialogue event
//closes dialogue UI
_gameState.ResetToPreviousGameState();
_gameState.ResetToPreviousGameState();
}

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventorySO.cs


// Created with collaboration from:
// https://forum.unity.com/threads/inventory-system.980646/
[CreateAssetMenu(fileName = "Inventory", menuName = "Inventory/Inventory", order = 51)]
[CreateAssetMenu(fileName = "Inventory", menuName = "Inventory/Inventory")]
public class InventorySO : ScriptableObject
{
[Tooltip("The collection of items and their quantities.")]

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventoryTabSO.cs


Recipe
}
[CreateAssetMenu(fileName = "InventoryTabType", menuName = "Inventory/Inventory Tab Type", order = 51)]
[CreateAssetMenu(fileName = "InventoryTabType", menuName = "Inventory/Inventory Tab Type")]
public class InventoryTabSO : ScriptableObject
{
[Tooltip("The tab Name that will be displayed in the inventory")]

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemRecipeSO.cs


using UnityEngine.Localization;
// Created with collaboration from:
// https://forum.unity.com/threads/inventory-system.980646/
[CreateAssetMenu(fileName = "ItemRecipe", menuName = "Inventory/Recipe", order = 51)]
[CreateAssetMenu(fileName = "ItemRecipe", menuName = "Inventory/Recipe")]
public class ItemRecipeSO : ItemSO
{

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemSO.cs


using UnityEngine.Localization;
// Created with collaboration from:
// https://forum.unity.com/threads/inventory-system.980646/
[CreateAssetMenu(fileName = "Item", menuName = "Inventory/Item", order = 51)]
[CreateAssetMenu(fileName = "Item", menuName = "Inventory/Item")]
public class ItemSO : SerializableScriptableObject
{
[Tooltip("The name of the item")]

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemTypeSO.cs


}
[CreateAssetMenu(fileName = "ItemType", menuName = "Inventory/ItemType", order = 51)]
[CreateAssetMenu(fileName = "ItemType", menuName = "Inventory/ItemType")]
public class ItemTypeSO : ScriptableObject
{
[Tooltip("The action associated with the item type")]

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/LocalizedItemSO.cs


using UnityEngine.Localization;
// Created with collaboration from:
// https://forum.unity.com/threads/inventory-system.980646/
[CreateAssetMenu(fileName = "LocalizedItem", menuName = "Inventory/Localized Item", order = 51)]
[CreateAssetMenu(fileName = "LocalizedItem", menuName = "Inventory/Localized Item")]
public class LocalizedItemSO : ItemSO
{

2
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestSO.cs


using UnityEditor;
using UnityEngine;
[CreateAssetMenu(fileName = "Quest", menuName = "Quests/Quest", order = 51)]
[CreateAssetMenu(fileName = "Quest", menuName = "Quests/Quest")]
public class QuestSO : SerializableScriptableObject
{
[SerializeField]

2
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs


using UnityEditor;
using UnityEngine;
[CreateAssetMenu(fileName = "Questline", menuName = "Quests/Questline", order = 51)]
[CreateAssetMenu(fileName = "Questline", menuName = "Quests/Questline")]
public class QuestlineSO : SerializableScriptableObject
{
[SerializeField]

2
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/StepSO.cs


CheckItem,
RewardItem
}
[CreateAssetMenu(fileName = "step", menuName = "Quests/step", order = 51)]
[CreateAssetMenu(fileName = "step", menuName = "Quests/Step")]
public class StepSO : SerializableScriptableObject
{

2
UOP1_Project/Assets/Scripts/UI/ScriptableObject/InteractionSO.cs


using UnityEngine;
using UnityEngine.Localization;
[CreateAssetMenu(fileName = "Interaction", menuName = "UI/Interaction", order = 51)]
[CreateAssetMenu(fileName = "Interaction", menuName = "UI/Interaction")]
public class InteractionSO : ScriptableObject
{
[Tooltip("The interaction name")]

正在加载...
取消
保存