//public int IndexOf(T _item) //{ // for (int i = 0; i < this.Count; i++) // { // if (this[i].Equals(_item)) // return i; // } // return -1; //} public Bunch <T> Merge(Bunch <T> _bunch) { Bunch <T> @out = this.Clone(); @out.Add(_bunch.Where(item => [email protected](item))); return(@out); }
public Bunch <string> GetAreasets() { Bunch <string> @out = new Bunch <string>(); foreach (Tuple <string, int> tile in this._Tiles) { if ([email protected](tile.Item1)) { @out.Add(tile.Item1); } } return(@out); }
internal Bunch <string> _GetAreasets() { Bunch <string> @out = new Bunch <string>(); for (int x = 0; x < this.Tiles.GetLength(0); x++) { for (int y = 0; y < this.Tiles.GetLength(1); y++) { if ([email protected](this.Tiles[x, y].Item1)) { @out.Add(this.Tiles[x, y].Item1); } } } return(@out); }
public void Save(string _path) { Bunch <string> _areasets = new Bunch <string>(); foreach (LayerSource l in this.Layers) { foreach (string areaset in l._GetAreasets()) { if (!_areasets.Contains(areaset)) { _areasets.Add(areaset); } } } MekaItem file = new MekaItem("File", new List <MekaItem>()); MekaItem info = new MekaItem("Info", new List <MekaItem>()); info.Children.Add(new MekaItem("Title", this.Title)); info.Children.Add(new MekaItem("Author", this.Author)); info.Children.Add(new MekaItem("Width", this.Size.X.ToString())); info.Children.Add(new MekaItem("Height", this.Size.Y.ToString())); info.Children.Add(new MekaItem("OnLoad", this.OnLoad.SourceCode)); info.Children.Add(new MekaItem("OnEnter", this.OnEnter.SourceCode)); info.Children.Add(new MekaItem("OnExit", this.OnEnter.SourceCode)); file.Children.Add(info); file.Children.Add(new MekaItem("Properties", this._Properties)); file.Children.Add(new MekaItem("Areasets", _areasets.Select(item => new MekaItem("Areaset", item)))); MekaItem layers = new MekaItem("Layers", new List <MekaItem>()); foreach (LayerSource l in this.Layers) { MekaItem item = l._Export(_areasets); if (this.MainLayer == l) { item.Children.Add(new MekaItem("Main")); } layers.Children.Add(item); } file.Children.Add(layers); file.SaveToFile(_path); }
internal byte[] _Export() { Bunch <string> _areasets = new Bunch <string>(); foreach (Layer l in this.TileEditor.Layers) { foreach (string areaset in l.GetAreasets()) { if (!_areasets.Contains(areaset)) { _areasets.Add(areaset); } } } MekaItem file = new MekaItem("File", new List <MekaItem>()); file.Children.Add(this.LevelInfoEditor.Export()); file.Children.Add(this.LevelPropertiesEditor.Export()); file.Children.Add(new MekaItem("Areasets", _areasets.Select(item => new MekaItem("Areaset", item)))); MekaItem layers = new MekaItem("Layers", new List <MekaItem>()); foreach (Layer l in this.TileEditor.Layers) { MekaItem item = l._Export(_areasets); if (this.TileEditor.MainLayer == l) { item.Children.Add(new MekaItem("Main")); } layers.Children.Add(item); } file.Children.Add(layers); return(file.ToBytesEncrypted()); }