示例#1
0
        void HandleTeamTagging(LMTeamVM team, string taggedPlayer)
        {
            // limitation to the number of temporal contexts that can be created
            int position = taggedPlayer.Length;

            if (position == 3)
            {
                HandleTaggedPlayer(team, taggedPlayer);
            }

            KeyTemporalContext tempContext = new KeyTemporalContext {
            };

            for (int i = 0; i < 10; i++)
            {
                string     newTaggedPlayer = taggedPlayer + i;
                VKeyAction action          = new VKeyAction(new KeyConfig {
                    Name = taggedPlayer,
                    Key  = App.Current.Keyboard.ParseName(i.ToString())
                }, () => HandleTeamTagging(team, newTaggedPlayer));
                tempContext.AddAction(action);
            }
            tempContext.Duration          = Constants.TEMP_TAGGING_DURATION;
            tempContext.ExpiredTimeAction = () => HandleTaggedPlayer(team, taggedPlayer);

            App.Current.KeyContextManager.AddContext(tempContext);
        }
示例#2
0
 /// <summary>
 /// Adds a KeyAction
 /// </summary>
 /// <param name="keyAction">Key action.</param>
 public void AddAction(KeyAction keyAction)
 {
     if (!KeyActions.Contains(keyAction))
     {
         KeyActions.Add(keyAction);
         KeyActions.Sort();
     }
 }
示例#3
0
        public override IEnumerable <VKeyAction> GetDefaultKeyActions()
        {
            List <VKeyAction> keyActions = (List <VKeyAction>)base.GetDefaultKeyActions();

            VKeyAction action = new VKeyAction(new KeyConfig {
                Name = App.Current.Config.Hotkeys.ActionsDescriptions [LKeyAction.LocalPlayer],
                Key  = App.Current.Config.Hotkeys.ActionsHotkeys [LKeyAction.LocalPlayer]
            }, () => HandleTeamTagging(((LMProjectVM)project).HomeTeam, string.Empty));

            keyActions.Add(action);

            action = new VKeyAction(new KeyConfig {
                Name = App.Current.Config.Hotkeys.ActionsDescriptions [LKeyAction.VisitorPlayer],
                Key  = App.Current.Config.Hotkeys.ActionsHotkeys [LKeyAction.VisitorPlayer]
            }, () => HandleTeamTagging(((LMProjectVM)project).AwayTeam, string.Empty));
            keyActions.Add(action);

            return(keyActions);
        }
示例#4
0
 /// <summary>
 /// Removes a KeyAction
 /// </summary>
 /// <param name="keyAction">Key action.</param>
 public void RemoveAction(KeyAction keyAction)
 {
     KeyActions.RemoveAll(x => x == keyAction);
     KeyActions.Sort();
 }