protected int UploadTileForeach(Util.DBHelper db, Point[] indexList) { List<KeyValuePair<int, BsonValue>> indexItemListNeedUpdate = new List<KeyValuePair<int, BsonValue>>(); foreach (var location in indexList) { // 타일맵 범위 초과시 아무것도 안함. if (location.X < 0 || location.X >= this.Width || location.Y < 0 || location.Y >= this.Height) { continue; } int index = Util.Utility.TwoDToOneD(location.X, location.Y, m_tileMap); indexItemListNeedUpdate.Add(new KeyValuePair<int, BsonValue>(index, m_tileMap[location.X, location.Y].ToBsonDocument())); } // 동기화 db.UpdateArrayDocument("Tiles", "List", "Index", indexItemListNeedUpdate); return 0; }
//################################################################################## protected int UploadTileAt(Util.DBHelper db, int tileWidthIndex, int tileHeightIndex) { // 타일맵 범위 초과시 아무것도 안함. if (tileWidthIndex < 0 || tileWidthIndex >= this.Width || tileHeightIndex < 0 || tileHeightIndex >= this.Height) { return -1; } // 동기화 db.UpdateArrayDocument("Tiles", "List", "Index", new List<KeyValuePair<int, BsonValue>>() { new KeyValuePair<int, BsonValue>(Util.Utility.TwoDToOneD(tileWidthIndex, tileHeightIndex, m_tileMap), m_tileMap[tileWidthIndex, tileHeightIndex].ToBsonDocument()) }); return 0; }