public void InitCorpsList() { List <CorpsInfo> corpList = CorpsMgr.Instance.CorpsList; int needCreateNode = corpList.Count - _joinNodeBuffer.Count; if (needCreateNode > 0) { for (int idx = 0; idx < needCreateNode; ++idx) { GameObject node = GameObject.Instantiate(JoinNode.gameObject, this.corpsnodes_obj.transform); CorpsNodeView nodeView = node.GetComponent <CorpsNodeView>(); _joinNodeBuffer.Add(nodeView); } } for (int idx = 0; idx < _joinNodeBuffer.Count; ++idx) { CorpsNodeView nodeView = _joinNodeBuffer[idx]; if (idx < corpList.Count) { CorpsInfo info = corpList[idx]; nodeView.SetInfo(info.UID, info.flag, info.camp, info.name, info.level, info.members, info.leader, info.limit, info.state); nodeView.gameObject.SetActive(true); } else { nodeView.gameObject.SetActive(false); } } RectTransform nodesRect = this.corpsnodes_obj.GetComponent <RectTransform>(); nodesRect.sizeDelta = new Vector2(nodesRect.sizeDelta.x, corpList.Count * JoinNode.GetComponent <RectTransform>().sizeDelta.y); }
public CorpsMgr() { for (int idx = 0; idx < 10; ++idx) { CorpsMember member = new CorpsMember(); member.RoleId = (uint)idx; member.Name = string.Format("董大喵{0}", idx); member.Level = idx * 10; member.Job = idx / 4; member.HeadId = 1; member.Vigour = 1000 + idx; member.Donate = 9999 - idx; member.LastOL = 0; CorpsMemberList.Add(member); } for (int idx = 0; idx < 5; ++idx) { CorpsRequest request = new CorpsRequest(); request.RoleId = (uint)idx; request.Name = string.Format("董大喵{0}", idx); request.Level = 10 + idx; request.HeadId = 1; request.FightPower = 10000 + idx; CorpsRequestList.Add(request); } for (int idx = 0; idx < 5; ++idx) { CorpsLogNode log = new CorpsLogNode(); log.date = idx + 1; log.log = new string[idx + 1]; for (int idx2 = 0; idx2 < log.log.Length; ++idx2) { log.log[idx2] = string.Format("日志日志日志日志{0}", idx2); } CorpsLogs.Add(log); } for (int idx = 0; idx < 10; ++idx) { CorpsInfo info = new CorpsInfo(); info.UID = (uint)idx; info.name = string.Format("军团名称{0}", idx); info.level = idx; info.flag = 20051 + idx; info.camp = idx % 3; info.leader = string.Format("董大喵{0}", idx); info.limit = 0; info.members = 40 + idx; info.state = 0; CorpsList.Add(info); } }