public void MapModCreationTest() { List <MapMod> mpList = MapMod.getMapModList(); MapMod mp = new MapMod("camp"); Assert.AreEqual(mp.getMapModType(), MapMods.camp); MapMod ms = new MapMod("circle"); Assert.AreEqual(ms.getMapModType(), MapMods.circle); Assert.AreEqual(mpList.Count, 2); }
public void DoMapMod(MapMod mod) { var layer = GetLayer(mod.Layer); if (layer != null) { layer[mod.MapX, mod.MapY].TileId = mod.Value; } if (mod.Layer.Equals("collision")) { collision.ColMap[mod.MapX, mod.MapY] = mod.Value; } }
//public string MapCategory //{ // get { return $"{_mod}{_modIndex}"; } //} public Beatmap(int mapId, string title, string artist, string mapper, string diffName, float bpm, float stars, int mod, int modIndex) { _mapId = mapId; _title = title; _artist = artist; _mapper = mapper; _diffName = diffName; _bpm = bpm; _stars = stars; _mod = (MapMod)mod; //_mod = ConvertMapMod(mod); _modIndex = modIndex; }
protected void Update() { if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { if (Input.GetKeyDown(KeyCode.P)) { DebugLog.Log("Ctrl+P : Toggle Pins"); MapMod.TogglePins(); } if (Input.GetKeyDown(KeyCode.G)) { DebugLog.Log("Ctrl+G : Toggle Resource Helpers"); MapMod.ToggleResourceHelpers(); } if (Input.GetKeyDown(KeyCode.M)) { DebugLog.Log("Ctrl+M : Give All Maps"); MapMod.GiveAllMaps("Hotkey"); } } List <(string, Action)> keyPhrases = new List <(string, Action)> { ("alsoafraidofchange", () => MapMod.SetPinStyleOrReturnToNormal(MapMod.PinStyles.AlsoAfraid)), ("afraidofchange", () => MapMod.SetPinStyleOrReturnToNormal(MapMod.PinStyles.Afraid)), (SeriouslyBoring.BORING_PHRASE_1, SeriouslyBoring.ToggleBoringMode1), (SeriouslyBoring.BORING_PHRASE_2, SeriouslyBoring.ToggleBoringMode2), }; string inputString = Input.inputString; if (inputString != string.Empty) { _typedString += inputString.Replace("'", "").ToLower(); foreach ((string phrase, Action call)item in keyPhrases) { if (_typedString.ToLower().Contains(item.phrase.ToLower())) { DebugLog.Log($"'{item.phrase}' KeyPhrase found!"); item.call.Invoke(); _typedString = ""; } } if (_typedString.Length > 20) { _typedString.Substring(1); } } }
//Creates a new Map modification item public void CreateMapModificationPin(String AI) { mapModName = AI; MapMod mapMod = new MapMod("line"); MapModPin lineMapModPin = new MapModPin(mapMod, this, this.ActualWidth, this.ActualHeight); this.Cursor = Cursors.Pen; //Only one map modification pin will be created. It will contain all shapes and lines drawn on the map. Thus it only needs to be created once. if (!ContainsLine) { AdditionalMap.Children.Add(lineMapModPin); ContainsLine = true; } }
private static MapMod ParseMapMod(string value) { string[] values = value.ToStrValues(); if (values.Length >= 4) { MapMod mod = new MapMod(); mod.Layer = values[0]; mod.MapX = values[1].ToIntValue(); mod.MapY = values[2].ToIntValue(); mod.Value = values[3].ToIntValue(); return(mod); } return(null); }
/// <summary> /// Backs up all tracked instances of the MapMod class. /// </summary> private void BackUpMapMods() { List <MapMod> mods = new List <MapMod>(MapMod.getMapModList()); foreach (MapMod mm in mods) { try { fileStream = File.Create(outputDirectory + "MapMod" + mm.getID() + ".tmp"); serializer.Serialize(fileStream, mm); fileStream.Close(); } catch (Exception ex) { LogException(ex); } } }
/// <summary> /// Recovers backed up MapMod instances. /// </summary> private void RecoverMapMods() { if (Recoverable()) { String[] filenames = Directory.GetFiles(outputDirectory, "MapMod*.tmp"); if (filenames.Length > 0) { foreach (string fn in filenames) { try { fileStream = File.OpenRead(fn); MapMod.getMapModList().Add(((MapMod)serializer.Deserialize(fileStream))); fileStream.Close(); } catch (Exception ex) { LogException(ex); } } } } }
public MapModPin(MapMod mapMod, AdditionalInfoPage aiSection, double width, double height) : base(mapMod, aiSection, aiSection.ActualWidth, aiSection.ActualHeight) { base.setImage(TechnicalServices.getImage(mapMod.getMapModType())); //Setting the image of the map modification pin mapModification = mapMod; //Providing a link to the map that this pin represents }