Init() public static méthode

public static Init ( string appId ) : void
appId string
Résultat void
Exemple #1
0
    void Start()
    {
        extraMessage = null;

        // Call before using any other methods on GameThrive.
        // Should only be called once when your game is loaded.
        GameThrive.Init("b49e69ca-d0b8-11e3-97bf-c3d1433e8bc1", "703322744261", HandleNotification);
    }
Exemple #2
0
 void Start()
 {
     extraMessage = null;
     textStatic   = text;
     // Call before using any other methods on GameThrive.
     // Should only be called once when your game is loaded.
     GameThrive.Init("7159e91c-aae9-11e4-a836-1b616324191f", "1038037127124", HandleNotification);
 }
Exemple #3
0
    void Start()
    {
        extraMessage = null;

        // The only required method you need to call to setup GameThrive to recieve push notifications.
        // Call before using any other methods on GameThrive.
        // Should only be called once when your game is loaded.
        // GameThrive.Init(GameThrive_AppId, GoogleProjectNumber, NotificationReceivedHandler(optional));
        GameThrive.Init("b49e69ca-d0b8-11e3-97bf-c3d1433e8bc1", "703322744261", HandleNotification);
    }
    void Start()
    {
        extraMessage = null;

        // The only required method you need to call to setup GameThrive to recieve push notifications.
        // Call before using any other methods on GameThrive.
        // Should only be called once when your game is loaded.
        // GameThrive.Init(GameThrive_AppId, GoogleProjectNumber, NotificationReceivedHandler(optional));
        GameThrive.Init("0e3f3ad6-c7ee-11e4-9aca-47e056863935", "660292827653", HandleNotification);
    }
Exemple #5
0
    // Use this for initialization
    void Start()
    {
        GameThrive.Init("7159e91c-aae9-11e4-a836-1b616324191f", "1038037127124", HandleNotification, true);
        ActivityInfo currentActivity = DataStore.LoadLastActivity();

        if (currentActivity != null)
        {
            activity          = currentActivity;
            textDistance.text = "" + activity.distance + " KM";
            textTime.text     = "" + "" + getValue((int)(activity.time / 3600)) + ":" + getValue((int)(activity.time / 60) % 60) + ":" + getValue((int)(activity.time % 60));
            currentTime       = activity.time;
        }
        if (googleLogout != null)
        {
            googleLogout.gameObject.SetActive(false);
        }
        if (googleAchievements != null)
        {
            googleAchievements.gameObject.SetActive(false);
        }
        if (googleLeadersBoard != null)
        {
            googleLeadersBoard.gameObject.SetActive(false);
        }
                #if UNITY_ANDROID && !UNITY_EDITOR
        staticText = text;
        try{
            if (androidPlugin == null)
            {
                using (AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                {
                    activityContext = activityClass.GetStatic <AndroidJavaObject>("currentActivity");
                }
                using (AndroidJavaClass pluginClass = new AndroidJavaClass("udea.telesalud.artica.com.plugin.AndroidPlugin"))
                {
                    if (pluginClass != null)
                    {
                        androidPlugin = pluginClass.CallStatic <AndroidJavaObject>("instance");
                        activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                            androidPlugin.Call("setContext", activityContext);
                            androidPlugin.Call("setCurrentDistance", activity.distance);
                        }));
                    }
                }
            }
        }
        catch (UnityException ex) {
            staticText.text = ex.Message.ToString();
        }
        catch (AndroidJavaException ex)
        {
            staticText.text = ex.Message.ToString();
        }
                #endif
    }
Exemple #6
0
    void Start()
    {
        GameThrive.Init("7159e91c-aae9-11e4-a836-1b616324191f", "1038037127124", HandleNotification, true);

        if (googleLogout != null)
        {
            googleLogout.gameObject.SetActive(false);
        }
        if (googleAchievements != null)
        {
            googleAchievements.gameObject.SetActive(false);
        }
        if (googleLeadersBoard != null)
        {
            googleLeadersBoard.gameObject.SetActive(false);
        }
        if (googleQuests != null)
        {
            googleQuests.gameObject.SetActive(false);
        }
        if (googleInbox != null)
        {
            googleInbox.gameObject.SetActive(false);
        }

        if (googleGifts != null)
        {
            googleGifts.gameObject.SetActive(false);
        }
        if (googleRequests != null)
        {
            googleRequests.gameObject.SetActive(false);
        }
        if (googleSavedGames != null)
        {
            googleSavedGames.gameObject.SetActive(false);
        }
                #if UNITY_ANDROID && !UNITY_EDITOR
        staticText = text;
        try{
            if (androidPlugin == null)
            {
                using (AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                {
                    activityContext = activityClass.GetStatic <AndroidJavaObject>("currentActivity");
                }
                using (AndroidJavaClass pluginClass = new AndroidJavaClass("com.artica.juegohabitos.androidplugins.GooglePlayServicesPlugin"))
                {
                    if (pluginClass != null)
                    {
                        androidPlugin = pluginClass.CallStatic <AndroidJavaObject>("instance");
                        activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                            androidPlugin.Call("setContext", activityContext);
                        }));
                    }
                }
            }
        }
        catch (UnityException ex) {
            staticText.text = ex.Message.ToString();
        }
        catch (AndroidJavaException ex)
        {
            staticText.text = ex.Message.ToString();
        }
                #endif
    }
Exemple #7
0
    //private int LastNotificationId = 0;


    // Use this for initialization
    void Start()
    {
        if (progress.Count == 0)
        {
            getProgress();
            staticClass.initLevels();
            market.SetActive(true);
            if (progress["sound"] == 0)
            {
                setSound(false);
            }
            if (progress["music"] == 1)
            {
                GameObject.Find("music").GetComponent <AudioSource>().enabled = true;
            }
            //опции
            GameObject.Find("settings folder").transform.GetChild(0).gameObject.SetActive(true);
            GameObject.Find(Localization.language).GetComponent <UIToggle>().value = true;
            GameObject.Find("settings folder").transform.GetChild(0).gameObject.SetActive(false);
            //
            //push
            GameThrive.Init("0e3f3ad6-c7ee-11e4-9aca-47e056863935", "660292827653", HandleNotification);
            GoogleCloudMessageService.instance.InitPushNotifications();
            Debug.Log("......................................");
            //AndroidNotificationManager.instance.ScheduleLocalNotification(Localization.Get("notiferTitleDay"), "notiferTitleDay", 600);
            //AndroidNotificationManager.instance.OnNotificationIdLoaded += OnNotificationIdLoaded;
            //AndroidNotificationManager.instance.LocadAppLaunchNotificationId();

            List <LocalNotificationTemplate> PendingNotifications;
            PendingNotifications = AndroidNotificationManager.instance.LoadPendingNotifications();
            bool flagNotifer = false;
            foreach (var PendingNotification in PendingNotifications)
            {
                if (PendingNotification.title == Localization.Get("notiferTitleDay"))
                {
                    if (PendingNotification.fireDate.Day == DateTime.Now.Day)
                    {
                        AndroidNotificationManager.instance.CancelLocalNotification(PendingNotification.id);
                        AndroidNotificationManager.instance.ScheduleLocalNotification(Localization.Get("notiferTitleDay"), Localization.Get("notiferMessageDay"), 60 * 60 * 24);
                    }
                    flagNotifer = true;
                }
            }
            if (!flagNotifer)
            {
                AndroidNotificationManager.instance.ScheduleLocalNotification(Localization.Get("notiferTitleDay"), Localization.Get("notiferMesssageDay"), 60 * 60 * 24);
            }

            Debug.Log("......................................");
            //
        }


        if (GooglePlayConnection.state == GPConnectionState.STATE_CONNECTED)
        {
            achievements.SetActive(true);
            leaderboards.SetActive(true);
            googlePlus.SetActive(false);
        }
        else if (progress["googlePlay"] == 1)
        {
            GooglePlayConnection.instance.connect();
        }

        //listen for GooglePlayConnection events
        GooglePlayConnection.instance.addEventListener(GooglePlayConnection.PLAYER_CONNECTED, OnPlayerConnected);
        GooglePlayConnection.instance.addEventListener(GooglePlayConnection.PLAYER_DISCONNECTED, OnPlayerDisconnected);
    }