Ejemplo n.º 1
0
    private void Awake()
    {
        GCM.Initialize(); //create GCMReceiver

        // Set callbacks
        GCM.SetErrorCallback(errorId => Debug.Log("Parse notification error: " + errorId));
        GCM.SetUnregisteredCallback(registrationId => Debug.Log("Parse notification Unregistered: " + registrationId));
        GCM.SetDeleteMessagesCallback(total => Debug.Log("Parse notification DeleteMessages " + total));
        GCM.SetMessageCallback(HandleMessage);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        // Create receiver game object
        GCM.Initialize();

        // Set callbacks
        GCM.SetErrorCallback((string errorId) => {
            Debug.Log("Error!!! " + errorId);
            GCM.ShowToast("Error!!!");
            _text = "Error: " + errorId;
        });

        GCM.SetMessageCallback((Dictionary <string, object> table) => {
            Debug.Log("Message!!!");
            GCM.ShowToast("Message!!!");
            _text = "Message: " + System.Environment.NewLine;
            foreach (var key in  table.Keys)
            {
                _text += key + "=" + table[key] + System.Environment.NewLine;
            }
        });

        GCM.SetRegisteredCallback((string registrationId) => {
            Debug.Log("Registered!!! " + registrationId);
            GCM.ShowToast("Registered!!!");
            _text = "Register: " + registrationId;
        });

        GCM.SetUnregisteredCallback((string registrationId) => {
            Debug.Log("Unregistered!!! " + registrationId);
            GCM.ShowToast("Unregistered!!!");
            _text = "Unregister: " + registrationId;
        });

        GCM.SetDeleteMessagesCallback((int total) => {
            Debug.Log("DeleteMessages!!! " + total);
            GCM.ShowToast("DeleteMessaged!!!");
            _text = "DeleteMessages: " + total;
        });
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes GCM service.
 /// </summary>
 public void Initialize()
 {
     GCM.Initialize();
 }
Ejemplo n.º 4
0
    void Start()
    {
        GameGlobals.messageCount = PlayerPrefs.GetInt("challengeMessages", 0);
        GameGlobals.Songs        = new Hashtable();
        GameGlobals.otherIDs     = new ArrayList();
        //string trackFolder = "Assets/Audio/Resources/Tracks/";
        if (Debug.isDebugBuild)
        {
            Debug.Log("loading track names");
        }
        string trackFolder = "Tracks/";

        GameGlobals.Songs.Add("Clu - Ruby", new AudioTrack(trackFolder + "01/Songs/Clu - Ruby", trackFolder + "01/AlbumArt/Clu", true, false, "TKHSCLURUB"));
        GameGlobals.Songs.Add("Clu + Ft. Lindstrøm - Rà-àkõ-st", new AudioTrack(trackFolder + "01/Songs/Clu + Ft. Lindstrøm - Rà-àkõ-st", trackFolder + "01/AlbumArt/Clu", true, false, "TKHSCLURAA"));
        GameGlobals.Songs.Add("Cosmic Boy - Survival", new AudioTrack(trackFolder + "02/Songs/Cosmic Boy - Survival", trackFolder + "02/AlbumArt/Cosmic Boy", true, false, "TKHSCOSSUR"));
        GameGlobals.Songs.Add("Knife City - Bad News", new AudioTrack(trackFolder + "03/Songs/Knife City - Bad News", trackFolder + "03/AlbumArt/Knife City", true, false, "TKHSKNIBAD"));
        GameGlobals.Songs.Add("Knife City - Just Trash", new AudioTrack(trackFolder + "03/Songs/Knife City - Just Trash", trackFolder + "03/AlbumArt/Knife City", true, false, "TKHSKNIJUS"));
        GameGlobals.Songs.Add("Polygon APE - IncrediBULL", new AudioTrack(trackFolder + "04/Songs/Polygon APE - IncrediBULL", trackFolder + "04/AlbumArt/Polygon APE", true, false, "TKHSPOLINC"));
        GameGlobals.Songs.Add("Polygon APE - Riff Raff", new AudioTrack(trackFolder + "04/Songs/Polygon APE - Riff Raff", trackFolder + "04/AlbumArt/Polygon APE", true, false, "TKHSPOLRIF"));
        GameGlobals.Songs.Add("RIOT AKKT - TIGER CHILD", new AudioTrack(trackFolder + "05/Songs/RIOT AKKT - TIGER CHILD", trackFolder + "05/AlbumArt/Riot Akkt", true, false, "TKHSRIOTIG"));
        GameGlobals.Songs.Add("Sabrepulse + Knife City - First Crush", new AudioTrack(trackFolder + "06/Songs/Sabrepulse + Knife City - First Crush", trackFolder + "06/AlbumArt/Sabrepulse", true, false, "TKHSSABFIR"));
        GameGlobals.Songs.Add("Sabrepulse - A Girl I Know", new AudioTrack(trackFolder + "06/Songs/Sabrepulse - A Girl I Know", trackFolder + "06/AlbumArt/Sabrepulse", true, false, "TKHSSABAGI"));

        if (Debug.isDebugBuild)
        {
            Debug.Log(" finished loading track names");
        }

        GameGlobals.TileSets = new Hashtable();

        string tilesFolder = "Tiles/01/";

        GameGlobals.TileSets.Add("LED", new TileSet("LED", tilesFolder, true, "AAAAAAAAAA"));
        tilesFolder = "Tiles/02/";
        GameGlobals.TileSets.Add("Fruit", new TileSet("Fruit", tilesFolder, true, "BBBBBBBBBB"));
        tilesFolder = "Tiles/03/";
        GameGlobals.TileSets.Add("Stripes", new TileSet("Stripes", tilesFolder, true, "CCCCCCCCCC"));



        /*
         * string[] folderNames = Directory.GetFiles("Assets/Audio/Resources/Tracks");
         *
         * foreach(string folder in folderNames){
         *      //if(folder != "Assets/Audio/Resources/Tracks/.DS_Store")//macs add this file to this directory
         *      {
         *              if(!folder.Contains(".meta") && !folder.Contains(".DS_Store")){
         *                      string[] albumArt = Directory.GetFiles(folder+"/AlbumArt/");
         *                      string[] songNames = Directory.GetFiles(folder+"/Songs/");
         *
         *                      foreach(string currentSong in songNames){
         *                              if(!currentSong.Contains(".meta") && !folder.Contains(".DS_Store")){
         *                                      if( !albumArt[0].Contains(".DS_Store") )
         *                                              GameGlobals.Songs.Add( new AudioTrack( folder+"/Songs/"+currentSong, folder+"/AlbumArt/"+albumArt[0] ) );
         *                                      else
         *                                              GameGlobals.Songs.Add( new AudioTrack( folder+"/Songs/"+currentSong, folder+"/AlbumArt/"+albumArt[1] ) );
         *                              }
         *                      }
         *              }
         *      }
         * }
         *
         *
         * foreach(AudioTrack current in GameGlobals.Songs){
         *      if (Debug.isDebugBuild) Debug.LogError(current.song + " - " + current.albumArt);
         * }
         */
        if (Debug.isDebugBuild)
        {
            Debug.Log("setting selected track");
        }
        GameGlobals.selectedTrack = ((AudioTrack)GameGlobals.Songs["Clu - Ruby"]);

        if (Debug.isDebugBuild)
        {
            Debug.Log("finished setting selected track");
        }


        GameGlobals.sound    = (PlayerPrefs.GetInt("Sound") == 0) ? true: false;
        GameGlobals.messages = (PlayerPrefs.GetInt("Messages") == 0) ? true : false;

        //everybody starts with 3 multipliers
        if (PlayerPrefs.GetInt("FirstTimePlaying") == 0)
        {
            PlayerPrefs.SetInt("FirstTimePlaying", 1);
            //PlayerPrefs.SetInt("InGameCurrency", 0);
            PlayerPrefs.SetInt("X2s", 3);
        }

        if (PlayerPrefs.GetString("TileSet") == "" || PlayerPrefs.GetString("TileSet") == null)
        {
            PlayerPrefs.SetString("TileSet", "LED");
        }

        GameGlobals.selectedTiles = ((TileSet)GameGlobals.TileSets[PlayerPrefs.GetString("TileSet")]);



        DontDestroyOnLoad(this);
        SetCallbacks();
#if !UNITY_EDITOR && !UNITY_WEB_PLAYER && !UNITY_STANDALONE_OSX && !UNITY_STANDALONE_WIN
        FacebookAccess.init(false);
#else
        GSApi.facebookConnect("CAAHZBQNnoPZBMBAFBJJXuqFhEbWkjfEKOwUNzZAGT2nZCvQkLZBB43fbk2M5F3YoDc1nRSaEDCA6zspcZAL9hFhRQjNSYEkLVtcy8Ha1ewceuXv1CAi41XoudeMCBrmgX8V0yZCGVqqmIhqkXfSqJeSbJSWZBieMuze7N0lEZBK2VDeuggBR4BD2qluDUbGdVOmeCpnar5i6K9sMUPY6GSwZBH");
        //GSApi.facebookConnect("CAAHZBQNnoPZBMBABWZBc7ZA9AnojVXSwDpJ3I5wtUTntrVnuU67EYKxWg9AKVF3UidCGb66K8sdDPZCiizffbaDPfeMlezKBKfRy1mEwhWYm6IKQmSxf89ZAO4EZC6vbmJTZCZA0cCpiNVg1LLbhbhVTZC5W3sZAGYteZAE4QmGzXyCZAMQhYeRlZBlgWLvQHaXtWDd6fRXMVJc3m9I7qAVwkjaS8h");
#endif

        if (Debug.isDebugBuild)
        {
            Debug.Log("setting account info");
        }

        Hashtable details = GSApi.accountDetails();


        if (!GSApi.OfflineMode() && details["userId"] != null)
        {
            if (details["userId"] != null)
            {
                GameGlobals.userID = (string)details["userId"];
            }


            if (Debug.isDebugBuild)
            {
                Debug.Log("finished setting account info");
            }
            GameGlobals.online = true;
            dlcManager.initDLC();            //start managing dlc
        }
#if UNITY_ANDROID && !UNITY_EDITOR
        if (Debug.isDebugBuild)
        {
            Debug.Log("setting GCM");
        }
        GCM.Initialize();
        IAP.init(key);

        if (!GCM.IsRegistered())
        {
            GCM.Register();
        }
        if (!GCM.IsRegisteredOnServer())
        {
            GCM.SetRegisteredOnServer(true);
        }
        if (Debug.isDebugBuild)
        {
            Debug.Log("finished setting GCM");
        }
#endif
    }