Esempio n. 1
0
 public bool UpdateFade(GameTime time)
 {
     if (fadeToBlack && (Game1.pauseTime == 0f || Game1.eventUp))
     {
         if (fadeToBlackAlpha > 1.1f && !Game1.messagePause)
         {
             fadeToBlackAlpha = 1f;
             if (onFadeToBlackComplete())
             {
                 return(true);
             }
             nonWarpFade = false;
             fadeIn      = false;
             if (afterFade != null)
             {
                 Game1.afterFadeFunction afterFadeFunction = afterFade;
                 afterFade = null;
                 afterFadeFunction();
             }
             globalFade = false;
         }
         if (fadeToBlackAlpha < -0.1f)
         {
             fadeToBlackAlpha = 0f;
             fadeToBlack      = false;
             onFadedBackInComplete();
         }
         UpdateFadeAlpha(time);
     }
     return(false);
 }
Esempio n. 2
0
 public void closeDialogue()
 {
     if (Game1.activeClickableMenu.Equals(this))
     {
         Game1.exitActiveMenu();
         Game1.dialogueUp = false;
         if (characterDialogue != null && characterDialogue.speaker != null && characterDialogue.speaker.CurrentDialogue.Count > 0 && dialogueFinished && characterDialogue.speaker.CurrentDialogue.Count > 0)
         {
             characterDialogue.speaker.CurrentDialogue.Pop();
         }
         if (Game1.messagePause)
         {
             Game1.pauseTime = 500f;
         }
         if (Game1.currentObjectDialogue.Count > 0)
         {
             Game1.currentObjectDialogue.Dequeue();
         }
         Game1.currentDialogueCharacterIndex = 0;
         if (Game1.currentObjectDialogue.Count > 0)
         {
             Game1.dialogueUp = true;
             Game1.questionChoices.Clear();
             Game1.dialogueTyping = true;
         }
         Game1.tvStation = -1;
         if (characterDialogue != null && characterDialogue.speaker != null && !characterDialogue.speaker.Name.Equals("Gunther") && !Game1.eventUp && !characterDialogue.speaker.doingEndOfRouteAnimation)
         {
             characterDialogue.speaker.doneFacingPlayer(Game1.player);
         }
         Game1.currentSpeaker = null;
         if (!Game1.eventUp)
         {
             if (!Game1.isWarping)
             {
                 Game1.player.CanMove = true;
             }
             Game1.player.movementDirections.Clear();
         }
         else if (Game1.currentLocation.currentEvent.CurrentCommand > 0 || Game1.currentLocation.currentEvent.specialEventVariable1)
         {
             if (!Game1.isFestival() || !Game1.currentLocation.currentEvent.canMoveAfterDialogue())
             {
                 Game1.currentLocation.currentEvent.CurrentCommand++;
             }
             else
             {
                 Game1.player.CanMove = true;
             }
         }
         Game1.questionChoices.Clear();
     }
     if (Game1.afterDialogues != null)
     {
         Game1.afterFadeFunction afterDialogues = Game1.afterDialogues;
         Game1.afterDialogues = null;
         afterDialogues();
     }
 }
Esempio n. 3
0
        public static void fadeAfterDelay(Game1.afterFadeFunction behaviorAfterFade, int timer)
        {
            DelayedAction delayedAction = new DelayedAction(timer);

            delayedAction.behavior          = new DelayedAction.delayedBehavior(delayedAction.doGlobalFade);
            delayedAction.afterFadeBehavior = behaviorAfterFade;
            Game1.delayedActions.Add(delayedAction);
        }
 private static Game1.afterFadeFunction Intercept(Game1.afterFadeFunction afterFade, IReflectionHelper reflection)
 {
     if (afterFade != null && afterFade.Target is MineShaft mineShaft && afterFade.Method == MINESHAFT_AFTERFALL_METHOD)
     {
         return(new SkullCavernFallMessageIntercepter(mineShaft, reflection).AfterFall);
     }
     return(afterFade);
 }
Esempio n. 5
0
 public void closeDialogue()
 {
     if (Game1.activeClickableMenu.Equals(this))
     {
         Game1.exitActiveMenu();
         Game1.dialogueUp = false;
         if (Game1.messagePause)
         {
             Game1.pauseTime = 500f;
         }
         if (Game1.currentObjectDialogue.Count > 0)
         {
             Game1.currentObjectDialogue.Dequeue();
         }
         Game1.currentDialogueCharacterIndex = 0;
         if (Game1.currentObjectDialogue.Count > 0)
         {
             Game1.dialogueUp = true;
             Game1.questionChoices.Clear();
             Game1.dialogueTyping = true;
         }
         Game1.tvStation      = -1;
         Game1.currentSpeaker = (NPC)null;
         if (!Game1.eventUp)
         {
             if (!Game1.isWarping)
             {
                 Game1.player.CanMove = true;
             }
             Game1.player.movementDirections.Clear();
         }
         else if (Game1.currentLocation.currentEvent.CurrentCommand > 0 || Game1.currentLocation.currentEvent.specialEventVariable1)
         {
             if (!Game1.isFestival() || !Game1.currentLocation.currentEvent.canMoveAfterDialogue())
             {
                 ++Game1.currentLocation.currentEvent.CurrentCommand;
             }
             else
             {
                 Game1.player.CanMove = true;
             }
         }
         Game1.questionChoices.Clear();
     }
     if (Game1.afterDialogues == null)
     {
         return;
     }
     Game1.afterFadeFunction afterDialogues = Game1.afterDialogues;
     Game1.afterDialogues = (Game1.afterFadeFunction)null;
     afterDialogues();
 }
Esempio n. 6
0
 public void GlobalFadeToBlack(Game1.afterFadeFunction afterFade = null, float fadeSpeed = 0.02f)
 {
     if (fadeToBlack && !fadeIn)
     {
         onFadedBackInComplete();
     }
     fadeToBlack      = false;
     globalFade       = true;
     fadeIn           = false;
     this.afterFade   = afterFade;
     globalFadeSpeed  = fadeSpeed;
     fadeToBlackAlpha = 0f;
 }
Esempio n. 7
0
 public void UpdateGlobalFade()
 {
     if (fadeIn)
     {
         if (fadeToBlackAlpha <= 0f)
         {
             globalFade = false;
             if (afterFade != null)
             {
                 Game1.afterFadeFunction tmp2 = afterFade;
                 afterFade();
                 if (afterFade != null && afterFade.Equals(tmp2))
                 {
                     afterFade = null;
                 }
                 if (Game1.nonWarpFade)
                 {
                     fadeToBlack = false;
                 }
             }
         }
         fadeToBlackAlpha = Math.Max(0f, fadeToBlackAlpha - globalFadeSpeed);
         return;
     }
     if (fadeToBlackAlpha >= 1f)
     {
         globalFade = false;
         if (afterFade != null)
         {
             Game1.afterFadeFunction tmp = afterFade;
             afterFade();
             if (afterFade != null && afterFade.Equals(tmp))
             {
                 afterFade = null;
             }
             if (Game1.nonWarpFade)
             {
                 fadeToBlack = false;
             }
         }
     }
     fadeToBlackAlpha = Math.Min(1f, fadeToBlackAlpha + globalFadeSpeed);
 }