示例#1
0
        /// <summary>
        /// Scene Map Update
        /// </summary>
        public override void Update()
        {
            // Debug
            if (debug)
            {
                UpdateDebug();
            }

            if (!messageWindow.IsVisible)
            {
                UpdateMenuCall();
            }
            if (!InGame.Temp.IsTransferringPlayer && !Graphics.IsTransitioning)
            {
                InGame.Tags.Update();
                InGame.Map.Update();
                InGame.Temp.MapInterpreter.Update();
                InGame.Player.Update();
                // Update system (Timer), screen
                InGame.System.Update();
                InGame.Screen.Update();
            }
            // Abort loop if player isn't place moving
            if (InGame.Temp.IsTransferringPlayer)
            {
                if (isOperatingTransfer)
                {
                    PlayerTransferring();
                }
                else
                {
                    transferPhase       = 1;
                    isOperatingTransfer = true;
                    PlayerTransferring();
                }
                return;
            }
            // Update sprite set
            spriteset.Update();
            // Update message window
            messageWindow.Update();
            // If returning to title screen
            if (InGame.Temp.ToTitle)
            {
                // Change to title screen
                Main.Scene = new SceneTitle();
                return;
            }
            // If Transition processing
            if (InGame.Temp.IsProcessingTransition)
            {
                // Clear Transition processing flag
                InGame.Temp.IsProcessingTransition = false;
                // Execute Transition
                if (InGame.Temp.TransitionName == "")
                {
                    Graphics.Transition(20);
                }
                else
                {
                    Graphics.Transition(40, InGame.Temp.TransitionName);
                }
            }
            // If showing message window
            if (InGame.Temp.IsMessageWindowShowing)
            {
                return;
            }
            // If encounter list isn't empty, and encounter count is 0
            if (InGame.Player.EncounterCount == 0 && InGame.Map.EncounterList.Length != 0)
            {
                // If event is running or encounter is not forbidden
                if (!(InGame.Temp.MapInterpreter.IsRunning || InGame.System.IsEncounterDisabled))
                {
                    // Confirm troop
                    Random random   = new Random();
                    int    n        = random.Next(InGame.Map.EncounterList.Length);
                    int    troop_id = InGame.Map.EncounterList[n];
                    // If troop is valid
                    if (Data.Npcs[troop_id] != null)
                    {
                        // Set battle calling flag
                        InGame.Temp.IsCallingBattle   = true;
                        InGame.Temp.BattleTroopId     = troop_id;
                        InGame.Temp.IsBattleCanEscape = true;
                        InGame.Temp.IsBattleCanLose   = false;
                        InGame.Temp.BattleProc        = null;
                    }
                }
            }
            UpdateCalls();
        }