private ScenarioCommand ExecuteNext() { if (mCommandList.Length <= mCursor) { return(null); } ScenarioCommand command = mCommandList[mCursor++]; if (command is ConversationCommand) { ConversationCommand conv = command as ConversationCommand; mName = conv.Name; mContext = conv.Context; } else if (command is CharacterCommand) { CharacterCommand crt = command as CharacterCommand; SetCharacterId(crt.Position, crt.Id); } else if (command is BackgroundCommand) { BackgroundCommand bg = command as BackgroundCommand; BG = bg.Id; mBGColor = bg.BackgroundColor; } return(command); }
public ScenarioCommand NextConversation() { while (true) { ScenarioCommand cmd = ExecuteNext(); if (cmd == null) { break; } if (cmd is ConversationCommand) { return(cmd); } } return(null); }
public void StartNew(string path) { Stream stream = new Utilities.DecryptStream(File.OpenRead(path)); mCommandList = ScenarioParser.Parse(stream); mCursor = 0; mName = string.Empty; mContext = string.Empty; for (int i = 0; i < 8; i++) { mIds[i] = null; if (mCrtBase[i] != null) { mCrtBase[i].Dispose(); } if (mCrtAdditional[i] != null) { mCrtAdditional[i].Dispose(); } mCrtBase[i] = null; mCrtAdditional[i] = null; } mBG = -1; mBGColor = Color.Black; ScenarioCommand title = mCommandList[mCursor++]; if (!(title is TitleCommand)) // no title { mCursor = 0; Title = null; Invalidate(); return; } Title = (title as TitleCommand).Title; Invalidate(); }