Example #1
0
    void OnGUI()
    {
        if (GUILayout.Button("login"))
        {
#if UNITY_WEB_PLAYER || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#else
            FacebookAccess.login();
#endif
            oNGUIState = OnGUIState.none;
        }

        if (GUILayout.Button("accountDetails", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            Hashtable table = GSApi.accountDetails();
            Debug.Log(table["displayName"]);


            oNGUIState = OnGUIState.none;
        }
        if (GUILayout.Button("challenge sceen", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GameGlobals.loading = true;
            Application.LoadLevelAsync("FriendsList");

            oNGUIState = OnGUIState.none;
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks;

        Hashtable accountDetails   = GSApi.accountDetails();
        Hashtable challengeDetails = GSApi.listChallengeDetails(GameGlobals.relevantID);
        double    pot = (double)((Hashtable)challengeDetails["challenge"])["currency3Wager"];

        if (pot > ((double)accountDetails["currency3"]))
        {
            AcceptButton.gameObject.SetActive(false);
            PlayButton.gameObject.SetActive(false);
            RejectButton.transform.localPosition = new Vector3(400f, -1275.456f, 0f);
        }
        else
        {
            BuyCoinsButton.gameObject.SetActive(false);
        }



        /*
         * if(false){
         *      AcceptButton.gameObject.SetActive(false);
         *      PlayButton.gameObject.SetActive(false);
         *      RejectButton.transform.localPosition = new Vector3(400f,-1275.456f,0f);
         * }
         * else{
         *      BuyCoinsButton.gameObject.SetActive(false);
         * }
         */
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        //price = GameGlobals.selectedTrack.inGameCurrencyCost.ToString();
        if (confirmation)
        {
            if (yes.pressed)
            {
                yes.pressed  = false;
                confirmation = false;

                Hashtable accountDetails = GSApi.accountDetails();

                if (((double)accountDetails["currency3"]) < (double)GameGlobals.selectedTrack.gamesparkCurrencyCost)
                {
                    StartCoroutine(InsufficentFunds());
                }
                else
                {
                    if (dlc.PurchaseTrack(GameGlobals.selectedTrack.song, GameGlobals.selectedTrack.challengeShortCode.Replace("TKHS", "TK")))
                    {
                        GameGlobals.loading = true;
                        Application.LoadLevelAsync("BuyTracks");
                    }
                }
            }
            else if (no.pressed)
            {
                no.pressed   = false;
                confirmation = false;
                ShowConfirmation(false);
            }
        }
    }
Example #4
0
    IEnumerator CheckXML(AssetBundle bundle)
    {
        Hashtable details = GSApi.accountDetails();
        Hashtable virtualGoods;
        Hashtable costs    = GSApi.listVirtualGoods();
        ArrayList goodList = (ArrayList)costs["virtualGoods"];

        XmlDocument xmldoc = new XmlDocument();

        xmldoc.LoadXml(((TextAsset)bundle.Load("dlc", typeof(TextAsset))).text);
        var list = xmldoc.GetElementsByTagName("dlctrack");

        virtualGoods = (Hashtable)details["virtualGoods"];
        foreach (XmlElement node in list)
        {
            if (details["virtualGoods"] != null &&
                (virtualGoods[node["id"].InnerText.Replace("TKHS", "TK")] != null))
            {
                if (!System.IO.File.Exists(Application.persistentDataPath + "/" + node["id"].InnerText + ".unity3d"))
                {
                    if (Debug.isDebugBuild)
                    {
                        Debug.Log("download missing track");
                    }
                    yield return(StartCoroutine("DownloadBundle", node["id"].InnerText.Replace("TKHS", "TK")));
                }
                AddDLCTrack(node["artist"].InnerText + "-" + node["track"].InnerText, node["image"].InnerText, node["id"].InnerText, true, 0, 0);
            }
            else
            {
                int bb = 0;
                int gs = 0;
                foreach (Hashtable table in goodList)
                {
                    if ((string)table["shortcode"] == node["id"].InnerText.Replace("TKHS", "TK"))
                    {
                        gs = (int)(double)table["currency2Cost"];
                        bb = (int)(double)table["currency3Cost"];
                    }
                }
                AddDLCTrack(node["artist"].InnerText + "-" + node["track"].InnerText, node["image"].InnerText, node["id"].InnerText, false, bb, gs);
                if (Debug.isDebugBuild)
                {
                    Debug.Log("I don't own this track");
                }
            }

            /*node[artist].InnerText
             * node[track].InnerText
             * node[image].InnerText
             * node[id].InnerText*/

            if (Debug.isDebugBuild)
            {
                Debug.LogWarning(node.InnerText);
            }
        }
    }
    void Start()
    {
        //pierce/ if we're not online hide all this

        GameSparks GSApi          = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks;
        Hashtable  accountDetails = GSApi.accountDetails();
        int        currency       = (int)((double)accountDetails["currency3"]);

        (GetComponent(typeof(UILabel)) as UILabel).text = ((int)((double)accountDetails["currency3"])).ToString();
        //(GetComponent(typeof(UILabel)) as UILabel).text = coinPurse.ToString();
    }
    // Use this for initialization
    void Start()
    {
        if (GameGlobals.selectedTrack.dlc && !GameGlobals.selectedTrack.purchased)
        {
            GameGlobals.selectedTrack = ((AudioTrack)GameGlobals.Songs["Clu - Ruby"]);
        }

        GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks;

        Hashtable accountDetails = GSApi.accountDetails();

        if (accountDetails != null)
        {
            int currency = (int)((double)accountDetails["currency3"]);
            stakes.items.Clear();

            for (int i = 0; i <= currency && i < 1000; i += 100)
            {
                stakes.items.Add(i.ToString());
            }
            stakes.selection = "0";

            track.items.Clear();
            foreach (DictionaryEntry currentTrack in GameGlobals.Songs)
            {
                //Check to see if this track is dlc & bought or not DLC before adding it as an option
                if (!((AudioTrack)currentTrack.Value).dlc || ((AudioTrack)currentTrack.Value).purchased)
                {
                    track.items.Add((string)currentTrack.Key);
                }
                //Pierce/ it would be nice if we could see if other people in this challenge own this song before adding it too
                //or I could make another scene that says you need to purchase "song" to play this challenge hmmm, sounds like f*****g work to me

                if (GameGlobals.selectedTrack.song.Contains((string)currentTrack.Key))
                {
                    track.selection = (string)currentTrack.Key;
                }
            }
        }
    }
Example #7
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
    }
    void OnGUI()
    {
        // center labels
        GUI.skin.label.alignment     = TextAnchor.MiddleCenter;
        GUI.skin.textField.alignment = TextAnchor.MiddleCenter;

        //GUILayout.BeginVertical();

        if (GUILayout.Button("Clear Log", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            myLog = "";
            myLogQueue.Clear();
        }

        if (GUILayout.Button("accountDetails", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.accountDetails();
        }
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("facebookConnect", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.facebookConnect(fbToken);
        }

        fbToken = GUILayout.TextField(fbToken, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();



        GUILayout.BeginHorizontal();

        if (GUILayout.Button("logEvent - HS", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            int hsScoreInt = 0;
            int hsLevelInt = 0;
            if (int.TryParse(HSScore, out hsScoreInt) && int.TryParse(HSLevel, out hsLevelInt))
            {
                GSApi.logEvent("HS", new EventVal("HS", int.Parse(HSScore)), new EventVal("GL", int.Parse(HSLevel)));
            }
            else
            {
                Debug.Log("Non numeric values....");
            }
        }

        HSScore = GUILayout.TextField(HSScore, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));
        HSLevel = GUILayout.TextField(HSLevel, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("buyVirtualGoodWithCurrency", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            int buyGoodQtyInt = 0;
            if (int.TryParse(buyGoodQty, out buyGoodQtyInt))
            {
                GSApi.buyVirtualGoodWithVirtualCurrency(buyGoodShortCode, buyGoodQtyInt, 3);
            }
            else
            {
                Debug.Log("Non numeric values....");
            }
        }

        buyGoodShortCode = GUILayout.TextField(buyGoodShortCode, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));
        buyGoodQty       = GUILayout.TextField(buyGoodQty, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();


        if (GUILayout.Button("listAchievements", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listAchievements();
        }

        if (GUILayout.Button("listGameFriends", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listGameFriends();
        }

        if (GUILayout.Button("listVirtualGoods", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listVirtualGoods();
        }

        if (GUILayout.Button("listChallengeTypes", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listChallengeTypes();
        }

        if (GUILayout.Button("listIssuedChallenges", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listIssuedChallenges();
        }

        if (GUILayout.Button("listRunningChallenges", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listRunningChallenges();
        }

        if (GUILayout.Button("listMessages", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.listMessages();
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("dismissMessage", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.dismissMessage(dismissMessageId);
        }

        dismissMessageId = GUILayout.TextField(dismissMessageId, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("acceptChallenge", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GSApi.acceptChallenge(acceptChallengeInstanceId, acceptChallengeMessage);
        }

        acceptChallengeInstanceId = GUILayout.TextField(acceptChallengeInstanceId, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));
        acceptChallengeMessage    = GUILayout.TextField(acceptChallengeMessage, GUILayout.Width(itemWidth / 2), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        GUI.TextArea(new Rect(420, 5, Screen.width - 425, Screen.height - 10), myLog);

        Hashtable logEvent = new Hashtable();

        logEvent.Add("@class", ".LogEventRequest");
        logEvent.Add("HS", 1234);
        logEvent.Add("GL", "TRACK1");
    }