Tips for Silverlight game development: Skill cool-down 2 (Cooldown) 2

Source: Internet
Author: User

It may wonder why a version 2nd is used. In fact, this is an improved version, which is easier to implement and more convenient, but the problem is also obvious, because a DLL of more than 100 KB will be added, any 1KB is a valuable resource for web games, and the XAP capacity will be increased for no reason for this small effect, it also proves that there is a sense of loss. How should I choose between fish and bear's paw? Let's first look at this implementation method.

The preceding method is almost the same, but the two grids do not need to be added. Instead, LayoutRoot is directly cropped with a Rect of the entire size,

Of course, if you like it, you can use Border or other containers as the background, add an image as the icon basemap, and then find the "Pie" Control in Asset.

You can know in the prompt that Microsoft. expression. drawing. dll, and this is the culprit. It will relentlessly enter the final release of XAP. Well, we will not tangle with this issue first, and proceed first.

Add to control

Expand the margin so that the slice arc will not leak out. By the way, we fill in a translucent black.

We set all Margin to-15. In the Pie control, StartAngle is the starting angle. I simply set 120, which is different from the previous one.

Now we have made storyboards in similar ways.

This is a simple animation. You can set StartAngle to 0 in 0 seconds and 2nd in 360 seconds. If you need different time lengths, you can make some adjustments.

In the previous article, I did not write the click code. In this article, we can modify the code based on our own needs. If we program UserControl, we can rewrite the Click Event of the mouse.

Code Snippet
  1. Public partial class SkillIcon: UserControl
  2. {
  3. Public SkillIcon ()
  4. {
  5. InitializeComponent ();
  6. }
  7. Protected override void OnMouseLeftButtonDown (MouseButtonEventArgs e)
  8. {
  9. ANI_CoolDown.Begin ();
  10. Base. OnMouseLeftButtonDown (e );
  11. }
  12. }

Actually, it is to execute Begin ()

In the following running effect, it is almost the same as the first one. Here we need to make a comparison and trade-offs to sacrifice the size for convenience, to reduce the production efficiency by KB (the actual compression may only be 50 KB. In fact, each method can be used, as long as we can implement our ideas.

Source code: Click to download directly

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.