Beispiel #1
0
 public void ChangeActionState(GuiActions action, bool isOn)
 {
     if (actionCache.ContainsKey(action))
     {
         actionCache[action].IsOn = isOn;
     }
 }
Beispiel #2
0
 private void RaiseActionEvent(GuiActions action)
 {
     if (PlayerPerformedAction != null)
     {
         PlayerPerformedAction(this, new ActionEventArgs(action));
     }
 }
Beispiel #3
0
        public bool GetActionState(GuiActions action)
        {
            if (actionCache.ContainsKey(action))
            {
                return(actionCache[action].IsOn);
            }

            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// A callback for a player action button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void ActionButtonClicked(object sender, RoutedEventArgs args)
        {
            // must have a valid player as the data context to handle the current action
            GuiMainPlayer thePlayer = DataContext as GuiMainPlayer;

            if (thePlayer == null)
            {
                return;
            }
            // the action is also the button tag
            Button     clickedButton = (Button)sender;
            GuiActions action        = (GuiActions)clickedButton.Tag;

            // send the player the action played
            thePlayer.HandleAction(action);
        }
Beispiel #5
0
        /// <summary>Converts a value. </summary>
        /// <returns>A converted value. If the method returns null, the valid null value is used.</returns>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(Binding.DoNothing);
            }

            GuiActions action = (GuiActions)value;

            // split the all in value,
            if (action == GuiActions.AllIn)
            {
                return("All In");
            }
            // in all other cases, use the action name
            else
            {
                return(action.ToString());
            }
        }
Beispiel #6
0
 public ActionWrapper(GuiActions action)
 {
     this.action = action;
 }
Beispiel #7
0
 public void HandleAction(GuiActions action)
 {
     RaiseActionEvent(action);
 }
Beispiel #8
0
 public ActionEventArgs(GuiActions action)
 {
     this.action = action;
 }