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();
        }
        public void LoadData()
        {
            IsBusy = true;
            systemManageDomainContext = new SystemManageDomainContext();
            systemManageDomainContext.PropertyChanged -= systemManageDomainContext_PropertyChanged;
            systemManageDomainContext.PropertyChanged += systemManageDomainContext_PropertyChanged;
            RootActionAndRoleActionEntity.ChildList.Clear();
            ActionAndRoleAnctionEntityDictionary.Clear();
            RoleEntityList.Clear();
            ActionEntityList.Clear();
            LoadOperation <ProductManager.Web.Model.action> loadOperationAction
                = systemManageDomainContext.Load <ProductManager.Web.Model.action>(systemManageDomainContext.GetActionQuery());

            loadOperationAction.Completed += LoadOperation_ActionCompleted;
        }
        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;
        }
示例#4
0
 public void ClearList()
 {
     for (int i = NextLevelEntityList.Count - 1; i >= 0; i--)
     {
         NextLevelEntityList[i].Destroy();
     }
     for (int x = ActionEntityList.Count - 1; x >= 0; x--)
     {
         ActionEntityList[x].Destroy();
     }
     for (int z = BulletList.Count - 1; z >= 0; z--)
     {
         BulletList[z].Destroy();
     }
     for (int y = SignEntityList.Count - 1; y >= 0; y--)
     {
         SignEntityList[y].Destroy();
     }
     for (int g = EnemyCornerList.Count - 1; g >= 0; g--)
     {
         EnemyCornerList[g].Destroy();
     }
     for (int h = GroundEnemyList.Count - 1; h >= 0; h--)
     {
         GroundEnemyList[h].Destroy();
     }
     for (int o = EnemyBulletList.Count - 1; o >= 0; o--)
     {
         EnemyBulletList[o].Destroy();
     }
     NextLevelEntityList.Clear();
     ActionEntityList.Clear();
     BulletList.Clear();
     EnemyBulletList.Clear();
     GroundEnemyList.Clear();
     SignEntityList.Clear();
     EnemyCornerList.Clear();
 }
示例#5
0
        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;
                        }
                    }
                }
            }
        }