Esempio n. 1
0
    public override CByteStream DeSerialize(CByteStream bs)
    {
        this.characters.Clear();
        int num = 0;

        bs.Read(ref num);
        for (int i = 0; i < num; i++)
        {
            CharacterInfo info = new CharacterInfo();
            bs.Read(info);
            characters.Add(info);
        }
        return(bs);
    }
 private void ShowRoles()
 {
     if (base.Prepared)
     {
         int i     = 0;
         int index = 0;
         while (i < m_lCharacterList.Count)
         {
             CharacterInfo characterInfo = m_lCharacterList[i];
             int           roleId        = characterInfo.PlayerIndex;
             Debug.Log(roleId);
             IXUIListItem item;
             if (index < base.uiBehaviour.m_List_RoleList.Count)
             {
                 item = base.uiBehaviour.m_List_RoleList.GetItemByIndex(index);
             }
             else
             {
                 item = base.uiBehaviour.m_List_RoleList.AddListItem();
             }
             if (item != null)
             {
                 DataPlayerList dataRoleList = GameData <DataPlayerList> .dataMap[roleId];
                 if (dataRoleList != null)
                 {
                     IXUILabel nameLabel = item.GetUIObject("name/nameLabel") as IXUILabel;
                     if (nameLabel != null)
                     {
                         Debug.Log(characterInfo.Name);
                         nameLabel.SetText("Lv." + characterInfo.Level + "  " + characterInfo.Name + "\n" + dataRoleList.Name);
                     }
                     else
                     {
                         Debug.Log("Label == null");
                     }
                     IXUISprite icon = item.GetUIObject("Icon") as IXUISprite;
                     if (icon != null)
                     {
                         icon.SetSprite(dataRoleList.IconFile);
                     }
                     else
                     {
                         Debug.Log("Icon == null");
                     }
                     item.SetVisible(true);
                     item.Id = characterInfo.PlayerId;
                 }
                 else
                 {
                     item.SetVisible(false);
                 }
                 index++;
             }
             else
             {
                 Debug.Log("Item == null");
             }
             i++;
         }
     }
 }