public void BuildRelationship() { foreach (var rg in RoomGroups) { rg.SubRoomGroups = new List <RoomGroup>(); rg.SubRoomGroups.AddRange(RoomGroups.Where(g => g.ParentGroup_Id.HasValue && g.ParentGroup_Id.Value == rg.Id)); rg.Rooms = Rooms.Where(r => r.RoomGroup_Id == rg.Id).ToList(); } GiftGroups.ForEach(giftGroup => { giftGroup.Gifts = Gifts.Where(g => g.GiftGroup_Id == giftGroup.Id).ToList(); }); foreach (var room in Rooms) { room.RoomRoles = new List <RoomRole>(); var rrs = RoomRoles.Where(r => r.Room_Id == room.Id); if (rrs != null) { room.RoomRoles.AddRange(rrs); } } foreach (var role in Roles) { if (role.Application_Id == applicationId || role.Application_Id == BuiltIns.AllApplication.Id) { role.RoleCommands = new List <RoleCommandView>(); var rcs = RoleCommands.Where(rc => (rc.SourceRole_Id == role.Id || rc.SourceRole_Id == BuiltIns.AllRole.Id) && (rc.Application_Id == applicationId || rc.Application_Id == BuiltIns.AllApplication.Id)); if (rcs != null) { role.RoleCommands.AddRange(rcs); } } } }
public Room(OrbIt game, int worldWidth, int worldHeight, bool Groups = true) { groups = new RoomGroups(this); AllActiveLinks = new ObservableHashSet<Link>(); AllInactiveLinks = new ObservableHashSet<Link>(); this.worldWidth = worldWidth; this.worldHeight = worldHeight; scheduler = new Scheduler(); borderColor = Color.DarkGray; // grid System gridsystemAffect = new GridSystem(this, 40, new Vector2(0, worldHeight - OrbIt.ScreenHeight), worldWidth, OrbIt.ScreenHeight); collisionManager = new CollisionManager(this); //gridsystemAffect = new GridSystem(this, 40, new Vector2(0, worldHeight - OrbIt.Height), worldWidth, OrbIt.Height); level = new Level(this, 40, 40, gridsystemAffect.cellWidth, gridsystemAffect.cellHeight); roomRenderTarget = new RenderTarget2D(game.GraphicsDevice, OrbIt.ScreenWidth, OrbIt.ScreenHeight); //gridsystemCollision = new GridSystem(this, gridsystemAffect.cellsX, new Vector2(0, worldHeight - OrbIt.Height), worldWidth, OrbIt.Height); camera = new ThreadedCamera(this, 1f); DrawLinks = true; scheduler = new Scheduler(); players = new HashSet<Player>(); #region ///Default User props/// Dictionary<dynamic, dynamic> userPr = new Dictionary<dynamic, dynamic>() { { nodeE.position, new Vector2(0, 0) }, { nodeE.texture, textures.blackorb }, }; #endregion defaultNode = new Node(this, userPr); defaultNode.name = "master"; //defaultNode.IsDefault = true; foreach(Component c in defaultNode.comps.Values) { c.AfterCloning(); } Node firstdefault = new Node(this, ShapeType.Circle); //firstdefault.addComponent(comp.itempayload, true); Node.cloneNode(defaultNode, firstdefault); firstdefault.name = "[G0]0"; //firstdefault.IsDefault = true; masterGroup = new Group(this, defaultNode, null, defaultNode.name, false); if (Groups) { new Group(this, defaultNode, masterGroup, "General Groups", false); new Group(this, defaultNode, masterGroup, "Preset Groups", false); new Group(this, defaultNode.CreateClone(this), masterGroup, "Player Group", true); new Group(this, defaultNode, masterGroup, "Item Group", false); new Group(this, defaultNode, masterGroup, "Link Groups", false); new Group(this, defaultNode.CreateClone(this), masterGroup, "Bullet Group", true); new Group(this, defaultNode, masterGroup, "Wall Group", true); new Group(this, firstdefault, groups.general, "Group1"); } Dictionary<dynamic, dynamic> userPropsTarget = new Dictionary<dynamic, dynamic>() { { typeof(ColorChanger), true }, { nodeE.texture, textures.ring } }; targetNodeGraphic = new Node(this,userPropsTarget); targetNodeGraphic.name = "TargetNodeGraphic"; //MakeWalls(WallWidth); MakePresetGroups(); MakeItemGroups(); }