Example #1
0
		private static void ParseMapDetails(string folder, Map map) {
			String bgPath = null;
			using (var streamReader = new StreamReader(Path.Combine(folder, map.Path))) {
				while (!streamReader.EndOfStream) {
					var line = streamReader.ReadLine().Trim();
					var matcher = Regex.Match(line, @"^\[(\w+)\]$");

					if (matcher.Success) {
						var sectionName = matcher.Result("$1");

						if (sectionName.Equals("Events")) {
							while (!streamReader.EndOfStream) {
								var sectionLine = streamReader.ReadLine().Trim();

								if (sectionLine == "")
									break;

								if (sectionLine.StartsWith("//"))
									continue;

								var values = sectionLine.Split(',');

								if (values[0] != "0")
									continue;

								bgPath = values[2].Substring(1, values[2].Length - 2);
							}
						}
					}
				}
			}
			map.BackgroundPath = bgPath;
		}
Example #2
0
		public override void GenerateMapStoryboard(Map map) {
			var someProperty = (Int32)map.Get("someProperty");

			if (someProperty == 1) {
				var sprite = SB.Sprite("dot2.png", SB.Foreground, SB.TopCentre);
				sprite.move(0, 10000, 320, 240, 340, 360);
			}
		}
Example #3
0
		public override void DeclareMaps(List<Map> maps) {
			var map1 = new Map("testsong (Damnae) [testdiff1].osu");
			map1.Put("someProperty", 1);
			maps.Add(map1);

			var map2 = new Map("testsong (Damnae) [testdiff2].osu");
			map2.Put("someProperty", 0);
			maps.Add(map2);
		}
 public override void GenerateMapStoryboard(Map map)
 {
     // Any maps that have been instantiated in the DeclareMaps method
     // can be called here. The generation is simply based on
     // the someProperty ID given in DeclareMaps.
     //
     // Example:
     // var someProperty = (Int32)map.Get("someProperty");
     //
     // if (someProperty == 1)
     // {
     //     var sprite = SB.Sprite("dot2.png", SB.Foreground, SB.TopCentre);
     //     sprite.move(0, 10000, 320, 240, 340, 360);
     // }
     // dot2.png is now exclusive to testdiff1.
 }
Example #5
0
		private void WriteMapStoryboard(string folder, Map map) {
			var code = SB.GenerateCode();
			Trace.Write(code);

			var diffContents = "";
			using (var streamReader = new StreamReader(Path.Combine(folder, map.Path))) {
				diffContents = streamReader.ReadToEnd();
			}

			var beginning = "//Storyboard Layer 0 (Background)";
			var end = "//Storyboard Sound Samples";

			var contentsBeginning = diffContents.IndexOf(beginning);
			var contentsEnd = diffContents.IndexOf(end);

			var codeBeginning = code.IndexOf(beginning);
			var codeEnd = code.IndexOf(end);

			var updatedDiffContents = diffContents.Substring(0, contentsBeginning);
			updatedDiffContents += code.Substring(codeBeginning, codeEnd - codeBeginning);
			updatedDiffContents += diffContents.Substring(contentsEnd, diffContents.Length - contentsEnd);
			if (IsWidescreen())
				updatedDiffContents = updatedDiffContents.Replace("WidescreenStoryboard: 0", "WidescreenStoryboard: 1");
			else
				updatedDiffContents = updatedDiffContents.Replace("WidescreenStoryboard: 1", "WidescreenStoryboard: 0");

			using (TextWriter tw = new StreamWriter(Path.Combine(folder, map.Path))) {
				tw.Write(updatedDiffContents);
			}
		}
Example #6
0
		/// <summary>
		/// Write the diff specific storyboard code here.
		/// This gets called once for each declared Map.
		/// </summary>
		public abstract void GenerateMapStoryboard(Map map);