public void DownloadImage() { GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/shop/itemimage.php", HandleGetImage); WWWForm form = new WWWForm(); form.AddField("item_id", id); form.AddField("app_id", Info.appId); conn.connect(form); }
void InitReplay(EZTransition transition) { Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); if (Flow.currentGame.friend.rawText != null) { enemyPicture.material.mainTexture = Flow.currentGame.friend.rawText; } else { GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetFriendPicture); WWWForm form = new WWWForm(); form.AddField("user_id", Flow.currentGame.friend.id); conn.connect(form); } enemyName.Text = Flow.currentGame.friend.name; int enemyPoints = 0; int myPoints = 0; for (int i = 0; i < Flow.ROUNDS_PER_TURN; i++) { //myPoints += Flow.currentGame.pastMyRoundList[i].playerRoundWin; //enemyPoints += Flow.currentGame.pastTheirRoundList[i].playerRoundWin; } if (enemyPoints > myPoints) { Flow.enemyWin = true; Flow.playerWin = false; } else if (myPoints > enemyPoints) { Flow.playerWin = true; Flow.enemyWin = false; } else { Flow.playerWin = false; Flow.enemyWin = false; } }
public void UpdateOfflineItems() { Debug.Log("chamou"); if(!Save.GetString(PlayerPrefsKeys.TOKEN).IsEmpty()) { Debug.Log("o cara ta logado, pega us iti deli"); // Manda para o servidor as compras offline que o usuario daquele app fez GameJsonAuthConnection conn = new GameJsonAuthConnection(Flow.URL_BASE + "login/shop/updateuseritems.php",OnUpdateOfflineItems); WWWForm form = new WWWForm(); int key = 0; // Adicionar nesse form os ids dos itens que o usuario comprou, salvos no Save #if !UNITY_WEBPLAYER ShopItem[] allItems = Flow.config.GetComponent<ConfigManager>().shopItems; for(int i = 0 ; i < allItems.Length ; i++) { if(Save.HasKey(PlayerPrefsKeys.ITEM+allItems[i].id)) { form.AddField("items["+key+"][id]",allItems[i].id); form.AddField("items["+key+"][count]", Save.GetInt(PlayerPrefsKeys.ITEM+allItems[i].id)); key++; } } #endif conn.connect(form); // Se a foto do usuario estiver nula, abrir conexao pra baixar ela if(Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", Flow.getPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } } }
void InitReplay (EZTransition transition) { Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); if(Flow.currentGame.friend.rawText != null) enemyPicture.material.mainTexture = Flow.currentGame.friend.rawText; else { GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetFriendPicture); WWWForm form = new WWWForm(); form.AddField("user_id", Flow.currentGame.friend.id); conn.connect(form); } enemyName.Text = Flow.currentGame.friend.name; int enemyPoints = 0; int myPoints = 0; for(int i = 0 ; i < Flow.ROUNDS_PER_TURN ; i++) { //myPoints += Flow.currentGame.pastMyRoundList[i].playerRoundWin; //enemyPoints += Flow.currentGame.pastTheirRoundList[i].playerRoundWin; } if(enemyPoints > myPoints) { Flow.enemyWin = true; Flow.playerWin = false; } else if(myPoints > enemyPoints) { Flow.playerWin = true; Flow.enemyWin = false; } else { Flow.playerWin = false; Flow.enemyWin = false; } }
public void UpdateOfflineItems() { Debug.Log("chamou"); if (!Save.GetString(PlayerPrefsKeys.TOKEN).IsEmpty()) { Debug.Log("o cara ta logado, pega us iti deli"); // Manda para o servidor as compras offline que o usuario daquele app fez GameJsonAuthConnection conn = new GameJsonAuthConnection(Flow.URL_BASE + "login/shop/updateuseritems.php", OnUpdateOfflineItems); WWWForm form = new WWWForm(); int key = 0; // Adicionar nesse form os ids dos itens que o usuario comprou, salvos no Save #if !UNITY_WEBPLAYER ShopItem[] allItems = Flow.config.GetComponent <ConfigManager>().shopItems; for (int i = 0; i < allItems.Length; i++) { if (Save.HasKey(PlayerPrefsKeys.ITEM + allItems[i].id)) { form.AddField("items[" + key + "][id]", allItems[i].id); form.AddField("items[" + key + "][count]", Save.GetInt(PlayerPrefsKeys.ITEM + allItems[i].id)); key++; } } #endif conn.connect(form); // Se a foto do usuario estiver nula, abrir conexao pra baixar ela if (Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", Flow.getPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } } }
// Obtem a foto caso necessario public void GetPicture() { if (got_picture) { return; } //got_picture = true; GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetPicture); WWWForm form = new WWWForm(); if (id != null) { form.AddField("user_id", id); } else { form.AddField("facebook_id", facebook_id); } conn.connect(form); }
// Use this for initialization void Start() { Connect(); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(true); switch (Flow.nextPanel) { case PanelToLoad.Menu: UIPanelManager.instance.BringIn("MenuScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.BattleStatus: UIPanelManager.instance.BringIn("BattleStatusScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.WinLose: UIPanelManager.instance.BringIn("WinLoseScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; // GLA case PanelToLoad.EndLevel: UIPanelManager.instance.BringIn("EndLevelPanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.Multiplayer: UIPanelManager.instance.BringIn("MultiplayerScenePanel"); break; case PanelToLoad.LevelSelection: UIPanelManager.instance.BringIn("LevelSelectionScenePanel"); break; case PanelToLoad.Challenge: UIPanelManager.instance.BringIn("ChallengesScenePanel"); break; case PanelToLoad.CustomStages: UIPanelManager.instance.BringIn("CustomLevelsScenePanel"); break; case PanelToLoad.Ranking: UIPanelManager.instance.BringIn("RankingsScenePanel"); break; } // Se a foto do usuario estiver nula, abrir conexao pra baixar ela if (Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", Flow.getPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } Advertisement.Banner.Show(); // TESTE //Flow.header.coins = 2000; int firstWorld = 9999; foreach (KeyValuePair <int, World> w in Flow.worldDict) { if (w.Key < firstWorld) { firstWorld = w.Key; } } for (int i = 0; i < worldObjects.Length; i++) { int levelCounter = 0; worldObjects[i].GetComponent <World>().id = i + firstWorld; foreach (Transform child in worldObjects[i].transform) { int firstLevel = 9999; Debug.Log(firstWorld); foreach (KeyValuePair <int, Level> l in Flow.worldDict[firstWorld + i].levelDict) { if (l.Key < firstLevel) { firstLevel = l.Key; } } //Debug.Log("firstLevel "+firstLevel); if (Flow.worldDict[firstWorld + i].levelDict[firstLevel + levelCounter].id != 7) { Flow.worldDict[firstWorld + i].levelDict[firstLevel + levelCounter].toUnlock = Flow.worldDict[firstWorld + i].levelDict[firstLevel + levelCounter].id - 1; } else { Flow.worldDict[firstWorld + i].levelDict[firstLevel + levelCounter].toUnlock = 0; } child.GetComponent <Level>().SetLevel(Flow.worldDict[firstWorld + i].levelDict[firstLevel + levelCounter]); levelCounter++; } } }
void AccountSettingsLoad(EZTransition transition) { //Debug.Log(Save.GetString(PlayerPrefsKeys.EMAIL.ToString())); if (Save.HasKey(PlayerPrefsKeys.FACEBOOK_TOKEN.ToString())) { facebookButton.Text = "Logged"; } if (Save.HasKey(PlayerPrefsKeys.EMAIL.ToString())) { emailField.Text = Save.GetString(PlayerPrefsKeys.EMAIL.ToString()); } if (Save.HasKey(PlayerPrefsKeys.FIRST_NAME.ToString())) { firstNameField.Text = Save.GetString(PlayerPrefsKeys.FIRST_NAME.ToString()); } if (Save.HasKey(PlayerPrefsKeys.LAST_NAME.ToString())) { lastNameField.Text = Save.GetString(PlayerPrefsKeys.LAST_NAME.ToString()); } if (Save.HasKey(PlayerPrefsKeys.LOCATION.ToString())) { countryField.Text = Save.GetString(PlayerPrefsKeys.LOCATION.ToString()); } if (Save.HasKey(PlayerPrefsKeys.DATE_DAY.ToString())) { dayField.Text = Save.GetString(PlayerPrefsKeys.DATE_DAY.ToString()); } if (Save.HasKey(PlayerPrefsKeys.DATE_MONTH.ToString())) { monthField.Text = Save.GetString(PlayerPrefsKeys.DATE_MONTH.ToString()); } if (Save.HasKey(PlayerPrefsKeys.DATE_YEAR.ToString())) { yearField.Text = Save.GetString(PlayerPrefsKeys.DATE_YEAR.ToString()); } if (Save.HasKey(PlayerPrefsKeys.GENDER.ToString())) { if (Save.GetString(PlayerPrefsKeys.GENDER.ToString()) == "Male") { maleFemaleToggle.SetState(0); } else { maleFemaleToggle.SetState(1); } } dayValidation = dayField.Text; monthValidation = monthField.Text; yearValidation = yearField.Text; if (Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", GetPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } else { photoMeshRenderer.material.mainTexture = Flow.playerPhoto; } }
// Obtem a foto caso necessario public void GetPicture() { if (got_picture) return; //got_picture = true; GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetPicture); WWWForm form = new WWWForm(); if(id != null) form.AddField("user_id", id); else form.AddField("facebook_id", facebook_id); conn.connect(form); }
void AccountSettingsLoad(EZTransition transition) { //Debug.Log(Save.GetString(PlayerPrefsKeys.EMAIL.ToString())); if(Save.HasKey(PlayerPrefsKeys.FACEBOOK_TOKEN.ToString())) facebookButton.Text = "Logged"; if(Save.HasKey(PlayerPrefsKeys.EMAIL.ToString())) emailField.Text = Save.GetString(PlayerPrefsKeys.EMAIL.ToString()); if(Save.HasKey(PlayerPrefsKeys.FIRST_NAME.ToString())) firstNameField.Text = Save.GetString(PlayerPrefsKeys.FIRST_NAME.ToString()); if(Save.HasKey(PlayerPrefsKeys.LAST_NAME.ToString())) lastNameField.Text = Save.GetString(PlayerPrefsKeys.LAST_NAME.ToString()); if(Save.HasKey(PlayerPrefsKeys.LOCATION.ToString())) countryField.Text = Save.GetString(PlayerPrefsKeys.LOCATION.ToString()); if(Save.HasKey(PlayerPrefsKeys.DATE_DAY.ToString())) dayField.Text = Save.GetString(PlayerPrefsKeys.DATE_DAY.ToString()); if(Save.HasKey(PlayerPrefsKeys.DATE_MONTH.ToString())) monthField.Text = Save.GetString(PlayerPrefsKeys.DATE_MONTH.ToString()); if(Save.HasKey(PlayerPrefsKeys.DATE_YEAR.ToString())) yearField.Text = Save.GetString(PlayerPrefsKeys.DATE_YEAR.ToString()); if(Save.HasKey(PlayerPrefsKeys.GENDER.ToString())) { if(Save.GetString(PlayerPrefsKeys.GENDER.ToString()) == "Male") { maleFemaleToggle.SetState(0); } else { maleFemaleToggle.SetState(1); } } dayValidation = dayField.Text; monthValidation = monthField.Text; yearValidation = yearField.Text; if(Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", GetPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } else { photoMeshRenderer.material.mainTexture = Flow.playerPhoto; } }
// Use this for initialization void Start () { Connect(); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(true); switch(Flow.nextPanel) { case PanelToLoad.Menu: UIPanelManager.instance.BringIn("MenuScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.BattleStatus: UIPanelManager.instance.BringIn("BattleStatusScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.WinLose: UIPanelManager.instance.BringIn("WinLoseScenePanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; // GLA case PanelToLoad.EndLevel: UIPanelManager.instance.BringIn("EndLevelPanel"); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); break; case PanelToLoad.Multiplayer: UIPanelManager.instance.BringIn("MultiplayerScenePanel"); break; case PanelToLoad.LevelSelection: UIPanelManager.instance.BringIn("LevelSelectionScenePanel"); break; case PanelToLoad.Challenge: UIPanelManager.instance.BringIn("ChallengesScenePanel"); break; case PanelToLoad.CustomStages: UIPanelManager.instance.BringIn("CustomLevelsScenePanel"); break; case PanelToLoad.Ranking: UIPanelManager.instance.BringIn("RankingsScenePanel"); break; } // Se a foto do usuario estiver nula, abrir conexao pra baixar ela if(Flow.playerPhoto == null && !Flow.isDownloadingPlayerPhoto) { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", Flow.getPlayerPhoto); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); Flow.isDownloadingPlayerPhoto = true; } Advertisement.Banner.Show(); // TESTE //Flow.header.coins = 2000; int firstWorld = 9999; foreach(KeyValuePair<int,World> w in Flow.worldDict) { if(w.Key < firstWorld) firstWorld = w.Key; } for(int i = 0 ; i < worldObjects.Length ; i++) { int levelCounter = 0; worldObjects[i].GetComponent<World>().id = i+firstWorld; foreach(Transform child in worldObjects[i].transform) { int firstLevel = 9999; Debug.Log(firstWorld); foreach(KeyValuePair<int,Level> l in Flow.worldDict[firstWorld+i].levelDict) { if(l.Key < firstLevel) firstLevel = l.Key; } //Debug.Log("firstLevel "+firstLevel); if(Flow.worldDict[firstWorld+i].levelDict[firstLevel+ levelCounter].id != 7) { Flow.worldDict[firstWorld+i].levelDict[firstLevel+ levelCounter].toUnlock = Flow.worldDict[firstWorld+i].levelDict[firstLevel+ levelCounter].id-1; } else { Flow.worldDict[firstWorld+i].levelDict[firstLevel+ levelCounter].toUnlock = 0; } child.GetComponent<Level>().SetLevel(Flow.worldDict[firstWorld+i].levelDict[firstLevel+levelCounter]); levelCounter++; } } }
void FillValues(EZTransition transition) { //Debug.Log ("FillValues"); Debug.Log(Save.GetString(PlayerPrefsKeys.NAME.ToString())); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); if(Flow.playerPhoto != null) userPicture.material.mainTexture = Flow.playerPhoto; else { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetPlayerPicture); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); } if(Flow.currentGame.friend.rawText) friendPicture.material.mainTexture = Flow.currentGame.friend.rawText; else { GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetFriendPicture); WWWForm form = new WWWForm(); form.AddField("user_id", Flow.currentGame.friend.id); conn.connect(form); } userName.Text = Save.GetString(PlayerPrefsKeys.NAME.ToString()); friendName.Text = Flow.currentGame.friend.name; turnsWon.Text = Flow.currentGame.turnsWon.ToString(); turnsLost.Text = Flow.currentGame.turnsLost.ToString(); if(Flow.path == TurnStatus.BeginGame) { winLoseLabel.transform.localPosition = new Vector3(0,-0.9547787f,0); winLoseLabel.Text = "Waiting Your Friend Answer"; coinsGained.gameObject.SetActive(false); turnsLost.transform.parent.gameObject.SetActive(false); turnsWon.transform.parent.gameObject.SetActive(false); /*Flow.currentGame.myTotalScore = 0; foreach(Round r in Flow.currentGame.myRoundList) { Flow.currentGame.myTotalScore += r.score; }*/ /*for(int i = 0; i<friendTimes.Length; i++) friendTimes[i].Text = ""; //friendScore.Text = "Waiting..."; for(int i = 0; i<userTimes.Length; i++) { userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.myRoundList[i].time.ToString(); }*/ } else { turnsLost.transform.parent.gameObject.SetActive(true); turnsWon.transform.parent.gameObject.SetActive(true); Color winLoseLabelColor = winLoseLabel.GetComponent<SpriteText>().color; coinsGained.gameObject.SetActive(true); if (Flow.playerWin && !Flow.enemyWin) { winLoseLabelColor.r = 23f/255f; winLoseLabelColor.g = 247f/255f; winLoseLabelColor.b = 40f/255f; winLoseLabel.GetComponent<SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0,0,0); winLoseLabel.Text = "You Win!"; coinsLabel.Text = "x"+ServerSettings.GetInt("GAME_WIN"); } else if (!Flow.playerWin) { if (Flow.enemyWin) { winLoseLabelColor.r = 232f/255f; winLoseLabelColor.g = 33f/255f; winLoseLabelColor.b = 34f/255f; winLoseLabel.GetComponent<SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0,0,0); winLoseLabel.Text = "You Lose!"; coinsLabel.Text = "x"+ServerSettings.GetInt("GAME_LOSE"); } else { winLoseLabelColor.r = 0f/255f; winLoseLabelColor.g = 0f/255f; winLoseLabelColor.b = 0f/255f; winLoseLabel.GetComponent<SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0,0,0); winLoseLabel.Text = "Draw!"; coinsLabel.Text = "x"+ServerSettings.GetInt("GAME_DRAW"); } } //turnsLost.Text = "Victories: " + Flow.currentGame.turnsLost.ToString(); //turnsWon.Text = "Defeats: " + Flow.currentGame.turnsWon.ToString(); } if (Flow.path == TurnStatus.ShowPast) { Debug.Log ("ShowPastPanel "+Flow.currentGame.id+PlayerPrefsKeys.COINS+Flow.currentGame.lastTurnID ); if(!Save.HasKey(Flow.currentGame.id+PlayerPrefsKeys.COINS+Flow.currentGame.lastTurnID)) { if(Flow.currentGame.pastMyRoundList[0].time < Flow.currentGame.pastTheirRoundList[0].time) { // vitoria Flow.header.coins += ServerSettings.GetInt("GAME_WIN"); } else if(Flow.currentGame.pastMyRoundList[0].time < Flow.currentGame.pastTheirRoundList[0].time) { // derrota Flow.header.coins += ServerSettings.GetInt("GAME_LOSE"); } else { // empate Flow.header.coins += ServerSettings.GetInt("GAME_DRAW"); } Save.Set(Flow.currentGame.id+PlayerPrefsKeys.COINS+Flow.currentGame.lastTurnID, true, true); } ShowPastPanel(); } /*else if(Flow.path == TurnStatus.AnswerGame) { /*Flow.currentGame.myTotalScore = 0; foreach(Round r in Flow.currentGame.myRoundList) { //Flow.currentGame.myTotalScore += r.score; } Flow.currentGame.theirTotalScore = 0; foreach(Round r in Flow.currentGame.theirRoundList) { //Flow.currentGame.theirTotalScore += r.score; } for(int i = 0; i<friendTimes.Length; i++) { friendTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.theirRoundList[i].time.ToString(); } //friendScore.Text = "Score: " + Flow.currentGame.theirTotalScore.ToString(); for(int i = 0; i<userTimes.Length; i++) { userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.myRoundList[i].time.ToString(); } }*/ /*else if(Flow.path == TurnStatus.ShowPast) { Flow.currentGame.myTotalScore = 0; foreach(Round r in Flow.currentGame.pastMyRoundList) { //Flow.currentGame.myTotalScore += r.score; } Flow.currentGame.theirTotalScore = 0; foreach(Round r in Flow.currentGame.pastTheirRoundList) { //Flow.currentGame.theirTotalScore += r.score; } Debug.Log(Flow.currentGame.pastTheirRoundList.Count); for(int i = 0; i<friendTimes.Length; i++) { friendTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.pastTheirRoundList[i].time.ToString(); } //friendScore.Text = "Score: " + Flow.currentGame.theirTotalScore.ToString(); for(int i = 0; i<userTimes.Length; i++) { userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.pastMyRoundList[i].time.ToString(); } ShowPastPanel(); }*/ //userScore.Text = "Score: " + Flow.currentGame.myTotalScore.ToString(); }
void FillValues(EZTransition transition) { //Debug.Log ("FillValues"); Debug.Log(Save.GetString(PlayerPrefsKeys.NAME.ToString())); Flow.header.transform.FindChild("OptionsPanel").gameObject.SetActive(false); if (Flow.playerPhoto != null) { userPicture.material.mainTexture = Flow.playerPhoto; } else { GameRawAuthConnection conn2 = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetPlayerPicture); WWWForm form2 = new WWWForm(); form2.AddField("user_id", "me"); conn2.connect(form2); } if (Flow.currentGame.friend.rawText) { friendPicture.material.mainTexture = Flow.currentGame.friend.rawText; } else { GameRawAuthConnection conn = new GameRawAuthConnection(Flow.URL_BASE + "login/picture.php", HandleGetFriendPicture); WWWForm form = new WWWForm(); form.AddField("user_id", Flow.currentGame.friend.id); conn.connect(form); } userName.Text = Save.GetString(PlayerPrefsKeys.NAME.ToString()); friendName.Text = Flow.currentGame.friend.name; turnsWon.Text = Flow.currentGame.turnsWon.ToString(); turnsLost.Text = Flow.currentGame.turnsLost.ToString(); if (Flow.path == TurnStatus.BeginGame) { winLoseLabel.transform.localPosition = new Vector3(0, -0.9547787f, 0); winLoseLabel.Text = "Waiting Your Friend Answer"; coinsGained.gameObject.SetActive(false); turnsLost.transform.parent.gameObject.SetActive(false); turnsWon.transform.parent.gameObject.SetActive(false); /*Flow.currentGame.myTotalScore = 0; * foreach(Round r in Flow.currentGame.myRoundList) * { * Flow.currentGame.myTotalScore += r.score; * }*/ /*for(int i = 0; i<friendTimes.Length; i++) friendTimes[i].Text = ""; * //friendScore.Text = "Waiting..."; * for(int i = 0; i<userTimes.Length; i++) * { * userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.myRoundList[i].time.ToString(); * }*/ } else { turnsLost.transform.parent.gameObject.SetActive(true); turnsWon.transform.parent.gameObject.SetActive(true); Color winLoseLabelColor = winLoseLabel.GetComponent <SpriteText>().color; coinsGained.gameObject.SetActive(true); if (Flow.playerWin && !Flow.enemyWin) { winLoseLabelColor.r = 23f / 255f; winLoseLabelColor.g = 247f / 255f; winLoseLabelColor.b = 40f / 255f; winLoseLabel.GetComponent <SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0, 0, 0); winLoseLabel.Text = "You Win!"; coinsLabel.Text = "x" + ServerSettings.GetInt("GAME_WIN"); } else if (!Flow.playerWin) { if (Flow.enemyWin) { winLoseLabelColor.r = 232f / 255f; winLoseLabelColor.g = 33f / 255f; winLoseLabelColor.b = 34f / 255f; winLoseLabel.GetComponent <SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0, 0, 0); winLoseLabel.Text = "You Lose!"; coinsLabel.Text = "x" + ServerSettings.GetInt("GAME_LOSE"); } else { winLoseLabelColor.r = 0f / 255f; winLoseLabelColor.g = 0f / 255f; winLoseLabelColor.b = 0f / 255f; winLoseLabel.GetComponent <SpriteText>().SetColor(winLoseLabelColor); winLoseLabel.transform.localPosition = new Vector3(0, 0, 0); winLoseLabel.Text = "Draw!"; coinsLabel.Text = "x" + ServerSettings.GetInt("GAME_DRAW"); } } //turnsLost.Text = "Victories: " + Flow.currentGame.turnsLost.ToString(); //turnsWon.Text = "Defeats: " + Flow.currentGame.turnsWon.ToString(); } if (Flow.path == TurnStatus.ShowPast) { Debug.Log("ShowPastPanel " + Flow.currentGame.id + PlayerPrefsKeys.COINS + Flow.currentGame.lastTurnID); if (!Save.HasKey(Flow.currentGame.id + PlayerPrefsKeys.COINS + Flow.currentGame.lastTurnID)) { if (Flow.currentGame.pastMyRoundList[0].time < Flow.currentGame.pastTheirRoundList[0].time) { // vitoria Flow.header.coins += ServerSettings.GetInt("GAME_WIN"); } else if (Flow.currentGame.pastMyRoundList[0].time < Flow.currentGame.pastTheirRoundList[0].time) { // derrota Flow.header.coins += ServerSettings.GetInt("GAME_LOSE"); } else { // empate Flow.header.coins += ServerSettings.GetInt("GAME_DRAW"); } Save.Set(Flow.currentGame.id + PlayerPrefsKeys.COINS + Flow.currentGame.lastTurnID, true, true); } ShowPastPanel(); } /*else if(Flow.path == TurnStatus.AnswerGame) * { * /*Flow.currentGame.myTotalScore = 0; * foreach(Round r in Flow.currentGame.myRoundList) * { * //Flow.currentGame.myTotalScore += r.score; * } * Flow.currentGame.theirTotalScore = 0; * foreach(Round r in Flow.currentGame.theirRoundList) * { * //Flow.currentGame.theirTotalScore += r.score; * } * * for(int i = 0; i<friendTimes.Length; i++) * { * friendTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.theirRoundList[i].time.ToString(); * } * //friendScore.Text = "Score: " + Flow.currentGame.theirTotalScore.ToString(); * for(int i = 0; i<userTimes.Length; i++) * { * userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.myRoundList[i].time.ToString(); * } * }*/ /*else if(Flow.path == TurnStatus.ShowPast) * { * Flow.currentGame.myTotalScore = 0; * foreach(Round r in Flow.currentGame.pastMyRoundList) * { * //Flow.currentGame.myTotalScore += r.score; * } * Flow.currentGame.theirTotalScore = 0; * foreach(Round r in Flow.currentGame.pastTheirRoundList) * { * //Flow.currentGame.theirTotalScore += r.score; * } * * Debug.Log(Flow.currentGame.pastTheirRoundList.Count); * * for(int i = 0; i<friendTimes.Length; i++) * { * friendTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.pastTheirRoundList[i].time.ToString(); * } * //friendScore.Text = "Score: " + Flow.currentGame.theirTotalScore.ToString(); * for(int i = 0; i<userTimes.Length; i++) * { * userTimes[i].Text = "Time " + (i+1).ToString() + ": " + Flow.currentGame.pastMyRoundList[i].time.ToString(); * } * * ShowPastPanel(); * }*/ //userScore.Text = "Score: " + Flow.currentGame.myTotalScore.ToString(); }