private static void setVarsFromTooltipPanel(TooltipType type) { TooltipPanel panel; switch(type) { case TooltipType.BIOBRICK: panel = _instance.bioBrickTooltipPanel; break; case TooltipType.DEVICE: panel = _instance.deviceTooltipPanel; break; default: panel = _instance.bioBrickTooltipPanel; break; } _instance._tooltipPanel = panel.gameObject.GetComponent<UIPanel>(); _instance._titleLabel = panel.titleLabel; _instance._typeLabel = panel.typeLabel; _instance._subtitleLabel = panel.subtitleLabel; _instance._illustrationSprite = panel.illustrationSprite; _instance._customFieldLabel = panel.customFieldLabel; _instance._customValueLabel = panel.customValueLabel; _instance._lengthValueLabel = panel.lengthValueLabel; _instance._referenceValueLabel = panel.referenceValueLabel; _instance._energyConsumptionValueLabel = panel.energyConsumptionValueLabel; _instance._explanationLabel = panel.explanationLabel; _instance._backgroundSprite = panel.backgroundSprite; }
public void ShowTooltip(string _text, TooltipType _type) { m_tooltipText.text = _text; // IF XBOX switch (_type) { case TooltipType.A: m_iconText.text = "A"; m_iconBackground.color = new Color(0, 0.62f, 0.04f); break; case TooltipType.B: m_iconText.text = "B"; m_iconBackground.color = new Color(1, 0, 0); break; case TooltipType.X: m_iconText.text = "X"; m_iconBackground.color = new Color(0, 0, 1); break; case TooltipType.Y: m_iconText.text = "Y"; m_iconBackground.color = new Color(1, 0.82f, 0); break; } // END IF XBOX }
internal Tooltip(string strHeader, ImageSource image, string strText, TooltipType type) { m_strHeader = strHeader; m_ImageSource = image; m_strTooltipText = strText; m_Type = type; }
private void setOperateByType(TooltipType ttype) { btn_equip.SetActive(false); btn_unEquip.SetActive(false); btn_use.SetActive(false); btn_drop.SetActive(false); btn_hotBar.SetActive(false); if (ttype == TooltipType.Inventory) { btn_drop.SetActive(true); if (item.isEquipItem()) { btn_equip.SetActive(true); } if (item.isConsumeItem()) { btn_use.SetActive(true); btn_hotBar.SetActive(true); } } else if (ttype == TooltipType.Equipment) { btn_unEquip.SetActive(true); } }
private async void DisplayAnimator(TooltipType type) { const string POPUP_BOOLID = "Popup"; Animator toDisplay = null; switch (type) { case TooltipType.NoItem: toDisplay = noItem_Animator; break; case TooltipType.WrongItem: toDisplay = wrongItem_Animator; break; case TooltipType.NotCleanedItem: toDisplay = noCleanedItem_Animator; break; } toDisplay.SetBool(POPUP_BOOLID, true); await Task.Delay(TimeSpan.FromSeconds(DISPLAY_TOOLTIP_TIMER)); toDisplay.SetBool(POPUP_BOOLID, false); }
public static Rect GetTargetTooltipRect(TooltipType pType, Item pItem = null) { Rect targetRect = new Rect(); switch (pType) { default: case TooltipType.Info: targetRect = AppUI.Instance.infoTooltipObject.GetComponent <RectTransform>().rect; break; case TooltipType.Item: targetRect = AppUI.Instance.ItemTooltipObject.GetComponent <RectTransform>().rect; break; } if (pItem == null) { return(targetRect); } switch (pItem.Type) { case ItemType.Resource: targetRect.yMax -= AppUI.Instance.ItemTooltipObject.GetComponent <ItemTooltipUIObject>().EquipmentBase.rect.height; break; } return(targetRect); }
private void FillSkillDescription(Skill p_skill, TooltipType p_type, Boolean p_isDefault) { if (p_type == TooltipType.BASE || p_type == TooltipType.PARTY_CREATION) { String text = LocaManager.GetText(p_skill.Description); if (p_type == TooltipType.PARTY_CREATION) { if (p_skill.MaxTier == ETier.GRAND_MASTER) { text = text + "\n\n[00ff00]" + LocaManager.GetText("TOOLTIP_SKILL_MAX_GRANDMASTER") + "[-]"; } else if (p_skill.MaxTier == ETier.MASTER) { text = text + "\n\n[00ff00]" + LocaManager.GetText("TOOLTIP_SKILL_MAX_MASTER") + "[-]"; } else if (p_skill.MaxTier == ETier.EXPERT) { text = text + "\n\n[00ff00]" + LocaManager.GetText("TOOLTIP_SKILL_MAX_EXPERT") + "[-]"; } if (p_isDefault) { text = text + "\n\n[ff0000]" + LocaManager.GetText("TOOLTIP_SKILL_IS_DEFAULT") + "[-]"; } } m_description.UpdateText(text); } else { String increaseDescription = GetIncreaseDescription(p_skill, p_skill.Level, true); m_description.UpdateText(increaseDescription); } }
private void FillSkillName(Skill p_skill, TooltipType p_type) { if (p_type == TooltipType.CURRENT_EFFECT_NEXT || p_type == TooltipType.CURRENT_EFFECT_PREV) { m_name.Label.color = m_normalColor; m_name.UpdateText(LocaManager.GetText("SKILL_CURRENT_INCREASE")); } if (p_type == TooltipType.BASE || p_type == TooltipType.PARTY_CREATION) { m_name.Label.color = m_normalColor; m_name.UpdateText(LocaManager.GetText(p_skill.Name)); } else if (p_type == TooltipType.EXPERT) { m_name.Label.color = ((p_skill.Tier < ETier.EXPERT) ? m_unlearnedColor : m_normalColor); m_name.UpdateText(LocaManager.GetText("SKILL_TIER_BONUS_2")); } else if (p_type == TooltipType.MASTER) { m_name.Label.color = ((p_skill.Tier < ETier.MASTER) ? m_unlearnedColor : m_normalColor); m_name.UpdateText(LocaManager.GetText("SKILL_TIER_BONUS_3")); } else if (p_type == TooltipType.GRAND_MASTER) { m_name.Label.color = ((p_skill.Tier < ETier.GRAND_MASTER) ? m_unlearnedColor : m_normalColor); m_name.UpdateText(LocaManager.GetText("SKILL_TIER_BONUS_4")); } }
private async void DisplayAnimator(TooltipType type) { const string POPUP_BOOLID = "Popup"; Animator toDisplay = null; switch (type) { case TooltipType.HandsFull: toDisplay = handsFull_Icon; break; case TooltipType.ObjectIsFull: toDisplay = objectIsFull_Icon; break; case TooltipType.StorageEmpty: toDisplay = storageEmpty_Icon; break; case TooltipType.WrongItemInHands: toDisplay = wrongItem_Icon; break; case TooltipType.BusyWashing: toDisplay = busyWashing_Icon; break; } toDisplay.SetBool(POPUP_BOOLID, true); await Task.Delay(TimeSpan.FromSeconds(DISPLAY_TOOLTIP_TIMER)); toDisplay.SetBool(POPUP_BOOLID, false); }
private static void setVarsFromTooltipPanel(TooltipType type) { TooltipPanel panel; switch (type) { case TooltipType.BIOBRICK: panel = _instance.bioBrickTooltipPanel; break; case TooltipType.DEVICE: panel = _instance.deviceTooltipPanel; break; default: panel = _instance.bioBrickTooltipPanel; break; } _instance._tooltipPanel = panel.gameObject.GetComponent <UIPanel>(); _instance._titleLabel = panel.titleLabel; _instance._typeLabel = panel.typeLabel; _instance._subtitleLabel = panel.subtitleLabel; _instance._illustrationSprite = panel.illustrationSprite; _instance._customFieldLabel = panel.customFieldLabel; _instance._customValueLabel = panel.customValueLabel; _instance._lengthValueLabel = panel.lengthValueLabel; _instance._referenceValueLabel = panel.referenceValueLabel; _instance._energyConsumptionValueLabel = panel.energyConsumptionValueLabel; _instance._explanationLabel = panel.explanationLabel; _instance._backgroundSprite = panel.backgroundSprite; }
public void Fill(TooltipType p_type, EPotionTarget p_attribute, Int32 p_currentIncrease, Character p_character, DummyCharacter p_dummy) { Init(); m_atrribute = p_attribute; Single num = m_outerPadding + m_innerPadding; m_currentIncrease = p_currentIncrease; m_currentHeader.UpdatePositionY(-num); m_currentHeader.UpdateText(LocaManager.GetText("ATTRIBUTE_CURRENT")); num += m_currentHeader.Size.y + m_innerPadding; m_currentText.UpdatePositionY(-num); FillDescription(m_currentText, m_currentIncrease, p_character, p_dummy, false); num += m_currentText.Size.y + m_innerPadding; m_changeHeader.UpdatePositionY(-num); if (p_type == TooltipType.CURRENT_EFFECT_NEXT) { m_changeHeader.UpdateText(LocaManager.GetText("ATTRIBUTE_NEXT")); } else { m_changeHeader.UpdateText(LocaManager.GetText("ATTRIBUTE_PREV")); } num += m_changeHeader.Size.y + m_innerPadding; m_changeText.UpdatePositionY(-num); if (p_type == TooltipType.CURRENT_EFFECT_NEXT) { FillDescription(m_changeText, m_currentIncrease + 1, p_character, p_dummy, true); } else { FillDescription(m_changeText, m_currentIncrease - 1, p_character, p_dummy, true); } num += m_changeText.Size.y + m_innerPadding; m_background.Scale(m_currentHeader.Size.x + m_outerPadding * 2f, num - m_innerPadding + m_outerPadding); }
/// <summary> /// 根据类型获取预制 by吴江 /// </summary> /// <param name="_type"></param> /// <returns></returns> protected static GUIBase GetPanelByType(TooltipType _type) { if (!tooltipPanelDictionary.ContainsKey(_type) || tooltipPanelDictionary[_type] == null) { string path = GetPath(_type); Object obj = exResources.GetResource(ResourceType.GUI, path); if (obj == null) { GameSys.LogError("找不到UI预制:" + path); return(null); } GameObject panel = GameObject.Instantiate(obj) as GameObject; panel.transform.parent = GameCenter.uIMng.uIRoot.transform; panel.transform.localPosition = new Vector3(0, 0, 0); panel.transform.localScale = new Vector3(1, 1, 1); panel.name = obj.name; obj = null; GUIBase wnd = panel.GetComponent <GUIBase>(); if (wnd == null) { GameSys.LogError("找不到<GUIBase>组件!"); return(null); } if (_type != TooltipType.Access) { tooltipPanelDictionary[_type] = wnd; } else { return(wnd); } } return(tooltipPanelDictionary[_type]); }
public int InitializeOffset; // We need to wait 2 frames before width and height can be read correctly public void Initialize(TooltipType type, string title, string text) { Title.gameObject.SetActive(type == TooltipType.TitleAndText); Separator.gameObject.SetActive(type == TooltipType.TitleAndText); Title.text = title; Text.text = text; InitializeOffset = 0; }
private void FillSkillEffect(Skill p_skill, TooltipType p_type) { if (p_type == TooltipType.CURRENT_EFFECT_NEXT) { String increaseDescription = GetIncreaseDescription(p_skill, p_skill.Level + 1, false); m_effect.UpdateText(increaseDescription); m_effect.Label.color = m_unlearnedColor; } else if (p_type == TooltipType.CURRENT_EFFECT_PREV) { String increaseDescription2 = GetIncreaseDescription(p_skill, p_skill.Level - 1, false); m_effect.UpdateText(increaseDescription2); m_effect.Label.color = m_unlearnedColor; } else if (p_type == TooltipType.BASE) { String tierBoni = GetTierBoni(p_skill.Tier1Effects, p_skill.Tier >= ETier.NOVICE); m_effect.UpdateText(tierBoni); m_effect.Label.color = m_normalColor; } else if (p_type == TooltipType.EXPERT) { Boolean flag = p_skill.Tier >= ETier.EXPERT; String tierBoni2 = GetTierBoni(p_skill.Tier2Effects, flag); m_effect.UpdateText(tierBoni2); m_effect.Label.color = ((!flag) ? m_unlearnedColor : m_normalColor); } else if (p_type == TooltipType.MASTER) { Boolean flag2 = p_skill.Tier >= ETier.MASTER; String tierBoni3 = GetTierBoni(p_skill.Tier3Effects, flag2); m_effect.UpdateText(tierBoni3); m_effect.Label.color = ((!flag2) ? m_unlearnedColor : m_normalColor); } else if (p_type == TooltipType.GRAND_MASTER) { Boolean flag3 = p_skill.Tier >= ETier.GRAND_MASTER; String tierBoni4 = GetTierBoni(p_skill.Tier4Effects, flag3); m_effect.UpdateText(tierBoni4); m_effect.Label.color = ((!flag3) ? m_unlearnedColor : m_normalColor); } else { if (IsMagicSchoolSkill(p_skill)) { if (p_skill.StaticID == 11) { m_effect.UpdateText(LocaManager.GetText("TOOLTIP_SKILL_START_WARFARE")); } else { m_effect.UpdateText(LocaManager.GetText("TOOLTIP_SKILL_START_SPELL")); } } m_effect.Label.color = m_normalColor; } }
public void SetItem(Item item) { if (item == null) { return; } _item = item; UpdateInfo(); toolType = TooltipType.Gear; }
private Vector3 GetToolTipsScreenPosition(bool isKeyboard, TooltipType toolTipType) { switch (toolTipType) { case TooltipType.Follow when isKeyboard: return(SetKeyboardTooltipPosition()); case TooltipType.Follow: return(SetMouseToolTipPosition()); case TooltipType.FixedPosition: return(SetFixedToolTipPosition()); default: throw new ArgumentOutOfRangeException(nameof(toolTipType), toolTipType, null); } }
public void Prepare(TooltipType type) { Initialize(); if (!type.IsDynamic()) { SetPositionToStatic(); } if (type == TooltipType.StaticClick) { CanvasGroup.blocksRaycasts = true; } else { CanvasGroup.blocksRaycasts = false; } }
/// <summary> /// Get the correct position of the active tooltip basesd on the mouse position and tooltip rect. /// </summary> /// <returns>The position of the tooltip.</returns> public static Vector2 GetTooltipPosition(TooltipType pType, Item pItem = null) { // Just update the tooltip's position // It should be anchored to the mouse such that no part of it is off screen Vector3 mp = Input.mousePosition; Vector2 position = new Vector2(); Rect targetRect = GetTargetTooltipRect(pType, pItem); targetRect.size = Vector2.Scale(targetRect.size, AppUI.Instance.UICanvas.transform.lossyScale); if (mp.y + targetRect.height > Screen.height) { // Choose one of the top corners instead. if (mp.x - targetRect.width < 0) { // Should follow the top left corner position = new Vector2(mp.x + (targetRect.width / 2), mp.y - (targetRect.height / 2)); } else { // Should follow the top right corner position = new Vector2(mp.x - (targetRect.width / 2), mp.y - (targetRect.height / 2)); } } else { // Choose one of the bottom corners if (mp.x - targetRect.width < 0) { // Should follow the bottom left corner position = new Vector2(mp.x + (targetRect.width / 2), mp.y + (targetRect.height / 2)); } else { // Should follow the bottom right corner position = new Vector2(mp.x - (targetRect.width / 2), mp.y + (targetRect.height / 2)); } } return(position); }
public void OpenTooltipAtPos(TooltipType type, Vector3 pos, TooltipInfo info, string message, bool isTwoDimension = true) { if (info.Title == "") { info = new TooltipInfo(); } SwapTooltipObjects(type == TooltipType.Default ? tooltipObject : objectTooltipObject); Vector3 _pos = isTwoDimension ? GetPos_2D(pos) : GetPos_3D(pos); if (type == TooltipType.Default) { textTooltip.text = message; transformTooltip.position = _pos; } else { objectTooltip.OpenTooltipAtPosWithInfo(_pos, info); } }
private void FillSkillLevel(Skill p_skill, TooltipType p_type, Boolean p_isDefault) { if (p_type == TooltipType.PARTY_CREATION) { if (p_skill.MaxTier == ETier.NONE) { m_level.UpdateText(LocaManager.GetText("TOOLTIP_SKILL_CANNOT_LEARN")); } else { String p_text; if (p_skill.Tier == ETier.NONE) { p_text = LocaManager.GetText("TOOLTIP_SKILL_UNSELECTED"); } else { p_text = "[00ff00]" + LocaManager.GetText("TOOLTIP_SKILL_SELECTED") + "[-]"; } m_level.UpdateText(p_text); } } else if (p_skill.Tier == ETier.NONE) { m_level.UpdateText(LocaManager.GetText("GUI_SKILLS_LEVEL_DESCRIPTION_UNLEARNED")); } else { String arg; if (p_skill.VirtualSkillLevel > 0) { arg = m_effectColorHex + (p_skill.Level + p_skill.VirtualSkillLevel) + "[-]"; } else { arg = p_skill.Level.ToString(); } m_level.UpdateText(LocaManager.GetText("TT_SKILL_LEVEL", SkillView.GetTierText(p_skill.Tier), arg)); } }
/// <summary> /// 根据类型获取预制路径 by吴江 /// </summary> /// <param name="_type"></param> /// <returns></returns> protected static string GetPath(TooltipType _type) { switch (_type) { case TooltipType.Equipment: return("Item_icon/Item_Wnd"); case TooltipType.Property: return("Tooltip/Panel_MSGBubble"); case TooltipType.ShowForMall: return("Item/ItemDesc_show"); case TooltipType.Access: return("Access/Access"); case TooltipType.EquipmentCompare: return("Item_icon/Item_Compare"); default: return(string.Empty); } }
public void SetAbility(Ability ability) { _ability = ability; toolType = TooltipType.Ability; UpdateInfo(); }
private void setOperateByType(TooltipType ttype) { btn_equip.SetActive(false); btn_unEquip.SetActive(false); btn_use.SetActive(false); btn_drop.SetActive(false); btn_hotBar.SetActive(false); if (ttype == TooltipType.Inventory) { btn_drop.SetActive(true); if (item.isEquipItem()) btn_equip.SetActive(true); if (item.isConsumeItem()) { btn_use.SetActive(true); btn_hotBar.SetActive(true); } } else if (ttype == TooltipType.Equipment) { btn_unEquip.SetActive(true); } }
public void Fill(Skill p_skill, TooltipType p_type, Boolean p_isDefault) { Init(); Single num = m_outerPadding + m_innerPadding; Boolean flag = p_type != TooltipType.CURRENT_EFFECT_NEXT || p_skill.Tier >= ETier.NOVICE; m_name.SetVisible(flag); if (flag) { m_name.UpdatePositionY(-num); FillSkillName(p_skill, p_type); num += m_name.Size.y + m_innerPadding; } Boolean flag2 = p_type == TooltipType.BASE || p_type == TooltipType.PARTY_CREATION; m_itemSlot.SetVisible(flag2); m_level.SetVisible(flag2); if (flag2) { m_itemSlot.UpdatePosition(new Vector3(-m_name.Size.x / 2f, -num, 0f)); m_itemSlot.SetItem(p_skill.Icon); m_level.VerticalAlign = TooltipGroup.Align.CENTER; m_level.MinHeight = m_itemSlot.Size.y; m_level.UpdatePositionY(-num); FillSkillLevel(p_skill, p_type, p_isDefault); num += m_level.Size.y + m_innerPadding; } Boolean flag3 = p_type == TooltipType.BASE || p_type == TooltipType.PARTY_CREATION || p_type == TooltipType.CURRENT_EFFECT_PREV || (p_type == TooltipType.CURRENT_EFFECT_NEXT && p_skill.Tier >= ETier.NOVICE); m_description.SetVisible(flag3); if (flag3) { m_description.UpdatePositionY(-num); FillSkillDescription(p_skill, p_type, p_isDefault); num += m_description.Size.y + m_innerPadding; } Boolean flag4 = p_type == TooltipType.CURRENT_EFFECT_NEXT || (p_type == TooltipType.CURRENT_EFFECT_PREV && p_skill.Level > 1); m_subHeadLine.SetVisible(flag4); if (flag4) { m_subHeadLine.UpdatePositionY(-num); if (p_type == TooltipType.CURRENT_EFFECT_NEXT) { m_subHeadLine.UpdateText(LocaManager.GetText("SKILL_NEXT_INCREASE")); } else { m_subHeadLine.UpdateText(LocaManager.GetText("SKILL_PREV_INCREASE")); } num += m_subHeadLine.Size.y + m_innerPadding; } Boolean flag5 = (p_type != TooltipType.CURRENT_EFFECT_PREV || p_skill.Level > 1) && (p_type != TooltipType.PARTY_CREATION || IsMagicSchoolSkill(p_skill)); m_effect.SetVisible(flag5); if (flag5) { m_effect.UpdatePositionY(-num); FillSkillEffect(p_skill, p_type); num += m_effect.Size.y + m_innerPadding; } Boolean flag6 = p_type == TooltipType.PARTY_CREATION && IsMagicSchoolSkill(p_skill); Int32 num2 = 0; for (Int32 i = 0; i < m_spellSlot.Length; i++) { m_spellSlot[i].SetVisible(false); m_spellName[i].SetVisible(false); } if (flag6) { foreach (SkillEffectStaticData skillEffectStaticData in p_skill.Tier1Effects) { if (skillEffectStaticData.Type == ESkillEffectType.LEARN_SPELL) { Int32 p_spellType = (Int32)skillEffectStaticData.Value; CharacterSpell characterSpell = SpellFactory.CreateCharacterSpell((ECharacterSpell)p_spellType); m_spellSlot[num2].SetVisible(true); m_spellSlot[num2].UpdatePosition(new Vector3(-m_name.Size.x / 2f, -num, 0f)); m_spellSlot[num2].SetItem(characterSpell.StaticData.Icon); m_spellName[num2].SetVisible(true); m_spellName[num2].VerticalAlign = TooltipGroup.Align.CENTER; m_spellName[num2].MinHeight = m_spellSlot[num2].Size.y; m_spellName[num2].UpdatePositionY(-num); m_spellName[num2].UpdateText(LocaManager.GetText(characterSpell.NameKey)); num += m_spellName[num2].Size.y + m_innerPadding; num2++; } } } m_background.Scale(m_name.Size.x + m_outerPadding * 2f, num - m_innerPadding + m_outerPadding); }
public static bool IsClickable(this TooltipType tooltipType) { return(tooltipType == TooltipType.DynamicClick || tooltipType == TooltipType.StaticClick); }
/// <summary> /// Добавить подсказку на слово в словарь /// </summary> public static void AddItem(int idContent, string title, string description, string url, TooltipType tooltipType) { if (!eDictionary.Contains(idContent, title)) { eDictionary.Add(idContent, title, description, url, tooltipType); } }
public static bool IsDynamic(this TooltipType tooltipType) { return(tooltipType == TooltipType.DynamicClick || tooltipType == TooltipType.DynamicEnter); }
public void SetTooltipLabel(bool label) { if(label) { ttType = TooltipType.Label; } else { ttType = TooltipType.Box; } }