Beispiel #1
0
 void OnCollisionStay2D(Collision2D col)
 {
     if (outOfBoundsWithoutOrbit)
     {
         if (col.gameObject == GameScreenManager.leftWall || col.gameObject == GameScreenManager.rightWall || col.gameObject == GameScreenManager.bottomWall)
         {
             if (!coRoutineInProgress)
             {
                 StartCoroutine(OutOfBoundsEndGameCheck());
                 coRoutineInProgress = true;
             }
         }
         if (col.gameObject == GameScreenManager.earth)
         {
             PlayerExplosion();
             SoundFXPlayer.PlayCrashSFX();
             GameScreenManager.playerHasCrashed = true;
             isOutOfBounds = true;
                             #if UNITY_ANDROID
             PlayGamesPlatform.Instance.ReportProgress("CgkIja6x2owHEAIQDA", 100.0f, (bool success) => {
             });
                             #elif UNITY_IOS
             GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
             Social.ReportProgress("xyz.mattpowell.helios.earthcrash", 100.0f, (bool success) => {
             });
                             #endif
         }
     }
 }
Beispiel #2
0
    void Awake()
    {
        MobileAds.Initialize(initStatus => { });

#if UNITY_IPHONE
        if (!Social.localUser.authenticated)
        {
            Social.localUser.Authenticate(ProcessAuthentication);
        }

        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
#if UNITY_ANDROID
        // recommended for debugging:
        //      PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        //// enables saving game progress.
        //.EnableSavedGames()
        //.RequestServerAuthCode(false)
        //// requests an ID token be generated.  This OAuth token can be used to
        ////  identify the player to other services such as Firebase.
        //.RequestIdToken()
        //.Build();

        //PlayGamesPlatform.InitializeInstance(config);

        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate();

        LogIn();
#endif
    }
Beispiel #3
0
        /// <summary>
        /// Initializes the service. This is required before any other actions can be done e.g reporting scores.
        /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise
        /// the process will carry on silently.
        /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times
        /// while subsequent authentication calls will be ignored.
        /// </summary>
        public static void Init()
        {
            // Authenticate and register a ProcessAuthentication callback
            // This call needs to be made before we can proceed to other calls in the Social API
            #if UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
            Social.localUser.Authenticate(ProcessAuthentication);
            #elif UNITY_ANDROID && EM_GPGS
            if (Social.Active != PlayGamesPlatform.Instance)
            {
                PlayGamesPlatform.Activate();
            }
            PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameService.IsGPGSDebug;

            Social.localUser.Authenticate(ProcessAuthentication);
            #elif UNITY_ANDROID && !EM_GPGS
            if (Debug.isDebugBuild)
            {
                Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity.");
            }
            #else
            if (Debug.isDebugBuild)
            {
                Debug.Log("Init FAILED: platform not supported.");
            }
            #endif
        }
Beispiel #4
0
    public static void Authenticate()
    {
        if (authRequest)
        {
            return;
        }

        if (Social.localUser.authenticated)
        {
            return;
        }

        authRequest = true;

        //select social platform
        bool useOffline = false;

#if (UNITY_EDITOR || UNITY_ANDROID || UNITY_WEBPLAYER)
        useOffline = true;
#endif
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            useOffline = true;
        }

        if (useOffline)
        {
            Social.Active = PPrefsSocialPlatform.Instance;
            Debug.Log("USE_LOCAL_LEADERBOARD");
            onlinePlatform = false;
        }

#if UNITY_IPHONE
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
        Debug.Log("SocialAdaptor.Authenticate");
        Social.localUser.Authenticate(success => {
            if (success)
            {
                Debug.Log("Authentication successful");
                string userInfo = "Username: "******"\nUser ID: " + Social.localUser.id +
                                  "\nIsUnderage: " + Social.localUser.underage;
                Debug.Log(userInfo);
                //GameObjectUtils.BroadCastMessage("OnAuthenticateSuccess", true);
            }
            else
            {
                Debug.Log("Authentication Fail");

                Social.Active = PPrefsSocialPlatform.Instance;
                Social.localUser.Authenticate(null);
                Debug.Log("Authenticate fail, USE_LOCAL_LEADERBOARD");
                onlinePlatform = false;
                //GameObjectUtils.BroadCastMessage("OnAuthenticateSuccess", false);
            }
            authRequest = false;
        });
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
#if UNITY_IOS
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#elif UNITY_ANDROID
        PlayGamesPlatform.Activate(); //android
#endif
        ConectarGoogle();
    }
Beispiel #6
0
    void Start()
    {
        // Authenticate and register a ProcessAuthentication callback
        // This call needs to be made before we can proceed to other calls in the Social API
        Social.localUser.Authenticate(ProcessAuthentication);

        // Shows GameCenter banners for iOS
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
    }
Beispiel #7
0
        /// <summary>
        /// Initializes the service. This is required before any other actions can be done e.g reporting scores.
        /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise
        /// the process will carry on silently.
        /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times
        /// while subsequent authentication calls will be ignored.
        /// </summary>
        public static void Init()
        {
            // Authenticate and register a ProcessAuthentication callback
            // This call needs to be made before we can proceed to other calls in the Social API
#if UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
            Social.localUser.Authenticate(ProcessAuthentication);

#if EASY_MOBILE_PRO && !UNITY_EDITOR
            // Register the default GKLocalPlayerListener for invitation delegate if Multiplayer is enabled.
            // EM Pro only.
            if (EM_Settings.GameServices.IsMultiplayerEnabled)
            {
                RegisterDefaultGKLocalPlayerListener();
            }
#endif
#elif UNITY_ANDROID && EM_GPGS
#if EASY_MOBILE_PRO
            PlayGamesClientConfiguration.Builder gpgsConfigBuilder = new PlayGamesClientConfiguration.Builder();

            // Enable Saved Games.
            if (EM_Settings.GameServices.IsSavedGamesEnabled)
            {
                gpgsConfigBuilder.EnableSavedGames();
            }

            // Register an internal invitation delegate and match delegate if Multiplayer is enabled.
            if (EM_Settings.GameServices.IsMultiplayerEnabled)
            {
                gpgsConfigBuilder.WithInvitationDelegate(OnGPGSInvitationReceived);
                gpgsConfigBuilder.WithMatchDelegate(OnGPGSTBMatchReceived);
            }

            // Build the config
            PlayGamesClientConfiguration gpgsConfig = gpgsConfigBuilder.Build();

            // Initialize PlayGamesPlatform
            PlayGamesPlatform.InitializeInstance(gpgsConfig);
#endif

            // Enable logging if required
            PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameServices.GgpsDebugLogEnabled;

            // Set PlayGamesPlatforms as active
            if (Social.Active != PlayGamesPlatform.Instance)
            {
                PlayGamesPlatform.Activate();
            }

            // Now authenticate
            Social.localUser.Authenticate(ProcessAuthentication);
#elif UNITY_ANDROID && !EM_GPGS
            Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity.");
#else
            Debug.Log("Failed to initialize Game Services module: platform not supported.");
#endif
        }
Beispiel #8
0
 public void Authenticate()
 {
     if (!authenticating)
     {
         authenticating = true;
         Social.localUser.Authenticate(AuthenticateUser);
         GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
     }
 }
Beispiel #9
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 #10
0
 //------------------------------------------------------------------------------------------------
 public static void Authenticate()
 {
                                         #if UNITY_ANDROID
                                         #else
     GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
                                         #endif
     // Authenticate and register a ProcessAuthentication callback
     // This call needs to be made before we can proceed to other calls in the Social API
     Social.localUser.Authenticate(ProcessAuthentication);
 }
Beispiel #11
0
    void Start()
    {
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
        IAchievement achievement = Social.CreateAchievement();

        achievement.id = "axy01";

        Social.localUser.Authenticate(HandleAuthenticated);

        Debug.Log(Social.localUser);
    }
Beispiel #12
0
    void Start()
    {
#if UNITY_IOS
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#else
        GooglePlayGames.PlayGamesPlatform.Activate();
#endif


        LogInGooglePlus();
    }
Beispiel #13
0
    static void OnAuthenticate(bool success)
    {
        Debug.LogFormat("SocialManager.OnAuthenticate, success={0}", success);
        if (success)
        {
#if UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
            Social.LoadAchievements(OnAchievementsWasLoaded);
        }
    }
Beispiel #14
0
    void Start()
    {
#if UNITY_ANDROID
        Social.Active = new UnityEngine.SocialPlatforms.GPGSocial();
#elif UNITY_IPHONE
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
        StartCoroutine(GPGController.checkConnection());
#endif

        StartCoroutine(GPGController.signIn());
    }
Beispiel #15
0
 private static void CallbackCheckScore(bool success)
 {
     if (success)
     {
         GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
         Debug.Log("Score Success " + Social.localUser.userName);
     }
     else
     {
         Debug.Log("Score failed " + Social.localUser.userName);
     }
 }
Beispiel #16
0
        public static void Authenticate()
        {
            if (!_initialized)
            {
#if UNITY_IOS
                _platform = new GameCenterPlatform();
                _platform.localUser.Authenticate(OnAuthenticate);
                GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
                _initialized = true;
#endif
            }
        }
    void ProcessAuthentication(bool success)
    {
        if (success)
        {
            Debug.Log("Authenticated, checking achievements");

            LoadAchievements();
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
        }
        else
        {
            Debug.Log("Failed to authenticate");
        }
    }
        // Callbacks
        private void ProcessAuthentication(bool success)
        {
            if (success)
            {
#if !UNITY_EDITOR
                GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
            }

            if (onSocialAuthentication != null)
            {
                onSocialAuthentication(success);
            }
        }
Beispiel #19
0
 void Awake()
 {
     GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
     Social.localUser.Authenticate(success => {
         if (success)
         {
             Debug.Log("authenticated");
         }
         else
         {
             Debug.Log("Failed to authenticate");
         }
     });
 }
Beispiel #20
0
    public void Init()
    {
#if UNITY_ANDROID
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                                              .EnableSavedGames()
                                              .Build();

        PlayGamesPlatform.InitializeInstance(config);
        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate();
#elif UNITY_IOS
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
    }
Beispiel #21
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

#if UNITY_ANDROID
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();

        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
    }
Beispiel #22
0
    void Awake()
    {
        {
                        #if UNITY_ANDROID
            PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                                                  .EnableSavedGames()
                                                  .Build();

            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();
                        #elif UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
                        #endif
        }
    }
Beispiel #23
0
    ///<summary> Calls to sign the player in </summary>
    public static void SignIn(CallBack goodCall, CallBack badCall)
    {
        achievements.Clear();


#if UNITY_ANDROID
        for (int i = 0; i < instance.namesAndIDs.Length; i++)
        {
            achievements.Add(instance.namesAndIDs[i].Android_ID, null);
        }

        // authenticate user:
        Social.localUser.Authenticate((bool success) => {
            // handle success or failure
            if (success)
            {
                LoadAchievements();
                goodCall();
            }
            else
            {
                badCall();
            }
        });
#elif UNITY_IOS
        for (int i = 0; i < instance.namesAndIDs.Length; i++)
        {
            achievements.Add(instance.namesAndIDs[i].ios_ID, null);
        }

        // Authenticate and register a ProcessAuthentication callback
        // This call needs to be made before we can proceed to other calls in the Social API
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
        Social.localUser.Authenticate(delegate(bool obj) {
            if (obj)
            {
                LoadAchievements();

                goodCall();
            }
            else
            {
                badCall();
            }
        });
#endif
    }
Beispiel #24
0
        public void Initialize()
        {
            if (_isInited)
            {
                Log.Warning(nameof(AppleGameCenterService), "플랫폼은 이미 초기화 되어 있다");
                return;
            }

            Log.Verbose(nameof(AppleGameCenterService), "Initialize");
            _isInited = true;

#if UNITY_IPHONE
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
            IsGuestUser    = PlatformService.GetGuestUser();
            IsPlatformAuth = PlatformService.GetPlatformAuth();
        }
Beispiel #25
0
        // Use this for initialization
        void Start()
        {
        #if UNITY_IPHONE
            Social.localUser.Authenticate((bool success) => {
                if (success && showAchievementBanners)
                {
                    GameCenterPlatform.ShowDefaultAchievementCompletionBanner(showAchievementBanners);
                    Debug.Log("Authenticated " + Social.localUser.userName);
                }
                else
                {
                    Debug.Log("Failed to authenticate " + Social.localUser.userName);
                }
            }
                                          );
#endif
        }
Beispiel #26
0
    /*public void DisplayPlayerControlUI ()
     * {
     *      playerControlMenuAnim.Play ("UIFadeIn");
     *      playerControl.interactable = true;
     *      playerControl.blocksRaycasts = true;
     *      inGameScoreText.enabled = true;
     * }*/

    public void PlayerDied()
    {
        StartCoroutine(TransitionToGameOverScene());
        SpawnController.SpawnPlanetsIsPaused = true;
        PlayerPrefs.SetInt("totalScore", PlayerPrefs.GetInt("totalScore") + ScoreController.scoreInt);

                #if UNITY_ANDROID
        if (PlayGamesPlatform.Instance.IsAuthenticated())
        {
            if (!PlayGamesPlatform.Instance.GetAchievement("CgkIja6x2owHEAIQCg").IsUnlocked)
            {
                PlayGamesPlatform.Instance.IncrementAchievement("CgkIja6x2owHEAIQCg", ScoreController.scoreInt, (bool success) => {
                });
            }
            if (!PlayGamesPlatform.Instance.GetAchievement("CgkIja6x2owHEAIQCw").IsUnlocked)
            {
                PlayGamesPlatform.Instance.IncrementAchievement("CgkIja6x2owHEAIQCw", ScoreController.scoreInt, (bool success) => {
                });
            }
            if (!PlayGamesPlatform.Instance.GetAchievement("CgkIja6x2owHEAIQCQ").IsUnlocked)
            {
                PlayGamesPlatform.Instance.IncrementAchievement("CgkIja6x2owHEAIQCQ", ScoreController.scoreInt, (bool success) => {
                });
            }

            PlayGamesPlatform.Instance.ReportScore(PlayerPrefs.GetInt("totalScore"), "CgkIja6x2owHEAIQDg", (bool success) => {
            });
        }
                #elif UNITY_IOS
        if (Social.localUser.authenticated)
        {
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
            Social.ReportProgress("xyz.mattpowell.helios.totalscore1000", (PlayerPrefs.GetInt("totalScore") / 1000) * 100f, (bool success) => {
            });
            Social.ReportProgress("xyz.mattpowell.helios.totalscore3000", (PlayerPrefs.GetInt("totalScore") / 3000) * 100f, (bool success) => {
            });
            Social.ReportProgress("xyz.mattpowell.helios.totalscore5000", (PlayerPrefs.GetInt("totalScore") / 5000) * 100f, (bool success) => {
            });
            Social.ReportScore(PlayerPrefs.GetInt("totalScore"), "xyz.mattpowell.helios.leaderboardtopscore", (bool success) => {
            });
        }
                #endif
    }
Beispiel #27
0
    void Start()
    {
        //iOSReviewRequest.Request();

        sessionCount = SecurePlayerPrefs.GetInt("sessionCount", 0);
        sessionCount++;
        SecurePlayerPrefs.SetInt("sessionCount", sessionCount);

        SecurePlayerPrefs.SetInt("NativeReview", 1);

        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
        Social.localUser.Authenticate(success => {
            if (success)
            {
                Debug.Log("Authentication successful");
                string userInfo = "Username: "******"\nUser ID: " + Social.localUser.id +
                                  "\nIsUnderage: " + Social.localUser.underage;
                Debug.Log(userInfo);
            }
            else
            {
                Debug.Log("Authentication failed");
            }
        });

        // Initialize Unity Ads
        Advertisement.Initialize("2677701", testMode);

        // Use this for initialization
        OneSignal.StartInit("4a1c6f9e-b413-4d4c-9d35-1b3671a50812")
        .Settings(new Dictionary <string, bool>()
        {
            { OneSignal.kOSSettingsAutoPrompt, false },
            { OneSignal.kOSSettingsInAppLaunchURL, true }
        })
        .EndInit();

        OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;

        StartCoroutine(LoadNextScene());
    }
Beispiel #28
0
    void Start()
    {
        FrameworkBridge.initializeDelegate();

        Social.localUser.Authenticate(success => {
            if (success)
            {
                Debug.Log("Authenticated, checking achievements");

                FrameworkBridge.GameLoadedHandler gameLoaded = new FrameworkBridge.GameLoadedHandler(OnGameLoaded);
                FrameworkBridge.loadGame(gameLoaded);
            }
            else
            {
                Debug.Log("Failed to authenticate");
            }
        });

        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
    }
    // Start is called before the first frame update
    void Awake()
    {
        //PlayerPrefs.DeleteAll();

        if (Instance == null)
        {
            Instance = this;
        }

        //구글 서비스 활성화
#if UNITY_ANDROID
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                                              .EnableSavedGames()
                                              .Build();
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();
#elif UNITY_IOS
        GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
#endif
    }
Beispiel #30
0
 void Start()
 {
     OnFly = 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
     isAlive  = true;
     Ogravity = Physics.gravity;
 }