Skip to main content
Home Forums Silverlight Programming Game Development Slot Machine Implementation Guidance
6 replies. Latest Post by halhunt on October 25, 2009.
(0)
halhunt
Member
0 points
4 Posts
09-29-2009 2:55 PM |
Hello,
I am looking for some guidance in developing a SL3 app that mimics this flash app:
http://www.urbanspoon.com/spin-widget
My first thoughts were to use a ScrollViewer containing a Stackpanel (oriented vertically) containing a bunch of text blocks and just use the ScrollViewer.ScrollToVerticalOffset to control the movement of the slot. That all worked and was very simple to do. Now I'm trying to figure out how to actually simulate the "spin" of the slot. Any suggestions are greatly appreciated!
Thanks in advance!
drnomad
206 points
58 Posts
09-30-2009 2:54 AM |
If your control rotates the items round the wheel, then I guess the simulation is very simple by manipulating the scroll speed. In your example, they have also made the text a little vague, to make the rotation a little more convincing.
ben33333
50 points
11 Posts
09-30-2009 12:41 PM |
I think you're having trouble because the HorizontalOffset and VerticalOffset of ScrollViewer are read-only in Silverlight. However, there are workarounds:
http://blogs.msdn.com/delay/archive/2009/08/04/scrolling-so-smooth-like-the-butter-on-a-muffin-how-to-animate-the-horizontal-verticaloffset-properties-of-a-scrollviewer.aspx
That will probably work well with what you have already created. An alternative would be to place your StackPanel inside a Canvas and animate a TranslateTransform instead.
For the blur look, you could either overlay a blurred-text image over your text blocks, or use a pixel shader if you want something more advanced.
09-30-2009 9:18 PM |
Thanks so much for your reply Ben. I will look over the link you suggested too. I guess my challenge is that the items in each of my slots are less than 10 items long so I'm not sure how to make them "wrap" around like a wheel. So when the user "spins" the slot the whole items list is repeated again. I think if I used a StackPanel inside a canvas I would have the same issue. Does that make any sense?
10-01-2009 8:45 PM |
Any other suggestions on ways to accomplish this are very much appreciated!
Jonathan...
All-Star
24979 points
2,434 Posts
10-05-2009 5:14 AM |
Hi Halhunt,
I just took a look at the application. This can be down with Silverlight. We can simply add tree ListBox to show the Three Columns. Each column has two buttons, one for up and another for down operation. When we click to Spin, we can a WCF to get the target restaurant, and during this, we can show an animation or change the ListBox's ItemsSource with a fake data.
Best regards,
Jonathan
10-25-2009 5:24 PM |
Here is the final product:
http://www.shakedate.com
Enjoy!