12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using System.Collections;
- public class ChallengeRequestList : ListBase
- {
- public ChallengeRequestItem challengeRequestItemPrefab;
- protected override Transform CreateRandomItemForTestingInEditor(int index)
- {
- RequestInfo r = new RequestInfo();
- r.senderName = "Avatar "+index;
- r.data = "{ score : "+ Random.Range(100, 500) +" }";
- ChallengeRequestItem item = (ChallengeRequestItem)Instantiate(challengeRequestItemPrefab);
- item.SetData(r);
- return item.transform;
- }
- protected override bool HasItems()
- {
- return (FacebookHelper.Instance.lastReceivedRequests != null &&
- FacebookHelper.Instance.lastReceivedRequests.challengeRequests.Count > 0);
- }
- protected override void CreateItems()
- {
- int row = 0;
- foreach (RequestInfo data in FacebookHelper.Instance.lastReceivedRequests.challengeRequests)
- {
- ChallengeRequestItem item = (ChallengeRequestItem)Instantiate(challengeRequestItemPrefab);
- item.SetData(data);
- PlaceItem(item.transform, row);
- ++row;
- }
- }
- }
|