Пример #1
0
    /// <summary>
    /// Execs the method.
    /// </summary>
    /// <returns><c>true</c>, if method was execed, <c>false</c> otherwise.</returns>
    /// <param name="method">Method.</param>
    /// <param name="parameters">Parameters.</param>
    public static bool ExecMethod(string method, List <object> parameters)
    {
        string parametersString = FuelSDKCommon.Serialize(parameters);

        if (method == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "executing undefined method");
        }
        else
        {
            if (parameters == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "executing method '" + method + "' with undefined parameters");
            }
            else
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "executing method '" + method + "' with parameters: " + parametersString);
            }
        }

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().ExecMethod(method, parametersString);
        }

        return(succeeded);
    }
Пример #2
0
    void onFuelSDKNotificationDisabled(Dictionary <string, object> data)
    {
        object notificationTypeObject;
        bool   keyExists = data.TryGetValue("notificationType", out notificationTypeObject);

        if (notificationTypeObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected notification type");
            return;
        }

        if (!(notificationTypeObject is long))
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid notification type data type: " + notificationTypeObject.GetType().Name);
            return;
        }

        int notificationTypeValue = (int)((long)notificationTypeObject);

        if (!Enum.IsDefined(typeof(NotificationType), notificationTypeValue))
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unsuppported notification type value: " + notificationTypeValue.ToString());
            return;
        }
    }
        private Dictionary <string, object> parseToDic(string content)
        {
            object messageObject = FuelSDKCommon.Deserialize(content);

            if (messageObject == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "message could not be deserialized");
                return(null);
            }

            Dictionary <string, object> messageDictionary = null;

            try{
                messageDictionary = messageObject as Dictionary <string, object>;

                if (messageDictionary == null)
                {
                    FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, " message data type: " + messageObject.GetType().Name);
                    return(null);
                }
            }catch (Exception e) {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, " message data type: " + messageObject.GetType().Name + " error message : " + e.Message);
                return(null);
            }

            return(messageDictionary);
        }
Пример #4
0
    /// <summary>
    /// Sends the progress.
    /// </summary>
    /// <param name="progress">Progress.</param>
    /// <param name="tags">Tags.</param>
    public static void SendProgress(Dictionary <string, object> progress, List <object> tags)
    {
        string progressString = FuelSDKCommon.Serialize(progress);
        string tagsString     = FuelSDKCommon.Serialize(tags);

        if (progress == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "sending undefined progress");
        }
        else
        {
            if (tags == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "sending progress '" + progressString + "' with undefined tags");
            }
            else
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "sending progress '" + progressString + "' with tags: " + tagsString);
            }
        }

        if (progressString == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unable to serialize the progress dictionary");
            return;
        }

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SendProgress(progressString, tagsString);
        }
    }
Пример #5
0
    void Awake()
    {
        Instance = this;

        mIgniteLoaded = false;

        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "FuelIgnite Awake!");
    }
Пример #6
0
    /// <summary>
    /// Begins an asynchronous operation to request the player's challenge counts from Propeller.
    /// </summary>
    public static void SyncChallengeCounts()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "synching challenge counts");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SyncChallengeCounts();
        }
    }
Пример #7
0
    /// <summary>
    /// Begins an asynchronous operation to indicate sharing info is complete.
    /// </summary>
    public static void SdkSocialShareCompleted()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "social share completed");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SdkSocialShareCompleted();
        }
    }
Пример #8
0
    /// <summary>
    /// Begins an asynchronous operation to request the virtual goods from Propeller.
    /// </summary>
    public static void SyncVirtualGoods()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "syncing virtual goods");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SyncVirtualGoods();
        }
    }
Пример #9
0
    public static void DisableNotification(NotificationType notificationType)
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "disabling notification type: " + notificationType.ToString());

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().DisableNotification(notificationType);
        }
    }
Пример #10
0
    /// <summary>
    /// Begins an asynchronous operation to request the tournament information from Propeller.
    /// </summary>
    public static void SyncTournamentInfo()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "synching tournament info");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SyncTournamentInfo();
        }
    }
Пример #11
0
    /// <summary>
    /// Restores cancelled Propeller SDK local notifications
    /// </summary>
    public static void RestoreAllLocalNotifications()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "restoring all local notifications");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().RestoreAllLocalNotifications();
        }
    }
Пример #12
0
    /// <summary>
    /// Sets the orientationui ignite.
    /// </summary>
    /// <param name="orientation">Orientation.</param>
    public static void SetOrientationUIIgnite(ContentOrientation orientation)
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting the ignite UI orientation: " + orientation.ToString());

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SetOrientationUIIgnite(orientation);
        }
    }
Пример #13
0
    //Dynamics

    /// <summary>
    /// Initializes dynamics.
    /// </summary>
    public static void InitializeDynamics()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "initializing the dynamics product");

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().InitializeDynamics();
        }
    }
Пример #14
0
    public override void SetOrientationUIIgnite(FuelSDK.ContentOrientation orientation)
    {
        AndroidJavaObject fuelSDKOrientationType = getFuelSDKOrientationType(orientation);

        if (fuelSDKOrientationType == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid orientation type");
        }

        m_jniFuelSDKUnity.CallStatic("setOrientationuiIgnite", fuelSDKOrientationType);
    }
Пример #15
0
    public override bool IsNotificationEnabled(FuelSDK.NotificationType notificationType)
    {
        AndroidJavaObject fuelSDKNotificationType = getFuelSDKNotificationType(notificationType);

        if (fuelSDKNotificationType == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid notification type");
            return(false);
        }

        return(m_jniFuelSDKUnity.CallStatic <bool> ("isNotificationEnabled", fuelSDKNotificationType));
    }
Пример #16
0
    /// <summary>
    /// Sets the listener.
    /// </summary>
    /// <param name="listener">Listener.</param>
    public static void setListener(FuelSDKListener listener)
    {
        if (listener == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting undefined listener");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting listener");
        }

        m_listener = listener;
    }
Пример #17
0
    /// <summary>
    /// Begins an asynchronous operation to request the user values from Propeller.
    /// </summary>
    /// <returns><c>true</c>, if user values was synced, <c>false</c> otherwise.</returns>
    public static bool SyncUserValues()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "synching user values");

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().SyncUserValues();
        }

        return(succeeded);
    }
Пример #18
0
    /// <summary>
    /// Launch the SDK with the provided listener to handle callbacks.
    /// </summary>
    /// <param name='listener'>
    /// A class that subclasses the PropellerSDKListener abstract class that will receive various callbacks.
    /// </param>
    public static bool Launch()
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "launching the compete UI");

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().Launch();
        }

        return(succeeded);
    }
Пример #19
0
    void onFuelSDKUserValues(Dictionary <string, object> data)
    {
        object conditionsObject;
        bool   keyExists = data.TryGetValue("dynamicConditions", out conditionsObject);

        if (conditionsObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected dynamic conditions");
            return;
        }

        Dictionary <string, object> conditions = null;

        try{
            conditions = conditionsObject as Dictionary <string, object>;

            if (conditions == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid conditions data type: " + conditionsObject.GetType().Name);
                return;
            }
        }catch (Exception e) {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid conditions data type: " + conditionsObject.GetType().Name + " error message : " + e.Message);
            return;
        }

        object variablesObject;

        keyExists = data.TryGetValue("variables", out variablesObject);

        if (variablesObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected dynamic variables");
            return;
        }

        Dictionary <string, object> variables = null;

        try{
            variables = variablesObject as Dictionary <string, object>;

            if (variables == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid variables data type: " + variablesObject.GetType().Name);
                return;
            }
        }catch (Exception e) {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid variables data type: " + variablesObject.GetType().Name + " error message : " + e.Message);
            return;
        }
    }
Пример #20
0
    void onFuelSDKVirtualGoodList(Dictionary <string, object> data)
    {
        object transactionIDObject;
        bool   keyExists = data.TryGetValue("transactionID", out transactionIDObject);

        if (transactionIDObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected transaction ID");
            return;
        }

        if (!(transactionIDObject is string))
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid transaction ID data type: " + transactionIDObject.GetType().Name);
            return;
        }

        //temp comment due to warning
        //string transactionID = (string)transactionIDObject;


        object virtualGoodsObject;

        keyExists = data.TryGetValue("virtualGoods", out virtualGoodsObject);

        if (virtualGoodsObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected virtual goods list");
            return;
        }

        List <object> virtualGoods = null;

        try{
            virtualGoods = virtualGoodsObject as List <object>;

            if (virtualGoods == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid virtual goods list data type: " + virtualGoodsObject.GetType().Name);
                return;
            }
        }catch (Exception e) {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid virtual goods list data type: " + virtualGoodsObject.GetType().Name + " error message : " + e.Message);
            return;
        }

        //OnPropellerSDKVirtualGoodList (transactionID, virtualGoods);

        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.INFO, "FUEL DEBUG LOG ::: FuelManager:: onFuelSDKVirtualGoodList");
    }
Пример #21
0
    /// <summary>
    /// Sets the language code for the Propeller SDK online content. Must be compliant to ISO 639-1.
    /// If the language code is not supported, then the content will default to English (en)
    /// </summary>
    /// <param name="languageCode">
    /// Two character string language code to set the Fuel SDK online content to.
    /// </param>
    public static void SetLanguageCode(string languageCode)
    {
        if (languageCode == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "setting an undefined language code");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting language code: " + languageCode);
        }

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SetLanguageCode(languageCode);
        }
    }
Пример #22
0
    /// <summary>
    /// Begins an asynchronous operation to indicate login info is complete.
    /// </summary>
    /// <param name="loginInfo">Login info.</param>
    public static void SdkSocialLoginCompleted(Dictionary <string, string> loginInfo)
    {
        if (loginInfo == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "social login completed unsuccessfully");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "social login completed with login info: " + FuelSDKCommon.Serialize(loginInfo));
        }

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SdkSocialLoginCompleted(loginInfo);
        }
    }
Пример #23
0
    public static void SetNotificationToken(string notificationToken)
    {
        if (notificationToken == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "setting an undefined notification token");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting notification token: " + notificationToken);
        }

        if (!Application.isEditor)
        {
            GetFuelSDKPlatform().SetNotificationToken(notificationToken);
        }
    }
Пример #24
0
    void onFuelSDKVirtualGoodConsumeSuccess(Dictionary <string, object> data)
    {
        object transactionIDObject;
        bool   keyExists = data.TryGetValue("transactionID", out transactionIDObject);

        if (transactionIDObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected transaction ID");
            return;
        }

        if (!(transactionIDObject is string))
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid transaction ID data type: " + transactionIDObject.GetType().Name);
            return;
        }
    }
Пример #25
0
    private bool validateDataReceived(DataReceiverAction action, Dictionary <string, object> data)
    {
        if (data == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, action.ToString() + " - undefined data");
            return(false);
        }

        object successObject;
        bool   keyExists = data.TryGetValue("success", out successObject);

        if (successObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, action.ToString() + " - missing expected 'success' field");
            return(false);
        }

        if (!(successObject is bool))
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, action.ToString() + " - invalid success result data type: " + successObject.GetType().Name);
            return(false);
        }

        bool success = (bool)successObject;

        if (!success)
        {
            object reasonObject;
            keyExists = data.TryGetValue("reason", out reasonObject);

            if (reasonObject == null || keyExists == false)
            {
                reasonObject = "undefined failure reason";
            }

            if (!(reasonObject is string))
            {
                reasonObject = "invalid failure reason data type: " + reasonObject.GetType().Name;
            }

            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, action.ToString() + " - " + reasonObject.ToString());
        }

        return(success);
    }
Пример #26
0
    void onFuelSDKIgniteEvents(Dictionary <string, object> data)
    {
        FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "FuelIgnite : onFuelSDKIgniteEvents");

        mIgniteEventsDictionary = new Dictionary <string, IgniteEvent> ();

        object eventsObject;
        bool   keyExists = data.TryGetValue("events", out eventsObject);

        if (eventsObject == null || keyExists == false)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected event list");
            return;
        }

        List <object> eventList = null;

        try{
            eventList = eventsObject as List <object>;

            if (eventList == null)
            {
                FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid event list data type: " + eventsObject.GetType().Name);
                return;
            }
        }catch (Exception e) {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid event list data type: " + eventsObject.GetType().Name + " error message : " + e.Message);
            return;
        }



        foreach (object eventObj in eventList)
        {
            IgniteEvent igniteEvent = new IgniteEvent();
            igniteEvent.Create(eventObj as Dictionary <string, object>);

            mIgniteEventsDictionary [igniteEvent.Id] = igniteEvent;
        }

        mIgniteEventsRecieved = true;
    }
Пример #27
0
    /// <summary>
    /// Gets the leader board.
    /// </summary>
    /// <returns><c>true</c>, if leader board was gotten, <c>false</c> otherwise.</returns>
    /// <param name="boardID">Board I.</param>
    public static bool GetLeaderBoard(string boardID)
    {
        if (boardID == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "getting leaderboard with undefined leaderboard ID");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "getting leaderboard with leaderboard ID: " + boardID);
        }

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().GetLeaderBoard(boardID);
        }

        return(succeeded);
    }
Пример #28
0
    /// <summary>
    /// Gets the mission.
    /// </summary>
    /// <returns><c>true</c>, if mission was gotten, <c>false</c> otherwise.</returns>
    /// <param name="missionID">Mission I.</param>
    public static bool GetMission(string missionID)
    {
        if (missionID == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "getting mission with undefined mission ID");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "getting mission with mission ID: " + missionID);
        }

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().GetMission(missionID);
        }

        return(succeeded);
    }
Пример #29
0
    /// <summary>
    /// Joins an event.
    /// </summary>
    /// <returns><c>true</c>, if join request was sent through, <c>false</c> otherwise.</returns>
    /// <param name="eventID">Event ID.</param>
    public static bool JoinEvent(string eventID)
    {
        if (eventID == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "joining with undefined event ID");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "joining with event ID: " + eventID);
        }

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().JoinEvent(eventID);
        }

        return(succeeded);
    }
Пример #30
0
    /// <summary>
    /// Gets the quest.
    /// </summary>
    /// <returns><c>true</c>, if quest was gotten, <c>false</c> otherwise.</returns>
    /// <param name="questID">Quest I.</param>
    public static bool GetQuest(string questID)
    {
        if (questID == null)
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "getting quest with undefined quest ID");
        }
        else
        {
            FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "getting quest with quest ID: " + questID);
        }

        bool succeeded = false;

        if (!Application.isEditor)
        {
            succeeded = GetFuelSDKPlatform().GetQuest(questID);
        }

        return(succeeded);
    }