public void GameOver(bool isComplete, List <LeaderBoardData> datas) { if (IsPlaying) { VoodooFinish(false); LeaderBoardData.RemoveNames(); State = GameState.GameOver; Data.IsWin.Set(false); Data.Score.Set(0f); if (Best < Score) { Data.Best.Set(Score); if (isNewBest) { A.CC.NewBest(gameOverWaitTime, Score, Level, datas); } else { A.CC.GameOver(gameOverWaitTime, Score, Best, Level, datas, isComplete); } } else { A.CC.GameOver(gameOverWaitTime, Score, Best, Level, datas, isComplete); } } }
public static void AddLeaderboardsGroup(LeaderBoardData inGroup) { if (_instance.database.LeaderBoards == null) { _instance.database.LeaderBoards = new Dictionary <string, LeaderBoardData>(); } _instance.database.LeaderBoards.Add(inGroup.country, inGroup); }
public void BushwoodsFinestWins2013() { LeaderBoardData bushwoods = this.teamStandings2013LBD.First(); bushwoods.Team.Name.Should().StartWith("Bushwoods Finest"); bushwoods.Value.Should().Equal(836); bushwoods.Rank.Should().Equal(1); bushwoods.IsPlayer.ShouldBeFalse(); }
private void OnLoadLeaderboard() { LeaderBoardData boardData = SaveLoadJSON.Instance.LoadLeaderboard(); if (boardData != null) { UILeaderboard.Instance.SetData(boardData); } }
public void SetData(LeaderBoardData _dataLeader) { for (int i = 0; i < _dataLeader.dataList.Count; i++) { GameObject _item = (GameObject)Instantiate(m_item); _item.transform.SetParent(m_canvs, false); _item.SetActive(true); _item.GetComponent <UIItemsList>().SetLabel(_dataLeader.dataList[i].name, _dataLeader.dataList[i].score); } }
private string GetLeaderBoardDataInsert(LeaderBoardData l) { NullableValue <int> playerId = l.IsPlayer ? new NullableValue <int>(l.Player.Id) : new NullableValue <int>(); NullableValue <int> teamId = l.IsPlayer ? new NullableValue <int>() : new NullableValue <int>(l.Team.Id); return(new FluentMySqlInsert("leaderBoardData") .WithColumns("id", "rank", "value", "leaderBoardId", "yearId", "isPlayer", "teamId", "playerId", "detail", "formattedValue") .WithValues(l.Id, l.Rank, l.Value, l.LeaderBoard.Id, l.Year.Id, l.IsPlayer, teamId, playerId, l.Detail ?? string.Empty, l.FormattedValue) .ToString()); }
public void Play() { if (playerNameInp.NotNull()) { GameController.PlayerName = playerNameInp.text; } A.SetData(Data.PlayerName, GameController.PlayerName); LeaderBoardData.SetPlayerData(GameController.PlayerName); A.GC.Play(); }
public void Play() { if (playerNameInp) { GameController.PlayerName = playerNameInp.text; } Data.PlayerName.Set(GameController.PlayerName); LeaderBoardData.SetPlayerData(GameController.PlayerName); A.GC.Play(); }
public void OnResult() { UIInterface.Instance.ShowLeaderBoard(); LeaderBoardData boardData = SaveLoadJSON.Instance.LoadLeaderboard(); if (boardData == null) { boardData = new LeaderBoardData() { dataList = new List <PlayerData>() { new PlayerData() { id = 0, name = m_MachineName, score = (score_p1 > score_p2) ? score_p1 : score_p2 } } }; SaveLoadJSON.Instance.SaveLeaderboard(boardData); } else { boardData.dataList.Sort((s1, s2) => s1.score.CompareTo(s2.score)); for (int i = 0; i < boardData.dataList.Count; i++) { if (boardData.dataList[i].name.Equals(m_MachineName)) { // is player 1 win! if (score_p1 > score_p2) { if (boardData.dataList[i].score < score_p1) { boardData.dataList[i].score = score_p1; } } else { if (boardData.dataList[i].score < score_p2) { boardData.dataList[i].score = score_p2; } } } else { boardData.dataList.Add(new PlayerData() { id = 0, name = m_MachineName, score = (score_p1 > score_p2) ? score_p1 : score_p2 }); boardData.dataList.Sort((s1, s2) => s1.score.CompareTo(s2.score)); } } } UILeaderboard.Instance.SetData(boardData); }
public void SubmitToLeaderBoard(InputField field) { if (!string.IsNullOrEmpty(field.text)) { LB_AudioKing.instance.PlayOneShot(buttonSE); LeaderBoardData data = new LeaderBoardData(field.text.ToUpper(), LB_GameManager.instance.score); LeaderBoard.instance.Send(data); enterName.SetActive(false); endButtons.SetActive(true); } }
public void SetScore() { if (LeaderBoardData.GetScore() > LeaderBoardData.leaderboard.leaderBoardData[0].score) { scoreText.text = "New Highscore: " + LeaderBoardData.GetScore(); } else { scoreText.text = "New Score: " + LeaderBoardData.GetScore(); } }
void Awake() { if (leaderboard == null) { DontDestroyOnLoad(gameObject);// make sure object is kept when switching scenes leaderboard = this; } else if (leaderboard != this) { Load(); SetUsernameInputField(); Destroy(this.gameObject); } }// Make singleton
public bool SaveLeaderboard(LeaderBoardData _data) { string _path = GetLeaderboardPath(); string strJson = JsonConvert.SerializeObject(_data); { Debug.Log("file name : " + _path); Debug.Log("SaveCharacterLocation JSON data : " + strJson); } File.WriteAllText(_path, strJson); #if UNITY_EDITOR UnityEditor.AssetDatabase.Refresh(); #endif return(true); }
public LeaderBoardData LoadLeaderboard() { string _path = GetLeaderboardPath(); LeaderBoardData leaderboard = null; if (File.Exists(_path)) { string dataAsJson = File.ReadAllText(_path); { Debug.Log("file name : " + _path); Debug.Log("LeaderBoardData JSON data : " + dataAsJson); } leaderboard = JsonConvert.DeserializeObject <LeaderBoardData>(dataAsJson); } return(leaderboard); }
IEnumerator Upload(LeaderBoardData data) { UnityWebRequest www = UnityWebRequest.Post("http://db-learning-21t1.herokuapp.com/LeaderBoard", JsonUtility.ToJson(data)); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Form upload complete!"); if (!loadOnStart) { StartCoroutine(GetAllLeaderBoard()); } } }
public void ShowLeaderBoard(LeaderBoardData leaders) { //Debug.Log("111"); //snap.RemoveAllChildren(out removedObj); foreach (Transform game in leaderBoardContent.transform) { Destroy(game.gameObject); } leaders.top = leaders.top.OrderBy(o => o.score).ToArray(); if (leaders.user_top != null) { for (int i = leaders.user_top.Length - 1; i >= 0; i--) { if (leaders.user_top[i].username == LBController._lb_Controller._name) { myItem.setData(leaders.user_top.Length - i, leaders.user_top[i].username, leaders.user_top[i].score); //snap.AddChild(Instantiate(myItem, leaderBoardContent.transform).gameObject); } else { userItem.setData(leaders.user_top.Length - i, leaders.user_top[i].username, leaders.user_top[i].score); //snap.AddChild(Instantiate(userItem, leaderBoardContent.transform).gameObject); } } } for (int i = leaders.top.Length - 1; i >= 0; i--) { if (leaders.top[i].username == LBController._lb_Controller._name) { myItem.setData(leaders.top.Length - i, leaders.top[i].username, leaders.top[i].score); Instantiate(myItem, leaderBoardContent.transform); //snap.AddChild(Instantiate(myItem, leaderBoardContent.transform).gameObject); } else { userItem.setData(leaders.top.Length - i, leaders.top[i].username, leaders.top[i].score); Instantiate(userItem, leaderBoardContent.transform); //snap.AddChild(Instantiate(userItem, leaderBoardContent.transform).gameObject); } } //Debug.Log(snap.ChildObjects.Length); //snap.GoToScreen(snap.ChildObjects.Length - 1); }
public void GetLeaderboardScore() { PlayFabClientAPI.ExecuteCloudScript( new ExecuteCloudScriptRequest() { FunctionName = "getPlayerStat", }, result => { if (result != null && result.FunctionResult != null) { LeaderBoardData data = JsonUtility.FromJson <LeaderBoardData>(result.FunctionResult.ToString()); score = data.pokemon_amount; } }, error => { Debug.Log("Error getting leaderboard"); } ); }
private void Update() { if (IsPlaying) { if (hudLeaderBoard) { HudLeaderBoard(LeaderBoardData.GetDatas()); } if (hudTime) { time += DT; if (GameController.GameTime - time > 0) { HudTime(GameController.GameTime - time); } else { HudTime(0); A.GC.GameOver(); } } } }
private void Update() { if (A.IsPlaying) { if (hudLeaderBoard.NotNull()) { HudLeaderBoard(LeaderBoardData.GetDatas()); } if (hudTime.NotNull()) { time += Time.deltaTime; if (GameController.GameTime - time > 0) { HudTime(GameController.GameTime - time); } else { HudTime(0); A.GC.GameOver(); } } } }
IEnumerator GetScoreLeaderBoard(string username) { UnityWebRequest www = UnityWebRequest.Get($"http://db-learning-21t1.herokuapp.com/LeaderBoard?username={username}"); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { try { recievedData = JsonUtility.FromJson <LeaderBoardData>(www.downloadHandler.text); nameNotFound.SetActive(false); findName.text = recievedData.username; findScore.text = recievedData.score.ToString(); } catch { nameNotFound.SetActive(true); findName.text = ""; findScore.text = ""; } } }
public void Init() { LoadLevel(); LeaderBoardData.SetDatas(); }
public void LevelCompleted() { LevelCompleted(LeaderBoardData.GetDatas()); }
public void GameOver(bool isComplete = true) { GameOver(isComplete, LeaderBoardData.GetDatas()); }
private void AssignLeaderboard(LeaderBoardData inLeaderBoards) { Main.Data.Leaderboards = inLeaderBoards; Main.Data.Leaderboards.CalculateLastRank(); UpdateLeaderBoards(); }
private static void InitLocalDataBase() { //fill with 2 fake leaderBoards LocalLeaderboardSystem.AddLeaderboardsGroup(LeaderBoardData.RandomData("DK")); LocalLeaderboardSystem.AddLeaderboardsGroup(LeaderBoardData.RandomData("TN")); }
public virtual void LeaderBoardUIDataActive(int idx, bool active, int place, LeaderBoardData data) { }
public void Send(LeaderBoardData data) { StartCoroutine(Upload(data)); }