Example #1
0
 private void OnGetHarvestPlayerListResponseAction(HarvestPlayerInfo[] infos)
 {
     for (int i = 0; i < infos.Length; i++)
     {
         if (playerInfoDictionary.ContainsKey(infos[i].facebookID))
         {
             playerInfoDictionary[infos[i].facebookID] = new HarvestPlayerInfo
             {
                 facebookID            = infos[i].facebookID,
                 photo                 = playerInfoDictionary[infos[i].facebookID].photo,
                 name                  = playerInfoDictionary[infos[i].facebookID].name,
                 level                 = infos[i].level,
                 harvestableCakeNumber = infos[i].harvestableCakeNumber
             };
         }
         else
         {
             long fbID = infos[i].facebookID;
             playerInfoDictionary.Add(fbID, infos[i]);
             facebookAction.GetUserName(fbID, (result) =>
             {
                 if (result != null)
                 {
                     HarvestPlayerInfo info = playerInfoDictionary[fbID];
                     if (result.ResultDictionary.ContainsKey("name"))
                     {
                         playerInfoDictionary[fbID] = new HarvestPlayerInfo
                         {
                             facebookID            = fbID,
                             photo                 = info.photo,
                             name                  = (string)result.ResultDictionary["name"],
                             level                 = info.level,
                             harvestableCakeNumber = info.harvestableCakeNumber
                         };
                         harvestModePanelUI.UpdateHarvestPlayerList(playerInfoDictionary.Values.ToList());
                     }
                 }
             });
             facebookAction.GetUserPhoto(fbID, (result) =>
             {
                 if (string.IsNullOrEmpty(result.Error) && result.Texture != null)
                 {
                     HarvestPlayerInfo info = playerInfoDictionary[fbID];
                     if (result.Texture != null)
                     {
                         playerInfoDictionary[fbID] = new HarvestPlayerInfo
                         {
                             facebookID            = fbID,
                             photo                 = result.Texture,
                             name                  = info.name,
                             level                 = info.level,
                             harvestableCakeNumber = info.harvestableCakeNumber
                         };
                         harvestModePanelUI.UpdateHarvestPlayerList(playerInfoDictionary.Values.ToList());
                     }
                 }
             });
         }
     }
     harvestModePanelUI.UpdateHarvestPlayerList(playerInfoDictionary.Values.ToList());
 }