예제 #1
0
    void OnLoadTeamItem(GameObject resItem, object param)
    {
        if (resItem == null)
        {
            return;
        }
//         foreach (TeamPlatformItem item in ItemParent.GetComponentsInChildren<TeamPlatformItem>())
//         {
//             Destroy(item);
//         }
        Utils.CleanGrid(ItemParent);
        foreach (KeyValuePair <Int32, List <TeamPlatformplayerInfo> > item in TeamMap)
        {
            int        nCount  = 0;
            GameObject newItem = Utils.BindObjToParent(resItem, ItemParent);
            if (null == newItem)
            {
                continue;
            }

            TeamPlatformItem newTeamPlatformItem = newItem.GetComponent <TeamPlatformItem>();
            if (null == newTeamPlatformItem)
            {
                continue;
            }

            for (int i = 0; i < 4; i++)
            {
                newTeamPlatformItem.m_playerLevel[i].text  = "";
                newTeamPlatformItem.m_playerProf[i].text   = "";
                newTeamPlatformItem.m_playerCombat[i].text = "";
            }
            foreach (TeamPlatformplayerInfo platformInfo in item.Value)
            {
                if (nCount >= 4)
                {
                    break;
                }

                //newTeamPlatformItem.m_playerLevel[nCount].text = platformInfo.playerLevel.ToString() + "级";
                newTeamPlatformItem.m_playerLevel[nCount].text = StrDictionary.GetClientDictionaryString("#{2811}", platformInfo.playerLevel);
                newTeamPlatformItem.m_playerProf[nCount].text  = Utils.GetProfessionNameByType(platformInfo.playerProf); //StrDictionary.GetClientDictionaryString("#{" + CharacterDefine.PROFESSION_DICNUM[platformInfo.playerProf].ToString() + "}");
                //newTeamPlatformItem.m_playerCombat[nCount].text = platformInfo.playerCombat.ToString() + "战力";
                newTeamPlatformItem.m_playerCombat[nCount].text = StrDictionary.GetClientDictionaryString("#{2812}", platformInfo.playerCombat);
                nCount++;
            }
            newTeamPlatformItem.m_playerName.text       = item.Value[0].playerName;
            newTeamPlatformItem.m_playerHead.spriteName = "";
            if (null != GlobeVar.m_HeadIcon[item.Value[0].playerProf])
            {
                newTeamPlatformItem.m_playerHead.spriteName = GlobeVar.m_HeadIcon[item.Value[0].playerProf];
                newTeamPlatformItem.m_playerHead.MakePixelPerfect();
            }
            newTeamPlatformItem.UpdateData(item.Value[0].playerGuid, item.Key, item.Value[0].playerProf);
        }
        ItemParent.GetComponent <UIGrid>().repositionNow = true;
    }
예제 #2
0
    void OnLoadPlayerItem(GameObject resItem, object param)
    {
        if (resItem == null)
        {
            return;
        }
        Utils.CleanGrid(ItemParent);
//         foreach (TeamPlatformItem item in ItemParent.GetComponentsInChildren<TeamPlatformItem>())
//         {
//             Destroy(item);
//         }
        for (int i = playerList.Count - 1; i >= 0; i--)
        {
            GameObject newItem = Utils.BindObjToParent(resItem, ItemParent);
            if (null == newItem)
            {
                continue;
            }

            TeamPlatformItem newTeamPlatformItem = newItem.GetComponent <TeamPlatformItem>();
            if (null == newTeamPlatformItem)
            {
                continue;
            }

            for (int j = 0; j < 4; j++)
            {
                newTeamPlatformItem.m_playerLevel[j].text  = "";
                newTeamPlatformItem.m_playerProf[j].text   = "";
                newTeamPlatformItem.m_playerCombat[j].text = "";
            }
            newTeamPlatformItem.m_playerName.text = playerList[i].playerName;
            //newTeamPlatformItem.m_playerLevel[0].text = playerList[i].playerLevel.ToString() + "级";
            newTeamPlatformItem.m_playerLevel[0].text = StrDictionary.GetClientDictionaryString("#{2811}", playerList[i].playerLevel);
            newTeamPlatformItem.m_playerProf[0].text  = Utils.GetProfessionNameByType(playerList[i].playerProf); //StrDictionary.GetClientDictionaryString("#{" + CharacterDefine.PROFESSION_DICNUM[playerList[i].playerProf].ToString() + "}");
            //newTeamPlatformItem.m_playerCombat[0].text = playerList[i].playerCombat.ToString() + "战力";
            newTeamPlatformItem.m_playerCombat[0].text  = StrDictionary.GetClientDictionaryString("#{2812}", playerList[i].playerCombat);
            newTeamPlatformItem.m_playerHead.spriteName = "";
            newTeamPlatformItem.UpdateData(playerList[i].playerGuid, -1, playerList[i].playerProf);

            if (null != GlobeVar.m_HeadIcon[playerList[i].playerProf])
            {
                newTeamPlatformItem.m_playerHead.spriteName = GlobeVar.m_HeadIcon[playerList[i].playerProf];
                newTeamPlatformItem.m_playerHead.MakePixelPerfect();
            }
        }
        ItemParent.GetComponent <UIGrid>().repositionNow = true;
    }