예제 #1
0
        public void FetchNewMessages(APIAccess api)
        {
            if (fetchReq != null) return;

            fetchReq = new GetMessagesRequest(careChannels, lastMessageId);
            fetchReq.Success += delegate (List<Message> messages)
            {
                foreach (Message m in messages)
                {
                    careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m);
                }

                lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;

                Debug.Write("success!");
                fetchReq = null;
            };
            fetchReq.Failure += delegate
            {
                Debug.Write("failure!");
                fetchReq = null;
            };

            api.Queue(fetchReq);
        }
예제 #2
0
파일: OsuGameBase.cs 프로젝트: yheno/osu
 public void APIStateChanged(APIAccess api, APIState state)
 {
     switch (state)
     {
         case APIState.Online:
             Config.Set(OsuConfig.Username, Config.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
             Config.Set(OsuConfig.Password, Config.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
             break;
     }
 }
예제 #3
0
파일: ChatOverlay.cs 프로젝트: yheno/osu
 public void APIStateChanged(APIAccess api, APIState state)
 {
     switch (state)
     {
         case APIState.Online:
             initializeChannels();
             break;
         default:
             messageRequest?.Cancel();
             break;
     }
 }
예제 #4
0
 public void APIStateChanged(APIAccess api, APIState state)
 {
     switch (state)
     {
         default:
             Text = @"Guest";
             avatar.UserId = 1;
             break;
         case APIState.Online:
             Text = api.Username;
             avatar.UserId = api.LocalUser.Value.Id;
             break;
     }
 }
예제 #5
0
파일: LoginOptions.cs 프로젝트: yheno/osu
 public void APIStateChanged(APIAccess api, APIState state)
 {
     switch (state)
     {
         case APIState.Offline:
             Children = new Drawable[]
             {
                 new LoginForm()
             };
             break;
         case APIState.Failing:
             Children = new Drawable[]
             {
                 new SpriteText
                 {
                     Text = "Connection failing :(",
                 },
             };
             break;
         case APIState.Connecting:
             Children = new Drawable[]
             {
                 new SpriteText
                 {
                     Text = "Connecting...",
                 },
             };
             break;
         case APIState.Online:
             Children = new Drawable[]
             {
                 new SpriteText
                 {
                     Text = $"Connected as {api.Username}!",
                 },
                 new OsuButton
                 {
                     RelativeSizeAxes = Axes.X,
                     Text = "Sign out",
                     Action = api.Logout
                 }
             };
             break;
     }
 }
예제 #6
0
파일: OsuGameBase.cs 프로젝트: yheno/osu
        private void load()
        {
            Dependencies.Cache(this);
            Dependencies.Cache(Config);
            Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
            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 = 0.01f }, 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/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 = Config.Get<string>(OsuConfig.Username),
                Password = Config.Get<string>(OsuConfig.Password),
                Token = Config.Get<string>(OsuConfig.Token)
            });

            API.Register(this);
        }
예제 #7
0
파일: ChatOverlay.cs 프로젝트: yheno/osu
 private void load(APIAccess api)
 {
     this.api = api;
     api.Register(this);
 }
예제 #8
0
 private void load(APIAccess api, OsuConfigManager config)
 {
     api.Register(this);
 }
예제 #9
0
 private void load(APIAccess api)
 {
     this.api = api;
 }
예제 #10
0
파일: LoginOptions.cs 프로젝트: yheno/osu
 private void load(APIAccess api)
 {
     api?.Register(this);
 }