コード例 #1
0
        /// <summary>
        /// Return to the level multiform. The "increment" argument indicates whether
        /// we stay on the same level, go to the previous level, or go to the next level.
        /// </summary>
        /// <param name="increment"></param>
        public void ReturnToLevel(int increment)
        {
            var data = new MultiformTransmissionData(MultiformName);

            if (increment == NEXT_LEVEL)
                LevelNameInfo.IncrementLevel();
            else if (increment == PREV_LEVEL)
                LevelNameInfo.DecrementLevel();

            data.SetAttr<LevelNameInfo>("LevelNameInfo", LevelNameInfo);
            FadeOutAndClose(20, Color.White, LevelLoadMultiform.MultiformName,
                data, false, () => { UpdateForms(); }, () => { RenderForms(); });
        }
コード例 #2
0
        public void Update_Main()
        {
            if (HasScrollBar)
            {
                UpdateForm(ScrollBarFormName);
            }

            UpdateFormsExcept(ScrollBarFormName);

            if (buttonPressed)
            {
                var data = new MultiformTransmissionData(MultiformName);
                var LevelNameInfo = new LevelNameInfo(selectedLevelNumber);
                data.SetAttr<LevelNameInfo>("LevelNameInfo", LevelNameInfo);

                FadeOutAndClose(
                    20, Color.White, LevelLoadMultiform.MultiformName,
                    data, true, () => { UpdateForms(); }, Render_Main);
            }

            else if (GetForm<GUIButton>(BackButtonFormName).IsReleased(MouseButtons.Left))
            {
                FadeOutAndClose(
                    20, Color.White, MainMenu.MainMenuMultiform.MultiformName,
                    new MultiformTransmissionData(MultiformName), true,
                    () => { UpdateForms(); }, Render_Main);
            }
        }
コード例 #3
0
        public void Update_Main()
        {
            base.UpdateTime();

            if (KeyboardInput.IsReleased(Keys.Escape))
            {
                Paused ^= true;
            }

            if (!Paused)
            {
                UpdateForms();

                var form = GetForm<BoardForm>(BoardFormName);
                if (form.LevelComplete)
                {
                    if (LevelNameInfo.Sequential)
                    {
                        if (LevelNameInfo.LevelNumber.Value == LoadedLevelManager.HighestUnlockedLevel)
                            LoadedLevelManager.HighestUnlockedLevel++;
                    }
                    var data = new MultiformTransmissionData(MultiformName);
                    data.SetAttr<LevelNameInfo>("LevelNameInfo", LevelNameInfo);
                    data.SetAttr<LevelInfo>("LevelInfo", LevelInfo);

                    FadeOutAndClose(
                        20, Color.White, LevelCompleteMultiform.MultiformName,
                        data, true, () => { UpdateForms(); }, Render_Main);

                }
                else if (GetForm<GUIButton>(BackButtonFormName).IsReleased(MouseButtons.Left))
                {
                    FadeOutAndClose(
                        20, Color.White, LevelSelectMultiform.MultiformName,
                        null, true, () => { UpdateForms(); }, Render_Main);
                }
            }
        }
コード例 #4
0
        public override void Construct(MultiformTransmissionData args)
        {
            // Reinitialize variables that may have been carried over from the last
            // time the multiform was loaded.
            TimeOfMessagesCopied = -1;
            ResetTime();
            WarningMessages.Clear();
            RegisteredTextForms.Clear();

            LevelNameInfo = args.GetAttr<LevelNameInfo>("LevelNameInfo");
            LevelInfo = new LevelInfo(LevelNameInfo.LevelName);

            FatalError = LevelInfo.Exception != null;
            if (FatalError)
            {
                ErrorMessage = LevelInfo.Exception.Message;
            }

            if (LevelInfo != null && LevelInfo.WarningMessages.Count > 0)
            {
                WarningMessages.AddRange(LevelInfo.WarningMessages);
            }

            TransmissionData = new MultiformTransmissionData(MultiformName);
            TransmissionData.SetAttr<LevelNameInfo>("LevelNameInfo", LevelNameInfo);
            TransmissionData.SetAttr<LevelInfo>("LevelInfo", LevelInfo);

            ConstructMessageForms();

            SetUpdater(Update_Main);
            SetRenderer(Render_Main);
        }