usingUnityengine;usingSystem.Collections; Public classUserregister:monobehaviour {voidStart () {} Public stringUsername =""; Public stringPassword =""; Public stringRepassword =""; Public stringAge =""; Public stringemail =""; Public stringGender =""; Public stringShowMessage =""; Public voidOngui () {Guilayout.label (showmessage); Guilayout.label ("User name:");//User name (5-10-bit, can only have subtitles, numbers, _ composition, name only with SB two words)Username=Guilayout.textfield (username); Guilayout.label ("Password:");//(6-10-bit length)Password =Guilayout.textfield (password); Guilayout.label ("Repeat Password:"); Repassword=Guilayout.textfield (Repassword); Guilayout.label ("Age:");//1-100Age =Guilayout.textfield (age); Guilayout.label ("Email:");//have an @ ending with. com. net. cnemail =Guilayout.textfield (email); Guilayout.label ("Gender:");//male or femaleGender =Guilayout.textfield (gender); Checkinput (); } Private string[] Domainarray =New string[] {". com",". NET",". CN" }; Private voidCheckinput () {showmessage=""; if(Username = ="") {ShowMessage+="the user name cannot be empty \ n"; } Else if(username. Length <5|| Username. Length >Ten) {ShowMessage+="user name is 5-10 bits \ n"; } Else { for(inti =0; I < username. Length; i++) { Charc =Username[i]; if(c >='a'&& C <'Z') || (C >'A'&& C <='Z') || (c >='0'&& C <'9') || (c = ='_')) { } Else{showmessage+="user name can only have subtitles, numbers, _ Composition \ n"; } } if(username. IndexOf ("SB") != -1) {ShowMessage+="There is no sensitive typeface in the username \ n"; } } if(Password. Length <6|| Password. Length >Ten) {ShowMessage+="password length is 6-10 bits \ n"; } if(Repassword! =password) {ShowMessage+="two times the password for the input is inconsistent \ n"; } intagetemp=0; if(!int. TryParse (age, outagetemp)) {ShowMessage+="age must enter a number \ n"; }Else { if(Agetemp <=0|| Agetemp > -) {ShowMessage+="The age range must be 1-100\n"; } } if(email.) IndexOf ("@") == -1) {ShowMessage+="The format of the mailbox entry is not valid \ n"; }Else { BOOLisright=false; for(inti =0; i < domainarray.length; i++) { if(email.) EndsWith (Domainarray[i])) {Isright=true; Break; } } if(!isright) {ShowMessage+="The format of the mailbox entry is not valid \ n"; } } if(Gender = ="male"|| Gender = ="female") { } Else{showmessage+="gender must be filled in male or female"; } }}
Unity's Registry check (C #)