Пример #1
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Teetering:
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Idle:
     case ActionType.LookingLeft:
     case ActionType.LookingRight:
     case ActionType.LookingUp:
     case ActionType.LookingDown:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (!this.IsOnSign() || this.InputManager.CancelTalk != FezButtonState.Pressed)
         {
             break;
         }
         this.SpeechBubble.Origin = this.PlayerManager.Position;
         this.SpeechBubble.ChangeText(GameText.GetString(this.signText));
         this.PlayerManager.Action = ActionType.ReadingSign;
         this.InputManager.PressedToDown();
         break;
     }
 }
Пример #2
0
 protected override void LoadContent()
 {
     this.sLetterAppear            = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/LetterAppear");
     this.letterTexture            = this.CMProvider.CurrentLevel.Load <Texture2D>("Other Textures/mail/" + this.LetterName + "_1");
     this.textRenderer             = new GlyphTextRenderer(this.Game);
     this.sb                       = new SpriteBatch(this.GraphicsDevice);
     this.PlayerManager.CanControl = false;
     this.PlayerManager.Action     = ActionType.ReadTurnAround;
     this.LetterText               = GameText.GetString(this.LetterName);
 }
Пример #3
0
        public LongRunningAction Say(int id, string text, bool zuish)
        {
            this.SpeechBubble.Font = zuish ? SpeechFont.Zuish : SpeechFont.Pixel;
            this.SpeechBubble.ChangeText(zuish ? text : GameText.GetString(text));
            IPlayerManager playerManager = this.PlayerManager;
            Vector3        vector3       = playerManager.Velocity * Vector3.UnitY;

            playerManager.Velocity    = vector3;
            this.PlayerManager.Action = ActionType.ReadingSign;
            return(new LongRunningAction((Func <float, float, bool>)((_, __) =>
            {
                ArtObjectInstance local_0;
                if (!this.LevelManager.ArtObjects.TryGetValue(id, out local_0))
                {
                    return true;
                }
                this.SpeechBubble.Origin = local_0.Position + FezMath.RightVector(this.CameraManager.Viewpoint) * local_0.ArtObject.Size * 0.75f - Vector3.UnitY;
                return this.SpeechBubble.Hidden;
            })));
        }
Пример #4
0
 public LongRunningAction ShowScroll(string localizedString, float forSeconds, bool onTop, bool onVolume)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     TrialAndAwards.\u003C\u003Ec__DisplayClass19 cDisplayClass19 = new TrialAndAwards.\u003C\u003Ec__DisplayClass19();
     // ISSUE: reference to a compiler-generated field
     cDisplayClass19.localizedString = localizedString;
     // ISSUE: reference to a compiler-generated field
     cDisplayClass19.\u003C\u003E4__this = this;
     if (this.GameState.ActiveScroll != null)
     {
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         TrialAndAwards.\u003C\u003Ec__DisplayClass1b cDisplayClass1b = new TrialAndAwards.\u003C\u003Ec__DisplayClass1b();
         // ISSUE: reference to a compiler-generated field
         cDisplayClass1b.CS\u0024\u003C\u003E8__locals1a = cDisplayClass19;
         TextScroll textScroll = this.GameState.ActiveScroll;
         while (textScroll.NextScroll != null)
         {
             textScroll = textScroll.NextScroll;
         }
         // ISSUE: reference to a compiler-generated field
         if (textScroll.Key == cDisplayClass19.localizedString && !textScroll.Closing)
         {
             return((LongRunningAction)null);
         }
         textScroll.Closing = true;
         textScroll.Timeout = new float?();
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         cDisplayClass1b.nextScroll = new TextScroll(this.Game, GameText.GetString(cDisplayClass19.localizedString), onTop)
         {
             Key = cDisplayClass19.localizedString
         };
         if ((double)forSeconds > 0.0)
         {
             // ISSUE: reference to a compiler-generated field
             cDisplayClass1b.nextScroll.Timeout = new float?(forSeconds);
         }
         // ISSUE: reference to a compiler-generated field
         this.GameState.ActiveScroll.NextScroll = cDisplayClass1b.nextScroll;
         if (onVolume)
         {
             // ISSUE: reference to a compiler-generated method
             return(new LongRunningAction(new Action(cDisplayClass1b.\u003CShowScroll\u003Eb__17)));
         }
         else
         {
             return((LongRunningAction)null);
         }
     }
     else
     {
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         ServiceHelper.AddComponent((IGameComponent)(this.GameState.ActiveScroll = new TextScroll(this.Game, GameText.GetString(cDisplayClass19.localizedString), onTop)
         {
             Key = cDisplayClass19.localizedString
         }));
         if ((double)forSeconds > 0.0)
         {
             this.GameState.ActiveScroll.Timeout = new float?(forSeconds);
         }
         if (onVolume)
         {
             // ISSUE: reference to a compiler-generated method
             return(new LongRunningAction(new Action(cDisplayClass19.\u003CShowScroll\u003Eb__18)));
         }
         else
         {
             return((LongRunningAction)null);
         }
     }
 }
Пример #5
0
        private void Talk()
        {
            if (this.Npc.CustomSpeechLine != null)
            {
                this.CurrentLine = this.Npc.CustomSpeechLine;
            }
            else
            {
                SpeechLine speechLine = this.CurrentLine;
                if (this.Npc.Speech.Count <= 1 || this.Npc.SayFirstSpeechLineOnce && !this.SaidFirstLine)
                {
                    this.CurrentLine = Enumerable.FirstOrDefault <SpeechLine>((IEnumerable <SpeechLine>) this.Npc.Speech);
                }
                else
                {
                    do
                    {
                        if (this.Npc.RandomizeSpeech)
                        {
                            this.CurrentLine = RandomHelper.InList <SpeechLine>(this.Npc.Speech);
                        }
                        else
                        {
                            this.CurrentLine = this.Npc.Speech[this.SequentialLineIndex];
                            ++this.SequentialLineIndex;
                            if (this.SequentialLineIndex == this.Npc.Speech.Count)
                            {
                                this.SequentialLineIndex = 0;
                            }
                        }
                    }while (speechLine == this.CurrentLine || this.Npc.SayFirstSpeechLineOnce && this.SaidFirstLine && this.CurrentLine == this.Npc.Speech[0]);
                }
                this.SaidFirstLine = true;
            }
            IPlayerManager playerManager1 = this.PlayerManager;
            Vector3        vector3_1      = playerManager1.Velocity * Vector3.UnitY;

            playerManager1.Velocity   = vector3_1;
            this.PlayerManager.Action = ActionType.ReadingSign;
            Vector3 a = this.PlayerManager.Position - this.Position;

            this.SpeechManager.Origin = this.Position + Vector3.UnitY * 0.5f;
            string s;

            if (this.LevelManager.SongName == "Majesty")
            {
                this.SpeechManager.Font = SpeechFont.Zuish;
                string stringRaw = GameText.GetStringRaw(this.CurrentLine.Text);
                this.SpeechManager.Origin       = this.Position + Vector3.UnitY * 0.5f + FezMath.RightVector(this.CameraManager.Viewpoint);
                this.SpeechManager.ChangeText(s = stringRaw);
            }
            else
            {
                this.SpeechManager.ChangeText(s = GameText.GetString(this.CurrentLine.Text));
            }
            this.LookingDirection = FezMath.DirectionFromMovement(FezMath.Dot(a * FezMath.Sign(this.Npc.DestinationOffset), FezMath.SideMask(this.CameraManager.Viewpoint)));
            this.PlayerManager.LookingDirection = FezMath.DirectionFromMovement(-FezMath.Dot(a, FezMath.RightVector(this.CameraManager.Viewpoint)));
            float num = FezMath.Dot(a, FezMath.SideMask(this.CameraManager.Viewpoint));

            if ((double)Math.Abs(num) < 1.0)
            {
                Vector3 center   = this.PlayerManager.Center;
                Vector3 velocity = this.PlayerManager.Velocity;
                MultipleHits <TrileInstance> ground = this.PlayerManager.Ground;
                IPlayerManager playerManager2       = this.PlayerManager;
                Vector3        vector3_2            = playerManager2.Center + (float)Math.Sign(num) * (1.25f - Math.Abs(num)) * FezMath.SideMask(this.CameraManager.Viewpoint);
                playerManager2.Center = vector3_2;
                this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
                this.PlayerManager.Velocity = velocity;
                if (!this.PlayerManager.Grounded)
                {
                    this.PlayerManager.Center = center;
                    this.PlayerManager.Ground = ground;
                }
                else
                {
                    this.PlayerManager.Center = center + (float)Math.Sign(num) * (1f - Math.Abs(num)) * FezMath.SideMask(this.CameraManager.Viewpoint);
                }
            }
            this.CurrentAction = NpcAction.Talk;
            this.Npc.Talking   = true;
            if (this.Npc.ActorType == ActorType.LightningGhost)
            {
                this.Group.Material.Opacity = 0.0f;
            }
            this.talkWaiter = Waiters.Wait(0.100000001490116 + 0.0750000029802322 * (double)Util.StripPunctuation(s).Length *(Culture.IsCJK ? 2.0 : 1.0), (Action)(() =>
            {
                if (this.talkEmitter == null)
                {
                    return;
                }
                this.talkEmitter.FadeOutAndPause(0.1f);
            }));
            this.talkWaiter.AutoPause = true;
            this.UpdateAction();
        }
Пример #6
0
        public LongRunningAction Say(string line, bool nearGomez, bool hideAfter)
        {
            if (this.sTextNext == null)
            {
                this.sTextNext = this.CMProvider.Global.Load <SoundEffect>("Sounds/Ui/TextNext");
            }
            if (this.sDotTalk == null)
            {
                this.sDotTalk = this.CMProvider.Global.Load <SoundEffect>("Sounds/Dot/Talk");
            }
            bool    first         = false;
            bool    wasPreventing = false;
            IWaiter w             = (IWaiter)null;

            return(new LongRunningAction((Func <float, float, bool>)((_, __) =>
            {
                switch (this.PlayerManager.Action)
                {
                case ActionType.Sliding:
                case ActionType.Teetering:
                case ActionType.Idle:
                case ActionType.Walking:
                case ActionType.Running:
                    if (!first)
                    {
                        this.Dot.ComeOut();
                        wasPreventing = this.Dot.PreventPoI;
                        this.Dot.PreventPoI = true;
                        if (nearGomez || this.Dot.Hidden || (this.Dot.Burrowing || this.Dot.Behaviour == DotHost.BehaviourType.RoamInVolume))
                        {
                            this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk;
                        }
                        string local_0 = GameText.GetString(line);
                        this.SpeechBubble.ChangeText(local_0);
                        this.PlayerManager.CanControl = false;
                        this.SpeechBubble.Origin = this.Dot.Position;
                        first = true;
                        if (this.eDotTalk == null || this.eDotTalk.Dead)
                        {
                            this.eDotTalk = SoundEffectExtensions.EmitAt(this.sDotTalk, this.Dot.Position, true);
                        }
                        else
                        {
                            this.eDotTalk.Cue.Resume();
                            this.eDotTalk.VolumeFactor = 1f;
                            this.eDotTalk.Position = this.Dot.Position;
                        }
                        w = Waiters.Wait(0.0750000029802322 * (double)Util.StripPunctuation(local_0).Length *(Culture.IsCJK ? 2.0 : 1.0), (Action)(() =>
                        {
                            if (this.eDotTalk == null)
                            {
                                return;
                            }
                            this.eDotTalk.FadeOutAndPause(0.1f);
                        }));
                        w.AutoPause = true;
                    }
                    this.SpeechBubble.Origin = this.Dot.Position;
                    if (this.eDotTalk != null && !this.eDotTalk.Dead)
                    {
                        this.eDotTalk.Position = this.Dot.Position;
                    }
                    if (this.InputManager.CancelTalk != FezButtonState.Pressed)
                    {
                        return false;
                    }
                    if (w.Alive)
                    {
                        w.Cancel();
                    }
                    if (this.eDotTalk != null && !this.eDotTalk.Dead && this.eDotTalk.Cue.State == SoundState.Playing)
                    {
                        this.eDotTalk.Cue.Pause();
                    }
                    SoundEffectExtensions.Emit(this.sTextNext);
                    this.SpeechBubble.Hide();
                    return true;

                default:
                    return false;
                }
            }), (Action)(() =>
            {
                if (hideAfter)
                {
                    this.Dot.Burrow();
                    if (this.LevelManager.Name == "VILLAGEVILLE_3D")
                    {
                        this.CameraManager.Constrained = false;
                    }
                }
                this.Dot.PreventPoI = wasPreventing;
                this.PlayerManager.CanControl = true;
            })));
        }
Пример #7
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Loading || this.GameState.InMap || (this.PointsList.Length == 0 || this.Dot.PreventPoI) || (this.GameState.Paused || this.GameState.InMenuCube || this.Dot.Owner != null && this.Dot.Owner != this) || (this.GameState.FarawaySettings.InTransition || ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action)))
            {
                return;
            }
            Vector3     vector3      = FezMath.DepthMask(this.CameraManager.Viewpoint);
            BoundingBox boundingBox1 = new BoundingBox(this.PlayerManager.Center - new Vector3(6f), this.PlayerManager.Center + new Vector3(6f));
            Volume      volume1      = (Volume)null;

            foreach (Volume volume2 in this.PointsList)
            {
                if (volume2.Enabled)
                {
                    BoundingBox boundingBox2 = volume2.BoundingBox;
                    boundingBox2.Min -= vector3 * 1000f;
                    boundingBox2.Max += vector3 * 1000f;
                    if (boundingBox1.Contains(boundingBox2) != ContainmentType.Disjoint)
                    {
                        this.Dot.ComeOut();
                        this.Dot.Behaviour     = DotHost.BehaviourType.RoamInVolume;
                        this.Dot.RoamingVolume = volume1 = volume2;
                    }
                    if (this.SpeechBubble.Hidden)
                    {
                        if (this.talkWaiter != null && this.talkWaiter.Alive)
                        {
                            this.talkWaiter.Cancel();
                        }
                        if (this.eDotTalk != null && !this.eDotTalk.Dead)
                        {
                            this.eDotTalk.FadeOutAndPause(0.1f);
                        }
                    }
                    if (!this.SpeechBubble.Hidden && this.PlayerManager.CurrentVolumes.Contains(volume2) && volume2.ActorSettings.DotDialogue.Count > 0 && (this.PlayerManager.Action == ActionType.Suffering || this.PlayerManager.Action == ActionType.SuckedIn || (this.PlayerManager.Action == ActionType.LesserWarp || this.PlayerManager.Action == ActionType.GateWarp)))
                    {
                        this.SpeechBubble.Hide();
                        this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk;
                        this.InGroup       = false;
                    }
                    if (!this.GameState.InFpsMode && this.PlayerManager.CurrentVolumes.Contains(volume2) && volume2.ActorSettings.DotDialogue.Count > 0)
                    {
                        if (this.SpeechBubble.Hidden && (this.InputManager.CancelTalk == FezButtonState.Pressed || this.InGroup))
                        {
                            switch (this.PlayerManager.Action)
                            {
                            case ActionType.Sliding:
                            case ActionType.Landing:
                            case ActionType.IdlePlay:
                            case ActionType.IdleSleep:
                            case ActionType.IdleLookAround:
                            case ActionType.IdleYawn:
                            case ActionType.Idle:
                            case ActionType.Walking:
                            case ActionType.Running:
                                volume2.ActorSettings.NextLine = (volume2.ActorSettings.NextLine + 1) % volume2.ActorSettings.DotDialogue.Count;
                                int index1 = (volume2.ActorSettings.NextLine + 1) % volume2.ActorSettings.DotDialogue.Count;
                                this.InGroup = volume2.ActorSettings.DotDialogue[volume2.ActorSettings.NextLine].Grouped && volume2.ActorSettings.DotDialogue[index1].Grouped && index1 != 0;
                                volume2.ActorSettings.PreventHey = true;
                                string index2 = volume2.ActorSettings.DotDialogue[volume2.ActorSettings.NextLine].ResourceText;
                                bool   flag;
                                if (this.GameState.SaveData.OneTimeTutorials.TryGetValue(index2, out flag) && !flag)
                                {
                                    this.GameState.SaveData.OneTimeTutorials[index2] = true;
                                    this.SyncTutorials();
                                }
                                if (this.talkWaiter != null && this.talkWaiter.Alive)
                                {
                                    this.talkWaiter.Cancel();
                                }
                                string @string = GameText.GetString(index2);
                                this.SpeechBubble.ChangeText(@string);
                                this.PlayerManager.Action = ActionType.ReadingSign;
                                if (this.eDotTalk == null || this.eDotTalk.Dead)
                                {
                                    this.eDotTalk = SoundEffectExtensions.EmitAt(this.sDotTalk, this.Dot.Position, true);
                                }
                                else
                                {
                                    this.eDotTalk.Position = this.Dot.Position;
                                    Waiters.Wait(0.100000001490116, (Action)(() =>
                                    {
                                        this.eDotTalk.Cue.Resume();
                                        this.eDotTalk.VolumeFactor = 1f;
                                    })).AutoPause = true;
                                }
                                this.talkWaiter = Waiters.Wait(0.100000001490116 + 0.0750000029802322 * (double)Util.StripPunctuation(@string).Length *(Culture.IsCJK ? 2.0 : 1.0), (Action)(() =>
                                {
                                    if (this.eDotTalk == null)
                                    {
                                        return;
                                    }
                                    this.eDotTalk.FadeOutAndPause(0.1f);
                                }));
                                this.talkWaiter.AutoPause = true;
                                break;
                            }
                        }
                        if (this.SpeechBubble.Hidden && !volume2.ActorSettings.PreventHey)
                        {
                            if (this.PlayerManager.Grounded)
                            {
                                switch (this.PlayerManager.Action)
                                {
                                case ActionType.Sliding:
                                case ActionType.Landing:
                                case ActionType.IdlePlay:
                                case ActionType.IdleSleep:
                                case ActionType.IdleLookAround:
                                case ActionType.IdleYawn:
                                case ActionType.Idle:
                                case ActionType.Walking:
                                case ActionType.Running:
                                    this.Dot.Behaviour  = DotHost.BehaviourType.ThoughtBubble;
                                    this.Dot.FaceButton = DotFaceButton.B;
                                    if (this.Dot.Owner != this)
                                    {
                                        this.Dot.Hey();
                                    }
                                    this.Dot.Owner = (object)this;
                                    break;

                                default:
                                    this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk;
                        }
                        if (!this.SpeechBubble.Hidden)
                        {
                            this.SpeechBubble.Origin = this.Dot.Position;
                        }
                        if (this.Dot.Behaviour == DotHost.BehaviourType.ReadyToTalk || this.Dot.Behaviour == DotHost.BehaviourType.ThoughtBubble)
                        {
                            break;
                        }
                    }
                }
            }
            if (this.Dot.Behaviour != DotHost.BehaviourType.ThoughtBubble && this.Dot.Owner == this && this.SpeechBubble.Hidden)
            {
                this.Dot.Owner = (object)null;
            }
            if (volume1 != null || this.Dot.RoamingVolume == null)
            {
                return;
            }
            this.Dot.Burrow();
        }