public DlgCreateCharacter(PlayerCharacter character)
 {
     this.components = null;
     this.SelectedCharacterColorPanel = null;
     this.SelectedHRVColorPanel = null;
     this.SelectedHeadPanel = null;
     this.InitializeComponent();
     this.mCharacter = character;
     this.RefreshCharacterDisplay();
 }
 public override void MergeParticipants(GPGnetGameParticipant participant)
 {
     base.MergeParticipants(participant);
     if (this.Character == null)
     {
         this.mCharacter = (participant as SpaceSiegeGameParticipant).Character;
     }
     else
     {
         this.mCharacter.CharacterName = (participant as SpaceSiegeGameParticipant).Character.CharacterName;
         this.mCharacter.CharacterColor = (participant as SpaceSiegeGameParticipant).Character.CharacterColor;
     }
 }
 protected override void FromDataString(string[] tokens)
 {
     base.FromDataString(tokens);
     try
     {
         if (tokens.Length > 4)
         {
             this.mCharacter = new PlayerCharacter();
             this.Character.CharacterName = tokens[4];
             this.Character.CharacterColor = Color.FromArgb(int.Parse(tokens[5]));
             this.Character.Upgrades = int.Parse(tokens[6]);
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
 public void BindToCharacter(PlayerCharacter character)
 {
     this.mCharacter = character;
     if (character == null)
     {
         this.PlayerImage = null;
         this.HRVImage = null;
     }
     else
     {
         string str = "red";
         if (character.CharacterColor.ToArgb() == Color.Blue.ToArgb())
         {
             str = "blue";
         }
         else if (character.CharacterColor.ToArgb() == Color.Green.ToArgb())
         {
             str = "green";
         }
         else if (character.CharacterColor.ToArgb() == Color.Magenta.ToArgb())
         {
             str = "magenta";
         }
         string str2 = "red";
         if (character.RobotColor.ToArgb() == Color.Blue.ToArgb())
         {
             str2 = "blue";
         }
         else if (character.RobotColor.ToArgb() == Color.Green.ToArgb())
         {
             str2 = "green";
         }
         else if (character.RobotColor.ToArgb() == Color.Magenta.ToArgb())
         {
             str2 = "magenta";
         }
         this.PlayerImage = (Bitmap) SpaceSiegeImages.ResourceManager.GetObject(string.Format("player_{0}_{1}", str, character.Head));
         this.HRVImage = (Bitmap) SpaceSiegeImages.ResourceManager.GetObject(string.Format("hrv_{0}", str2));
     }
     this.Refresh();
 }
示例#5
0
 public static PlayerCharacter FromString(string data)
 {
     PlayerCharacter character = new PlayerCharacter();
     string[] strArray = data.Split(new char[] { ',' });
     if (strArray.Length > 2)
     {
         character.CharacterName = strArray[0];
         try
         {
             character.Upgrades = Convert.ToInt32(strArray[2]);
         }
         catch
         {
         }
         try
         {
             character.TimePlayed = strArray[1].ToString();
         }
         catch
         {
         }
     }
     return character;
 }