Пример #1
0
    private void DisplayCharMoveModel(IBaseTextModel ibtm)
    {
        CharMoveModel charMoveModel = (CharMoveModel)ibtm;

        if (charMoveModel.isCome)
        {
            animManager.Come(charMoveModel.pos);
        }
        else
        {
            animManager.Leave(charMoveModel.pos);
        }

        uiManager.SetExpression(charMoveModel.pos, statsManager.GetCharacter(charMoveModel.charName).FindExpression(ExpressionType.Normal));

        if (charMoveModel.audio != "")
        {
            audioManager.PlayMusic(charMoveModel.audio, MusicType.HumanSound);
        }

        if (charMoveModel.background != "")
        {
            uiManager.SetBackGroundImage(charMoveModel.background);
        }

        if (charMoveModel.bgm != "")
        {
            audioManager.PlayMusic(charMoveModel.bgm, MusicType.BGM);
        }
    }
Пример #2
0
    private void DisplaySelfDiaModel(IBaseTextModel ibtm)
    {
        SelfDiaModel selfDiaModel = (SelfDiaModel)ibtm;

        if (selfDiaModel.isSelf)
        {
            uiManager.UpdateSpeakerName("Me");
        }
        else
        {
            uiManager.UpdateSpeakerName("");
        }

        uiManager.StartCoroutine("UpdateDiaText", selfDiaModel.text);

        if (selfDiaModel.audio != "")
        {
            audioManager.PlayMusic(selfDiaModel.audio, MusicType.HumanSound);
        }

        if (selfDiaModel.isLightning)
        {
            animManager.LightningShock();
        }

        if (selfDiaModel.background != "")
        {
            uiManager.SetBackGroundImage(selfDiaModel.background);
        }

        if (selfDiaModel.bgm != "")
        {
            audioManager.PlayMusic(selfDiaModel.bgm, MusicType.BGM);
        }
    }
Пример #3
0
    private void NextCommand()
    {
        if (currentTextModels.Count <= 0)
        {
            return;
        }
        IBaseTextModel ibtm     = currentTextModels.Dequeue();
        string         nextType = "";

        if (currentTextModels.Count >= 1)
        {
            nextType = currentTextModels.Peek().GetType().ToString();
        }
        string typeName = ibtm.GetType().ToString();

        Debug.Log(typeName);

        switch (typeName)
        {
        case "StartModel":
            NextCommand();
            break;

        case "SelfDiaModel":
            DisplaySelfDiaModel(ibtm);
            break;

        case "DiaModel":
            DisplayDiaModel(ibtm);
            break;

        case "AnimModel":
            DisplayAnimModel(ibtm);
            break;

        case "CharMoveModel":
            DisplayCharMoveModel(ibtm);
            break;

        case "TriggerModel":
            DisplayTriggerModel(ibtm);
            break;

        case "ChoiceModel":
            DisplayChoiceModel(ibtm);
            break;

        case "EndModel":
            break;
        }

        CheckNextTypeAndFollowAnim(typeName, nextType);
        CheckNextTypeAndFollowCharMove(typeName, nextType);
    }
Пример #4
0
    private void DisplayChoiceModel(IBaseTextModel ibtm)
    {
        ChoiceModel choiceModel = (ChoiceModel)ibtm;

        List <string> choiceTexts = choiceModel.choicesText;

        for (int i = 0; i < choiceTexts.Count; i++)
        {
            uiManager.SetChoiceText(choiceTexts[i], i + 1);
        }

        currentChoiceBranches = choiceModel.choicesBranch;

        isChoosing = true;
    }
Пример #5
0
    private void DisplayAnimModel(IBaseTextModel ibtm)
    {
        AnimModel animModel = (AnimModel)ibtm;

        switch (animModel.animName)
        {
        case "bf_oi":
            animManager.StartCoroutine("BlindfoldFadeOutFadeIn", 2f);
            break;

        case "bf_i":
            animManager.BlindfoldFadeIn();
            break;

        case "bf_o":
            animManager.BlindfoldFadeOut();
            break;

        case "src_shake":
            animManager.BackgroundShake();
            break;
        }

        if (animModel.audio != "")
        {
            audioManager.PlayMusic(animModel.audio, MusicType.HumanSound);
        }

        if (animModel.isLightning)
        {
            animManager.LightningShock();
        }

        if (animModel.background != "")
        {
            uiManager.SetBackGroundImage(animModel.background);
        }

        if (animModel.bgm != "")
        {
            audioManager.PlayMusic(animModel.bgm, MusicType.BGM);
        }
    }
Пример #6
0
    public Dictionary <string, Queue <IBaseTextModel> > TextToModelList(string fileName)
    {
        StreamReader reader = new StreamReader("Assets/Resources/" + fileName);

        if (reader == null)
        {
            Debug.LogError("Error: file does not exist!! Please put the file in Resources folder");
            return(null);
        }
        Dictionary <string, Queue <IBaseTextModel> > outDict = new Dictionary <string, Queue <IBaseTextModel> >();
        string line = reader.ReadLine();
        string key;

        if (line != null && line[0] == 'S')
        {
            Queue <IBaseTextModel> textModel = new Queue <IBaseTextModel>();
            IBaseTextModel         model     = StartModelSolver(line);
            textModel.Enqueue(model);
            key = ((StartModel)model).sceneName;
            bool          isChoice    = false;
            List <string> choiceLines = new List <string>();
            while (true)
            {
                line = reader.ReadLine();
                if (line == "")
                {
                    break;
                }

                if (line[0] == 'S')
                {
                    model = StartModelSolver(line);
                    textModel.Enqueue(model);
                    key = ((StartModel)model).sceneName;
                    continue;
                }
                if (line[0] == 'E')
                {
                    textModel.Enqueue(EndModelSolver(line));
                    outDict.Add(key, new Queue <IBaseTextModel>(textModel));
                    textModel.Clear();
                    key = "";
                    continue;
                }
                if (line[0] == 'C')
                {
                    isChoice = true;
                }
                if (line[0] == 'L' && isChoice)
                {
                    textModel.Enqueue(ChoiceModel(choiceLines.ToArray()));
                    choiceLines.Clear();
                    isChoice = false;
                    continue;
                }

                if (isChoice)
                {
                    choiceLines.Add(line);
                    continue;
                }
                textModel.Enqueue(GeneralSolverExceptChoice(line));
            }
        }

        reader.Close();

        return(outDict);
    }
Пример #7
0
 private void DisplayTriggerModel(IBaseTextModel ibtm)
 {
     return;
 }
Пример #8
0
    private void DisplayDiaModel(IBaseTextModel ibtm)
    {
        DiaModel diaModel = (DiaModel)ibtm;

        uiManager.UpdateSpeakerName(diaModel.name);

        uiManager.StartCoroutine("UpdateDiaText", diaModel.text);

        Character character  = statsManager.GetCharacter(diaModel.name);
        Sprite    expression = null;

        switch (diaModel.expression)
        {
        case "normal":
            expression = character.FindExpression(ExpressionType.Normal);
            break;

        case "happy":
            expression = character.FindExpression(ExpressionType.Happy);
            break;

        case "angry":
            expression = character.FindExpression(ExpressionType.Angry);
            break;

        case "confused":
            expression = character.FindExpression(ExpressionType.Confused);
            break;

        case "shocking":
            expression = character.FindExpression(ExpressionType.Shocking);
            break;
        }

        if (expression != null)
        {
            uiManager.SetExpression(diaModel.pos, expression);
        }

        if (diaModel.audio != "")
        {
            audioManager.PlayMusic(diaModel.audio, MusicType.HumanSound);
        }

        if (diaModel.isShaking)
        {
            animManager.Shake(diaModel.pos);
        }

        if (diaModel.isLightning)
        {
            animManager.LightningShock();
        }

        if (diaModel.background != "")
        {
            uiManager.SetBackGroundImage(diaModel.background);
        }

        if (diaModel.bgm != "")
        {
            audioManager.PlayMusic(diaModel.bgm, MusicType.BGM);
        }
    }