Exemplo n.º 1
0
    protected void OnLoginComplete(string message = "")
    {
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
        {
            //print ("is loggedIn--------------------------");
            if (canRequestMoreFriends())
            {
                //print ("canRequestMoreFriends--------------------------");
                fbGraph.GetPlayerInfo();
                fbGraph.GetFriends();
                fbGraph.GetInvitableFriends();

                FacebookPersistentData.GetInstance().infoRequested = true;
            }
            else
            {
                fbGraph.setActive();

                fillRequestPanel(FacebookPersistentData.GetInstance().gameFriends, FBFriendsRequestPanel.EFriendsType.GAME);
                fillRequestPanel(FacebookPersistentData.GetInstance().allFriends, FBFriendsRequestPanel.EFriendsType.ALL);
            }

            //print ("getFriendsAppRequests--------------------------");
            fbGraph.getFriendsAppRequests();
            if (conectFacebook != null)
            {
                DestroyImmediate(conectFacebook);
            }
        }
    }
Exemplo n.º 2
0
    public void sendKey(List <string> friendsIDs, string bossReached, List <string> requestID)
    {
        /*if (!canPublish())
         * {
         *      return;
         * }*/

        string myFBID = FacebookPersistentData.GetInstance().getPlayerId();

        print(bossReached);

        FB.AppRequest("Here, take this key!",      // A message for the user
                      OGActionType.SEND,           // Can be .Send or .AskFor depending on what you want to do with the object.
                      "795229890609809",           // Here we put the object id we got as a result before.
                      friendsIDs,                  // The id of the sender.
                                                   //null,20,
                      "SendKey," + bossReached,    // Here you can put in any data you want
                      "Send a key to your friend", // A title
                      delegate(IAppRequestResult result) {
            if (result.Error == null)
            {
                for (int i = 0; i < friendsIDs.Count; i++)
                {
                    ShopikaSyncManager.GetCastedInstance <ShopikaSyncManager>().registerInvite(myFBID, friendsIDs[i]);
                    deleteAppRequest(requestID[i]);
                }
            }
            Debug.Log(result.RawResult);
        }
                      );
    }
Exemplo n.º 3
0
 public bool canRequestMoreFriends()
 {
     if (FacebookPersistentData.GetInstance().infoRequested)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
 public Sprite getPicture()
 {
     picture = FacebookPersistentData.GetInstance().getSpritePictureById(fbId);
     if (picture == null)
     {
         StartCoroutine("findPicture");
     }
     return(picture);
 }
Exemplo n.º 5
0
 protected Texture getfriendTextureByID(string id)
 {
     if (!FacebookPersistentData.GetInstance().containTextureByID(id))
     {
         Texture friendTexture = FacebookPersistentData.GetInstance().getTextureFromURL(FacebookPersistentData.GetInstance().getFriendPictureUrl(FacebookPersistentData.GetInstance().getFriendInfo(id)));
         return(friendTexture);
     }
     return(FacebookPersistentData.GetInstance().facebookUsersImage [id]);
 }
Exemplo n.º 6
0
    protected void checkImageExist(EFriendsType friendsType)
    {
        switch (friendsType)
        {
        case EFriendsType.ALL:
            if (!allFriendsImageExist)
            {
                allFriendsImageExist = true;
                for (int i = 0; i < invitableFriends.friends.Count; i++)
                {
                    if (!invitableFriends.friends[i].imageSetted)
                    {
                        allFriendsImageExist = false;
                        Sprite image = FacebookPersistentData.GetInstance().getSpritePictureById(invitableFriends.friends [i].id);
                        if (image == null)
                        {
                            invitableFriends.friends [i].getTextureFromURL(GraphUtil.DeserializePictureURL(FacebookPersistentData.GetInstance().getFriendInfo(invitableFriends.friends [i].id)));
                        }
                        else
                        {
                            invitableFriends.friends [i].setFriendImage(image);
                            invitableFriends.friends [i].imageSetted = true;
                        }
                    }
                }
            }
            break;

        case EFriendsType.GAME:
            if (!allGamesFriendsImageExist)
            {
                allGamesFriendsImageExist = true;
                for (int i = 0; i < gameFriends.friends.Count; i++)
                {
                    if (!gameFriends.friends[i].imageSetted)
                    {
                        allGamesFriendsImageExist = false;
                        Sprite image = FacebookPersistentData.GetInstance().getSpritePictureById(gameFriends.friends [i].id);
                        if (image == null)
                        {
                            gameFriends.friends [i].getTextureFromURL(GraphUtil.DeserializePictureURL(FacebookPersistentData.GetInstance().getFriendInfo(gameFriends.friends [i].id)));
                        }
                        else
                        {
                            gameFriends.friends [i].setFriendImage(image);
                            gameFriends.friends [i].imageSetted = true;
                        }
                    }
                }
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 7
0
 public void getTextureFromURL(string url)
 {
     GraphUtil.LoadImgFromURL(url, delegate(Texture pictureTexture)
     {
         if (pictureTexture != null)
         {
             FacebookPersistentData.GetInstance().addFriendImage(id, pictureTexture);
             setFriendImage(pictureTexture);
             imageSetted = true;
         }
     });
 }
Exemplo n.º 8
0
    protected void addUsersImage(string id, Texture image, bool myPicture = false)
    {
        if (myPicture)
        {
            FacebookPersistentData.GetInstance().addFriendImage(id, image);
            return;
        }

        if (FacebookPersistentData.GetInstance().containTextureByID(id))
        {
            FacebookPersistentData.GetInstance().addFriendImage(id, image);
        }
    }
Exemplo n.º 9
0
    IEnumerator requestImage(PanelAppRequest pR, string id)
    {
        int requested = 0;

        FacebookPersistentData.GetInstance().getTextureFromURL(FacebookPersistentData.GetInstance().getFriendPictureUrl(FacebookPersistentData.GetInstance().getFriendInfo(id)), delegate(Texture pictureTexture)
        {
            if (pictureTexture != null)
            {
                FacebookPersistentData.GetInstance().addFriendImage(id, pictureTexture);
                pR.addFriendPicture(pictureTexture);
            }
            requested = 1;
        });

        yield return(new WaitUntil(() => requested == 1));
    }
Exemplo n.º 10
0
    IEnumerator findPicture()
    {
        yield return(new WaitForSeconds(requestAgainTime));

        picture = FacebookPersistentData.GetInstance().getSpritePictureById(fbId);

        if (picture == null && attempts > 0)
        {
            attempts--;
            StartCoroutine("findPicture");
        }
        else if (attempts > 0)
        {
            if (OnFound != null)
            {
                OnFound(picture);
            }
        }
    }
Exemplo n.º 11
0
    public void initializeFriendsController(List <object> friends, FriendsController friendController)
    {
        for (int i = 0; i < friends.Count && i < maxFriendsToShow; i++)
        {
            Dictionary <string, object> friendInfo = ((Dictionary <string, object>)(friends [i]));
            string playerID = (string)friendInfo ["id"];
            //print (friendInfo.Keys.ToCommaSeparateList ());
            string  playerName  = (string)friendInfo ["name"];
            Texture playerImage = new Texture();

            if (FacebookPersistentData.GetInstance().containTextureByID(playerID))
            {
                playerImage = FacebookPersistentData.GetInstance().getTextureById(playerID);
            }

            friendController.addFriend(playerID, playerName, playerImage);
        }
        friendController.initializeFriends();
    }
Exemplo n.º 12
0
 void Start()
 {
     facebook = FacebookPersistentData.GetInstance();
 }
Exemplo n.º 13
0
 protected void mergeFriends()
 {
     FacebookPersistentData.GetInstance().mergeFriends();
     fillRequestPanel(FacebookPersistentData.GetInstance().allFriends, FBFriendsRequestPanel.EFriendsType.ALL);
 }
Exemplo n.º 14
0
 protected void addInivitableFriends(List <object> invitableFriends)
 {
     FacebookPersistentData.GetInstance().addInvitableFriend(invitableFriends);
 }
Exemplo n.º 15
0
    protected void addGameFriends(List <object> gameFriends)
    {
        FacebookPersistentData.GetInstance().addGameFriend(gameFriends);

        fillRequestPanel(gameFriends, FBFriendsRequestPanel.EFriendsType.GAME);
    }
Exemplo n.º 16
0
 protected void showPlayerInfo(string id, string name)
 {
     FacebookPersistentData.GetInstance().setPlayerId(id);
 }