Beispiel #1
0
        public void SetupRequiredOverworldGroups()
        {
            OverworldGroupRequirementCollection owReqs = new OverworldGroupRequirementCollection();

            var rGroup = owReqs.OverworldRequirements.Where(x => x.GroupId != null);

            foreach (var g in rGroup)
            {
                UsableOverworldSpriteGroups.Where(x => g.GroupId == x.GroupId).ToList()
                .ForEach((x) =>
                {
                    if (g.Subgroup0 == null && g.Subgroup1 == null && g.Subgroup2 == null && g.Subgroup3 == null)
                    {
                        // lazy
                        x.PreserveSubGroup0 = true;
                        x.PreserveSubGroup1 = true;
                        x.PreserveSubGroup2 = true;
                        x.PreserveSubGroup3 = true;
                    }

                    if (g.Subgroup0 != null)
                    {
                        x.SubGroup0         = (int)(g.Subgroup0 ?? x.SubGroup0);
                        x.PreserveSubGroup0 = true;
                    }
                    if (g.Subgroup1 != null)
                    {
                        x.SubGroup1         = (int)(g.Subgroup1 ?? x.SubGroup1);
                        x.PreserveSubGroup1 = true;
                    }
                    if (g.Subgroup2 != null)
                    {
                        x.SubGroup2         = (int)(g.Subgroup2 ?? x.SubGroup2);
                        x.PreserveSubGroup2 = true;
                    }
                    if (g.Subgroup3 != null)
                    {
                        x.SubGroup3         = (int)(g.Subgroup3 ?? x.SubGroup3);
                        x.PreserveSubGroup3 = true;
                    }
                    //if (g.GroupId != null)
                    //{
                    //    x.ForceRoomsToGroup.AddRange(g.Rooms);
                    //}
                });
            }
        }
Beispiel #2
0
        public IEnumerable <SpriteGroup> GetPossibleOverworldSpriteGroups(List <SpriteRequirement> doNotUpdateSprites = null)
        {
            if (doNotUpdateSprites == null || doNotUpdateSprites.Count == 0)
            {
                return(UsableOverworldSpriteGroups);
            }

            // TODO: gotta be a better way to do this
            var doNotUpdateGroupIds = doNotUpdateSprites.SelectMany(x => x.GroupId).ToList();
            var doNotUpdateSub0Ids  = doNotUpdateSprites.SelectMany(x => x.SubGroup0).ToList();
            var doNotUpdateSub1Ids  = doNotUpdateSprites.SelectMany(x => x.SubGroup1).ToList();
            var doNotUpdateSub2Ids  = doNotUpdateSprites.SelectMany(x => x.SubGroup2).ToList();
            var doNotUpdateSub3Ids  = doNotUpdateSprites.SelectMany(x => x.SubGroup3).ToList();

            return(UsableOverworldSpriteGroups
                   .Where(x => doNotUpdateGroupIds.Count == 0 || doNotUpdateGroupIds.Contains((byte)x.GroupId))
                   .Where(x => doNotUpdateSub0Ids.Count == 0 || doNotUpdateSub0Ids.Contains((byte)x.SubGroup0))
                   .Where(x => doNotUpdateSub1Ids.Count == 0 || doNotUpdateSub1Ids.Contains((byte)x.SubGroup1))
                   .Where(x => doNotUpdateSub2Ids.Count == 0 || doNotUpdateSub2Ids.Contains((byte)x.SubGroup2))
                   .Where(x => doNotUpdateSub3Ids.Count == 0 || doNotUpdateSub3Ids.Contains((byte)x.SubGroup3))
                   );
        }