Ejemplo n.º 1
0
 /// <summary>
 /// Frame Update
 /// </summary>
 /// <summary>
 /// Frame Update
 /// </summary>
 public void Update()
 {
     base.Update();
     if (InGame.Temp.ChoiceMax == 0) this.IsPausing = true;
     if (IsKeyLocked && isOpen && (text == null || text == string.Empty) && waitCount == 0) TerminateMessage();
     #region Hit C to accelerate message display
     if (Input.RMTrigger.C && isOpen && !IsKeyLocked)
     {
         if ((isMessageEnd || text == null || text == string.Empty) && InGame.Temp.NumInputVariableId == 0)
         {
             if (InGame.Temp.ChoiceMax > 0)
             {
                 InGame.System.SoundPlay(Data.System.DecisionSoundEffect);
                 InGame.Temp.ChoiceProc(this.Index);
             }
             TerminateMessage();
         }
         // Display all remaining chars
         while (text != string.Empty)
         {
             AddOneLetter();
         }
         isMessageEnd = true;
         return;
     }
     #endregion
     #region Hit B to cancel
     if (Input.RMTrigger.B && isOpen && !IsKeyLocked)
     {
         if (InGame.Temp.ChoiceMax > 0 && InGame.Temp.ChoiceCancelType >= 0)
         {
             InGame.System.SoundPlay(Data.System.CancelSoundEffect);
             InGame.Temp.ChoiceProc(InGame.Temp.ChoiceCancelType - 1);
             TerminateMessage();
         }
     }
     #endregion
     // Next char display
     if (isOpen) AddNextLetter();
     #region If number input
     if (InGame.Temp.NumInputVariableId > 0  && inputNumberWindow == null)
     {
         int digitMax = InGame.Temp.NumInputDigitsMax;
         int number = InGame.Variables.Arr[InGame.Temp.NumInputVariableId];
         inputNumberWindow = new WindowInputNumber(digitMax);
         inputNumberWindow.Number = number;
         inputNumberWindow.X = this.X + 8;
         inputNumberWindow.Y = this.Y + InGame.Temp.NumInputStart * charHeight;
     }
     #endregion
     #region Fade In
     if (isFadeIn && this.ContentsOpacity < WindowOpacity)
     {
         this.ContentsOpacity = (byte)Math.Min(this.ContentsOpacity + fadingSteps, WindowOpacity);
         titleWindow.ContentsOpacity = this.ContentsOpacity;
         if (inputNumberWindow != null) inputNumberWindow.ContentsOpacity = (byte)Math.Min(this.ContentsOpacity + fadingSteps, WindowOpacity);
         if (this.ContentsOpacity == WindowOpacity) isFadeIn = false;
         return;
     }
     #endregion
     #region Inputting number
     if (inputNumberWindow != null)
     {
         inputNumberWindow.Update();
         // Confirm
         if (Input.RMTrigger.C && !IsKeyLocked)
         {
             InGame.System.SoundPlay(Data.System.DecisionSoundEffect);
             InGame.Variables.Arr[InGame.Temp.NumInputVariableId] = inputNumberWindow.Number;
             InGame.Map.IsNeedRefresh = true;
             // Dispose of number input window
             inputNumberWindow.Dispose();
             inputNumberWindow = null;
             TerminateMessage();
         }
         return;
     }
     #endregion
     #region If display wait message or choice exists when not fading out
     if (!isFadeOut && InGame.Temp.MessageText != null && !isOpen)
     {
         contentsShowing = true;
         isFadeIn = true;
         //InGame.Temp.message_window_showing = true;
         if (!isOpen)
         {
             Refresh();
             // If choice
             if (InGame.Temp.ChoiceMax > 0)
             {
                 itemMax = InGame.Temp.ChoiceMax;
                 this.IsActive = true;
                 this.Index = 0;
             }
             // If number input
             if (InGame.Temp.NumInputVariableId > 0 && inputNumberWindow == null)
             {
                 int digitsMax = InGame.Temp.NumInputDigitsMax;
                 int number = InGame.Variables.Arr[InGame.Temp.NumInputVariableId];
                 inputNumberWindow = new WindowInputNumber(digitsMax);
                 inputNumberWindow.Number = number;
                 inputNumberWindow.X = this.X + 8;
                 inputNumberWindow.Y = this.Y + InGame.Temp.NumInputStart * 32;
             }
         }
         this.IsVisible = true;
         this.ContentsOpacity = 0;
         if (inputNumberWindow != null) inputNumberWindow.ContentsOpacity = 0;
         return;
     }
     #endregion
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Refresh
        /// </summary>
        void Refresh()
        {
            ResetWindow();
            this.Contents.Clear();
            textX = X_START;
            textY = (32 - charHeight) / 2 + 8;
            cursorWidth = GameOptions.MessageWindowRect.Width - 32;
            // Indent if choice
            if (InGame.Temp.ChoiceStart == 0)
            {
                textX = X_START + 8;
            }
            SetUp(InGame.Temp.MessageText);
            RefreshTitleWindow();
            // If choice
            if (InGame.Temp.ChoiceMax > 0)
            {
                itemMax = InGame.Temp.ChoiceMax;
                this.IsActive = true;
                this.Index = 0;
            }
            // If number input
            if (InGame.Temp.NumInputVariableId > 0 && inputNumberWindow == null)
            {
                int _digits_max = InGame.Temp.NumInputDigitsMax;
                int _number = (int)InGame.Variables.Arr[InGame.Temp.NumInputVariableId];
                inputNumberWindow = new WindowInputNumber(_digits_max);
                inputNumberWindow.Number = _number;
                inputNumberWindow.X = this.X + 8;
                inputNumberWindow.Y = this.Y + InGame.Temp.NumInputStart * 32;
            }

        }