コード例 #1
0
        /// <summary>
        /// Post-construct gets called after the form is added to a multiform
        /// (i.e. Parent != null).
        /// </summary>
        public override void PostConstruct()
        {
            base.PostConstruct();

            Board = Parent.GetForm<BoardForm>(LevelMultiform.BoardFormName);
            Inventory = Parent.GetForm<InventoryForm>(LevelMultiform.InventoryFormName);

            TOP_MESSAGE_Y_VALUE = (float)Board.BoardCollider.Y / 2f;

            // Set up the various sequential updaters.

            var Updater_001          = new DefaultUpdater();
            Updater_001.form         = this;
            Updater_001.InitialFrame = 70;
            Updater_001.Predicate    = () => Board.TileAdded;
            Updater_001.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 70,
                    Message  = "Click on one of the <<Image | 1>>'s to place a refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { new Sprite(Assets.Level.Images.EmptyTile) },
                }
            };

            var Updater_002          = new DefaultUpdater();
            Updater_002.form         = this;
            Updater_002.InitialFrame = 20;
            Updater_002.Predicate = () => Board.TileRemoved;
            Updater_002.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "You can right click to remove a refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = null
                }
            };

            var Updater_003          = new DefaultUpdater();
            Updater_003.form         = this;
            Updater_003.InitialFrame = 20;
            Updater_003.Predicate = () => Inventory.SelectionChanged;
            var y                    = ((RectCollider)Inventory.InventoryButtons[TileType.RF_UxR_UR].Collider).Center.Y;
            Updater_003.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Select a different refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth - 170, y),
                    Font     = Assets.Level.Fonts.TutorialMessage_Small,
                    Sprites  = null
                }
            };

            var Updater_004          = new DefaultUpdater();
            Updater_004.form         = this;
            Updater_004.InitialFrame = 20;
            Updater_004.Predicate    = () => Board.IsReceiverActivated(LaserColours.Red);
            var red_receiver         = new Sprite(Assets.Level.Images.Receiver);
            red_receiver.Tint        = LaserColours.Red.Color;
            Updater_004.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Light up <<Image | 1>>",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { red_receiver }
                }
            };

            var Updater_005          = new DefaultUpdater();
            Updater_005.form         = this;
            Updater_005.InitialFrame = 20;
            Updater_005.Predicate    = () => Board.IsReceiverActivated(LaserColours.Blue);
            var blue_receiver        = new Sprite(Assets.Level.Images.Receiver);
            blue_receiver.Tint       = LaserColours.Blue.Color;
            Updater_005.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Good! Now light up <<Image | 1>>",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, (float)Board.BoardCollider.Y / 3f),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { blue_receiver }
                },
                new MessageInfo {
                    Frame    = 300,
                    Message  = "(Hint: Use a different refractor)",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, (float)Board.BoardCollider.Y / 3f * 2f),
                    Font     = Assets.Level.Fonts.TutorialMessage_Small,
                    Sprites  = null
                }
            };

            Updater_001.NextUpdater = Updater_002;
            Updater_002.NextUpdater = Updater_003;
            Updater_003.NextUpdater = Updater_004;
            Updater_004.NextUpdater = Updater_005;
            Updater_005.NextUpdaterAction = () => { };

            CurrentUpdater = Updater_001.Update;
        }