Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    public void InitRequestList()
    {
        List <CorpsRequest> requestList = CorpsMgr.Instance.CorpsRequestList;

        this.totalrequest_txt.text    = string.Format(JsonMgr.GetSingleton().GetGlobalStringArrayByID(2009).desc, requestList.Count);
        this.reqeust_members_txt.text = string.Format(JsonMgr.GetSingleton().GetGlobalStringArrayByID(2010).desc, CorpsMgr.Instance.CorpsMemberList.Count,
                                                      CorpsMgr.Instance.GetCorpsMaxMemberByLevel());
        int needCreateNode = requestList.Count - uiRequestList.Count;

        if (needCreateNode > 0)
        {
            for (int idx = 0; idx < needCreateNode; ++idx)
            {
                GameObject           node     = GameObject.Instantiate(RequestNode.gameObject, this.requesters_obj.transform);
                CorpsRequestNodeView nodeView = node.GetComponent <CorpsRequestNodeView>();
                uiRequestList.Add(nodeView);
            }
        }
        for (int idx = 0; idx < uiRequestList.Count; ++idx)
        {
            CorpsRequestNodeView nodeView = uiRequestList[idx];
            if (idx < requestList.Count)
            {
                CorpsRequest info = requestList[idx];
                nodeView.SetInfo(info.RoleId, info.HeadId, info.Name, info.Level, info.FightPower, false);
                nodeView.gameObject.SetActive(true);
            }
            else
            {
                nodeView.gameObject.SetActive(false);
            }
        }
        RectTransform nodesRect = this.requesters_obj.GetComponent <RectTransform>();

        nodesRect.sizeDelta = new Vector2(nodesRect.sizeDelta.x, requestList.Count *
                                          (RequestNode.GetComponent <RectTransform>().sizeDelta.y + 10) + 20);
    }