void LoadOperation_ActionCompleted(object sender, EventArgs e) { ActionEntityList.Clear(); LoadOperation loadOperation = sender as LoadOperation; foreach (ProductManager.Web.Model.action action in loadOperation.Entities) { ActionEntity actionEntity = new ActionEntity(); actionEntity.Action = action; actionEntity.Update(); ActionEntityList.Add(actionEntity); } UpdateRoleAndRoleAction(); }
void LoadOperation_ActionCompleted(object sender, EventArgs e) { ActionEntityList.Clear(); LoadOperation loadOperation = sender as LoadOperation; foreach (ProductManager.Web.Model.action action in loadOperation.Entities) { ActionEntity actionEntity = new ActionEntity(); actionEntity.Action = action; actionEntity.Update(); ActionEntityList.Add(actionEntity); } /*LoadOperation<ProductManager.Web.Model.role> loadOperationRole * = systemManageDomainContext.Load<ProductManager.Web.Model.role>(systemManageDomainContext.GetRoleQuery()); * loadOperationRole.Completed += loadOperation_RoleCompleted;*/ LoadOperation <ProductManager.Web.Model.department> loadOperationDepartment = systemManageDomainContext.Load <ProductManager.Web.Model.department>(systemManageDomainContext.GetDepartmentQuery()); loadOperationDepartment.Completed += loadOperationDepartment_Completed; }
private void SetUpTiles() { const float tileSize = 16; string[] splitters = { "_" }; foreach (MapDrawableBatch layer in TiledMap.MapLayers) { if (layer.NamedTileOrderedIndexes.ContainsKey("Collision")) { List <int> indexes = layer.NamedTileOrderedIndexes["Collision"]; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; AddShapes(TileCollisionShapes, tileSize, tileSize, new Vector3(centerX, centerY, 0), false, Color.Green); } } if (layer.NamedTileOrderedIndexes.ContainsKey("StartPos")) { List <int> indexes = layer.NamedTileOrderedIndexes["StartPos"]; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize / 2.0f; float centerY = bottom + tileSize / 2.0f; PlayerInstance.Position = new Vector3(centerX, centerY, 10); layer.Visible = false; } } foreach (KeyValuePair <string, List <int> > entry in layer.NamedTileOrderedIndexes) { if (entry.Key.StartsWith("NextLevel_")) { string[] levelName = entry.Key.Split(splitters, StringSplitOptions.None); List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; Entities.NextLevelEntity nextLevel = new Entities.NextLevelEntity(); nextLevel.Position = new Vector3(centerX, centerY, 15); nextLevel.nextLevelName = levelName[1]; NextLevelEntityList.Add(nextLevel); } } if (entry.Key.StartsWith("Sign_")) { string[] signMessage = entry.Key.Split(splitters, StringSplitOptions.None); List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; Entities.SignEntity sign = new Entities.SignEntity(); sign.Position = new Vector3(centerX, centerY, 20); sign.signMessage = signMessage[1]; SignEntityList.Add(sign); } } if (entry.Key.StartsWith("Action_")) { string[] actionString = entry.Key.Split(splitters, StringSplitOptions.None); List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; Entities.ActionEntity action = new Entities.ActionEntity(); action.Position = new Vector3(centerX, centerY, 0); action.actionString = actionString[1]; ActionEntityList.Add(action); layer.Visible = false; } } if (entry.Key.StartsWith("EnemyCorner_")) { string[] rotationString = entry.Key.Split(splitters, StringSplitOptions.None); List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; Entities.EnemyCorner enemy = new Entities.EnemyCorner(); enemy.Position = new Vector3(centerX, centerY, 10); if (rotationString[1] == "Right") { enemy.rightDirection = true; } else { enemy.rightDirection = false; } EnemyCornerList.Add(enemy); layer.Visible = false; } } if (entry.Key.StartsWith("EnemyGround")) { List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; Entities.GroundEnemy enemy = new Entities.GroundEnemy(); enemy.Position = new Vector3(centerX, centerY, 12); GroundEnemyList.Add(enemy); layer.Visible = false; } } if (entry.Key == "EnemyCollision") { List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; AddShapes(EntityCollisionShapes, 16, 16, new Vector3(centerX, centerY, 0), true, Color.Red); layer.Visible = false; } } if (entry.Key == "EnemyCollisionGround") { List <int> indexes = entry.Value; foreach (int index in indexes) { float left; float bottom; layer.GetBottomLeftWorldCoordinateForOrderedTile(index, out left, out bottom); float centerX = left + tileSize; float centerY = bottom + tileSize; AddShapes(EnemyCollisionGround, 16, 16, new Vector3(centerX, centerY, 0), false, Color.Red); layer.Visible = false; } } } } }