public int GetEndifLine()
    {
        int unclosedIfs = 0;

        for (int i = currentLine + 1; i < vsnScriptContent.Length; i++)
        {
            string line    = vsnScriptContent[i];
            string command = OldVSNCommands.GetCommand(line);
            if (command == "if")
            {
                unclosedIfs++;
                continue;
            }
            if (command == "endif")
            {
                if (unclosedIfs == 0)
                {
                    return(i);
                }
                else
                {
                    unclosedIfs--;
                }
            }
        }

        Debug.LogError("NO ENDIF FOUND");

        return(-1);
    }
Ejemplo n.º 2
0
    public void StartVSNScript(string scriptToLoad, string waypointToStart)
    {
        StartVSNScript(scriptToLoad, 0);
        int lineToStart = OldVSNCommands.GetInstance().waypoints[waypointToStart];

        OldVSNScriptReader.GetInstance().GoToLine(lineToStart);
    }
    void StoreWaypointsAndCountLines()
    {
        Dictionary <string, int> waypoints = new Dictionary <string, int>();
        int        lineCount  = 1;
        bool       canGetItem = true;
        string     line       = null;
        TextReader reader;

        if (Persistence.debugMode && false)
        {
            FileStream scriptFile = new FileStream("script_debug.txt", FileMode.Open, FileAccess.Read);
            reader = new StreamReader(scriptFile);
        }
        else
        {
            reader = new StringReader(currentScript.text);
        }

        while ((line = reader.ReadLine()) != null)
        {
//      Debug.Log("Starting line "+lineCount+".");

            if (line.Length <= 1)
            {
                lineCount++;
                continue;
            }

            string currentCommand = OldVSNCommands.GetCommand(line);
            if (currentCommand == "" || currentCommand == null)
            {
                continue;
            }

            if (currentCommand == "waypoint")
            {
                string[] param        = OldVSNCommands.GetParams(line);
                string   waypointName = param[0];
                Debug.Log(waypointName + " in line " + lineCount);
                waypoints.Add(waypointName, lineCount);
            }
            if (currentCommand == "mouth_anim")
            {
                commandController.CheckCommand(line, lineCount);
            }
            if (currentCommand == "eye_blink_anim")
            {
                commandController.CheckCommand(line, lineCount);
            }

            lineCount++;
        }
        totalLines = lineCount;

        reader.Close();
        commandController.waypoints = waypoints;
    }
Ejemplo n.º 4
0
 public void SendAnswerDuplicateError()
 {
     if (OldVSNCommands.GetInstance().waypoints.ContainsKey(sendAnswerDuplicateErrorWaypoint))
     {
         int lineNumber = OldVSNCommands.GetInstance().waypoints[sendAnswerDuplicateErrorWaypoint];
         OldVSNScriptReader.GetInstance().GoToLine(lineNumber);
     }
     else
     {
         Debug.Log("ERROR SENDING ANSWER ERROR");
     }
     gameState = GameState.PlayingScript;
 }
Ejemplo n.º 5
0
    IEnumerator CreateCharacterAnimsCoroutine()
    {
        int    lineCount = 1;
        string line;

        finishedLoadingAnims = false;
        TextReader animReader;

        if (Persistence.debugMode)
        {
            FileStream scriptFile = new FileStream("CharacterAnims.txt", FileMode.Open, FileAccess.Read);
            animReader = new StreamReader(scriptFile);
        }
        else
        {
            animReader = new StringReader(animScript[0].text);
        }

        while ((line = animReader.ReadLine()) != null)
        {
            yield return(new WaitForEndOfFrame());

            if (line.Length >= 10)
            {
                if (line.Substring(0, 10).ToLower() == "mouth_anim")
                {
                    OldVSNCommands.CheckAnimCommand(line, lineCount);
                }
            }
            if (line.Length >= 15)
            {
                if (line.Substring(0, 15).ToLower() == "eye_blink_anim")
                {
                    OldVSNCommands.CheckAnimCommand(line, lineCount);
                }
            }

            lineCount++;
        }
//		//Debug.log("FINISHED LOADING ANIMS!");
        finishedLoadingAnims = true;

        animReader.Close();
    }
Ejemplo n.º 6
0
 void Awake()
 {
     instance = this;
 }