コード例 #1
0
ファイル: TooltipManager.cs プロジェクト: acosin/MMXLegacy
        public void Show(MonoBehaviour p_caller, Equipment p_item, Equipment p_compareItem, Equipment p_compareSecondaryItem, IInventory p_inventory, Vector3 p_position, Vector3 p_offset)
        {
            m_showTime      = Time.time;
            m_showCompare   = true;
            m_tooltipCaller = p_caller;
            Boolean flag = p_item is MeleeWeapon && ((MeleeWeapon)p_item).GetSubType() == EEquipmentType.TWOHANDED;

            flag |= (p_item is MagicFocus && ((MagicFocus)p_item).GetMagicfocusType() == EEquipmentType.MAGIC_FOCUS_TWOHANDED);
            if (p_compareSecondaryItem != null && !flag)
            {
                m_itemTooltip.Fill(p_item, null, null, p_inventory);
                m_compareTooltip.Fill(p_compareItem, p_item, null, p_inventory);
                m_compareSecondaryTooltip.Fill(p_compareSecondaryItem, p_item, null, p_inventory);
                m_showCompareSecondary = true;
            }
            else
            {
                m_itemTooltip.Fill(p_item, p_compareItem, p_compareSecondaryItem, p_inventory);
                m_compareTooltip.Fill(p_compareItem, null, null, p_inventory);
                if (p_compareSecondaryItem != null)
                {
                    m_compareSecondaryTooltip.Fill(p_compareSecondaryItem, null, null, p_inventory);
                    m_showCompareSecondary = true;
                }
            }
            m_position = UICamera.currentCamera.WorldToScreenPoint(p_position);
            Single p_xOffset = m_tooltipOffset + 0.5f * m_itemTooltip.Scale.x + p_offset.x;
            Single p_yOffset = m_tooltipOffset + p_offset.y;
            Single num       = p_offset.x + m_itemTooltip.Scale.x + m_compareTooltip.Scale.x + m_compareGap;
            Single num2      = Math.Max(m_itemTooltip.Scale.y, m_compareTooltip.Scale.y);

            if (p_compareSecondaryItem != null)
            {
                num += m_compareSecondaryTooltip.Scale.x + m_compareGap;
                num2 = Math.Max(num2, m_compareSecondaryTooltip.Scale.y);
            }
            AdjustAlignment(p_xOffset, p_yOffset, num, num2, EVerticalAlignmentType.MIDDLE);
            AdjustPosition();
            Vector3 localPosition  = m_compareTooltip.gameObject.transform.localPosition;
            Vector3 localPosition2 = m_compareSecondaryTooltip.gameObject.transform.localPosition;

            if (m_horizontalAlignment == EHorizontalAlignmentType.RIGHT)
            {
                localPosition.x  = m_itemTooltip.Scale.x + m_compareGap;
                localPosition2.x = m_itemTooltip.Scale.x + m_compareTooltip.Scale.x + m_compareGap * 2f;
            }
            else
            {
                localPosition.x  = -m_itemTooltip.Scale.x - m_compareGap;
                localPosition2.x = -m_itemTooltip.Scale.x - m_compareTooltip.Scale.x - m_compareGap * 2f;
            }
            localPosition.y  = m_compareTooltip.EquippedGroup.Size.y;
            localPosition2.y = m_compareSecondaryTooltip.EquippedGroup.Size.y;
            m_compareTooltip.gameObject.transform.localPosition          = localPosition;
            m_compareSecondaryTooltip.gameObject.transform.localPosition = localPosition2;
            m_itemTooltip.Show();
        }
コード例 #2
0
ファイル: TooltipManager.cs プロジェクト: acosin/MMXLegacy
        public void Show(MonoBehaviour p_caller, BaseItem p_item, IInventory p_inventory, Vector3 p_position, Vector3 p_offset)
        {
            m_tooltipCaller = p_caller;
            m_itemTooltip.Fill(p_item, null, null, p_inventory);
            m_position = UICamera.currentCamera.WorldToScreenPoint(p_position);
            Single p_xOffset = m_tooltipOffset + 0.5f * m_itemTooltip.Scale.x + p_offset.x;
            Single p_yOffset = m_tooltipOffset + p_offset.y;

            AdjustAlignment(p_xOffset, p_yOffset, m_itemTooltip.Scale.x + p_offset.x, m_itemTooltip.Scale.y, EVerticalAlignmentType.MIDDLE);
            AdjustPosition();
            m_itemTooltip.Show();
        }