Ejemplo n.º 1
0
 public DlgCharacterSelect(SpaceSiegeGameParticipant participant)
 {
     this.components = null;
     this.InitializeComponent();
     this.gvCharacters.SelectionChanged += new SelectionChangedEventHandler(this.gvCharacters_SelectionChanged);
     this.gvCharacters.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gvCharacters_FocusedRowChanged);
 }
Ejemplo n.º 2
0
 public SpaceSiegeGame(SpaceSiegeGameParticipant leader) : base(leader)
 {
 }
Ejemplo n.º 3
0
 private void ChangePosition(SpaceSiegeGameParticipant participant, int newPosition)
 {
     this.ParticipantPanels[participant.Position].SetParticipant(null);
     this.ParticipantPanels[newPosition].SetParticipant(participant);
 }
Ejemplo n.º 4
0
 private void OnRecieveParticipant(SpaceSiegeGameParticipant participant)
 {
     SpaceSiegeGameParticipant participant2 = this.Game.FindMember(participant.Name) as SpaceSiegeGameParticipant;
     if (participant2 == null)
     {
         this.Game.Members.Add(participant);
         this.ParticipantPanels[participant.Position].SetParticipant(participant);
         this.chatPanel.SystemEvent("{0} has joined the game lobby.", new object[] { participant.Name });
         this.UpdateLaunchAbility();
         this.UpdateHostedGameRecord();
     }
     else
     {
         participant2.MergeParticipants(participant);
         this.ParticipantPanels[participant2.Position].SetParticipant(participant2);
         this.UpdateHostedGameRecord();
         this.UpdateLaunchAbility();
     }
 }
Ejemplo n.º 5
0
 private void OnAcceptInvite(string senderName, int senderId)
 {
     if (this.Game.AvailablePositions < 1)
     {
         this.SendMessage(senderName, SpaceSiegeLobbyMessages.Full, new object[0]);
     }
     else
     {
         SpaceSiegeGameParticipant item = new SpaceSiegeGameParticipant(this.Game, senderName, senderId);
         item.Position = this.Game.NextAvailablePosition();
         this.SendMessage(SpaceSiegeLobbyMessages.ParticipantInfo, new object[] { item.ToDataString() });
         this.Game.Members.Add(item);
         this.ParticipantPanels[item.Position].SetParticipant(item);
         this.SendMessage(senderName, SpaceSiegeLobbyMessages.Game, new object[] { this.Game.ToDataString() });
         this.chatPanel.SystemEvent("{0} has joined the game lobby.", new object[] { senderName });
         this.UpdateLaunchAbility();
         this.UpdateHostedGameRecord();
     }
 }
Ejemplo n.º 6
0
 private void KickParticipant(SpaceSiegeGameParticipant participant)
 {
     this.SendMessage(SpaceSiegeLobbyMessages.Kick, new object[] { participant.Name });
     this.RemoveParticipant(participant.Name);
     this.chatPanel.SystemMessage("<LOC>You have kicked {0} from the game lobby.", new object[] { participant.Name });
 }
Ejemplo n.º 7
0
 public void SetParticipant(SpaceSiegeGameParticipant participant)
 {
     if ((this.Game != null) && (this.Postition >= 0))
     {
         if (((participant != null) && (participant.Character == null)) && (participant.ID == User.Current.ID))
         {
             string path = PlayerCharacter.CharacterFilePath + @"\characters.gpgnet";
             if (File.Exists(path))
             {
                 StreamReader reader = new StreamReader(path);
                 string str2 = reader.ReadToEnd();
                 reader.Close();
                 string[] strArray = str2.Split(new char[] { '\x000e' });
                 int index = 0;
                 while (index < strArray.Length)
                 {
                     string data = strArray[index];
                     participant.Character = PlayerCharacter.FromString(data);
                     break;
                 }
             }
         }
         this.mParticipant = participant;
         this.skinDropDownPlayer.Menu.MenuItems.Clear();
         if (participant == null)
         {
             this.skinButtonSelectCharacter.Visible = false;
             this.skinButtonLaunch.Visible = false;
             this.gpgLabelCharacterName.Visible = false;
             if (this.IsOpen)
             {
                 this.skinDropDownPlayer.Text = Loc.Get("<LOC>Open");
                 if (this.Game.Host.IsSelf)
                 {
                     this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemInvite());
                     this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemClosed());
                 }
                 this.gpgPictureBoxReady.Visible = true;
                 this.gpgPictureBoxReady.Image = ControlRes.open_ready;
             }
             else
             {
                 if (this.Game.Host.IsSelf)
                 {
                     this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemOpen());
                 }
                 this.skinDropDownPlayer.Text = Loc.Get("<LOC>Closed");
                 this.gpgPictureBoxReady.Visible = false;
             }
         }
         else
         {
             this.skinButtonSelectCharacter.Visible = participant.IsSelf;
             this.skinButtonLaunch.Visible = participant.IsSelf && participant.IsHost;
             participant.Position = this.Postition;
             this.skinDropDownPlayer.Text = participant.Name;
             if (participant.Character == null)
             {
                 this.gpgLabelCharacterName.Text = Loc.Get("<LOC>No character selected");
                 this.gpgLabelCharacterName.ForeColor = Program.Settings.StylePreferences.MasterForeColor;
                 this.gpgLabelCharacterName.Visible = true;
             }
             else
             {
                 this.gpgLabelCharacterName.Text = participant.Character.CharacterName;
                 this.gpgLabelCharacterName.ForeColor = participant.Character.CharacterColor;
                 this.gpgLabelCharacterName.Visible = true;
             }
             if (participant.IsSelf && this.Game.Host.IsSelf)
             {
                 this.skinButtonLaunch.Enabled = this.Game.CanLaunch && !this.Game.HasLaunched;
                 this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemDisband());
             }
             else if (participant.IsSelf)
             {
                 this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemLeave());
             }
             else if (this.Game.Host.IsSelf)
             {
                 this.skinDropDownPlayer.Menu.MenuItems.Add(this.GetMenuItemKick());
             }
             this.gpgPictureBoxReady.Visible = true;
             if (participant.IsReady)
             {
                 this.gpgPictureBoxReady.Image = ControlRes.ready;
             }
             else
             {
                 this.gpgPictureBoxReady.Image = ControlRes.not_ready;
             }
         }
     }
 }