void Start( ) { if (SLController.Load( ) == null) { continueButton.gameObject.SetActive(false); } GetScore( ); }
public void SetSavePoint(Stage stage, P.Player player) { DomainEvents.Raise <OnStageChange> (new OnStageChange(stage, currentStage)); currentStage = stage; //get player data this.player = player; playerData = new SaveData(player.Dash.Energy, player.Dash.CanDash, stage, gameController.ElapsedTime); SLController.Save(playerData); }
public static void SetUserName(string name) { string path = Application.persistentDataPath + "/user.txt"; FileStream fs = new FileStream(path, FileMode.Create); string fileContext = name; StreamWriter file = new StreamWriter(fs); file.Write(fileContext); file.Close( ); SLController.WriteLog("Set User Name to " + name); }
void Awake( ) { foreach (Transform o in scoreObjs) { scoreTexts.Add(o.Find("Score").GetComponent <Text> ( )); userTexts.Add(o.Find("User").GetComponent <Text> ( )); timeTexts.Add(o.Find("Time").GetComponent <Text> ( )); levelTexts.Add(o.Find("Level").GetComponent <Text> ( )); o.gameObject.SetActive(false); } inputField.text = SLController.GetUserName( ); }
void GetScore( ) { SLController.WriteLog("Try to get score"); CollectionReference scoreboardRef = GameManager.Instance.Db.Collection("ScoreBoard"); Query query = scoreboardRef.OrderBy("Score").Limit(10); query.GetSnapshotAsync( ).ContinueWith(task => { List <Dictionary <string, object> > data = new List <Dictionary <string, object> > ( ); foreach (DocumentSnapshot o in task.Result.Documents) { data.Add(o.ToDictionary( )); } for (int i = 0; i < task.Result.Count; i++) { this.datas.Add(new ScoreData(data[i]["User"].ToString( ), float.Parse(data[i]["Score"].ToString( )).ToString("F2"), data[i]["Time"].ToString( ), data[i]["Level"].ToString( ))); } bSocreGet = true; SLController.WriteLog("Alreay get the score"); }); }
override protected void Awake( ) { base.Awake( ); if (Instance == this) { control = new PlayerControl( ); SLController.WriteLog("Start check firebase instance"); var task = Firebase.FirebaseApp.CheckAndFixDependenciesAsync( ); task.Wait( ); Firebase.DependencyStatus obj = task.Result; if (obj == Firebase.DependencyStatus.Available) { db = FirebaseFirestore.DefaultInstance; SLController.WriteLog("Finish check firebase instance"); } else { SLController.WriteLog(System.String.Format("Could not resolve all Firebase dependencies: {0}", obj)); #if UNITY_EDITOR Debug.LogError(System.String.Format("Could not resolve all Firebase dependencies: {0}", obj)); #endif } } }
public void OnSetNamePressed( ) { SLController.SetUserName(userText.text); Debug.Log(userText.text); }
public void OnContinuePressed( ) { SaveData data = SLController.Load( ); GameManager.Instance.LoadLevel(data.Level, data); }