コード例 #1
0
 public HighScoreViewModel(HighScoreWindow window)
 {
     this.window    = window;
     this.container = getContainer();
     this.window.Scores.ItemsSource = container.GetRecords();
     this.BackCommand = new CommandBase(this.ExecuteBackCommand, this.CanExecuteBackCommand);
 }
コード例 #2
0
 public static void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/" + fileName))
     {
         string json = File.ReadAllText(Application.persistentDataPath + "/" + fileName);
         _scores = JsonUtility.FromJson <HighScoreContainer>(json);
         Debug.Log("Loading from: " + Application.persistentDataPath + "/" + fileName + "\nJson: " + json);
     }
 }
コード例 #3
0
    public void Save(HighScoreContainer saveData)
    {
        string path = Application.persistentDataPath + PathData.FilePath;

        using (FileStream fs = File.Create(path)) {
            using (BinaryWriter writer = new BinaryWriter(fs)) {
                saveData.Write(writer);
            }
        }
    }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static TreasureUser Beginner()
 {
     return(new TreasureUser
     {
         Name = "Beginner",
         FrequencyDelta = 3000,
         CurrentLevel = 1,
         Scores = HighScoreContainer.Default()
     });
 }
コード例 #5
0
 private void SaveContainer(HighScoreContainer container, RecordSerializer serilizer)
 {
     try
     {
         serilizer.Serialize(container);
     }
     catch (RecordSerializationException)
     {
         //Log Error
         return;
     }
 }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static TreasureUser Expert()
        {
            var GG = new TreasureUser
            {
                Name           = "Expert",
                FrequencyDelta = 4500,
                CurrentLevel   = 10,
                Scores         = HighScoreContainer.Default()
            };

            return(GG);
        }
コード例 #7
0
        private void SaveScore(string name, int points)
        {
            BinaryFormatter  formatter = new BinaryFormatter();
            string           fileName  = GlobalConstants.ScorFilePath;
            RecordSerializer serilizer = new RecordSerializer(formatter, fileName);

            HighScoreContainer container = GetContainer(serilizer);

            Player player = new Player(DateTime.Now, name, points);

            container.Add(player);

            SaveContainer(container, serilizer);
        }
コード例 #8
0
    public HighScoreContainer Load()
    {
        HighScoreContainer highScoreContainer = new HighScoreContainer();

        string path = Application.persistentDataPath + PathData.FilePath;

        if (File.Exists(path))
        {
            using (FileStream fs = File.OpenRead(path)) {
                using (BinaryReader reader = new BinaryReader(fs)) {
                    highScoreContainer.Read(reader);
                }
            }
        }

        return(highScoreContainer);
    }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 public TreasureUser()
 {
     this._userType     = UserType.Stereotype;
     this._Name         = "";
     this._FqTraining   = 2500;
     this._FqDelta      = 0;
     this._FqComparison = 0;
     this._currLevel    = 1;
     this._currLife     = 4;
     this._currGold     = 0;
     this._currScore    = 0;
     this._currTarget   = 0;
     this._maxTarget    = 0;
     this._currExposure = 0;
     this._nbActions    = 0;
     this._showDebug    = false;
     this._scores       = new HighScoreContainer();
     this.Pattern       = new WinPattern();
     this.VisualTiming  = new Gates();
 }
コード例 #10
0
ファイル: HighScoreManager.cs プロジェクト: Zkarts/WhacAMole
 private void Awake()
 {
     saveService        = GetComponent <IHighscoreSaveService>();
     loadService        = GetComponent <IHighscoreLoadService>();
     highScoreContainer = loadService.Load();
 }