Tuesday, November 24, 2009

Surface D&D and other Board Games - "Enhanced"

This is a reference to Rob Wettach's October 26th blog on Surface D&D:




This is something that I discovered myself when I looked into some ideas for my final project. I was never a D&D player myself, but this Surface controlled environment would make it easy to play and learn the game.
When I first saw this demonstration, I thought about the number of other board games that would be great to play on a Surface. Classics like Monopoly would be easy to pick up on a Surface. You could still roll dice and move your piece if you wanted to, or have the computer move your player for you while you manage your assets and discuss property trades.

I also considered playing a much more complex game like Axis & Allies or Risk. A game like these would really benefit from limiting the physical pieces on the board that can easily be lost or knocked over (which subsequently ruins the game). In addition, these games can take hours to finish, so it would be nice to save the game and come back later. While coding the rules to the games would take up LOTS of time, it would keep opponents from forgetting the rules or cheating.

Of course the strict rule enforcement might be the game's downfall as well. "House" rules would need to be programmed into the code to allow for game adjustments like collecting money on the "Free Parking" square of Monopoly.

Wednesday, November 4, 2009

XAML Triggers

There are three types of triggers in WPF: Property, Data and Event.
A property trigger is invoked when the value of a dependency property changes.
A data trigger is invoked when the value of a .NET property changes.
An event trigger is invoked when a routed event is raised.

Here is an example of a property based trigger:
<Style TargetType="{x:Type Button}" key="TriggerStyle">
  <Style.Triggers>
   <Trigger Property="IsMouseOver" value="True">
      <Setter Property="Background" Value="Green">
    </Trigger>
  </Style.Triggers>
</Style>

Here is an example of an event based trigger:
<Button Name="btn_OK" Click="btnOK_Click">OK</Button>