コード例 #1
0
ファイル: ToolTipManager.cs プロジェクト: svifylabs/dwarfcorp
        public void Update(DwarfTime time)
        {
            MouseState currentMouse = Mouse.GetState();

            int movement = Math.Abs(LastMouse.X - currentMouse.X) + Math.Abs(LastMouse.Y - currentMouse.Y);

            if (ToolTip != "" && movement > MovementThreshold)
            {
                ToolTip = "";
                HoverTimer.Reset(HoverTimer.TargetTimeSeconds);
            }
            else if (ToolTip == "" && movement < MovementThreshold)
            {
                HoverTimer.Update(time);

                if (HoverTimer.HasTriggered)
                {
                    List <string> tips = new List <string>();
                    GetToolTipsUnderMouseRecursive(GUI.RootComponent, tips);

                    ToolTip = tips.Count > 0 ? tips.Last() : "";
                }
            }

            PopupTimer.Update(time);

            if (PopupTimer.HasTriggered)
            {
                PopupTip = null;
            }

            LastMouse = currentMouse;
        }
コード例 #2
0
 public void Popup(string text, float time)
 {
     PopupTip = text;
     PopupTimer.Reset(time);
 }