예제 #1
0
    /// <summary>
    /// In this parsing section, we can assume the action is set and we are adding properties or subactions to it. This means we don't need to null check everything
    /// </summary>
    /// <param name="line">The full text line to parse</param>
    /// <param name="workingAction">The DynamicAction currently being processed. Guaranteed not null.</param>
    private static void ProcessActionSection(string line, DynamicAction workingAction, int lineNumber)
    {
        string token;

        //Process Properties Tokens
        if ((token = GetTokenVal(line, ActionTokens.Properties.Length)) != null)
        {
            int lengthNo = 1;
            if (int.TryParse(token, out lengthNo))
            {
                workingAction.length = lengthNo;
            }
            else
            {
                throwException(string.Format("Could not parse int for property {0} - {1}", ActionTokens.Properties.Length, token), lineNumber);
            }
        }
        else if ((token = GetTokenVal(line, ActionTokens.Properties.Animation)) != null)
        {
            workingAction.animationName = token;
        }
        else if ((token = GetTokenVal(line, ActionTokens.Properties.ExitAction)) != null)
        {
            workingAction.exit_action = token;
        }

        //Process Group
        else if ((token = GetTokenVal(line, ActionTokens.GroupStart)) != null)
        {
            //Debug.Log("Starting SubGroup "+token);
            workingSubGroupName = token;
        }
        else if ((token = GetTokenVal(line, ActionTokens.GroupEnd, 0)) != null)
        {
            //Debug.Log("Ending SubGroup");
            workingSubGroupName = null;
        }

        //If we haven't closed this subGroup by now, all that's left is a Subaction Definition
        else if (workingSubGroupName != null)
        {
            SubactionData subData = processSubactionLine(line, lineNumber);
            if (subData != null)
            {
                workingAction.AddSubaction(workingSubGroupName, subData);
            }
        }
    }