Ejemplo n.º 1
0
    /*internal DialogueStage Stage(string stageID)
     * {
     *  string[] stringParts = stageID.Split(new char[] { '.' }, 2);
     *  if (stringParts.Length != 2)
     *      throw new Exception($"Invalid format of StageID: {stageID}");
     *  DialogueTopic topic = this[stringParts[0]];
     *  DialogueStage stage = GameManager.Instance.DialogueLineCache.Stage(stringParts[1], topic);
     *  return stage;
     * }*/

    protected override void load(string path, IEnumerable <string> modPaths)
    {
        base.load(path, modPaths);
        _greetings = new List <DialogueTopic>();
        foreach (DialogueTopic topic in _dict.Values)
        {
            if (topic.IsGreeting && !topic.IsEventExclusive)
            {
                _greetings.Add(topic);
            }
        }
        Prioritizable.Sort(_greetings);
    }
Ejemplo n.º 2
0
    public DialogueLine Line(GameData gameData)
    {
        IEnumerable <DialogueLine> allLines = this.Values;

        List <DialogueLine> possibleLines = new List <DialogueLine>();

        foreach (DialogueLine line in allLines)
        {
            if (line.Condition.evaluate(gameData))
            {
                possibleLines.Add(line);
            }
        }

        Prioritizable.Sort(possibleLines);

        if (possibleLines.Count == 0)
        {
            throw new GameException("No valid line");
        }

        return(possibleLines[0]);
    }