示例#1
0
//	private bool bScreenshot = false;


    /// <summary>
    /// Starts this instance.
    /// Use this for initialization.
    /// </summary>
    void Start()
    {
        fgoodDog = (Font)Resources.Load("Fonts/GoodDog" + fontSuffix);

        tBackground = (Texture2D)Resources.Load("Profile/BG");
        tShed       = (Texture2D)Resources.Load("Profile/Headline");
        tBGBar      = (Texture2D)Resources.Load("Profile/BG-Bar");

        tShareDisable = (Texture2D)Resources.Load("Profile/BTN-Share-Disable");
        tShare        = (Texture2D)Resources.Load("Profile/BTN-Share-Normal");
        tSharePress   = (Texture2D)Resources.Load("Profile/BTN-Share-Press");

        tShareStoryDisable = (Texture2D)Resources.Load("Profile/BTN-ShareStory-Disable");
        tShareStory        = (Texture2D)Resources.Load("Profile/BTN-ShareStory-Normal");
        tShareStoryPress   = (Texture2D)Resources.Load("Profile/BTN-ShareStory-Press");

        tUploadDisable = (Texture2D)Resources.Load("Profile/BTN-Upload-Disable");
        tUpload        = (Texture2D)Resources.Load("Profile/BTN-Upload-Normal");
        tUploadPress   = (Texture2D)Resources.Load("Profile/BTN-Upload-Press");

        tConnect      = (Texture2D)Resources.Load("Profile/BTN-Connect");
        tConnectPress = (Texture2D)Resources.Load("Profile/BTN-Connect-Press");

        tLogout      = (Texture2D)Resources.Load("Profile/BTN-LogOut");
        tLogoutPress = (Texture2D)Resources.Load("Profile/BTN-LogOut-Press");


        // examples of catching fired events
        ProfileEvents.OnSoomlaProfileInitialized += () => {
            Soomla.SoomlaUtils.LogDebug("ExampleWindow", "SoomlaProfile Initialized !");
            isInit = true;
        };

        ProfileEvents.OnUserRatingEvent += () => {
            Soomla.SoomlaUtils.LogDebug("ExampleWindow", "User opened rating page");
        };

        ProfileEvents.OnGetScoresFinished += (GetScoresFinishedEvent ev) => {
            foreach (Score score in ev.Scores.PageData)
            {
                Debug.Log(score.Player.ProfileId);
            }
        };
        ProfileEvents.OnGetLeaderboardsFinished += (GetLeaderboardsFinishedEvent ev) => {
            Debug.Log("leaderboard 1: " + ev.Leaderboards.PageData[0].ID);
            SoomlaProfile.GetScores(targetProvider, ev.Leaderboards.PageData[0]);
        };
        ProfileEvents.OnGetLeaderboardsFailed += (GetLeaderboardsFailedEvent ev) => {
            SoomlaUtils.LogDebug("ExampleWindow", "leaderboard error: " + ev.ErrorDescription);
        };
        ProfileEvents.OnLoginFinished += (UserProfile UserProfile, bool autoLogin, string payload) => {
            Debug.Log("logged in");
            //SoomlaProfile.ShowLeaderboards(targetProvider);
            SoomlaProfile.GetLeaderboards(targetProvider);
        };

        ProfileEvents.OnGetContactsFinished += (Provider provider, SocialPageData <UserProfile> contactsData, string payload) => {
            Soomla.SoomlaUtils.LogDebug("ExampleWindow", "get contacts for: " + contactsData.PageData.Count + " page: " + contactsData.PageNumber + " More? " + contactsData.HasMore);
            foreach (var profile in contactsData.PageData)
            {
                Soomla.SoomlaUtils.LogDebug("ExampleWindow", "Contact: " + profile.toJSONObject().print());
            }

            if (contactsData.HasMore)
            {
                SoomlaProfile.GetContacts(targetProvider);
            }
        };

        SoomlaProfile.Initialize();
//		SoomlaProfile.OpenAppRatingPage();

                #if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.Gray);
                #elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Small);
                #endif
    }