/// <summary> /// Initializes the API. You must do this before anything else. Get your credentials from the Playtomic dashboard. /// </summary> /// <param name="gameid"> /// A <see cref="System.Int64"/> /// </param> /// <param name="gameguid"> /// A <see cref="System.String"/> /// </param> /// <param name="apikey"> /// A <see cref="System.String"/> /// </param> public static void Initialize(long gameid, string gameguid, string apikey) { if (_instance != null) { return; } var go = new GameObject("playtomic"); GameObject.DontDestroyOnLoad(go); _instance = go.AddComponent("Playtomic") as Playtomic; _instance.gameid = gameid; _instance.gameguid = gameguid; _instance.sourceUrl = string.IsNullOrEmpty(Application.absoluteURL) ? "http://localhost/" : Application.absoluteURL; _instance.log = new Playtomic_Log(); _instance.data = new Playtomic_Data(); _instance.leaderboards = new Playtomic_Leaderboards(); _instance.playerlevels = new Playtomic_PlayerLevels(); _instance.geoip = new Playtomic_GeoIP(); _instance.link = new Playtomic_Link(); _instance.gamevars = new Playtomic_GameVars(); _instance.parse = new Playtomic_Parse(); Playtomic_Request.Initialise(); Playtomic_Data.Initialise(apikey); Playtomic_GameVars.Initialise(apikey); Playtomic_Leaderboards.Initialise(apikey); Playtomic_GeoIP.Initialise(apikey); Playtomic_PlayerLevels.Initialise(apikey); Playtomic_Parse.Initialise(apikey); _instance.log.LoadRequest(); }
/// <summary> /// Initializes the API. You must do this before anything else. /// </summary> /// <param name="publickey"> /// A <see cref="System.String"/> /// </param> /// <param name="privatekey"> /// A <see cref="System.String"/> /// </param> /// <param name="apiurl"> /// A <see cref="System.String"/> /// </param> public static void Initialize(string publickey, string privatekey, string apiurl) { if (_instance != null) { return; } // Add Unity Extentions to LitJson LitJson.JsonExtend.AddExtentds(); GameObject go = new GameObject("playtomic"); GameObject.DontDestroyOnLoad(go); _instance = go.AddComponent("Playtomic") as Playtomic; _instance._leaderboards = new PLeaderboards(); _instance._playerlevels = new PPlayerLevels(); _instance._geoip = new PGeoIP(); _instance._gamevars = new PGameVars(); _instance._achievements = new PAchievements(); _instance._newsletter = new PNewsletter(); _instance._playerchallenges = new PPlayerChallenges(); _instance._playerprofiles = new PPlayerProfiles(); PRequest.Initialise(publickey, privatekey, apiurl); }
public void Start() { Playtomic.Initialize("testpublickey", "testprivatekey", testURL); PTest.Setup(); PTestLeaderboards.rnd = PTestPlayerLevels.rnd = PTestAchievements.rnd = RND(); _tests = new List <Action <Action> > { #if TEST_GAMEVARS PTestGameVars.All, PTestGameVars.Single, #endif #if TEST_GEO PTestGeoIP.Lookup, #endif #if TEST_NEWSLETTER PTestNewsletter.Subscribe, #endif #if TEST_LEADERBOARDS PTestLeaderboards.FirstScore, PTestLeaderboards.SecondScore, PTestLeaderboards.HighScores, PTestLeaderboards.LowScores, PTestLeaderboards.AllScores, PTestLeaderboards.FriendsScores, PTestLeaderboards.OwnScores, #endif #if TEST_PLAYERLEVELS PTestPlayerLevels.Create, PTestPlayerLevels.List, PTestPlayerLevels.Load, PTestPlayerLevels.Rate, #endif #if TEST_ACHIEVEMENTS PTestAchievements.List, PTestAchievements.ListWithFriends, PTestAchievements.ListWithPlayer, PTestAchievements.ListWithPlayerAndFriends, PTestAchievements.Stream, PTestAchievements.StreamWithFriends, PTestAchievements.StreamWithPlayerAndFriends, PTestAchievements.Save #endif }; Next(); }
/// <summary> /// Initializes the API. You must do this before anything else. /// </summary> /// <param name="publickey"> /// A <see cref="System.String"/> /// </param> /// <param name="privatekey"> /// A <see cref="System.String"/> /// </param> /// <param name="apiurl"> /// A <see cref="System.String"/> /// </param> public static void Initialize(string publickey, string privatekey, string apiurl) { if(_instance != null) return; var go = new GameObject("playtomic"); GameObject.DontDestroyOnLoad(go); _instance = go.AddComponent<Playtomic>() as Playtomic; _instance._leaderboards = new PLeaderboards(); _instance._playerlevels = new PPlayerLevels(); _instance._geoip = new PGeoIP(); _instance._gamevars = new PGameVars(); _instance._achievements = new PAchievements(); _instance._newsletter = new PNewsletter(); PRequest.Initialise(publickey, privatekey, apiurl); }
/// <summary> /// Initializes the API. You must do this before anything else. /// </summary> /// <param name="publickey"> /// A <see cref="System.String"/> /// </param> /// <param name="privatekey"> /// A <see cref="System.String"/> /// </param> /// <param name="apiurl"> /// A <see cref="System.String"/> /// </param> public static void Initialize(string publickey, string privatekey, string apiurl) { if (_instance != null) { return; } var go = new GameObject("playtomic"); GameObject.DontDestroyOnLoad(go); _instance = go.AddComponent("Playtomic") as Playtomic; _instance._leaderboards = new PLeaderboards(); _instance._playerlevels = new PPlayerLevels(); _instance._geoip = new PGeoIP(); _instance._gamevars = new PGameVars(); _instance._achievements = new PAchievements(); _instance._newsletter = new PNewsletter(); PRequest.Initialise(publickey, privatekey, apiurl); }
// Use this for initialization void Start() { Debug.Log("Start"); // tony's test Playtomic.Initialize(4277, "0c00e714e083408f", "60574a8152ec49ceb1cc61e90441ab"); Playtomic.Log.View(); Playtomic.Log.Play(); Playtomic.Log.CacheOnError = false; // ------ // geoip lookup //StartCoroutine(LoadGeoIP()); // gamevars lookup //Debug.Log("Loading gamevars"); //StartCoroutine(LoadGameVars()); // data lookup //StartCoroutine(LoadData()); // player levels //StartCoroutine(ListLevels()); //StartCoroutine(LoadLevel()); //StartCoroutine(RateLevel()); //StartCoroutine(SaveLevel()); // leaderboards //StartCoroutine(SaveScore()); //StartCoroutine(ListScores()); // parse StartCoroutine(SaveParseObject()); StartCoroutine(FindParseObject()); }
/// <summary> /// Initializes the API. You must do this before anything else. Get your credentials from the Playtomic dashboard. /// </summary> /// <param name="gameid"> /// A <see cref="System.Int64"/> /// </param> /// <param name="gameguid"> /// A <see cref="System.String"/> /// </param> /// <param name="apikey"> /// A <see cref="System.String"/> /// </param> public static void Initialize(long gameid, string gameguid, string apikey) { if(_instance != null) return; var go = new GameObject("playtomic"); GameObject.DontDestroyOnLoad(go); _instance = go.AddComponent("Playtomic") as Playtomic; _instance._gameid = gameid; _instance._gameguid = gameguid; _instance._sourceUrl = string.IsNullOrEmpty(Application.absoluteURL) ? "http://localhost/" : Application.absoluteURL; _instance._log = new Playtomic_Log(); _instance._data = new Playtomic_Data(); _instance._leaderboards = new Playtomic_Leaderboards(); _instance._playerlevels = new Playtomic_PlayerLevels(); _instance._geoip = new Playtomic_GeoIP(); _instance._link = new Playtomic_Link(); _instance._gamevars = new Playtomic_GameVars(); _instance._parse = new Playtomic_Parse(); Playtomic_Request.Initialise(); Playtomic_Data.Initialise(apikey); Playtomic_GameVars.Initialise(apikey); Playtomic_Leaderboards.Initialise(apikey); Playtomic_GeoIP.Initialise(apikey); Playtomic_PlayerLevels.Initialise(apikey); Playtomic_Parse.Initialise(apikey); Playtomic_RRequest.Initialise(); //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); }
//============================================================================= void Start() { if (m_bVerbose) { Debug.Log("AchievementsManager: Start"); } if (m_bInitialised == false) { m_bInitialised = true; m_bIsLoggedIn = false; m_Instance = this; m_bIsUploadingAchievement = false; m_UploadingAchievementTimeout = 10.0f; m_UploadingAchievementID = -1; m_ManagerState = eManagerState.Idle; if (m_bVerbose) { Debug.Log("AchievementsManager: Init"); } } // Connect to Game Center / Google Play #if UNITY_IPHONE GameCenterManager.playerAuthenticatedEvent += GCOnPlayerAuthenticated; GameCenterManager.playerFailedToAuthenticateEvent += GCOnPlayerFailedToAuthenticate; GameCenterManager.reportAchievementFailedEvent += GCOnReportAchievementFailed; GameCenterManager.reportAchievementFinishedEvent += GCOnReportAchievementFinished; GameCenterManager.reportScoreFailedEvent += GCOnReportScoreFailed; GameCenterManager.reportScoreFinishedEvent += GCOnReportScoreFinished; // Auto login if we already logged in a previous time //if( PlayerPrefs.GetInt( "GCGPAutoLogin" , 0 ) > 0 ) { Login(); } #endif #if UNITY_ANDROID GPGManager.authenticationSucceededEvent += GPOnPlayerAuthenticated; GPGManager.authenticationFailedEvent += GPOnPlayerFailedToAuthenticate; GPGManager.unlockAchievementFailedEvent += GPOnReportAchievementFailed; GPGManager.unlockAchievementSucceededEvent += GPOnReportAchievementFinished; GPGManager.submitScoreFailedEvent += GPOnReportScoreFailed; GPGManager.submitScoreSucceededEvent += GPOnReportScoreFinished; // Auto login if we already logged in a previous time //if( PlayerPrefs.GetInt( "GCGPAutoLogin" , 0 ) > 0 ) { Login(); } #endif // Playtomic init (scoreboards) Playtomic.Initialize("4297CC23E31BC29545FC2A9577AD4", "14A8D1497B7B68DBF43D97128CB88", "http://shreditscoreboard.herokuapp.com/"); // Connect to Facebook/Twitter #if UNITY_IPHONE || UNITY_ANDROID FacebookCombo.init(); TwitterCombo.init("GPC3ImeHkYHf0Bdhr9gNC39SW", "dty3PjzDLQTnlQ9jjqMJUM2oy4apJhqtPpaFCX0oVcLvTw2kPg"); #endif #if UNITY_IPHONE && !UNITY_EDITOR FacebookBinding.setSessionLoginBehavior(FacebookSessionLoginBehavior.ForcingWebView); #endif // For debug builds register a random player RandomiseName(); }