/*
         * protected DataMakerXmlNodeProxy GetDataMakerXmlNodeProxyPointer (GameObject aProxy, string nameReference, bool silent)
         * {
         *
         *      if (aProxy == null) {
         *              if (!silent)
         *                      Debug.LogError ("Null Proxy");
         *              return null;
         *      }
         *
         *
         *      DataMakerXmlNodeProxy[] proxies = aProxy.GetComponents<DataMakerXmlNodeProxy> ();
         *      if (proxies.Length > 1) {
         *
         *              if (nameReference == "") {
         *                      if (!silent)
         *                              Debug.LogError ("Several DataMaker Xml Node Proxies coexists on the same GameObject and no reference is given to find the expected DataMaker Xml Node Proxy");
         *              }
         *
         *              foreach (DataMakerXmlNodeProxy iProxy in proxies) {
         *                      if (iProxy.referenceName == nameReference) {
         *                              return iProxy;
         *                      }
         *              }
         *
         *              if (nameReference != "") {
         *                      if (!silent)
         *                              LogError ("DataMaker Xml Node Proxy not found for reference <" + nameReference + ">");
         *                      return null;
         *              }
         *
         *      } else if (proxies.Length > 0) {
         *              if (nameReference != "" && nameReference != proxies [0].referenceName) {
         *                      if (!silent)
         *                              Debug.LogError ("DataMaker Xml node Proxy reference do not match");
         *                      return null;
         *              }
         *
         *              return proxies [0];
         *
         *      }
         *
         *      if (!silent) {
         *              LogError ("XmlMaker proxy not found");
         *      }
         *      return null;
         * }// GetDataMakerXmlProxyPointer
         *
         */

        protected bool SetUpDataMakerXmlNodeProxyPointer(GameObject aProxyGO, string nameReference)
        {
            if (aProxyGO == null)
            {
                return(false);
            }

            proxy = DataMakerCore.GetDataMakerProxyPointer(typeof(DataMakerXmlNodeProxy), aProxyGO, nameReference, false) as DataMakerXmlNodeProxy;

            return(proxy != null);
        }
Example #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        DataMakerXmlNodeProxy _target = target as DataMakerXmlNodeProxy;

        if (_target._FsmXmlNode != null)
        {
            if (!_target._FsmXmlNode.Value.Equals(nodeCache))
            {
                nodeCache = _target._FsmXmlNode.Value;
                content   = DataMakerXmlUtils.XmlNodeToString(nodeCache);
            }
            DataMakerEditorGUILayoutUtils.feedbackLabel("Xml Source Valid", DataMakerEditorGUILayoutUtils.labelFeedbacks.OK);


            _scroll = DataMakerEditorGUILayoutUtils.StringContentPreview(_scroll, content);
        }
        else
        {
            DataMakerEditorGUILayoutUtils.feedbackLabel("Xml Source Invalid", DataMakerEditorGUILayoutUtils.labelFeedbacks.ERROR);
        }
    }
        /*
        protected DataMakerXmlNodeProxy GetDataMakerXmlNodeProxyPointer (GameObject aProxy, string nameReference, bool silent)
        {

            if (aProxy == null) {
                if (!silent)
                    Debug.LogError ("Null Proxy");
                return null;
            }

            DataMakerXmlNodeProxy[] proxies = aProxy.GetComponents<DataMakerXmlNodeProxy> ();
            if (proxies.Length > 1) {

                if (nameReference == "") {
                    if (!silent)
                        Debug.LogError ("Several DataMaker Xml Node Proxies coexists on the same GameObject and no reference is given to find the expected DataMaker Xml Node Proxy");
                }

                foreach (DataMakerXmlNodeProxy iProxy in proxies) {
                    if (iProxy.referenceName == nameReference) {
                        return iProxy;
                    }
                }

                if (nameReference != "") {
                    if (!silent)
                        LogError ("DataMaker Xml Node Proxy not found for reference <" + nameReference + ">");
                    return null;
                }

            } else if (proxies.Length > 0) {
                if (nameReference != "" && nameReference != proxies [0].referenceName) {
                    if (!silent)
                        Debug.LogError ("DataMaker Xml node Proxy reference do not match");
                    return null;
                }

                return proxies [0];

            }

            if (!silent) {
                LogError ("XmlMaker proxy not found");
            }
            return null;
        }// GetDataMakerXmlProxyPointer

        */
        protected bool SetUpDataMakerXmlNodeProxyPointer(GameObject aProxyGO, string nameReference)
        {
            if (aProxyGO == null) {
                return false;
            }

            proxy = DataMakerCore.GetDataMakerProxyPointer(typeof(DataMakerXmlNodeProxy), aProxyGO, nameReference, false) as DataMakerXmlNodeProxy;

            return proxy != null;
        }