GetInstance() public static method

public static GetInstance ( ) : Texture,
return Texture,
    //public static string fbAccessToken = "";

    public void OnSuccess(object response)
    {
        if (response is Game)
        {
            Game gameObj = (Game)response;
            Debug.Log("Game ::: " + gameObj.ToString());
            if (gameObj.GetScoreList().Count > 0)
            {
                for (int i = 0; i < gameObj.GetScoreList().Count; i++)
                {
                    string name       = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();
                    string score      = gameObj.GetScoreList()[i].GetValue().ToString();
                    string profilePic = gameObj.GetScoreList()[i].GetFacebookProfile().GetPicture();
                    string userId     = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();

                    Texture.GetInstance().ExecuteShow(userId, profilePic);

                    IList <string> slist1 = new List <string>();
                    slist1.Add(userId);
                    slist1.Add(name);
                    slist1.Add(profilePic);
                    slist1.Add(score);
                    friendList.Add(slist1);
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void OnSuccess(object response)
    {
        if (response is string)
        {
            LoadingMessage.newMessage = "SuccessFully Connected With Facebook";

            LeaderBoardCallBack.fbAccessToken = response.ToString();
            LeaderBoardCallBack.isConnected   = true;
            Application.LoadLevel("GameScene");
        }

        if (response is Game)
        {
            Game gameObj = (Game)response;
            Debug.Log("Game ::: " + gameObj.ToString());
            if (fromLeaderBoard)
            {
                if (gameObj.GetScoreList().Count > 0)
                {
                    for (int i = 0; i < gameObj.GetScoreList().Count; i++)
                    {
                        int    currentDetails = gameObj.GetScoreList()[i].GetJsonDocList().Count - 1;
                        string score          = gameObj.GetScoreList()[i].GetValue().ToString();
                        string jsonDoc        = gameObj.GetScoreList()[i].GetJsonDocList()[currentDetails].GetJsonDoc();
                        var    parser         = SimpleJSON.JObject.Parse(jsonDoc);
                        string profilePic     = parser["profilePic"];
                        string userId         = parser["userId"];
                        string name           = parser["name"];
                        Texture.GetInstance().ExecuteShow(userId, profilePic);

                        Debug.Log("userId ::: " + name);

                        IList <string> slist1 = new List <string>();
                        slist1.Add(userId);
                        slist1.Add(name);
                        slist1.Add(profilePic);
                        slist1.Add(score);
                        fList.Add(slist1);
                    }
                }
                fromLeaderBoard = false;
                Application.LoadLevel("LeaderBoardScene");
            }
            if (fromSaveScore)
            {
                LoadingMessage.SetMessage("Score SuccessFully Saved.");
                //fromSaveScore = false;
            }
        }
        if (response is com.shephertz.app42.paas.sdk.csharp.social.Social)
        {
            com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;
            Debug.Log("Social :: " + socialObj.ToString());
            LeaderBoardCallBack.fbUserName       = socialObj.GetFacebookProfile().GetName();
            LeaderBoardCallBack.fbUserProfilePic = socialObj.GetFacebookProfile().GetPicture();
            LeaderBoardCallBack.fbUserId         = socialObj.GetFacebookProfile().GetId();
            //	FBUserConnect.isConnected = false;
        }
    }
	public void OnSuccess (object response)
	{

		if (response is Game){
			Game gameObj = (Game)response;
			Debug.Log("Game ::: "+gameObj.ToString());
			if (fromLeaderBoard){
				if(gameObj.GetScoreList().Count > 0){
					for (int i=0; i<gameObj.GetScoreList().Count; i++){
						string name = gameObj.GetScoreList()[i].GetFacebookProfile().GetName();
						string score = gameObj.GetScoreList()[i].GetValue().ToString();
						string jsonDoc = gameObj.GetScoreList()[i].GetJsonDocList()[0].GetJsonDoc();
						var parser = SimpleJSON.JObject.Parse(jsonDoc);
						string profilePic = parser["profilePic"];
						string userId = parser["userId"];
						Texture.GetInstance().ExecuteShow(name, profilePic);
						
						Debug.Log("userId ::: " + userId);
						
						IList<string> slist1 = new List<string>();
					//	slist1.Add(userId);
						slist1.Add(name);
						slist1.Add(profilePic);
						slist1.Add(score);
						fList.Add(slist1);
					}
				}
				fromLeaderBoard = false;
				Application.LoadLevel("LeaderBoardScene");
			}
			if (fromSaveScore){
				LoadingMessage.SetMessage("Score SuccessFully Saved.");
				//fromSaveScore = false;
			}
			
		}

	}