Small dream today 2048 of the game source code to share, actually feel this weight in the algorithm, the UI is very simple, and almost no use of what Windows Phone API. Small dream Encounter the most important problem is the handling of touch events, I just started to think of is the manipulation series of events, but in the test did not know why I set the Manipulationdelta,manipulationstart, Manipulationcompleted unexpectedly all have no reaction, I thought WP8.1 not support, so all touch events tried all over, to the last found when the Manipulationmode set to "All", finally have a reaction, (of course, This is not necessarily all, set to the touch events you support, such as panning, rotating. Want to ask: is it necessary to set manipulationmode and then manipulation to react? The result of my test is that it has to be. So I used Manipulationstart and manipulationcompleted and get touch start and end coordinates, but when finished, found the game although normal operation, but the reaction is super slow, obviously delayed about 1 seconds. I began to think that there is a problem with the algorithm, too much time, so I saw a lot of other people open algorithms, found that the complexity of the same. The last thought of the trigger sequence of touch events, manipulationcompleted time comparison, perhaps this reason. So I want to use the Manipulationdelta incident to try to see if the response will be faster, the result is indeed fast, but a touch will trigger multiple times. The workaround is to use its complete () method, which completes the touch without triggering the inertia time.
Another small problem is that when the layout generates 16 small squares, I use a button in the grid to implement it. It is important to note that the button itself has a default property of Margin,padding,borad, as well as a transition animation between the state attribute and the state, and we should remove or modify these properties if we want to implement the grid effect in 2048. And the grid has the default margin attribute, and we have to get rid of it.
As for the complete implementation of the 2048 process, write it another day.
Welcome everybody to spit groove and suggestion, the source code also has many improvement place, the small dream also will revise in.
Source: Windows Phone 2048 (you can just sign up, no other restrictions.) )
Windows Phone 2048 source code on