public void ShowHighScore(Window1 window1) { highScore bxh = new highScore(window1.id, window1.fullname); window1.Close(); bxh.Show(); }
public void SetDataTable(highScore highScore) { DataTable dt = new DataTable("ThanhVien"); UserServiceSoapClient reader = new UserServiceSoapClient(); DataTable bxh = reader.SetDataTable(dt); highScore.dataGrid.ItemsSource = bxh.DefaultView; }
public void ShowMainMenu(highScore highScore) { highScore.Equal += (object sender, EventArgs e) => { Window1 mainmenu = new Window1(highScore.id, highScore.fullname); highScore.Close(); mainmenu.Show(); }; }
public string writeScore() { highScore hs = loadScore(); string scores = "HIGH SCORES\n"; for (int i = 0; i < hs.scores.Count; i++) { scores += (i + 1) + ". " + (int)hs.scores[i] + "\n"; } return(scores); }
public static void saveGame(scoreCounter sC) { BinaryFormatter binaryFormatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/save.txt"; FileStream stream = new FileStream(path, FileMode.Create); highScore hiScore = new highScore(sC); binaryFormatter.Serialize(stream, hiScore); stream.Close(); }
// Use this for initialization void Start() { timer = GameObject.Find("timer"); highScore = GameObject.Find("highScore"); highScoreScript = (highScore)highScore.GetComponent(typeof(highScore)); timerScript = (Timer)timer.GetComponent(typeof(Timer)); scoreDisplay = GameObject.Find("scoreDisplayText"); levelDisplay = GameObject.Find("levelDisplayText"); scoreDisplayText = scoreDisplay.GetComponent <GUIText>(); levelDisplayText = levelDisplay.GetComponent <GUIText>(); coinTotal = GameObject.FindGameObjectsWithTag("Collectible").Length; exit = GameObject.Find("Portal_All"); exit.SetActive(false); updateScoreDisplay(); }
public highScore loadScore() { highScore hs; if (File.Exists(Application.persistentDataPath + "/scores.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/scores.dat", FileMode.Open); hs = (highScore)bf.Deserialize(file); file.Close(); } else { hs = new highScore(); for (int i = 0; i < 10; i++) { hs.scores.Add(0); } } return(hs); }
public static highScore loadGame() { string path = Application.persistentDataPath + "/save.txt"; if (File.Exists(path)) { BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); highScore hiScore = binaryFormatter.Deserialize(stream) as highScore; stream.Close(); return(hiScore); } else { Debug.LogError("File not found in " + path); return(null); } }
void Awake() { FB.Init(SetInit, OnHideUnity); if (FB.IsLoggedIn) { Debug.Log("FB login worked!"); DealWithFBMenus(true); QueryScores(); } else { Debug.Log("FB Login fail"); DealWithFBMenus(false); } if (SceneManager.GetActiveScene().name == "Game") { ObjGameOver = GameObject.Find("GameOver"); HighScore = ObjGameOver.GetComponent <highScore>(); } }
public void saveScore(int score) { BinaryFormatter bf = new BinaryFormatter(); highScore hs = loadScore(); FileStream file = File.Create(Application.persistentDataPath + "/scores.dat"); for (int i = 0; i < 10; i++) { if ((int)hs.scores[i] > score) { } else { hs.scores.Insert(i, score); if (hs.scores.Count > 10) { hs.scores.RemoveAt(10); } break; } } bf.Serialize(file, hs); file.Close(); }
void loadHighScore() { highScore hS = saveSystem.loadGame(); highestScore = hS.hiScore; }
void OnTriggerEnter(Collider playerCollider) { if (playerCollider.gameObject.tag == "Obstacles") { // game over if (PlayerPrefs.GetInt("adsDisabled") == 0) { simpleAd = GameObject.Find("simpleAd").GetComponent <simpleAd>(); simpleAd.gameOverAd(); } if (PlayerPrefs.GetInt("rewardClaimed") == 1) { rewardedAdsScript.rewardedAd(); } gameover.SetBool("isGameOver", true); swipeScript.isGameOver = true; pauseScript.isGameOver = true; if (character.name == "Ruth2") { character.GetComponent <Animation>().Play("shopper_dead_top"); } else if (character.name == "Char") { character.GetComponent <Animation>().Play("gary_dead_animation"); } scoring.enabled = false; pDescend.enabled = true; scoring.stopScoring(true); btnPause.SetActive(false); cam.SendMessage("TurnBlurOn"); ui.SetActive(false); //highscore hscoreScript = GameObject.Find("GameOver").GetComponent <highScore>(); hscoreScript.CheckAndSet(); //game over sfx GameObject objSfxGameOver = GameObject.Find("sfxGameOver"); AudioSource asSfxGameOver = objSfxGameOver.GetComponent <AudioSource>(); asSfxGameOver.Play(); BoxCollider colPlayer = GetComponent <BoxCollider>(); colPlayer.enabled = false; //addcoin from temp if (PlayerPrefs.HasKey("tempGoldCoins")) { tempGoldCoins = PlayerPrefs.GetInt("tempGoldCoins"); goldCoins = PlayerPrefs.GetInt("PlayerGold"); PlayerPrefs.SetInt("PlayerGold", goldCoins + tempGoldCoins); } //expAnim /* int txtExpReqInt = Convert.ToInt32(txtExpReq.text); * if (txtExpReqInt > lvlUpScript.lvl[0]) * { * expSlider.maxValue = txtExpReqInt / 2; * * }*/ //levelUp lvlUpScript.lvlUp(); swipeScript.enabled = false; //achievement if (playerCollider.gameObject.name == "bed(Clone)") { if (!PlayerPrefs.HasKey("achBreakingBed")) { PlayerPrefs.SetInt("achBreakingBed", 1); PlayGamesManager.IncrementAchievement("CgkI1OXD-eYaEAIQBA", 5); } else if (PlayerPrefs.GetInt("achBreakingBed") < 5) { PlayerPrefs.SetInt("achBreakingBed", PlayerPrefs.GetInt("achBreakingBed") + 1); PlayGamesManager.IncrementAchievement("CgkI1OXD-eYaEAIQBA", 5); } } } else if (playerCollider.gameObject.tag == "CollectiblesCap") { // collectible capacity //achievement if (healthbarSlider.value == 1) { PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQCQ"); } swipeScript.swipeCap = Convert.ToInt32(healthbarSlider.maxValue); healthbarSlider.value = healthbarSlider.maxValue; Destroy(playerCollider.gameObject); print("cap collided"); GameObject objSfxCap = GameObject.Find("sfxCollectSwipe"); sfxScript = objSfxCap.GetComponent <SfxPlayer>(); sfxScript.playSfx(); } else if (playerCollider.gameObject.tag == "CollectiblesBoost") { // collectible boost btnBoost.interactable = true; rdmobj.stopBoostNow = true; Destroy(playerCollider.gameObject); GameObject objSfxBoost = GameObject.Find("sfxCollectBoost"); sfxScript = objSfxBoost.GetComponent <SfxPlayer>(); sfxScript.playSfx(); //achievement achLastResort(); } else if (playerCollider.gameObject.tag == "CollectiblesShield") { // collectible shield btnShield.interactable = true; rdmobj.stopShieldNow = true; Destroy(playerCollider.gameObject); GameObject objSfxShield = GameObject.Find("sfxCollectShield"); sfxScript = objSfxShield.GetComponent <SfxPlayer>(); sfxScript.playSfx(); //achievement achLastResort(); } else if (playerCollider.gameObject.tag == "CollectiblesAttack") { // collectible attack rdmobj.stopAttackNow = true; btnAttack.interactable = true; Destroy(playerCollider.gameObject); GameObject objSfxAttack = GameObject.Find("sfxCollectAttack"); sfxScript = objSfxAttack.GetComponent <SfxPlayer>(); sfxScript.playSfx(); //achievement achLastResort(); } else if (playerCollider.gameObject.tag == "CollectiblesCoin") { Destroy(playerCollider.gameObject); GameObject objSfxCoin = GameObject.Find("sfxCollectCoin"); sfxScript = objSfxCoin.GetComponent <SfxPlayer>(); sfxScript.playSfx(); //addCoin from colleced PlayerPrefs.SetInt("tempGoldCoins", PlayerPrefs.GetInt("tempGoldCoins") + 1); int Cc = int.Parse(colCoins.text); Cc += 1; colCoins.text = Cc.ToString(); uigoldScript.updateGoldCoin(); } }