public RectRoomGenerator(Rectangle minBounds, Rectangle maxBounds, IPlaceable wall, IPlaceable floor)
        {
            _minBounds = minBounds;
            _maxBounds = maxBounds;

            _wall  = wall;
            _floor = floor;

            Decorators            = new PrioritySource <GenerationContext, IAreaDecorator>(false);
            NeighborPossibilities = new PrioritySource <GenerationContext, IRoomGenerator>(false);
        }
Beispiel #2
0
        private static Source <GenerationContext, IRoomGenerator> RootSource()
        {
            IRoomGenerator closet    = new RectRoomGenerator(new Rectangle(0, 0, 4, 4), new Rectangle(0, 0, 6, 6), WallPlaceable, FloorPlacable);
            IRoomGenerator basicRoom = new RectRoomGenerator(new Rectangle(0, 0, 6, 6), new Rectangle(0, 0, 10, 10), WallPlaceable, FloorPlacable);
            IRoomGenerator largeRoom = new RectRoomGenerator(new Rectangle(0, 0, 10, 10), new Rectangle(0, 0, 20, 20), WallPlaceable, FloorPlacable);

            IRoomGenerator compositeRoom = new RectCompositeRoomGenerator(2, 3, new Rectangle(0, 0, 8, 8), new Rectangle(0, 0, 10, 10), WallPlaceable, FloorPlacable);

            IRoomGenerator hugeRoom = new RectRoomGenerator(new Rectangle(0, 0, 20, 20), new Rectangle(0, 0, 30, 30), WallPlaceable, FloorPlacable);

            WeightedSource <GenerationContext, IRoomGenerator> roomSource = new WeightedSource <GenerationContext, IRoomGenerator>(true);

            //roomSource.Add(Source.From(closet), 1);
            roomSource.Add(Source.From <GenerationContext, IRoomGenerator>(basicRoom), 5);
            roomSource.Add(Source.From <GenerationContext, IRoomGenerator>(largeRoom), 5);
            roomSource.Add(Source.From <GenerationContext, IRoomGenerator>(compositeRoom), 10);
            roomSource.Add(new LimitedSource <GenerationContext, IRoomGenerator>(Source.From <GenerationContext, IRoomGenerator>(hugeRoom), 1, true), 3);

            basicRoom.NeighborPossibilities     = roomSource;
            largeRoom.NeighborPossibilities     = roomSource;
            hugeRoom.NeighborPossibilities      = roomSource;
            compositeRoom.NeighborPossibilities = roomSource;

            WeightedSource <GenerationContext, IAreaDecorator> lightingSource = new WeightedSource <GenerationContext, IAreaDecorator>(true);

            lightingSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(GlowingMushroomsSpreader)), 1);
            lightingSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(GlowingFungusSpreader)), 1);
            lightingSource.Add(Source.From <GenerationContext, IAreaDecorator>(new WallDecorator(TorchPlacer)), 10);


            PrioritySource <GenerationContext, IAreaDecorator> decorationSource = new PrioritySource <GenerationContext, IAreaDecorator>(false);

            // First, place lighting in room (always)
            decorationSource.Add(new LimitedSource <GenerationContext, IAreaDecorator>(lightingSource, 1, false));

            //Then place foliage
            WeightedSource <GenerationContext, IAreaDecorator> foliageSource = new WeightedSource <GenerationContext, IAreaDecorator>(true);

            foliageSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(GrassSpreader)), 1);
            foliageSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(TallGrassSpreader)), 1);
            foliageSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(GoblinPlaceable)), 1);
            foliageSource.Add(Source.From <GenerationContext, IAreaDecorator>(new PlaceableDecorator(GoblinArcherPlaceable)), 1);

            decorationSource.Add(foliageSource);

            compositeRoom.Decorators = decorationSource;
            basicRoom.Decorators     = decorationSource;
            largeRoom.Decorators     = decorationSource;
            hugeRoom.Decorators      = decorationSource;

            return(Source.From <GenerationContext, IRoomGenerator>(basicRoom));
        }
Beispiel #3
0
        public RectCompositeRoomGenerator(int minRects, int maxRects, Rectangle minBounds, Rectangle maxBounds, IPlaceable wall, IPlaceable floor)
        {
            MinRects  = minRects;
            MaxRects  = maxRects;
            MinBounds = minBounds;
            MaxBounds = maxBounds;

            _wall  = wall;
            _floor = floor;

            Decorators            = new PrioritySource <GenerationContext, IAreaDecorator>(true);
            NeighborPossibilities = new PrioritySource <GenerationContext, IRoomGenerator>(true);
        }
Beispiel #4
0
        /// <summary>
        /// ViewModel 資料初始化
        /// </summary>
        /// <returns></returns>
        private async Task ViewModelInit()
        {
            Title = "你有一則新留言";

            NaviPageSource.Clear();
            NaviPageSource.Add("首頁");
            NaviPageSource.Add("明細頁面");
            NaviPageSelectedItem = NaviPageSource[1];

            StyleSource.Clear();
            StyleSource.Add(LocalNotificationStyleEnum.BigText.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Image.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Inbox.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Normal.ToString());
            StyleSelectedItem = StyleSource[0];

            VisibilitySource.Clear();
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Private.ToString());
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Public.ToString());
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Secret.ToString());
            VisibilitySelectedItem = VisibilitySource[0];

            PrioritySource.Clear();
            PrioritySource.Add(LocalNotificationPriorityEnum.Default.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.High.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Low.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Maximum.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Minimum.ToString());
            PrioritySelectedItem = PrioritySource[0];

            CategorySource.Clear();
            CategorySource.Add(LocalNotificationCategoryEnum.Alarm.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Call.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Email.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Error.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Event.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Message.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Progress.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Promo.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Recommendation.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Service.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Social.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Status.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.System.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Transport.ToString());
            CategorySelectedItem = CategorySource[0];

            ResetContentText();
            await Task.Delay(100);
        }