public void Init(Tab_GuildRule tabRule) { m_TitleLabel.text = StrDictionary.GetClientDictionaryString("#{10378}", tabRule.Id); m_ContentLabel.text = tabRule.RuleContent; m_Background.height = (int)(m_TitleLabel.printedSize.y + m_ContentLabel.printedSize.y + 30); // 最后加的30是微调 m_SelfBox.size = new Vector3(m_Background.width, m_Background.height, 0); m_SelfBox.center = new Vector3(m_Background.width / 2, -m_Background.height / 2, 0); }
public void Show(GUILDRULE_TYPE type) { gameObject.SetActive(true); if (type == GUILDRULE_TYPE.TYPE_GUILD) { m_TitleLabel.text = StrDictionary.GetClientDictionaryString("#{10461}"); } else if (type == GUILDRULE_TYPE.TYPE_REWARD) { m_TitleLabel.text = StrDictionary.GetClientDictionaryString("#{10508}"); } Utils.CleanGrid(m_GuildRuleItemTable); int index = 0; foreach (KeyValuePair<int, List<Tab_GuildRule>> pair in TableManager.GetGuildRule()) { Tab_GuildRule tabRule = pair.Value[0]; if (tabRule == null) { continue; } if (tabRule.RuleType != (int)type) { continue; } string szItemName = index < 10 ? "0" + index.ToString() : index.ToString(); GameObject RuleItem = Utils.BindObjToParent(m_GuildRuleItem, m_GuildRuleItemTable, szItemName); if (RuleItem == null || RuleItem.GetComponent<GuildRuleItemLogic>() == null) { continue; } RuleItem.GetComponent<GuildRuleItemLogic>().Init(tabRule); } if (m_GuildRuleItemTable.GetComponent<UITable>() != null) { m_GuildRuleItemTable.GetComponent<UITable>().Reposition(); } }