//讀取Xml資料
    void loadScore()
    {
        XmlSerializer serializer = new XmlSerializer(typeof(ScoreDatabase));
        FileStream    stream     = new FileStream(Application.dataPath + "/StreamingAssets/XML/Score_data.xml", FileMode.Open);

        scoreDB = serializer.Deserialize(stream) as ScoreDatabase;
        stream.Close();
    }
Example #2
0
        private void load()
        {
            Dependencies.Cache(this);
            Dependencies.Cache(LocalConfig);

            SQLiteConnection connection = Host.Storage.GetDatabase(@"client");

            Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection));
            Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host));
            Dependencies.Cache(ScoreDatabase   = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase));
            Dependencies.Cache(new OsuColour());

            //this completely overrides the framework default. will need to change once we make a proper FontStore.
            Dependencies.Cache(Fonts = new FontStore {
                ScaleAdjust = 100
            }, true);

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));

            var defaultBeatmap = new DummyWorkingBeatmap(this);

            Beatmap = new NonNullableBindable <WorkingBeatmap>(defaultBeatmap);
            BeatmapDatabase.DefaultBeatmap = defaultBeatmap;

            OszArchiveReader.Register();

            Dependencies.Cache(API = new APIAccess
            {
                Username = LocalConfig.Get <string>(OsuSetting.Username),
                Token    = LocalConfig.Get <string>(OsuSetting.Token)
            });

            API.Register(this);
        }
Example #3
0
 public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null)
     : base(host)
 {
     this.scores      = scores;
     MessageReceived += (msg) =>
     {
         Debug.Assert(scores != null);
         ImportAsync(msg.Path);
     };
 }
Example #4
0
        public DatabaseController(GameHost host, DependencyContainer dependencies)
        {
            Dependencies = dependencies;
            Connection   = host.Storage.GetDatabase(@"client");

            Dependencies.Cache(debugConfig  = new FrameworkDebugConfigManager());
            Dependencies.Cache(config       = new FrameworkConfigManager(host.Storage));
            Dependencies.Cache(Localisation = new LocalisationEngine(config));

            Dependencies.Cache(RulesetDatabase = new RulesetDatabase(host.Storage, Connection));
            Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(host.Storage, Connection, RulesetDatabase, host));
            Dependencies.Cache(ScoreDatabase   = new ScoreDatabase(host.Storage, Connection, host, BeatmapDatabase));
        }
Example #5
0
 public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null)
     : base(host)
 {
     this.scores      = scores;
     MessageReceived += msg =>
     {
         Debug.Assert(scores != null);
         ImportAsync(msg.Path).ContinueWith(t =>
         {
             if (t.Exception != null)
             {
                 throw t.Exception;
             }
         }, TaskContinuationOptions.OnlyOnFaulted);
     };
 }
Example #6
0
        private void dragDrop(DragEventArgs e)
        {
            // this method will only be executed if e.Effect in dragEnter gets set to something other that None.
            var dropData  = (object[])e.Data.GetData(DataFormats.FileDrop);
            var filePaths = dropData.Select(f => f.ToString()).ToArray();

            if (filePaths.All(f => Path.GetExtension(f) == @".osz"))
            {
                Task.Run(() => BeatmapDatabase.Import(filePaths));
            }
            else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
            {
                Task.Run(() =>
                {
                    var score = ScoreDatabase.ReadReplayFile(filePaths.First());
                    Schedule(() => LoadScore(score));
                });
            }
        }
Example #7
0
        private void load()
        {
            Dependencies.Cache(this);
            Dependencies.Cache(LocalConfig);
            Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, Host));
            Dependencies.Cache(ScoreDatabase   = new ScoreDatabase(Host.Storage, Host, BeatmapDatabase));
            Dependencies.Cache(new OsuColour());

            //this completely overrides the framework default. will need to change once we make a proper FontStore.
            Dependencies.Cache(Fonts = new FontStore {
                ScaleAdjust = 100
            }, true);

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));

            OszArchiveReader.Register();

            Dependencies.Cache(API = new APIAccess
            {
                Username = LocalConfig.Get <string>(OsuConfig.Username),
                Token    = LocalConfig.Get <string>(OsuConfig.Token)
            });

            API.Register(this);
        }
Example #8
0
    private void Awake()
    {
        SetSingleton();
        SetData();
        //LoadData();
        ScoreData data1;

        data1.name  = "John";
        data1.value = 500;

        ScoreData data2;

        data2.name    = "Jim";
        data2.value   = 600;
        scoreDatabase = new ScoreDatabase();
        scoreDatabase.AddScore(data1);
        scoreDatabase.AddScore(data2);
        SaveData(scoreDatabase, scoreDatabasePath);
    }
Example #9
0
 private void load(Storage storage)
 {
     scoreDatabase = new ScoreDatabase(storage);
 }
Example #10
0
    private void LoadData()
    {
        string contents = System.IO.File.ReadAllText(path + scoreDatabasePath);

        scoreDatabase = JsonUtility.FromJson <ScoreDatabase>(contents);
    }
Example #11
0
        private void load()
        {
            dependencies.Cache(this);
            dependencies.Cache(LocalConfig);

            SQLiteConnection connection = Host.Storage.GetDatabase(@"client");

            dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection));
            dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host));
            dependencies.Cache(ScoreDatabase   = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase));
            dependencies.Cache(new OsuColour());

            //this completely overrides the framework default. will need to change once we make a proper FontStore.
            dependencies.Cache(Fonts = new FontStore {
                ScaleAdjust = 100
            }, true);

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));

            var defaultBeatmap = new DummyWorkingBeatmap(this);

            Beatmap = new NonNullableBindable <WorkingBeatmap>(defaultBeatmap);
            BeatmapDatabase.DefaultBeatmap = defaultBeatmap;

            OszArchiveReader.Register();

            dependencies.Cache(API = new APIAccess
            {
                Username = LocalConfig.Get <string>(OsuSetting.Username),
                Token    = LocalConfig.Get <string>(OsuSetting.Token)
            });

            Beatmap.ValueChanged += b =>
            {
                // compare to last baetmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
                if (lastBeatmap?.Track != b.Track)
                {
                    // this disposal is done to stop the audio track.
                    // it may not be exactly what we want for cases beatmaps are reused, as it will
                    // trigger a fresh load of contained resources.
                    lastBeatmap?.Dispose();

                    Audio.Track.AddItem(b.Track);
                }

                lastBeatmap = b;
            };

            API.Register(this);
        }