Exemplo n.º 1
0
        private static void AddDialogues()
        {
          //  if (MyGuiScreenGamePlay.Static == null || MyDialogues.CurrentSentence == null)
            //    return;

             if (MyDialogues.CurrentSentence == null)
                return;

            if (MyDialogues.IsCurrentCuePausedAndHidden())
                return;

            MyGuiManager.BeginSpriteBatch();
            var offset = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0);

            //need to be -1 on triple mon (big resolution)
            var offsetTextArea = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0);

            if (m_lastDialogueSentence != MyDialogues.CurrentSentence)
            {
                m_lastDialogueSentence = MyDialogues.CurrentSentence;

                m_dialogueActorNameControl.Clear();
                if (MyFakes.ENABLE_DEBUG_DIALOGS)
                {
                    m_dialogIdSB.Clear();
                    m_dialogIdSB.Append(MyDialogues.CurrentSentence.Text.ToString());
                    m_dialogueActorNameControl.AppendText(m_dialogIdSB,
                        MyDialogues.CurrentSentence.Font, MyHudConstants.DIALOGUE_ACTORNAME_FONT_SIZE, Vector4.One);
                }
                else 
                {
                    m_dialogueActorNameControl.AppendText(MyTextsWrapper.Get(MyActorConstants.GetActorProperties(MyDialogues.CurrentSentence.Actor).DisplayName),
                        MyDialogues.CurrentSentence.Font, MyHudConstants.DIALOGUE_ACTORNAME_FONT_SIZE, Vector4.One);
                }
                m_dialogueTextAreaControl.Clear();                                
                m_dialogueTextAreaControl.AppendText(MyDialoguesWrapper.Get(MyDialogues.CurrentSentence.Text),
                    MyDialogues.CurrentSentence.Font, MyHudConstants.DIALOGUE_ACTORNAME_FONT_SIZE, Vector4.One);
            }

            float noise = MyDialogues.CurrentSentence.Noise;

            // draw actor texture
            if (MyActorConstants.GetActorProperties(MyDialogues.CurrentSentence.Actor).AvatarImage != null)
            {
                MyGuiManager.DrawSpriteBatch(MyActorConstants.GetActorProperties(MyDialogues.CurrentSentence.Actor).AvatarImage, MyHudConstants.DIALOGUE_ACTORTEXTURE_POSITION + offset,
                    MyHudConstants.DIALOGUE_ACTORTEXTURE_SIZE, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoModeManager.IsTripleHead());
            }
            else
            {
                noise = 1;
            }

            // draw noise
            MyGuiManager.DrawSpriteBatch(MyGuiManager.GetDialoguePortraitNoiseVideoPlayer().GetCurrentFrame(), MyHudConstants.DIALOGUE_ACTORTEXTURE_POSITION + offset,
                MyHudConstants.DIALOGUE_ACTORTEXTURE_SIZE, new Color(noise * Vector4.One), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoModeManager.IsTripleHead());
            // draw background
            MyGuiManager.DrawSpriteBatch(MyDialogues.CurrentSentence.BackgroundTexture, MyHudConstants.DIALOGUE_BACKGROUND_POSITION + offset,
                MyHudConstants.DIALOGUE_BACKGROUND_SIZE, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoModeManager.IsTripleHead());

            // draw text area
            m_dialogueTextAreaControl.SetPosition(MyHudConstants.DIALOGUE_TEXTAREA_POSITION + offsetTextArea);
            m_dialogueTextAreaControl.Draw();

            // draw actor name
            m_dialogueActorNameControl.SetPosition(MyHudConstants.DIALOGUE_ACTORNAME_POSITION + offsetTextArea);
            m_dialogueActorNameControl.Draw();

            MyGuiManager.EndSpriteBatch();
        }
Exemplo n.º 2
0
        public static void UnloadContent()
        {
            MyMwcLog.WriteLine("MyHud.UnloadContent - START");
            MyMwcLog.IncreaseIndent();

            if (m_missionDescriptions != null)
            {
                m_missionDescriptions.Clear();
                m_missionDescriptions = null;
            }

            m_dialogueTextAreaControl = null;
            m_lastDialogueSentence = null;

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHud.UnloadContent - END");
        }        
Exemplo n.º 3
0
 int DialogueSentencesComparer(MyDialogueSentence a, MyDialogueSentence b)
 {
     if (a.Cue.HasValue && b.Cue.HasValue)
     {
         return Enum.GetName(typeof(MySoundCuesEnum), a.Cue.Value).CompareTo(Enum.GetName(typeof(MySoundCuesEnum), b.Cue.Value));
     }
     else if (a.Cue.HasValue) return 1;
     else if (b.Cue.HasValue) return -1;
     else return 0;
 }