Пример #1
0
 public void HandleArguments(string args)
 {
     GameBase.Scheduler.Add(delegate
     {
         if (args.StartsWith("osu://"))
         {
             GameBase.BringToFront();
             ChatEngine.HandleLink(args);
         }
         else
         {
             //file handling.
             OsuModes gs = GameBase.ReceiveFile(args);
             if (gs != OsuModes.Unknown)
             {
                 if (GameBase.IsMinimized && GameBase.Form.Visible)
                 {
                     GameBase.Form.WindowState = FormWindowState.Normal;
                     GameBase.BringToFront();
                 }
                 GameBase.ChangeMode(gs, true);
             }
         }
     });
 }
Пример #2
0
        private pSprite AddLinkSprite(Link l, List <pSprite> linkSprites, Vector2 offset, Vector2 size)
        {
            pSprite linkSprite = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game, messageSprite.Position + offset);

            linkSprite.InitialPosition = messageSprite.InitialPosition + offset;
            linkSprite.Depth           = messageSprite.Depth - 0.001f;
            linkSprite.AlwaysDraw      = true;
            linkSprite.Tag             = @"link";
            linkSprite.InitialColour   = new Color(39, 70, 120, 255);

            linkSprite.Scale       = 1.6f;
            linkSprite.VectorScale = size;

            linkSprite.HandleInput = true;

            linkSprite.OnHover += delegate
            {
                foreach (pSprite s in linkSprites)
                {
                    s.FadeColour(Color.LightBlue, 100);
                }
            };

            linkSprite.OnHoverLost += delegate
            {
                foreach (pSprite s in linkSprites)
                {
                    s.FadeColour(new Color(39, 70, 120, 255), 100);
                }
            };

            linkSprite.OnClick += delegate { ChatEngine.HandleLink(l.Url); };

            linkSprite.ToolTip = @"link: " + l.Url;

            linkSprite.ClickRequiresConfirmation = true;
            Sprites.Add(linkSprite);

            return(linkSprite);
        }