Esempio n. 1
0
 public static HudPrompt RefreshHudAction(HudPrompt prompt, GUIHudMiniAction hudAction, GUIHudMode mode, bool clearPromptOnEmpty)
 {
     if (prompt.Visible)
     {
         if (mode == GUIHudMode.MouseAndKeyboard)
         {
             //key takes priority over mouse
             if (prompt.Key != KeyCode.None)
             {
                 if (!hudAction.SetKey(prompt.Key, prompt.Description))
                 {
                     if (clearPromptOnEmpty)
                     {
                         prompt.Clear();
                     }
                     hudAction.Reset();
                     prompt.IsEmpty = true;
                 }
                 else
                 {
                     prompt.IsEmpty = false;
                 }
             }
             else
             {
                 //mouse
                 if (!hudAction.SetMouse(prompt.Mouse, prompt.Description))
                 {
                     if (clearPromptOnEmpty)
                     {
                         prompt.Clear();
                     }
                     hudAction.Reset();
                     prompt.IsEmpty = true;
                 }
                 else
                 {
                     prompt.IsEmpty = false;
                 }
             }
         }
         else
         {
             if (!hudAction.SetControl(prompt.Control, prompt.Description, InterfaceActionManager.ActionSpriteSuffix))
             {
                 if (clearPromptOnEmpty)
                 {
                     prompt.Clear();
                 }
                 hudAction.Reset();
                 prompt.IsEmpty = true;
             }
             else
             {
                 prompt.IsEmpty = false;
             }
         }
     }
     else
     {
         hudAction.Reset();
         if (clearPromptOnEmpty)
         {
             prompt.Clear();
         }
         prompt.IsEmpty = true;
     }
     return(prompt);
 }
Esempio n. 2
0
        public void Update()
        {
            for (int i = 0; i < GUINames.Length; i++)
            {
                GUINames [i].Name.Clear();
            }

            if (!GameManager.Is(FGameState.InGame) ||
                !Profile.Get.CurrentPreferences.Immersion.WorldItemHUD ||
                GUIManager.HideCrosshair ||
                (RequireFocus && (FocusItem == null || FocusItem.Destroyed || !FocusItem.HasPlayerFocus)) ||
                (FollowTarget.target == null))
            {
                if (ControllerPanel.enabled)
                {
                    ////Debug.Log ("Shutting down");
                    FocusItem = null;
                    ControllerPanel.enabled   = false;
                    mShowStartTime            = 0f;
                    mShowProgressBarStartTime = 0f;
                    ResetAlpha();
                }
                return;
            }

            if (Profile.Get.CurrentPreferences.Controls.ShowControllerPrompts)
            {
                Mode = GUIHudMode.Controller;
            }
            else
            {
                Mode = GUIHudMode.MouseAndKeyboard;
            }

            FollowTarget.alwaysInCenter = Profile.Get.CurrentPreferences.Immersion.WorldItemHUDInCenter;

            if (mRefreshNextUpdate)
            {
                mRefreshNextUpdate = false;
                Refresh();
            }

            ControllerPanel.enabled = true;
            FollowTarget.enabled    = true;

            if (WorldClock.RealTime < ShowEndTime)
            {
                if (Prompt1.Visible)
                {
                    Prompt1.Alpha = Mathf.Lerp(Prompt1.Alpha, 1f, 0.5f);
                }
                if (Prompt2.Visible)
                {
                    Prompt2.Alpha = Mathf.Lerp(Prompt2.Alpha, 1f, 0.5f);
                }
            }
            else
            {
                //Debug.Log("No longer showing");
                if (Prompt1.Visible)
                {
                    Prompt1.Alpha = Mathf.Lerp(Prompt1.Alpha, 0f, 0.25f);
                }
                if (Prompt2.Visible)
                {
                    Prompt2.Alpha = Mathf.Lerp(Prompt2.Alpha, 0f, 0.25f);
                }
            }

            HudAction1.SetAlpha(Prompt1.Alpha);
            HudAction2.SetAlpha(Prompt2.Alpha);

            if (WorldClock.RealTime < ShowProgressBarEndTime)
            {
                SetProgressBarAlpha(Mathf.Lerp(ProgressBarForeground.alpha, 1f, 0.25f));
            }
            else
            {
                SetProgressBarAlpha(Mathf.Lerp(ProgressBarForeground.alpha, 0f, 0.25f));
            }
        }