Exemplo n.º 1
0
    void OnLoadMasterPreviewItem(GameObject resItem, object param)
    {
        if (null == resItem)
        {
            LogModule.ErrorLog("load master List item fail");
            return;
        }

        Utils.CleanGrid(m_MasterPreviewGrid);

        //填充数据
        int nMasterPreviewItemIndex             = 0;
        List <MasterPreviewInfo> masterInfoList = GameManager.gameManager.PlayerDataPool.MasterPreList.MasterInfoList;

        for (int i = 0; i < masterInfoList.Count; i++)
        {
            MasterPreviewInfo info = masterInfoList[i];
            if (info.MasterGuid != GlobeVar.INVALID_GUID)
            {
                GameObject newMasterPreviewItem = Utils.BindObjToParent(resItem, m_MasterPreviewGrid, nMasterPreviewItemIndex.ToString());
                if (null != newMasterPreviewItem &&
                    null != newMasterPreviewItem.GetComponent <MasterPreviewItemLogic>())
                {
                    newMasterPreviewItem.GetComponent <MasterPreviewItemLogic>().Init(info, nMasterPreviewItemIndex + 1);
                }
                nMasterPreviewItemIndex++;
            }
        }

        //Grid排序,防止列表异常
        m_MasterPreviewGrid.GetComponent <UIGrid>().Reposition();
        m_MasterPreviewGrid.GetComponent <UITopGrid>().Recenter(true);
    }
Exemplo n.º 2
0
    public void UpdateData(GC_MASTER_RET_LIST list)
    {
        m_MasterInfoList.Clear();

        SortedDictionary <int, MasterPreviewInfo> tempList = new SortedDictionary <int, MasterPreviewInfo> (new MySort());

        // 按照师门薪火排序
        for (int i = 0; i < list.masterGuidCount; ++i)
        {
            MasterPreviewInfo info = new MasterPreviewInfo();
            info.MasterGuid = list.GetMasterGuid(i);
            if (info.MasterGuid == GlobeVar.INVALID_GUID)
            {
                continue;
            }

            if (list.masterNameCount > i)
            {
                info.MasterName = list.GetMasterName(i);
            }

            if (list.masterTorchCount > i)
            {
                info.MasterTorch = list.GetMasterTorch(i);
            }

            if (list.masterChiefNameCount > i)
            {
                info.MasterChiefName = list.GetMasterChiefName(i);
            }

            if (list.memberNumCount > i)
            {
                info.MasterCurMemberNum = list.GetMemberNum(i);
            }

            if (list.createTimeCount > i)
            {
                info.MasterCreateTime = list.GetCreateTime(i);
            }

            if (list.skillID1Count > i)
            {
                info.MasterSkillId1 = list.GetSkillID1(i);
            }
            if (list.skillID2Count > i)
            {
                info.MasterSkillId2 = list.GetSkillID2(i);
            }
            if (list.skillID3Count > i)
            {
                info.MasterSkillId3 = list.GetSkillID3(i);
            }
            if (list.skillID4Count > i)
            {
                info.MasterSkillId4 = list.GetSkillID4(i);
            }

            //合法则添加
            //int repeatedTorchCount = 1;
            if (info.IsValid())
            {
                if (tempList.ContainsKey(-info.MasterTorch))
                {
                    continue;
                }
                else
                {
                    doAddTorchToSortedList(-info.MasterTorch, info, tempList);
                }
            }
        }

        foreach (var item in tempList)
        {
            m_MasterInfoList.Add(item.Value);
        }
    }
Exemplo n.º 3
0
 void doAddTorchToSortedList(int key, MasterPreviewInfo value, SortedDictionary <int, MasterPreviewInfo> list)
 {
     list.Add(key, value);
 }
    private UInt64 m_MasterGuid;           //师门GUID

    //根据数据初始化控件
    public void Init(MasterPreviewInfo info, int nIndex)
    {
        //判断数据合法性
        if (info.MasterGuid == GlobeVar.INVALID_GUID)
        {
            return;
        }

        m_MasterGuid = info.MasterGuid;

        //填充数据
        if (null != m_MasterIndexLable)
        {
            m_MasterIndexLable.text = nIndex.ToString();
        }
        if (null != m_MasterNameLabel)
        {
            m_MasterNameLabel.text = info.MasterName;
        }
        if (null != m_MasterChiefNameLabel)
        {
            m_MasterChiefNameLabel.text = info.MasterChiefName;
        }
        if (null != m_MasterTorchLabel)
        {
            m_MasterTorchLabel.text = info.MasterTorch.ToString();
        }
        if (null != m_MasterMemberNumLabel)
        {
            m_MasterMemberNumLabel.text = info.MasterCurMemberNum.ToString();
        }
        int SkillIndex = 0;

        if (info.MasterSkillId1 >= 0)
        {
            Tab_SkillEx lineSkillEx = TableManager.GetSkillExByID(info.MasterSkillId1, 0);
            if (lineSkillEx != null)
            {
                Tab_SkillBase lineSkillBase = TableManager.GetSkillBaseByID(lineSkillEx.BaseId, 0);
                if (lineSkillBase != null &&
                    SkillIndex >= 0 &&
                    SkillIndex < m_MasterSkillSprite.Length &&
                    null != m_MasterSkillSprite[SkillIndex])
                {
                    m_MasterSkillSprite[SkillIndex].gameObject.SetActive(true);
                    m_MasterSkillSprite[SkillIndex].spriteName = lineSkillBase.Icon;
                    SkillIndex = SkillIndex + 1;
                }
            }
        }
        if (info.MasterSkillId2 >= 0)
        {
            Tab_SkillEx lineSkillEx = TableManager.GetSkillExByID(info.MasterSkillId2, 0);
            if (lineSkillEx != null)
            {
                Tab_SkillBase lineSkillBase = TableManager.GetSkillBaseByID(lineSkillEx.BaseId, 0);
                if (lineSkillBase != null &&
                    SkillIndex >= 0 &&
                    SkillIndex < m_MasterSkillSprite.Length &&
                    null != m_MasterSkillSprite[SkillIndex])
                {
                    m_MasterSkillSprite[SkillIndex].gameObject.SetActive(true);
                    m_MasterSkillSprite[SkillIndex].spriteName = lineSkillBase.Icon;
                    SkillIndex = SkillIndex + 1;
                }
            }
        }
        if (info.MasterSkillId3 >= 0)
        {
            Tab_SkillEx lineSkillEx = TableManager.GetSkillExByID(info.MasterSkillId3, 0);
            if (lineSkillEx != null)
            {
                Tab_SkillBase lineSkillBase = TableManager.GetSkillBaseByID(lineSkillEx.BaseId, 0);
                if (lineSkillBase != null &&
                    SkillIndex >= 0 &&
                    SkillIndex < m_MasterSkillSprite.Length &&
                    null != m_MasterSkillSprite[SkillIndex])
                {
                    m_MasterSkillSprite[SkillIndex].gameObject.SetActive(true);
                    m_MasterSkillSprite[SkillIndex].spriteName = lineSkillBase.Icon;
                    SkillIndex = SkillIndex + 1;
                }
            }
        }
        for (; SkillIndex < 4; SkillIndex++)
        {
            if (SkillIndex >= 0 &&
                SkillIndex < m_MasterSkillSprite.Length &&
                null != m_MasterSkillSprite[SkillIndex])
            {
                m_MasterSkillSprite[SkillIndex].gameObject.SetActive(false);
            }
        }
    }