Guest User

Untitled

a guest
Jan 6th, 2017
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System.Xml;
  6. using System.IO;
  7.  
  8. public class LOGINTESTSCRIPT : MonoBehaviour
  9. {
  10.     private string currentUsername;
  11.     private string currentPassword;
  12.  
  13.     public InputField mainInputField;
  14.    
  15.     void Update()
  16.     {
  17.         if(GetKeyDown)
  18.     }
  19.  
  20.     public void CreateLogin()
  21.     {
  22.         currentUsername = transform.parent.GetChild(0).GetComponent<UsernameScript>().InputUsername();
  23.         currentPassword = transform.parent.GetChild(1).GetComponent<PasswordScript>().InputPassword();
  24.  
  25.         string filePath = Application.dataPath + "User1.xml";
  26.  
  27.         if (File.Exists(filePath))
  28.             File.Delete(filePath);
  29.         XmlDocument xmlDoc = new XmlDocument();
  30.         xmlDoc.LoadXml("<User ></User>");
  31.  
  32.         XmlElement root = xmlDoc.DocumentElement;
  33.         root.SetAttribute("name", currentUsername);
  34.        
  35.             XmlElement node = xmlDoc.CreateElement("Password");
  36.             node.SetAttribute("pass",currentPassword);
  37.             root.AppendChild(node);
  38.        
  39.         xmlDoc.Save("User1.xml");
  40.  
  41.  
  42.     }
Add Comment
Please, Sign In to add comment