// 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); * } */ }
public void Load() { GameSparks GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Debug.LogWarning("posting score to challenge"); GSApi.logChallengeScore(GameGlobals.relevantID, GameGlobals.currentScore, GameGlobals.selectedTrack.challengeShortCode); GameGlobals.loading = true; MenuMusic.Instance.SetEnabled(true); if (GameGlobals.gameState == GameGlobals.GameState.Journey) { Application.LoadLevelAsync("Journey"); } else if (GameGlobals.gameState == GameGlobals.GameState.AgainstTheClock) { if (!GSApi.OfflineMode()) { GSApi.logHighScore(GameGlobals.currentScore, GameGlobals.selectedTrack.challengeShortCode); } Application.LoadLevelAsync("BuyTracks"); } else if (GameGlobals.gameState == GameGlobals.GameState.Challenge) { Application.LoadLevelAsync("ChallengeDetails"); } }
public void Load() { if (areYouSure != null) { GameSparks GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Debug.LogWarning("posting score to challenge"); GSApi.logChallengeScore(GameGlobals.relevantID, GameGlobals.currentScore, GameGlobals.selectedTrack.challengeShortCode); GameGlobals.challengeAttemptsRemaining--; if (GameGlobals.gameState == GameGlobals.GameState.AgainstTheClock) { //Piere/ send score to highscore table if (!GSApi.OfflineMode()) { GSApi.logHighScore(GameGlobals.currentScore, GameGlobals.selectedTrack.challengeShortCode); } } } if (GameGlobals.currentScore > GameGlobals.opponentsScore) { GameGlobals.opponentsScore = GameGlobals.currentScore; } GameGlobals.loading = true; Application.LoadLevel(Application.loadedLevelName); }
void OnClick() { //pierce/ change the status of this challenge to rejected (GameGlobals.relivantID should still be set) GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; GSApi.declineChallenge(GameGlobals.relevantID, null); GameGlobals.loading = true; Application.LoadLevelAsync("ChallengesList"); }
public static void MessageReceived (GameSparks.Api.Messages.GSMessage message){ if (m_MessageReceived == null) return; try{ m_MessageReceived (null, new GameSparksMessageReceivedEventArgs (message.JSONData)); }catch(Exception e){ DebugMsg(e.ToString()); } }
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() { GameGlobals.otherIDs.Clear(); Debug.Log("get gs"); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; friends = new ArrayList(); Hashtable friendsGS = GSApi.listGameFriends(); Debug.Log("got gs"); if (friendsGS != null) { foreach (Hashtable friend in ((ArrayList)friendsGS["friends"])) { Debug.Log("start adding friend"); friends.Add(new Friend { id = (string)friend["id"], displayName = (string)friend["displayName"], online = (bool)friend["online"] }); Debug.Log("stop adding friend"); } } else { Debug.LogWarning("no friends found or not signed in"); } /*foreach(DictionaryEntry friend in ((ArrayList)friendsGS["friends"])) * { * Debug.Log(friend.Key); * Debug.Log(friend.Value); * }*/ //populate from gamespark /* * friends.Add(new Friend{id = "a", displayName = "aaa", online = true}); * friends.Add(new Friend{id = "b", displayName = "bbbbb", online = true}); * friends.Add(new Friend{id = "c", displayName = "ccccccccc", online = true}); * friends.Add(new Friend{id = "d", displayName = "dddd", online = true}); * friends.Add(new Friend{id = "e", displayName = "ee", online = true}); * friends.Add(new Friend{id = "f", displayName = "ffff", online = true}); * friends.Add(new Friend{id = "g", displayName = "ggggggg", online = true}); */ Scroll_Item_FriendsList.itemCount = 1; for (int counter = 0; counter < friends.Count; counter++) { GameObject item = Instantiate(friendPrefab, friendPrefab.transform.position, Quaternion.identity) as GameObject; item.transform.parent = this.transform; item.transform.localScale = new Vector3(1, 1, 1); item.transform.localPosition = item.transform.position + new Vector3(0, -46 * counter, 0); (item.GetComponentInChildren(typeof(Scroll_Item_FriendsList)) as Scroll_Item_FriendsList).id = ((Friend)friends[counter]).id; (item.GetComponentInChildren(typeof(Scroll_Item_FriendsList)) as Scroll_Item_FriendsList).name.text = ((Friend)friends[counter]).displayName; } }
// Use this for initialization void Start() { GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; foreach (GameObject obj in endScreenElements) { obj.SetActive(false); } foreach (GameObject obj in endScreenSinglePlayer) { obj.SetActive(false); } foreach (GameObject obj in journeyTicks) { obj.SetActive(false); } foreach (GameObject obj in ticks) { obj.SetActive(false); } foreach (GameObject obj in endScreenSinglePlayer2) { obj.SetActive(false); } foreach (GameObject obj in endScreenAgainstThecClock1) { obj.SetActive(false); } foreach (GameObject obj in endScreenAgainstThecClock2) { obj.SetActive(false); } foreach (GameObject obj in endScreenChallenge) { obj.SetActive(false); } target1.text = GameGlobals.challengeScore1.ToString(); target2.text = GameGlobals.challengeScore2.ToString(); target3.text = GameGlobals.challengeScore3.ToString(); }
// Use this for initialization void Start() { ShowConfirmation(false); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable virtualGoodsResponse = GSApi.listVirtualGoods(); ArrayList virtualGoods = (ArrayList)(virtualGoodsResponse["virtualGoods"]); foreach (Hashtable good in virtualGoods) { if ((string)((Hashtable)good)["shortCode"] == "X2M") { price.text = ((double)((Hashtable)good)["currency3Cost"]).ToString(); break; } } }
void Start() { GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; //GSApi.listChallengeDetails(GameGlobals.relevantID); GSApi.GSMessageReceived += (GS, args) => { Debug.Log("message recieved"); if (args.Message.ContainsKey("challenge")) { Debug.Log("adding line"); if ((string)(((Hashtable)args.Message["challenge"])["challengeId"]) == GameGlobals.relevantID) { Debug.Log((string)args.Message["who"]); Debug.Log((string)args.Message["message"]); callbackString = (whiteGreySwitch ? "[FFFFFF]" : "[AAAAAA]") + (string)args.Message["who"] + ": " + (string)args.Message["message"]; whiteGreySwitch = !whiteGreySwitch; } } }; mInput = GetComponent <UIInput>(); ArrayList messages = GSApi.GetMessages()["messageList"] as ArrayList; if (messages != null) { foreach (Hashtable message in messages) { if (((string)message["@class"] == ".ChallengeChatMessage")) { if (((string)((Hashtable)message["challenge"])["challengeId"]) == GameGlobals.relevantID) { Debug.Log(message["message"]); textList.Add((whiteGreySwitch ? "[FFFFFF]" : "[AAAAAA]") + ((string)message["who"]) + ": " + ((string)message["message"])); whiteGreySwitch = !whiteGreySwitch; } } } } }
// Use this for initialization void Start() { ShowConfirmation(false); dlc = GameObject.FindObjectOfType(typeof(DLCManager)) as DLCManager; GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable virtualGoodsResponse = GSApi.listVirtualGoods(); ArrayList virtualGoods = (ArrayList)(virtualGoodsResponse["virtualGoods"]); foreach (Hashtable good in virtualGoods) { if ((string)((Hashtable)good)["shortCode"] == GameGlobals.selectedTrack.challengeShortCode.Replace("TKHS", "TK")) { //price.text =((double)((Hashtable)good)["currency3Cost"]).ToString(); price.text = GameGlobals.selectedTrack.gamesparkCurrencyCost.ToString(); break; } } }
public void PopulateTable(string track) { GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable leaderHash = GSApi.Leaderboards(((AudioTrack)GameGlobals.Songs[label.text]).challengeShortCode); playerScores = new ArrayList(); ArrayList pScores = (ArrayList)leaderHash["data"]; foreach (Hashtable pScore in pScores) { int score = 0; int attemptCount = 0; Debug.Log("adding player"); playerScores.Add(new Challenger { id = (string)pScore["userId"], displayName = (string)pScore["userName"], topScore = (int)(double)pScore["HS"], attempts = attemptCount }); } for (int counter = transform.childCount - 1; counter >= 0; counter--) { Destroy(transform.GetChild(counter).gameObject); } ((UIScrollBar)GameObject.FindObjectOfType(typeof(UIScrollBar))).scrollValue = 0; Scroll_Item_ChallengesList.itemCount = 1; Debug.Log(playerScores.Count); for (int counter = 0; counter < playerScores.Count; counter++) { GameObject item = Instantiate(playerScorePrefab, playerScorePrefab.transform.position, Quaternion.identity) as GameObject; item.transform.parent = this.transform; item.transform.localScale = new Vector3(1, 1, 1); item.transform.localPosition = item.transform.position + new Vector3(0, -46 * counter, 0); Debug.Log(item.GetType()); (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).id = ((Challenger)playerScores[counter]).id; (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).name.text = ((Challenger)playerScores[counter]).displayName; (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).topScore.text = ((Challenger)playerScores[counter]).topScore.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; } } } }
void Start() { GSApi = GetComponent <GameSparks>(); }
void Start() { GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; }
// Use this for initialization void Start() { DontDestroyOnLoad(this); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; }
// Use this for initialization void Start() { challengers = new ArrayList(); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable challengesHash = GSApi.listChallengeDetails(GameGlobals.relevantID); ArrayList ChallengeResponse = ((challengesHash["challenge"] as Hashtable)["challenged"]) as ArrayList; Hashtable attemptList = (Hashtable)(((Hashtable)challengesHash["challenge"])["turnCount"]); ArrayList scores = (ArrayList)(((Hashtable)GSApi.ListChallengeScores(GameGlobals.selectedTrack.challengeShortCode, GameGlobals.relevantID, 10))["data"]); //GameGlobals.shortCode = (string)(((Hashtable)challengesHash["challenge"])["shortCode"]); // Debug.LogWarning(GameGlobals.shortCode ); Hashtable pScore = new Hashtable(); Debug.LogWarning(((Hashtable)GSApi.ListChallengeScores(GameGlobals.selectedTrack.challengeShortCode, GameGlobals.relevantID, 10))["data"]); Debug.LogWarning(scores.Count); if (scores != null) { foreach (Hashtable scoreEnt in scores) { Debug.LogWarning( (scoreEnt) ["HS"] ); Debug.LogWarning(scoreEnt["userId"]); pScore.Add((string)((Hashtable)scoreEnt)["userId"], (double)scoreEnt["HS"]); } } int score = 0; int attemptCount = 0; string id = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["id"]); if (attemptList[id] != null) { attemptCount = (int)(double)attemptList[id]; if (pScore[id] != null) { score = (int)(double)pScore[id]; } } challengers.Add(new Challenger { id = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["id"]), displayName = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["name"]), topScore = score, attempts = attemptCount }); foreach (Hashtable challenger in ChallengeResponse) { score = 0; attemptCount = 0; id = (string)challenger["id"]; if (attemptList[(string)challenger["id"]] != null) { attemptCount = (int)(double)attemptList[id]; if (pScore[id] != null) { score = (int)(double)pScore[id]; } } challengers.Add(new Challenger { id = (string)challenger["id"], displayName = (string)challenger["name"], topScore = score, attempts = attemptCount }); } //populate the chat windows with the correct chat history Scroll_Item_ChallengesList.itemCount = 1; for (int counter = 0; counter < challengers.Count; counter++) { GameObject item = Instantiate(challengerPrefab, challengerPrefab.transform.position, Quaternion.identity) as GameObject; item.transform.parent = this.transform; item.transform.localScale = new Vector3(1, 1, 1); item.transform.localPosition = item.transform.position + new Vector3(0, -46 * counter, 0); (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).id = ((Challenger)challengers[counter]).id; //(item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).position.text = ((Challenger)challengers[counter]).position.ToString(); (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).name.text = ((Challenger)challengers[counter]).displayName; (item.GetComponentInChildren(typeof(Scroll_Item_Challengers_Finished)) as Scroll_Item_Challengers_Finished).topScore.text = ((Challenger)challengers[counter]).topScore.ToString(); } }
// Use this for initialization void Start() { challenges = new ArrayList(); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable challengesHash = GSApi.listRunningChallenges(); ArrayList challengeInstances = challengesHash["challengeInstances"] as ArrayList; foreach (Hashtable challenge in challengeInstances) { Challenge c = new Challenge(); c.id = (string)challenge["challengeId"]; c.displayName = (string)(((Hashtable)challenge["challenger"])["name"]); c.pot = challenge["currency3Wager"] == null? 0: (double)challenge["currency3Wager"]; c.status = Challenge.ChallengeStatus.waiting; c.ends = (string)challenge["endDate"]; challenges.Add(c); Debug.Log(challenge["endDate"]); } challengesHash = GSApi.listRecievedChallenges(); challengeInstances = challengesHash["challengeInstances"] as ArrayList; if (challengeInstances != null) { foreach (Hashtable challenge in challengeInstances) { Challenge c = new Challenge(); c.id = (string)challenge["challengeId"]; c.displayName = (string)(((Hashtable)challenge["challenger"])["name"]); c.pot = challenge["currency3Wager"] == null? 0: (double)challenge["currency3Wager"]; c.status = Challenge.ChallengeStatus.recieved; c.ends = (string)challenge["endDate"]; challenges.Add(c); } } challengesHash = GSApi.listCompletedChallenges(); challengeInstances = challengesHash["challengeInstances"] as ArrayList; if (challengeInstances != null) { foreach (Hashtable challenge in challengeInstances) { Challenge c = new Challenge(); c.id = (string)challenge["challengeId"]; c.displayName = (string)(((Hashtable)challenge["challenger"])["name"]); c.pot = challenge["currency3Wager"] == null? 0: (double)challenge["currency3Wager"]; c.status = Challenge.ChallengeStatus.complete; c.ends = (string)challenge["endDate"]; challenges.Add(c); } } /* * * challenges = new ArrayList(); * //populate from gamespark * challenges.Add(new Challenge{id = "a", displayName = "Alex", pot = 100, status = Challenge.ChallengeStatus.waiting, ends = 0}); * challenges.Add(new Challenge{id = "b", displayName = "Billy", pot = 200, status = Challenge.ChallengeStatus.waiting, ends = 1}); * challenges.Add(new Challenge{id = "c", displayName = "Claire", pot = 300, status = Challenge.ChallengeStatus.waiting, ends = 2}); * challenges.Add(new Challenge{id = "d", displayName = "Derick", pot = 400, status = Challenge.ChallengeStatus.waiting, ends = 3}); * challenges.Add(new Challenge{id = "e", displayName = "Emmet", pot = 500, status = Challenge.ChallengeStatus.waiting, ends = 25}); * challenges.Add(new Challenge{id = "f", displayName = "Frank", pot = 600, status = Challenge.ChallengeStatus.waiting, ends = 49}); * challenges.Add(new Challenge{id = "g", displayName = "Gregory", pot = 700, status = Challenge.ChallengeStatus.waiting, ends = 73}); */ //PopulateList("waiting"); }
// Use this for initialization void Start() { challengers = new ArrayList(); GSApi = GameObject.FindObjectOfType(typeof(GameSparks)) as GameSparks; Hashtable challengesHash = GSApi.listChallengeDetails(GameGlobals.relevantID); string shortCode = (string)(challengesHash["challenge"] as Hashtable)["shortCode"]; Debug.LogWarning(shortCode); ArrayList ChallengeResponse = ((challengesHash["challenge"] as Hashtable)["challenged"]) as ArrayList; Hashtable attemptList = (Hashtable)(((Hashtable)challengesHash["challenge"])["turnCount"]); foreach (DictionaryEntry currentTrack in GameGlobals.Songs) { if (((AudioTrack)currentTrack.Value).challengeShortCode == shortCode) { GameGlobals.selectedTrack = ((AudioTrack)currentTrack.Value); //set track for challenge break; } } // Debug.LogWarning(GameGlobals.shortCode ); GameGlobals.opponentsScore = 0; ArrayList scores = (ArrayList)(((Hashtable)GSApi.ListChallengeScores(shortCode, GameGlobals.relevantID, 10))["data"]); Hashtable pScore = new Hashtable(); if (scores != null) { foreach (Hashtable scoreEnt in scores) { if (GameGlobals.opponentsScore < (double)scoreEnt["HS"]) { GameGlobals.opponentsScore = (int)(double)scoreEnt["HS"]; //set high score for challenge } pScore.Add((string)((Hashtable)scoreEnt)["userId"], (double)scoreEnt["HS"]); } } int score = 0; int attemptCount = 0; string id = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["id"]); if (attemptList[id] != null) { attemptCount = (int)(double)attemptList[id]; if (pScore[id] != null) { score = (int)(double)pScore[id]; } } challengers.Add(new Challenger { id = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["id"]), displayName = (string)(((Hashtable)((Hashtable)challengesHash["challenge"])["challenger"])["name"]), topScore = score, attempts = attemptCount }); foreach (Hashtable challenger in ChallengeResponse) { score = 0; attemptCount = 0; id = (string)challenger["id"]; if (attemptList[(string)challenger["id"]] != null) { attemptCount = (int)(double)attemptList[id]; if (pScore[id] != null) { score = (int)(double)pScore[id]; } } challengers.Add(new Challenger { id = (string)challenger["id"], displayName = (string)challenger["name"], topScore = score, attempts = attemptCount }); } //populate the chat windows with the correct chat history Scroll_Item_ChallengesList.itemCount = 1; for (int counter = 0; counter < challengers.Count; counter++) { GameObject item = Instantiate(challengerPrefab, challengerPrefab.transform.position, Quaternion.identity) as GameObject; item.transform.parent = this.transform; item.transform.localScale = new Vector3(1, 1, 1); item.transform.localPosition = item.transform.position + new Vector3(0, -46 * counter, 0); (item.GetComponentInChildren(typeof(Scroll_Item_Challengers)) as Scroll_Item_Challengers).id = ((Challenger)challengers[counter]).id; (item.GetComponentInChildren(typeof(Scroll_Item_Challengers)) as Scroll_Item_Challengers).name.text = ((Challenger)challengers[counter]).displayName; (item.GetComponentInChildren(typeof(Scroll_Item_Challengers)) as Scroll_Item_Challengers).topScore.text = ((Challenger)challengers[counter]).topScore.ToString(); (item.GetComponentInChildren(typeof(Scroll_Item_Challengers)) as Scroll_Item_Challengers).attempts.text = ((Challenger)challengers[counter]).attempts.ToString() + "/" + ((double)(((Hashtable)challengesHash["challenge"])["maxTurns"])).ToString(); if (((Challenger)challengers[counter]).id == GameGlobals.userID) //attempts remaining { GameGlobals.challengeAttemptsRemaining = ((int)((double)(((Hashtable)challengesHash["challenge"])["maxTurns"]))) - ((int)((double)((Challenger)challengers[counter]).attempts)); if (GameGlobals.challengeAttemptsRemaining <= 0) { playButton.SetActive(false); } } } }