public void addCutSceneItem() { Vector2 mousePosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y - 20); Vector2 worldMousePosition = Vector2.Transform(mousePosition, Matrix.Invert(game.drawingTool.cam._transform)); if (csim == CutSceneItemMode.NORMAL) { CutSceneObj obj = new CutSceneObj(currentFrame, currentFrame, "pixGavin", worldMousePosition, game); cutSceneObjects.Add(obj); } if (csim == CutSceneItemMode.TEXT) { String[] words ={" ........","1234567"}; CutSceneObjText obj = new CutSceneObjText(currentFrame, "pixGavin", worldMousePosition, game, words); cutSceneObjects.Add(obj); } }
public void readCutScene(String file) { StringReader sr = new StringReader(file); String line; char[] delimiterChars = { ' ', ',', ':', '\t' }; while ((line = sr.ReadLine()) != null) { string[] words = line.Split(delimiterChars); if(words[0].Equals("cso")) { String imageName = words[1]; float xPos = System.Convert.ToSingle(words[2]) * game.drawingTool.worldDemension.X; float yPos = System.Convert.ToSingle(words[3]) * game.drawingTool.worldDemension.Y; int startFrame = (int)System.Convert.ToSingle(words[4]); int endFrame = (int)System.Convert.ToSingle(words[5]); CutSceneObj obj = new CutSceneObj(startFrame, endFrame, imageName, new Vector2(xPos, yPos), game); cutSceneObjects.Add(obj); } else if(words[0].Equals("csot")) { float xPos = System.Convert.ToSingle(words[1]) * game.drawingTool.worldDemension.X; float yPos = System.Convert.ToSingle(words[2]) * game.drawingTool.worldDemension.Y; int startFrame = (int)System.Convert.ToSingle(words[3]); List<String> textItems = new List<String>(); String lineText; while (!(lineText = sr.ReadLine()).Contains("$")) { //text[i] = lineText; textItems.Add(lineText); } String[] text = textItems.ToArray(); CutSceneObjText obj = new CutSceneObjText(startFrame, "", new Vector2(xPos, yPos), game, text); cutSceneObjects.Add(obj); } } }