Beispiel #1
0
 void showAll()
 {
     GUILayout.Box(logo);
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Facebook"))
     {
         currentSub = LeftGUI.FBSUB;
     }
     //if(GUILayout.Button("Twitter")){
     //  currentSub=LeftGUI.TWSUB;
     //}
     if (GUILayout.Button("GameCenter"))
     {
         //currentSub=LeftGUI.GCSUB;
         Social.ShowLeaderboardUI();
     }
     if (GUILayout.Button("Email"))
     {
         Application.OpenURL("mailto:[email protected][email protected]&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!");
         //Application.OpenURL("http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=294409923&mt=8");
         //currentSub=LeftGUI.EMSUB;
         //Application.OpenURL("sms:+61433052581");
     }
     GUILayout.EndHorizontal();
 }
Beispiel #2
0
 void BackToLeftAll()
 {
     if (GUILayout.Button("Back"))
     {
         currentSub = LeftGUI.ALL;
     }
 }
Beispiel #3
0
    IEnumerator Start()
    {
        InitPlayerInfo();

        notreadytoShow = false;
                #if UNITY_IPHONE
        Social.localUser.Authenticate(
            result => {
            if (result && showAchievementBanners)
            {
                GameCenterPlatform.ShowDefaultAchievementCompletionBanner(showAchievementBanners);
                Debug.Log("Authenticated " + Social.localUser.userName);
            }
            else
            {
                Debug.Log("Failed to authenticate " + Social.localUser.userName);
            }
        }
            );
                #endif
        adBanner = GameObject.FindGameObjectWithTag("AdBanner");
        gamecode = CalculateMD5Hash(key + databaseID);
        Debug.Log(gamecode);
        currentPage  = Page.Main;
        currentSub   = LeftGUI.ALL;
        currentRight = RightGUI.ALL;
        Debug.Log(Screen.width / baseScreenWidth);

        DontDestroyOnLoad(gameObject);

        FB.Init(SetInit, OnHideUnity);

        locationFound = false;
        Input.location.Start();
        int maxWait = 10;
        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }
        if (maxWait < 1)
        {
            yield return(false);
        }
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            yield return(false);
            //return false;
        }
        else
        {
            locationFound = true;
        }
        Input.location.Stop();
    }
Beispiel #4
0
    void ShowFaceBookUnLogin()
    {
        if (GUILayout.Button("Login Facebook"))
        {
            FB.Login("email,publish_actions", LoginCallback);
        }

        if (GUILayout.Button("Back"))
        {
            currentSub = LeftGUI.ALL;
        }
    }
Beispiel #5
0
    void ShowFaceBookLogined()
    {
        if (DoGrabDataOnce)
        {
            DoGrabDataOnce = false;
            //https://graph.facebook.com/zuck/picture?width=150&height=150
            FB.API("/me/friends?access_token=" + FB.AccessToken + "&fields=name,id,picture.type(square)", Facebook.HttpMethod.GET, FriendsData);
            //FB.API("/me/friends?access_token="+FB.AccessToken+"&fields=name,id,picture?width=150&height=150",Facebook.HttpMethod.GET,FriendsData);
            //FB.API("/me/picture?width=128&height=128", Facebook.HttpMethod.GET, MyData);
            FB.API("/me?access_token=" + FB.AccessToken + "&fields=name,picture.type(small)", Facebook.HttpMethod.GET, MyData);
        }

        if (friendsList != null && DoOne)
        {
            GrabDataOnce(friendsList);
            DoOne = false;
        }

        GUIStyle back = GUI.skin.GetStyle("backButton");
        GUIStyle GS   = GUI.skin.GetStyle("SubmitButton");

        if (friendsList != null)
        {
            GUILayout.Label("View Your Friends' Score");
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(300), GUILayout.Height(150));
            //GUILayout.Label(tt);

            fbFriends.Sort();
            fbFriends.Reverse();

            foreach (FBUser fuser in fbFriends)
            {
                if (fuser.picture == null)
                {
                    notreadytoShow = false;
                    break;
                }
                notreadytoShow = true;
            }

            if (notreadytoShow)
            {
                foreach (FBUser fuser in fbFriends)
                {
                    if (fuser.score > 0)
                    {
                        friendsInGame.Add(fuser);
                        GUILayout.BeginHorizontal();
                        //GUILayout.Label("No."+position);
                        GUILayout.Label("No." + position);
                        if (fuser.picture != null)
                        {
                            GUILayout.Label(fuser.picture, GUILayout.ExpandWidth(true));
                            //GUI.DrawTexture(Rect(10,10,60,60), fuser.picture, ScaleMode.ScaleToFit, true, 10.0f);
                        }
                        GUILayout.Label(fuser.name);
                        //float score=0;

                        GUILayout.Label(fuser.score.ToString());
                        GUILayout.EndHorizontal();
                        position++;
                    }
                }

                position = 1;
            }
            else
            {
                GUILayout.Label("Loading your score");
            }



            GUILayout.EndScrollView();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Near By Player", GS))
            {
                getNearBy();
                showWindow = true;
            }
            if (GUILayout.Button("Every Day Gift", back))
            {
                getGift();
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.BeginHorizontal();


        if (GUILayout.Button("Invite Friends"))
        {
            FB.AppRequest(
                message: "Friend Smash is smashing! Check it out.",
                title: "Play Friend Smash with me!"
                );
        }

        if (GUILayout.Button("Share With Facebook"))
        {
            FB.Feed(
                linkCaption: "I just post this Hello World Test Message on facebook for test!!",
                picture: "http://www.friendsmash.com/images/logo_large.jpg",
                linkName: "Check out my hello world",
                link: "https://apps.facebook.com/friendsmashsampledev/?challenge_brag="

                );
        }

        if (GUILayout.Button("Logout FB"))
        {
            FB.Logout();
        }

        GUILayout.EndHorizontal();

        string prettyText = textFileContents.Replace("</", "?@?");

        prettyText = prettyText.Replace("<", "\n<");

        prettyText = prettyText.Replace("?@?", "</");

        GUILayout.BeginHorizontal();
        //GUILayout.Label("your score online is "+prettyText);

        if (DoCheckUserAccountOnce)
        {
            Debug.Log("Run CheckWebUser");
            StartCoroutine(CheckWebUser());
            DoCheckUserAccountOnce = false;
        }

        WebButtons();

        if (GUILayout.Button("Back", back))
        {
            currentSub = LeftGUI.ALL;
        }
        GUILayout.EndHorizontal();
        if (nearByPlayer != null && GrabNearByPlayerDataOnce)
        {
            Debug.Log(nearByPlayer);
            ParseNearByPlayer(nearByPlayer);
            //string textData=scoreDataTextFile.text;
            //Debug.Log(textData);

            //ParseNearByPlayer(textData);

            GrabNearByPlayerDataOnce = false;
        }
        if (showWindow)
        {
            windowRect = GUILayout.Window(0, windowRect, MakeWindow, "Near By Player");
        }
    }