Ejemplo n.º 1
0
    public void InitMemberList()
    {
        List <CorpsMember> memberList = CorpsMgr.Instance.CorpsMemberList;
        int needCreateNode            = memberList.Count - uiMemberList.Count;

        if (needCreateNode > 0)
        {
            for (int idx = 0; idx < needCreateNode; ++idx)
            {
                GameObject          node     = GameObject.Instantiate(MemberNode.gameObject, this.memberlist_obj.transform);
                CorpsMemberNodeView nodeView = node.GetComponent <CorpsMemberNodeView>();
                uiMemberList.Add(nodeView);
            }
        }
        for (int idx = 0; idx < uiMemberList.Count; ++idx)
        {
            CorpsMemberNodeView nodeView = uiMemberList[idx];
            if (idx < memberList.Count)
            {
                CorpsMember info = memberList[idx];
                nodeView.SetInfo(info.RoleId, info.HeadId, info.Name, info.Level, info.Job, info.Vigour, info.Donate, info.LastOL,
                                 info.RoleId == Role.Instance.RoleId);
                nodeView.gameObject.SetActive(true);
            }
            else
            {
                nodeView.gameObject.SetActive(false);
            }
        }
        RectTransform nodesRect = this.memberlist_obj.GetComponent <RectTransform>();

        nodesRect.sizeDelta = new Vector2(nodesRect.sizeDelta.x, memberList.Count * (MemberNode.GetComponent <RectTransform>().sizeDelta.y + 10) + 20);
    }
Ejemplo n.º 2
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);
        }
    }
Ejemplo n.º 3
0
    private int sortByType(CorpsSortType type, CorpsMember a, CorpsMember b)
    {
        switch (type)
        {
        case CorpsSortType.Level:
            return(a.Level < b.Level ? (isDescend ? 1 : -1) : ((a.Level > b.Level) ? (isDescend ? -1 : 1) : 0));

        case CorpsSortType.Job:
            return(a.Job < b.Job ? (isDescend ? 1 : -1) : ((a.Job > b.Job) ? (isDescend ? -1 : 1) : 0));

        case CorpsSortType.Vigour:
            return(a.Vigour < b.Vigour ? (isDescend ? 1 : -1) : ((a.Vigour > b.Vigour) ? (isDescend ? -1 : 1) : 0));

        case CorpsSortType.Donate:
            return(a.Donate < b.Donate ? (isDescend ? 1 : -1) : ((a.Donate > b.Donate) ? (isDescend ? -1 : 1) : 0));

        case CorpsSortType.LastOl:
            return(lastOl2SortType(a.LastOL) < lastOl2SortType(b.LastOL) ? (isDescend ? 1 : -1) :
                   ((lastOl2SortType(a.LastOL) > lastOl2SortType(b.LastOL)) ? (isDescend ? -1 : 1) : 0));

        default:
            return(0);
        }
    }