Beispiel #1
0
 public override void Initialize()
 {
     privateMessageItem = new XNAContextMenuItem()
     {
         Text         = PRIVATE_MESSAGE,
         SelectAction = () => pmWindow.InitPM(GetIrcUser().Name)
     };
     toggleFriendItem = new XNAContextMenuItem()
     {
         Text         = ADD_FRIEND,
         SelectAction = () => cncnetUserData.ToggleFriend(GetIrcUser().Name)
     };
     toggleIgnoreItem = new XNAContextMenuItem()
     {
         Text         = BLOCK,
         SelectAction = () => GetIrcUserIdent(cncnetUserData.ToggleIgnoreUser)
     };
     invitePlayerItem = new XNAContextMenuItem()
     {
         Text         = INVITE,
         SelectAction = Invite
     };
     joinPlayerItem = new XNAContextMenuItem()
     {
         Text         = JOIN,
         SelectAction = () => JoinEvent?.Invoke(this, new JoinUserEventArgs(GetIrcUser()))
     };
     AddItem(privateMessageItem);
     AddItem(toggleFriendItem);
     AddItem(toggleIgnoreItem);
     AddItem(invitePlayerItem);
     AddItem(joinPlayerItem);
 }
Beispiel #2
0
        public void UpdateStartingLocationTexts()
        {
            foreach (PlayerLocationIndicator indicator in startingLocationIndicators)
            {
                indicator.Players.Clear();
            }

            foreach (PlayerInfo pInfo in players)
            {
                if (pInfo.StartingLocation > 0)
                {
                    startingLocationIndicators[pInfo.StartingLocation - 1].Players.Add(pInfo);
                }
            }

            foreach (PlayerInfo aiInfo in aiPlayers)
            {
                if (aiInfo.StartingLocation > 0)
                {
                    startingLocationIndicators[aiInfo.StartingLocation - 1].Players.Add(aiInfo);
                }
            }

            foreach (PlayerLocationIndicator indicator in startingLocationIndicators)
            {
                indicator.Refresh();
            }

            contextMenu.ClearItems();

            int id         = 1;
            var playerList = players.Concat(aiPlayers).ToList();

            for (int i = 0; i < playerList.Count; i++)
            {
                PlayerInfo pInfo = playerList[i];

                string text = pInfo.Name;

                if (pInfo.TeamId > 0)
                {
                    text = teamIds[pInfo.TeamId] + text;
                }

                int index = i;
                XNAContextMenuItem item = new XNAContextMenuItem()
                {
                    Text         = id + ". " + text,
                    TextColor    = pInfo.ColorId > 0 ? mpColors[pInfo.ColorId - 1].XnaColor : Color.White,
                    SelectAction = () => ContextMenu_OptionSelected(index),
                };
                contextMenu.AddItem(item);

                id++;
            }
        }