Ejemplo n.º 1
0
    private void appRequestCallback(FBResult result)
    {
        Debug.Log("appRequestCallback");

        if (result.Error != null)
        {
            Debug.Log("appRequestCallback - invite request failed: " + result.Error);
        }
        else
        {
            var responseObject = Json.Deserialize(result.Text) as Dictionary <string, object>;

            object obj = null;

            if (responseObject.TryGetValue("cancelled", out obj))
            {
                Debug.Log("appRequestCallback - invite request cancelled");
            }
            else if (responseObject.TryGetValue("request", out obj))
            {
                Debug.Log("appRequestCallback - invite request sent");
            }
        }

#if PROPELLER_SDK
        PropellerSDK.SdkSocialInviteCompleted();
#endif
    }
Ejemplo n.º 2
0
    //not currently being used
    private void sendCustomMatchResult(long score, float visualScore)
    {
        Debug.Log("sendCustomMatchResult");

        // construct custom leader board score currency dictionary for auxScore1
        Dictionary <string, object> auxScore1Currency = new Dictionary <string, object> ();

        auxScore1Currency.Add("id", "visualScore");
        auxScore1Currency.Add("score", visualScore);
        auxScore1Currency.Add("visualScore", visualScore.ToString());

        // construct array of custom leader board score currencies
        List <object> currencies = new List <object> ();

        currencies.Add(auxScore1Currency);

        // construct match data dictionary
        Dictionary <string, object> matchData = new Dictionary <string, object> ();

        matchData.Add("currencies", currencies);

        Dictionary <string, object> matchResult = new Dictionary <string, object> ();

        matchResult.Add("tournamentID", m_matchData.TournamentID);
        matchResult.Add("matchID", m_matchData.MatchID);
        matchResult.Add("score", m_matchData.MatchScore);
        matchResult.Add("matchData", matchData);

#if PROPELLER_SDK
        PropellerSDK.SubmitMatchResult(matchResult);
        NotificationCenter.DefaultCenter.PostNotification(getMainMenuClass(), "AddTransOverlay");
        PropellerSDK.Launch(m_listener);
#endif
    }
Ejemplo n.º 3
0
    void UpdatePropellerSDKPrefab()
    {
        PropellerSDK propellerSDK = GetPropellerSDK();

        propellerSDK.GameKey            = _gameKey;
        propellerSDK.GameSecret         = _gameSecret;
        propellerSDK.AndroidGCMSenderID = _androidGCMSenderID;
    }
Ejemplo n.º 4
0
    void UserCallBack(FBResult result)
    {
        Debug.Log("UserCallBack");

        if (result.Error != null)
        {
            Debug.Log("UserCallBack - user graph request failed: " + result.Error + " - " + result.Text);

#if PROPELLER_SDK
            PropellerSDK.SdkSocialLoginCompleted(null);
#endif

            if (socialPost != SocialPost.NONE)
            {
#if PROPELLER_SDK
                switch (socialPost)
                {
                case SocialPost.INVITE:
                    PropellerSDK.SdkSocialInviteCompleted();
                    break;

                case SocialPost.SHARE:
                    PropellerSDK.SdkSocialShareCompleted();
                    break;
                }
#endif

                socialPost     = SocialPost.NONE;
                socialPostData = null;
            }

            return;
        }

        string get_data = result.Text;

        var dict = Json.Deserialize(get_data) as IDictionary;
        fbname      = dict ["name"].ToString();
        fbemail     = dict ["email"].ToString();
        fbgender    = dict ["gender"].ToString();
        fbfirstname = dict ["first_name"].ToString();

        PushFBDataToFuel();

        if (socialPost != SocialPost.NONE)
        {
            switch (socialPost)
            {
            case SocialPost.INVITE:
                onSocialInviteClicked(socialPostData);
                break;

            case SocialPost.SHARE:
                onSocialShareClicked(socialPostData);
                break;
            }
        }
    }
Ejemplo n.º 5
0
    /*
     * -----------------------------------------------------
     *                                      Launch Routines
     * -----------------------------------------------------
     */
    private void LaunchDashBoard()
    {
        Debug.Log("LaunchDashBoard");

#if PROPELLER_SDK
        NotificationCenter.DefaultCenter.PostNotification(getMainMenuClass(), "AddTransOverlay");
        PropellerSDK.Launch(m_listener);
#endif
    }
Ejemplo n.º 6
0
    public void setUserConditions()
    {
        Debug.Log("setUserConditions");

        String isTablet = "FALSE";

        if (isDeviceTablet() == true)
        {
            isTablet = "TRUE";
        }

        int userAge     = getUserAge();
        int numLaunches = getNumLaunches();
        int numSessions = getNumSessions();

        Dictionary <string, string> conditions = new Dictionary <string, string> ();

        //required
        conditions.Add("userAge", userAge.ToString());
        conditions.Add("numSessions", numSessions.ToString());
        conditions.Add("numLaunches", numLaunches.ToString());
        conditions.Add("isTablet", isTablet);
        conditions.Add("gameVersion", "1.0.2");

        //standardized
        conditions.Add("orientation", "portrait");
        conditions.Add("daysSinceFirstPayment", "-1");
        conditions.Add("daysSinceLastPayment", "-1");
        conditions.Add("language", "en");
        conditions.Add("gender", "female");
        conditions.Add("age", "16");

        //non standardized

#if PROPELLER_SDK
        PropellerSDK.SetUserConditions(conditions);
#endif

        Debug.Log
        (
            "*** conditions ***" + "\n" +
            "userAge = " + userAge.ToString() + "\n" +
            "numSessions = " + numSessions.ToString() + "\n" +
            "numLaunches = " + numLaunches.ToString() + "\n" +
            "isTablet = " + isTablet + "\n" +
            "orientation = " + "portrait" + "\n" +
            "daysSinceFirstPayment = " + "-1" + "\n" +
            "daysSinceLastPayment = " + "-1" + "\n" +
            "language = " + "en" + "\n" +
            "gender = " + "female" + "\n" +
            "age = " + "16" + "\n" +
            "gameVersion = " + "1.0.2"
        );
    }
Ejemplo n.º 7
0
    /*
     * -----------------------------------------------------
     *                                      Challenge Counts
     * -----------------------------------------------------
     */
    public void SyncChallengeCounts()
    {
        if (useFuelCompete == false)
        {
            return;
        }

#if PROPELLER_SDK
        PropellerSDK.SyncChallengeCounts();
#endif
    }
Ejemplo n.º 8
0
    /*
     * -----------------------------------------------------
     *                              FaceBook Share
     * -----------------------------------------------------
     */

    public void onSocialShareClicked(Dictionary <string, string> shareInfo)
    {
        Debug.Log("onSocialShareClicked");

        /*
         * string toId = "",
         * string link = "",
         * string linkName = "",
         * string linkCaption = "",
         * string linkDescription = "",
         * string picture = "",
         * string mediaSource = "",
         * string actionName = "",
         * string actionLink = "",
         * string reference = "",
         * Dictionary<string, string[]> properties = null,
         * FacebookDelegate callback = null)
         */

        if (FB.IsLoggedIn)
        {
            FB.Feed(
                FB.UserId,
                shareInfo ["link"],
                shareInfo ["subject"],
                shareInfo ["short"],
                shareInfo ["long"],
                shareInfo ["picture"],
                null,
                null,
                null,
                null,
                null,
                appFeedCallback);
        }
        else
        {
            if (socialPost != SocialPost.NONE)
            {
                socialPost     = SocialPost.NONE;
                socialPostData = null;

#if PROPELLER_SDK
                PropellerSDK.SdkSocialShareCompleted();
#endif
                return;
            }

            socialPost     = SocialPost.SHARE;
            socialPostData = shareInfo;

            trySocialLogin(false);
        }
    }
Ejemplo n.º 9
0
    /*
     * -----------------------------------------------------
     *                                      Tournament Info
     * -----------------------------------------------------
     */
    public void SyncTournamentInfo()
    {
        if (useFuelCompete == false)
        {
            return;
        }

#if PROPELLER_SDK
        PropellerSDK.SyncTournamentInfo();
#endif
    }
Ejemplo n.º 10
0
    /*
     * -----------------------------------------------------
     *                                      Virtual Goods
     * -----------------------------------------------------
     */
    public void SyncVirtualGoods()
    {
        if (useFuelCompete == false)
        {
            return;
        }

#if RUN_UNIT_TESTS
        VirtualGoodUnitTest();
#endif
#if PROPELLER_SDK
        PropellerSDK.SyncVirtualGoods();
#endif
    }
Ejemplo n.º 11
0
    /*
     * -----------------------------------------------------
     *                              FaceBook Invite
     * -----------------------------------------------------
     */

    public void onSocialInviteClicked(Dictionary <string, string> inviteInfo)
    {
        Debug.Log("onSocialInviteClicked");

        /*
         *      string message,
         *      string[] to = null,
         *      List<object> filters = null,
         *      string[] excludeIds = null,
         *      int? maxRecipients = null,
         *      string data = "",
         *      string title = "",
         *      FacebookDelegate callback = null)
         */


        if (FB.IsLoggedIn)
        {
            FB.AppRequest(
                inviteInfo ["long"],
                null,
                null,
                null,
                null,
                null,
                inviteInfo ["subject"],
                appRequestCallback);
        }
        else
        {
            if (socialPost != SocialPost.NONE)
            {
                socialPost     = SocialPost.NONE;
                socialPostData = null;

#if PROPELLER_SDK
                PropellerSDK.SdkSocialInviteCompleted();
#endif
                return;
            }

            socialPost     = SocialPost.INVITE;
            socialPostData = inviteInfo;

            trySocialLogin(false);
        }
    }
Ejemplo n.º 12
0
    public void OnPropellerSDKVirtualGoodList(Dictionary <string, object> virtualGoodInfo)
    {
        string        transactionId = (string)virtualGoodInfo["transactionID"];
        List <string> virtualGoods  = (List <string>)virtualGoodInfo["virtualGoods"];

        Debug.Log("OnPropellerSDKVirtualGoodList: transactionId = " + transactionId);

        Hashtable goodsTable = new Hashtable();

        goodsTable["addGold"]    = 0;
        goodsTable["addOil"]     = 0;
        goodsTable["showTrophy"] = 0;

        bool virtualGoodsTaken = false;

        foreach (string vg in virtualGoods)
        {
            Debug.Log(":virtual good = " + vg);

            if (vg == "golddrop")
            {
                goodsTable["addGold"] = 2;
                virtualGoodsTaken     = true;
            }
            else if (vg == "oildrop")
            {
                goodsTable["addOil"] = 2;
                virtualGoodsTaken    = true;
            }
            else if (vg == "trophydrop")
            {
                goodsTable["showTrophy"] = 1;
                virtualGoodsTaken        = true;
            }
        }

        if (virtualGoodsTaken == true)
        {
            getMainMenuClass().RefreshVirtualGoods(goodsTable);
            //NotificationCenter.DefaultCenter.PostNotification (getMainMenuClass(), "RefreshVirtualGoods", goodsTable);
        }

#if PROPELLER_SDK
        // Acknowledge the receipt of the virtual goods list
        PropellerSDK.AcknowledgeVirtualGoods(transactionId, true);
#endif
    }
Ejemplo n.º 13
0
    PropellerSDK GetPropellerSDK()
    {
        GameObject gameObject = GameObject.Find("PropellerSDK");

        if (gameObject == null)
        {
            throw new Exception("Unable to find the Propeller SDK game object");
        }

        PropellerSDK propellerSDK = gameObject.GetComponent <PropellerSDK> ();

        if (propellerSDK == null)
        {
            throw new Exception("Unable to obtain the Propeller SDK script");
        }

        return(propellerSDK);
    }
Ejemplo n.º 14
0
    void LoginCallback(FBResult result)
    {
        Debug.Log("LoginCallback");

        if (!FB.IsLoggedIn)
        {
            if (result.Error != null)
            {
                Debug.Log("LoginCallback - login request failed: " + result.Error);
            }
            else
            {
                Debug.Log("LoginCallback - login request cancelled");
            }

#if PROPELLER_SDK
            PropellerSDK.SdkSocialLoginCompleted(null);
#endif

            if (socialPost != SocialPost.NONE)
            {
#if PROPELLER_SDK
                switch (socialPost)
                {
                case SocialPost.INVITE:
                    PropellerSDK.SdkSocialInviteCompleted();
                    break;

                case SocialPost.SHARE:
                    PropellerSDK.SdkSocialShareCompleted();
                    break;
                }
#endif

                socialPost     = SocialPost.NONE;
                socialPostData = null;
            }

            return;
        }

        OnLoggedIn();
    }
Ejemplo n.º 15
0
    public void launchPropeller()
    {
        if (useFuelCompete == false)
        {
            return;
        }

        Debug.Log("launchPropeller");

#if PROPELLER_SDK
        if (m_listener == null)
        {
            throw new Exception();
        }

        NotificationCenter.DefaultCenter.PostNotification(getMainMenuClass(), "AddTransOverlay");
        PropellerSDK.Launch(m_listener);
#endif
    }
Ejemplo n.º 16
0
    private void sendMatchResult(long score)
    {
        Debug.Log("sendMatchResult");

        long visualScore = score;

        Dictionary <string, object> matchResult = new Dictionary <string, object> ();

        matchResult.Add("tournamentID", m_matchData.TournamentID);
        matchResult.Add("matchID", m_matchData.MatchID);
        matchResult.Add("score", m_matchData.MatchScore);
        string visualScoreStr = visualScore.ToString() + " : " + m_matchData.MatchMaxSpeed.ToString() + " mps";

        matchResult.Add("visualScore", visualScoreStr);

#if PROPELLER_SDK
        PropellerSDK.SubmitMatchResult(matchResult);
#endif
    }
Ejemplo n.º 17
0
    public void PushFBDataToFuel()
    {
        Debug.Log("PushFBDataToFuel");

        string   provider   = "facebook";
        string   email      = fbemail;
        string   id         = FB.UserId;
        string   token      = FB.AccessToken;
        DateTime expireDate = FB.AccessTokenExpiresAt;
        string   nickname   = fbfirstname;    //not available from FB using first name
        string   name       = fbname;
        string   gender     = fbgender;

        Dictionary <string, string> loginInfo = null;

        loginInfo = new Dictionary <string, string> ();
        loginInfo.Add("provider", provider);
        loginInfo.Add("email", email);
        loginInfo.Add("id", id);
        loginInfo.Add("token", token);
        loginInfo.Add("nickname", nickname);
        loginInfo.Add("name", name);
        loginInfo.Add("gender", gender);

        Debug.Log
        (
            "*** loginInfo ***" + "\n" +
            "provider = " + loginInfo ["provider"].ToString() + "\n" +
            "email = " + loginInfo ["email"].ToString() + "\n" +
            "id = " + loginInfo ["id"].ToString() + "\n" +
            "token = " + loginInfo ["token"].ToString() + "\n" +
            "nickname = " + loginInfo ["nickname"].ToString() + "\n" +
            "name = " + loginInfo ["name"].ToString() + "\n" +
            "gender = " + loginInfo ["gender"].ToString() + "\n" +
            "expireDate = " + expireDate.ToLongDateString()
        );

#if PROPELLER_SDK
        PropellerSDK.SdkSocialLoginCompleted(loginInfo);
#endif
    }
Ejemplo n.º 18
0
    private void SetLanguageLocale()
    {
        Dictionary <string, string> langLookup = new Dictionary <string, string> ();

        langLookup.Add("English", "en");
        langLookup.Add("French", "fr");
        langLookup.Add("German", "de");
        langLookup.Add("Spanish", "es");
        langLookup.Add("Italian", "it");
        langLookup.Add("Portuguese", "pt");

        langLookup.Add("Chinese", "zh");
        langLookup.Add("ChineseSimplified", "zh");
        langLookup.Add("Korean", "ko");
        langLookup.Add("Japanese", "ja");
        langLookup.Add("Russian", "ru");
        langLookup.Add("Arabic", "ar");

        var unityLang = Application.systemLanguage;

        string langCode;

        if (langLookup.TryGetValue(unityLang.ToString(), out langCode))
        {
#if PROPELLER_SDK
            PropellerSDK.SetLanguageCode(langCode);
#endif
        }
        else
        {
            Debug.Log("SetLanguageLocale Error: " + unityLang.ToString() + " not supported.");
#if PROPELLER_SDK
            PropellerSDK.SetLanguageCode("en");
#endif
        }
    }
Ejemplo n.º 19
0
    public void syncUserValues()
    {
#if PROPELLER_SDK
        PropellerSDK.SyncUserValues();
#endif
    }
Ejemplo n.º 20
0
    /*
     * -----------------------------------------------------
     *                                              Start
     * -----------------------------------------------------
     */
    void Start()
    {
        Debug.Log("Start");

        SetLanguageLocale();

#if PROPELLER_SDK
        // enable push notifications
        PropellerSDK.EnableNotification(PropellerSDK.NotificationType.push);

        // disable local notifications
        //PropellerSDK.DisableNotification ( PropellerSDK.NotificationType.local );

        // validate enabled notifications - result is false since local notifications are disabled
        bool fuelEnabled = PropellerSDK.IsNotificationEnabled(PropellerSDK.NotificationType.all);
        if (fuelEnabled)
        {
            Debug.Log("fuelEnabled NotificationEnabled!");
        }
#endif

        GearFriction  = 0.98f;
        GearShapeType = 5;
        GameTime      = 7;
        ShowDebug     = 0;
        FBIcon        = 0;
        Split1Name    = "none";

        //get stored dynamic values
        if (PlayerPrefs.HasKey("gearfriction"))
        {
            GearFriction = PlayerPrefs.GetFloat("gearfriction");
        }
        if (PlayerPrefs.HasKey("geartype"))
        {
            GearShapeType = PlayerPrefs.GetInt("geartype");
        }
        if (PlayerPrefs.HasKey("gametime"))
        {
            GameTime = PlayerPrefs.GetInt("gametime");
        }
        if (PlayerPrefs.HasKey("showdebug"))
        {
            ShowDebug = PlayerPrefs.GetInt("showdebug");
        }
        if (PlayerPrefs.HasKey("fbicon"))
        {
            FBIcon = PlayerPrefs.GetInt("fbicon");
        }
        if (PlayerPrefs.HasKey("splitgroup"))
        {
            Split1Name = PlayerPrefs.GetString("splitgroup");
        }


        if (PlayerPrefs.HasKey("numLaunches"))
        {
            int numLaunches = PlayerPrefs.GetInt("numLaunches");
            numLaunches++;
            PlayerPrefs.SetInt("numLaunches", numLaunches);
        }

        setUserConditions();
    }