Esempio n. 1
0
    void OnGUI()
    {
        float x      = 50.0f;
        float y      = 50.0f;
        float width  = Screen.width / 2 - x - 25.0f;
        float height = 100.0f;
        float margin = 25.0f;

        if (GUI.Button(new Rect(x, y, width, height), "Register"))
        {
            GCM.Register(SENDER_IDS);
        }

        x += width + margin * 2;

        if (GUI.Button(new Rect(x, y, width, height), "Unregister"))
        {
            GCM.Unregister();
        }

        x -= width + margin * 2;
        y += height + margin;

        if (GUI.Button(new Rect(x, y, width, height), "IsRegistered"))
        {
            _text = "IsRegistered = " + GCM.IsRegistered();
        }

        x += width + margin * 2;

        if (GUI.Button(new Rect(x, y, width, height), "GetRegisterationId"))
        {
            _text = "GetRegistrationId = " + GCM.GetRegistrationId();
        }

        x -= width + margin * 2;
        y += height + margin;

        if (GUI.Button(new Rect(x, y, width, height), "IsRegisteredOnServer"))
        {
            _text = "IsRegisteredOnServer = " + GCM.IsRegisteredOnServer();
        }

        x += width + margin * 2;

        if (GUI.Button(new Rect(x, y, width, height), "SetRegisteredOnServer"))
        {
            GCM.SetRegisteredOnServer(true);
            _text = "SetRegisteredOnServer";
        }

        x -= width + margin * 2;
        y += height + margin;

        if (GUI.Button(new Rect(x, y, width, height), "GetRegisterOnServerLifespan"))
        {
            _text = "GetRegisterOnServerLifespan = " + GCM.GetRegisterOnServerLifespan();
        }

        x += width + margin * 2;

        if (GUI.Button(new Rect(x, y, width, height), "SetRegisterOnServerLifespan"))
        {
            GCM.SetRegisterOnServerLifespan(30 * 1000);                 // 30 sec
            _text = "SetRegisterOnServerLifespan";
        }

        x -= width + margin * 2;
        y += height + margin;

        GUI.TextArea(new Rect(x, y, width * 2 + margin * 2, height), _text);

        y += height + margin;

        if (GUI.Button(new Rect(x, y, width, height), "Next"))
        {
            Application.LoadLevel("SubScene");
        }
    }
Esempio n. 2
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
    }