Exemplo n.º 1
0
        public override Bitmap ToImage()
        {
            var path    = $"UnoSharp.Resources.Cards.{this.Color}.{ShortName}.png";
            var content = EmbedResourceReader.GetStream(path);

            if (content == null)
            {
                return((Bitmap)Card.GoldenCardImage);
            }
            return(new Bitmap(content));
        }
        public void OnGameLog(string log)
        {
            Task.Run(() =>
            {
                if (log.Contains("LLHMessage")) // This for OrigindHelper
                {
                    var message = log.Split('%')[1];
                    var statusp = message.Split('&');
                    var statusw = statusp[0];
                    if (!double.TryParse(statusp[1], out var progress))
                    {
                        progress = 0.5;
                    }
                    string modname = string.Empty, progressname;
                    if (statusw == "reloading_resource_packs")
                    {
                        progressname = statusw;
                    }
                    else
                    {
                        var temp     = statusw.Split('*');
                        progressname = temp[0];
                        modname      = temp[1];
                    }

                    progressname     = Translate(progressname);
                    var progressText = $"{progressname} {modname} 完成";
                    _launchProgressWindow.Dispatcher.Invoke(() => _launchProgressWindow.Process(progressText, progress));
                }
                else if (log.EndsWith("GuiMainMenu Loaded"))
                {
                    _launchProgressWindow.Dispatcher.Invoke(() => _launchProgressWindow.Done());

                    if (Config.Instance.PlayGameLoadedSound)
                    {
                        Task.Run(async() =>
                        {
                            await Task.Delay(TimeSpan.FromSeconds(10));
                            var sound = EmbedResourceReader.GetStream("OrigindLauncher.Sounds.InterruptOne.ogg");
                            SoundPlayer.PlaySound(sound);
                        });
                    }
                }
                else
                {
                    _launchProgressWindow.Dispatcher.Invoke(() => _launchProgressWindow.AddLog(log));
                }
            });
        }