コード例 #1
0
        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);
        }
コード例 #2
0
        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");
            });
        }
コード例 #3
0
        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
                }
            }
        }