Ejemplo n.º 1
0
    public static CSUI_PopupHint CreatePopupHint(Vector3 pos, Transform parent, Vector3 offset, string text, bool bGreen = true)
    {
        if (m_Instance == null)
        {
            return(null);
        }
        if (m_Instance.m_PopupHintPrefab == null)
        {
            return(null);
        }

        CSUI_PopupHint ph = GameObject.Instantiate(m_Instance.m_PopupHintPrefab) as CSUI_PopupHint;

        ph.transform.parent        = parent;
        ph.transform.position      = pos;
        ph.transform.localScale    = Vector3.one;
        ph.transform.localPosition = new Vector3(ph.transform.localPosition.x + offset.x, ph.transform.localPosition.y + offset.y, offset.z);
        ph.m_Pos = ph.transform.position;

        ph.Text   = text;
        ph.bGreen = bGreen;

        ph.Tween();
        return(ph);
    }
Ejemplo n.º 2
0
    public void UpdatePopupHintInfo(CSEntity entiy)
    {
        if (entiy == null)
        {
            return;
        }


        int type = entiy.m_Type;

        if (type == CSConst.etEnhance)
        {
            //            CSEnhance cse = entiy as CSEnhance;
            if (null == m_enhanceItem)
            {
                return;
            }

            float curValue  = 0.0f;
            float nextValue = 0.0f;

            if (!m_PopupHints.ContainsKey(type))
            {
                m_PopupHints.Add(type, new List <CSUI_PopupHint>());
            }

            foreach (CSUI_PopupHint ph in m_PopupHints[type])
            {
                if (ph != null && ph.gameObject != null)
                {
                    Destroy(ph.gameObject);
                }
            }

            m_PopupHints[type].Clear();

            Vector3 pos = m_EnhanceProperty.m_Durability.transform.position;
            //item.GetLevelUpValue(ItemProperty.DurabilityMax, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurMaxDurability();
            nextValue = m_enhanceItem.GetNextMaxDurability();
            string         str   = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            CSUI_PopupHint phTmp = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);

            pos = m_EnhanceProperty.m_Atk.transform.position;
            //item.GetLevelUpValue(ItemProperty.Atk, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Atk);
            nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Atk);
            str       = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            phTmp     = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);

            pos = m_EnhanceProperty.m_Defense.transform.position;
            //item.GetLevelUpValue(ItemProperty.Def, out curValue, out nextValue);
            curValue  = m_enhanceItem.GetCurLevelProperty(Pathea.AttribType.Def);
            nextValue = m_enhanceItem.GetNextLevelProperty(Pathea.AttribType.Def);
            str       = " + " + Mathf.FloorToInt(nextValue - curValue).ToString();
            phTmp     = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_EnhanceHintGo.transform, new Vector3(10, -2, -6), str, true);
            m_PopupHints[type].Add(phTmp);
        }
        else if (type == CSConst.etRepair)
        {
            CSRepair repair = entiy as CSRepair;

            if (!m_PopupHints.ContainsKey(type))
            {
                m_PopupHints.Add(type, new List <CSUI_PopupHint>());
            }

            foreach (CSUI_PopupHint ph in m_PopupHints[type])
            {
                if (ph != null && ph.gameObject != null)
                {
                    Destroy(ph.gameObject);
                }
            }

            m_PopupHints[type].Clear();

            Vector3        pos   = m_EnhanceProperty.m_Durability.transform.position;
            float          val   = repair.GetIncreasingDura();
            string         str   = " + " + Mathf.FloorToInt(val).ToString();
            CSUI_PopupHint phTmp = CSUI_MainWndCtrl.CreatePopupHint(pos, m_PopupHintsPart.m_RepairHintGo.transform, new Vector3(10, -2, 0), str, true);
            m_PopupHints[type].Add(phTmp);
        }
        else if (type == CSConst.etRecyle)
        {
        }
    }