Example #1
0
 /// <summary>
 /// 隐藏提示
 /// </summary>
 private void OnHideTip(InteractiveTipType templateID)
 {
     if (m_CurrentTipTypes.ContainsKey(templateID) && m_CurrentTipTypes[templateID])
     {
         m_CurrentTipTypes[templateID] = false;
         RebuildView();
     }
 }
Example #2
0
    /// <summary>
    /// 重建视图
    /// </summary>
    private void RebuildView(string describe = null)
    {
        DeleteHotKey("f");

        bool isBattle = IsBattling();

        HotKeyMapID   hotKeyMapID = IsInSpace() ? HotKeyMapID.SHIP : HotKeyMapID.HUMAN;
        string        hotKeyID    = m_MustUseHumanFBox ? HotKeyID.LeapStart : IsInSpace() ? HotKeyID.InteractiveForShip : HotKeyID.InteractiveForHuman;
        RectTransform box         = (!IsInSpace() || m_MustUseHumanFBox) ? m_HumanBox : m_ShipBox;
        string        text        = !string.IsNullOrEmpty(describe) ? TableUtil.GetLanguageString(describe) : "Interactoin";

        HotkeyManager.HotkeyStyle hotkeyStyle = (!IsInSpace() || m_MustUseHumanFBox) ? HotkeyManager.HotkeyStyle.HUMAN_INTERACTIVE : HotkeyManager.HotkeyStyle.SHIP_INTERACTIVE;

        if (m_FocusNpcTid != 0)
        {
            float time = 0;
            switch (m_FocusNpcVO.InteractionType)
            {
            case 0: time = 0.0f; break;

            case 1: time = 0.0f; break;

            case 2: time = 0.0f; break;

            case 3: time = 0.6f; break;
            }

            AddHotKey("f", hotKeyMapID, hotKeyID, OnHotKeyCallbackByHold, time, box, text, hotkeyStyle);
        }

        bool tipShowed = false;

        for (int i = 0; i < m_OtherTipBox.childCount; i++)
        {
            Transform          child   = m_OtherTipBox.GetChild(i);
            InteractiveTipType tipType = (InteractiveTipType)i;
            bool enabled = false;
            if (tipType == InteractiveTipType.LockChest)
            {
                enabled = /* m_FocusNpcTid == 0 &&*/ !tipShowed /*&& !isBattle*/ && m_CurrentTipTypes.ContainsKey(tipType) && m_CurrentTipTypes[tipType];
            }
            else
            {
                enabled = m_FocusNpcTid == 0 && !tipShowed && !isBattle && m_CurrentTipTypes.ContainsKey(tipType) && m_CurrentTipTypes[tipType];
            }

            child.gameObject.SetActive(enabled);
            if (enabled)
            {
                tipShowed = true;
                Transform hotkeyBox = child.Find("HotKey");
                if (hotkeyBox != null)
                {
                    AddHotKey("f", hotKeyMapID, HotKeyID.ShipSwitchMode, OnHotKeyCallbackByTip, hotkeyBox, string.Empty, HotkeyManager.HotkeyStyle.UI_SIMPLE);
                }
            }
        }
    }
Example #3
0
 /// <summary>
 /// 显示提示
 /// </summary>
 /// <param name="templateID">模板ID</param>
 private void OnShowTip(InteractiveTipType templateID)
 {
     if (!m_CurrentTipTypes.ContainsKey(templateID))
     {
         m_CurrentTipTypes.Add(templateID, true);
         RebuildView();
     }
     else
     {
         if (!m_CurrentTipTypes[templateID])
         {
             m_CurrentTipTypes[templateID] = true;
             RebuildView();
         }
     }
 }