public class XMLStringReader : MonoBehaviour {
        public string slectedItem;
        private bool editing = false;

        public string signalsa;
        public XmlReaderSettings settings;

        void OnGUI() {
            if (GUILayout.Button(slectedItem)) {
                editing = true;
            }

            XmlReaderSettings settings = new XmlReaderSettings();
            settings.IgnoreWhitespace = true;
            settings.IgnoreComments = true;

            using (XmlReader reader = XmlReader.Create("D://Docs/Unity3D/cdp/UDPApplication/Components/UDPIOServer.xml", settings)) {
                while (reader.Read()) {
                    if (reader.NodeType == XmlNodeType.Element) {
                        if (reader.HasAttributes) {
                            if (reader.GetAttribute("UnityName") != null) {
                                signalsa = reader.GetAttribute("UnityName");
                                string[] signalsCDP = { signalsa };
                   //ahjesus  
if (editing) { for (int i = 0; i < signalsCDP.Length; i++) { if (GUILayout.Button(signalsCDP[i])) { slectedItem = signalsCDP[i]; editing = false; print(signalsCDP[i].ToString()); } } } } } } } } } }

 

posted on 2013-11-21 11:51  深海大虾  阅读(596)  评论(0编辑  收藏  举报