Silverlight Game development Tips: Skills Cooling effect 2 (cooldown) 2

Source: Internet
Author: User
Keywords This can we little tricks.
Tags .mall click control development fish game game development games

It may be strange why there is a 2nd version, in fact, this is an improved version, and this improved version is easier to implement, more convenient, but the problem is obvious, because it will add a 100 KB DLL, for web games, any 1KB is a valuable resource, For this small effect and no reason to increase the capacity of XAP, also verified that there must be some unreasonable, fish and bear's paw should be how to choose it, first of all to see how this implementation.

The previous approach is almost the same, but there is no need to increase the two grid, but directly with a whole size of rect to cut off the LayoutRoot,

Of course, if you like to use border or other containers to do the bottom, now add a picture as the bottom of the icon, and then in the asset find the "Pie" control.

You can know in the hint message, to use this control need to Microsoft.Expression.Drawing.dll, and this is the culprit, it will be ruthless into the final release of the XAP, well, we first do not tangle with this problem, go down first.

Add to control:

then expand the outer margin so that the fan-shaped arc is not leaking out, and we fill a translucent black.

We set the margin to 15, in the pie control, the startangle is the starting angle, I simply set 120, which is different from the previous one.

Now make storyboard animation in the same way as it used to be.

This is a simple animation, set the startangle to 0 in 0 seconds, set to 360 in the first 2 seconds, and if you need a variety of different time lengths, you can make some adjustments.

There is no written click on the code, this time, can be based on their own needs to transform, if we UserControl programming, you can rewrite the mouse click events.

public partial class Skillicon:usercontrol
{
Public Skillicon ()
{
InitializeComponent ();
}
protected override void Onmouseleftbuttondown (MouseButtonEventArgs e)
{
Ani_cooldown.begin ();
Base. Onmouseleftbuttondown (e);
}
}

Actually, it's just doing the Begin ()

In the following operating effect, almost as the first exactly the same, here needs to do a comparison and trade-offs, in the end is to facilitate the sacrifice of size, or to reduce the 100KB (the actual compression may only 50KB) and sacrificing the production efficiency. In fact, each method can be, as long as we can realize our ideas.

The source code download address is as follows: 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.