// 复制物件 public virtual ILoudspeakerItem Clone() { GameObject newObj = ResNode.InstantiateRes(m_obj.gameObject); LoudspeakerItemText newItem = newObj.GetComponent <LoudspeakerItemText>(); newItem.SetItemData(m_itemData); return(newItem); }
public override bool Init(LoudspeakerItemText obj, Text uiText, LoudspeakerManager.SLoudspeakerObjectInfo data) { base.Init(obj, uiText, data); if (m_itemData.param == null || !m_itemData.param.ContainsKey("id")) { return(false); } m_nPrizeID = Convert.ToInt32(m_itemData.param["id"]); SSchemeActorPrizeConfig prizeConfig = ActorPrizeConfig.Instance.GetActorPrizeConfig(m_nPrizeID); if (prizeConfig != null) { m_defaultColor = Color.white; if (prizeConfig.nPrizeGrade == 1) { m_defaultColor = Color.green; } else if (prizeConfig.nPrizeGrade == 2) { m_defaultColor = Color.blue; } else if (prizeConfig.nPrizeGrade == 3) { m_defaultColor = new Color(0.5f, 0f, 0.5f); } else if (prizeConfig.nPrizeGrade == 4) { m_defaultColor = Color.yellow; } else if (prizeConfig.nPrizeGrade == 5) { m_defaultColor = Color.red; } else if (prizeConfig.nPrizeGrade == 6) { m_defaultColor = new Color(1f, 0.647f, 0f); } m_UIText.color = m_defaultColor; m_UIText.text = "[" + prizeConfig.strPrizeName + "]"; } return(true); }
public virtual bool Init(LoudspeakerItemText obj, Text uiText, LoudspeakerManager.SLoudspeakerObjectInfo data) { m_obj = obj; m_UIText = uiText; m_itemData = data; if (data.param != null && data.param.ContainsKey("color")) { string colorParam = data.param["color"]; int r, g, b; LogicDataCenter.chatMessageManager.ParseColorParam(colorParam, out r, out g, out b); float factor = 1.0f / 255.0f; m_defaultColor = new Color(r * factor, g * factor, b * factor); } m_UIText.text = data.text; m_UIText.color = m_defaultColor; return(true); }
public override bool Init(LoudspeakerItemText obj, Text uiText, LoudspeakerManager.SLoudspeakerObjectInfo data) { base.Init(obj, uiText, data); m_UIText.raycastTarget = false; return(true); }