Example #1
0
    void OnEnable()
    {
        if (false == GameManager.gameManager.PlayerDataPool.IsHaveGuild())
        {
            return;
        }

        Guild info = GameManager.gameManager.PlayerDataPool.GuildInfo;

        Utils.CleanGrid(m_GuildHistoryTable);

        // 记录上一次的item 当有同一天的日志时不创建item 而是在上一个item中加一条记录
        GuildHistoryItemLogic itemBuffer = null;

        for (int i = info.GuildHistoryInfo.Count - 1; i >= 0; i--)
        {
            GuildHistory history = info.GuildHistoryInfo[i];
            if (false == history.IsValid())
            {
                break;
            }

            if (itemBuffer == null || false == itemBuffer.IsSameDate(history))
            {
                // 第一个item或和上一个item不在同一天 创建 同时更新buffer
                string     szItemName  = i < 10 ? "0" + i.ToString() : i.ToString();
                GameObject historyItem = Utils.BindObjToParent(m_GuildHistoryItem, m_GuildHistoryTable, szItemName);
                if (historyItem == null || historyItem.GetComponent <GuildHistoryItemLogic>() == null)
                {
                    break;
                }

                historyItem.GetComponent <GuildHistoryItemLogic>().Init(history);

                itemBuffer = historyItem.GetComponent <GuildHistoryItemLogic>();
            }
            else
            {
                // 在同一天 加记录 不创建新的
                itemBuffer.AddRecord(history);
            }
        }

        if (m_GuildHistoryTable.GetComponent <UITable>() != null)
        {
            m_GuildHistoryTable.GetComponent <UITable>().Reposition();
        }
    }
Example #2
0
    public void UpdateData(GC_GUILD_RET_INFO info)
    {
        //清空之前的数据
        CleanUp();

        //判断消息包数据合法性
        if (null == info || info.GuildGuid == GlobeVar.INVALID_GUID)
        {
            return;
        }

        //填充数据
        GuildGuid = info.GuildGuid;
        if (GuildGuid != GlobeVar.INVALID_GUID)
        {
            PreserveGuildGuid.Clear();
        }
        GuildLevel       = info.GuildLevel;
        GuildName        = info.GuildName;
        GuildChiefGuid   = info.GuildChiefGuid;
        GuildExp         = info.GuildExp;
        GuildNotice      = info.GuildNotice;
        GuildDeclaration = info.GuildDeclaration;
        NeedReserve      = info.NeedReserve == 1;
        LastWeekContri   = info.LastWeekContri;

        if (info.HasPscanacpttimes)
        {
            PSCanAcceptTimes = info.Pscanacpttimes;
        }

        for (int i = 0; i < info.memberGuidCount; ++i)
        {
            GuildMember member = new GuildMember();
            //member.CleanUp();

            member.Guid = info.GetMemberGuid(i);

            if (info.memberNameCount > i)
            {
                member.MemberName = info.GetMemberName(i);
            }
            if (info.memberVIPCount > i)
            {
                member.VIP = info.GetMemberVIP(i);
            }
            if (info.memberLevelCount > i)
            {
                member.Level = info.GetMemberLevel(i);
            }
            if (info.memberJobCount > i)
            {
                member.Job = info.GetMemberJob(i);
            }
            if (info.memberLastLogoutCount > i)
            {
                member.LastLogout = info.GetMemberLastLogout(i);
            }
            if (info.memberProfCount > i)
            {
                member.Profession = info.GetMemberProf(i);
            }
            if (info.memberStateCount > i)
            {
                member.State = info.GetMemberState(i);
            }
            if (info.memberContirbuteCount > i)
            {
                member.Contribute = info.GetMemberContirbute(i);
            }
            if (info.combatvalCount > i)
            {
                member.ComBatVal = info.GetCombatval(i);
            }
            if (member.IsValid())
            {
                GuildMemberList.Add(member.Guid, member);
            }
        }

        for (int i = 0; i < info.ViceChiefRoutineCount && i < ViceChiefRoutine.Length; i++)
        {
            ViceChiefRoutine[i] = info.ViceChiefRoutineList[i] == 1;
        }

        for (int i = 0; i < info.ElderRoutineCount && i < ElderRoutine.Length; i++)
        {
            ElderRoutine[i] = info.ElderRoutineList[i] == 1;
        }

        for (int i = 0; i < info.GuildJobNameCount && i < GuildJobName.Length; i++)
        {
            GuildJobName[i] = info.GuildJobNameList[i];
        }

        int nTextIndex = 0;

        for (int i = 0; i < info.GuildHistoryTypeCount; i++)
        {
            GuildHistory history = new GuildHistory();

            if (info.GuildHistoryTypeCount > i)
            {
                history.HistoryType = info.GuildHistoryTypeList[i];
            }
            if (info.GuildHistoryTimeCount > i)
            {
                history.HistoryTime = info.GuildHistoryTimeList[i];
            }

            for (int j = 0; j < GuildHistory.GetTypeTextCount(history.HistoryType) && j < history.HistoryText.Length; j++)
            {
                history.HistoryText[j] = info.GuildHistoryTextList[nTextIndex];
                nTextIndex            += 1;
            }

            if (history.IsValid())
            {
                GuildHistoryInfo.Add(history);
            }
        }

        for (int i = 0; i < info.SceneNpcIdCount; i++)
        {
            GuildHideAndSeekNpc npcInfo = new GuildHideAndSeekNpc();

            if (info.SceneNpcIdCount > i)
            {
                npcInfo.SceneNpcId = info.SceneNpcIdList[i];
            }
            if (info.SceneNpcFindCount > i)
            {
                npcInfo.IsFound = info.SceneNpcFindList[i] == 1;
            }

            if (npcInfo.IsValid())
            {
                HideAndSeekNpcInfo.Add(npcInfo);
            }
        }

        if (info.HasHideAndSeekWeek)
        {
            m_HideAndSeekWeek = info.HideAndSeekWeek == 1;
        }

        //按照VIP等级排序
        //SortMemberListByVIP(m_GuildMemberList);
        //按照等级排序
        //SortMemberListByLevel(m_GuildMemberList);
        //按照在线状态进行排序
        //SortMemberListByOnLine(m_GuildMemberList);
        //按照职位排序
        //SortMemberListByJob(m_GuildMemberList);

        // 帮主永远第一位,玩家自己第二位,然后按照官职排,最后按照等级排列
        SortByNewRule();

        if (ChatInfoLogic.Instance() != null)
        {
            ChatInfoLogic.Instance().UpdateGuildChannel();
            ChatInfoLogic.Instance().UpdateSpeakerList_Guild();
        }
    }