Пример #1
0
 public void setPlayerName(string boxtext)
 {
     if (!String_functions.HasNoSpecialChars(boxtext))
     {
         SetNameQuotes = "Dont use special chars.";
         Name          = Name.Remove(0);
         Name          = Name.Insert(0, "Default character");
     }
     else if (Data_store.CheckIfPlayerExists(boxtext) && cp_mode != "Edit")
     {
         SetNameQuotes = "Player with this name already exists.";
         Name          = Name.Remove(0);
         Name          = Name.Insert(0, "Default character");
     }
     else if (boxtext.Length > 20 || boxtext.Length < 6)
     {
         SetNameQuotes = "Player name length must bet betwee 6 and 20.";
         Name          = Name.Remove(0);
         Name          = Name.Insert(0, "Default character");
     }
     else
     {
         Name          = Name.Remove(0);
         Name          = Name.Insert(0, boxtext);
         SetNameQuotes = "Name set!";
     }
 }
Пример #2
0
 public void Create()
 {
     if (SelectedPlayer.Name != "Default character")
     {
         if (Data_store.CheckIfPlayerExists(SelectedPlayer.Name))
         {
             Data_store.DeletePlayer(SelectedPlayer.Name);
         }
         Data_store.SavePlayer(SelectedPlayer);
         _loadscreenviewmodel.Load_players();
         _loadscreenviewmodel.SelectedPlayer = SelectedPlayer;
         backToLoadScreen();
     }
 }