Ejemplo n.º 1
0
        public void Setup() => Schedule(() =>
        {
            Child = new Container
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Size   = new Vector2(300, 500),
                Child  = playlistOverlay = new PlaylistOverlay
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    State            = { Value = Visibility.Visible }
                }
            };

            beatmapSets.Clear();

            for (int i = 0; i < 100; i++)
            {
                beatmapSets.Add(TestResources.CreateTestBeatmapSetInfo().ToLiveUnmanaged());
            }

            first = beatmapSets.First();

            playlistOverlay.BeatmapSets.BindTo(beatmapSets);
        });
Ejemplo n.º 2
0
        private void onFileDeleted(string filename)
        {
            if (!UseableThemes.Any(t => t.Name == filename))
            {
                return;
            }

            scheduler.Add(() => UseableThemes.Remove(UseableThemes.First(t => t.Name == filename)));
        }
Ejemplo n.º 3
0
        private void HandleSwitchView(SwitchViewMessage msg)
        {
            if (msg.ViewModelType == GetType())
            {
                _busyService.ShowBusyIndicatorUntilFinishDrawing();

                var meaning = (Meaning)msg.DomainModels[0];
                SelectedMeaning = _meanings[meaning];
                if (msg.DomainModels.Count > 1)
                {
                    var wp = (WordPair)msg.DomainModels[1];
                    _selectedWords.ReplaceAll(new[] { _words.First(w => w.DomainWord == wp.Word1), _words.First(w => w.DomainWord == wp.Word2) });
                }
            }
        }
Ejemplo n.º 4
0
        private bool parse(IReadOnlyList <string> lines)
        {
            bool isParsingObjects = false;

            ProjectElement parsingElement = null;

            for (int i = 0; i < lines.Count; i++)
            {
                var line = lines[i];

                if (line.StartsWith('['))
                {
                    isParsingObjects = line.Trim('[', ']') switch
                    {
                        "Info" => false,
                        "Objects" => true,
                        _ => isParsingObjects,
                    };

                    continue;
                }

                if (isParsingObjects)
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        if (parsingElement != null)
                        {
                            AddElement(parsingElement);
                            parsingElement = null;
                        }

                        continue;
                    }

                    if (parsingElement == null)
                    {
                        var idents = line.Split('|', 3);

                        if (idents.Length != 3)
                        {
                            return(false);
                        }

                        parsingElement = Enum.Parse <ElementType>(idents[0]) switch
                        {
                            ElementType.Token => new Token(),
                            ElementType.Card => new Card(),
                            ElementType.Tile => new Tile(),
                            ElementType.Board => new Board(),
                            _ => null,
                        };

                        if (parsingElement == null)
                        {
                            return(false);
                        }

                        parsingElement.ID         = int.Parse(idents[1]);
                        parsingElement.Name.Value = idents[2];
                    }
                    else
                    {
                        var tokens = line.Split('=');

                        if (tokens.Length != 2)
                        {
                            return(false);
                        }

                        switch (tokens[0])
                        {
                        case "Images":
                        {
                            int amm = int.Parse(tokens[1]);

                            for (int j = i + amm; i < j; i++)
                            {
                                var parts = lines[i + 1].Split('=', ':');

                                if (parts.Length != 2)
                                {
                                    return(false);
                                }

                                if (parts[1] == "null")
                                {
                                    continue;
                                }

                                if (Images.First(im => im.ImageName == parts[1]) is var image && image != null)
                                {
                                    parsingElement.Images[parts[0]].Value = image;
                                }
                                else
                                {
                                    return(false);
                                }
                            }

                            break;
                        }