コード例 #1
0
        public void Init()
        {
            if (disabled)
            {
                return;
            }
            GJAPI.Init(gameID, privateKey, verbose, 1);

            //The following two methods are seperate from this Init() method
            //so that they may later be easily called multiple times, for something like timed login checks

            //Load in special users
            GJAPI.Data.Get("players");
            GJAPI.Data.GetCallback += LoadSpecialUsersCallback;

            //Check if current game jolt info is legit
            string username = ActiveData.GameSettings.gameJoltUsername;
            string token    = ActiveData.GameSettings.gameJoltToken;

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(token))
            {
                return;
            }

            GJAPI.Users.Verify(username, token);
            GJAPI.Users.VerifyCallback += CheckIfSignedInCallback;
        }
コード例 #2
0
    void Awake()
    {
        if (mInstance == null)
        {
            mInstance = this;
            DontDestroyOnLoad(gameObject);

            GJAPI.Init(gameID, privateKey);

            GJAPI.Users.VerifyCallback     += OnVerifyUser;
            GJAPI.Trophies.GetAllCallback  += OnTrophiesGrab;
            GJAPI.Trophies.AddCallback     += OnTrophyAdd;
            GJAPI.Scores.GetTablesCallback += OnScoresGrab;
            GJAPI.Scores.AddCallback       += OnScoreAdd;

            if (Achievement.instance)
            {
                Achievement.instance.RegisterService(this);
            }

            if (Leaderboard.instance)
            {
                Leaderboard.instance.RegisterService(this);
            }

            if (userGrabFromWeb)
            {
                mState = State.GrabUser;
                GJAPIHelper.Users.GetFromWeb(OnGrabUser);
            }
            else
            {
                //TODO: login window
                if (!string.IsNullOrEmpty(userName))
                {
                    if (string.IsNullOrEmpty(userToken))
                    {
                        mState   = State.None;
                        mIsGuest = true;
                    }
                    else
                    {
                        mState   = State.VerifyUser;
                        mIsGuest = false;
                        GJAPI.Users.Verify(userName, userToken);
                    }
                }
                else
                {
                    mState = State.RequireLogin;
                }
            }
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
コード例 #3
0
 void Awake()
 {
     _selfRef = this;
     DontDestroyOnLoad(gameObject);
     if (once)
     {
         GJAPI.Init(gameID, privateKey);
     }
 }
コード例 #4
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     gameID     = 60912;
     userName   = "******";
     userToken  = "4a6f2d";
     privateKey = "2465d53c5d34f2505eb38a16e26ad03e";
     GJAPI.Init(gameID, privateKey);
     GJAPIHelper.Users.ShowLogin();
 }
コード例 #5
0
ファイル: MenuLogin.cs プロジェクト: MlCHAEL/Sanicball
    // Use this for initialization
    void Start()
    {
        //Init the GJAPI and get the list of special players
        GJAPI.Init(gameID, privateKey, true, 1);      //Set this 'true' value to 'false' to disable GJ debug messages
        GJAPI.Data.Get("players");
        GJAPI.Data.GetCallback += LoadPlayerTypes;

        //Check the version of saved data and delete records if older (stupid, but gets rid of obsolete data)
        float savedVersion = PlayerPrefs.GetFloat("Version", -1f);

        if (savedVersion < GameVersion.AsFloat)
        {
            PlayerPrefs.DeleteAll();
            PlayerPrefs.SetFloat("Version", GameVersion.AsFloat);
            PlayerPrefs.Save();
            Debug.Log("Saved data is from an older game version! Removing everything.");
        }
    }
コード例 #6
0
ファイル: GameJoltAPIManager.cs プロジェクト: pLawitzki/GRAIL
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     GJAPI.Init(gameID, privateKey);
     GJAPIHelper.Users.GetFromWeb(OnGetFromWeb);
 }