예제 #1
0
        void AddBasePropertyFormOther(NFIClass xLogicClass, string strOther)
        {
            NFIClass xOtherClass = GetElement(strOther);

            if (null != xLogicClass && null != xOtherClass)
            {
                NFDataList xValue = xOtherClass.GetPropertyManager().GetPropertyList();
                for (int i = 0; i < xValue.Count(); ++i)
                {
                    NFIProperty xProperty = xOtherClass.GetPropertyManager().GetProperty(xValue.StringVal(i));
                    xLogicClass.GetPropertyManager().AddProperty(xValue.StringVal(i), xProperty.GetData());
                }
            }
        }
예제 #2
0
        void InitProperty(NFGUID self, string strClassName)
        {
            NFIClass   xLogicClass = mxLogicClassModule.GetElement(strClassName);
            NFDataList xDataList   = xLogicClass.GetPropertyManager().GetPropertyList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string      strPropertyName = xDataList.StringVal(i);
                NFIProperty xProperty       = xLogicClass.GetPropertyManager().GetProperty(strPropertyName);

                NFIObject          xObject          = GetObject(self);
                NFIPropertyManager xPropertyManager = xObject.GetPropertyManager();

                NFIProperty property = xPropertyManager.AddProperty(strPropertyName, xProperty.GetData());
                //if property==null ,means this property alreay exist in manager
                if (property != null)
                {
                    property.SetUpload(xProperty.GetUpload());
                }
            }
        }
예제 #3
0
        private void LoadLogicClassProperty(string strName)
        {
            NFIClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = mstrPath + xLogicClass.GetPath();

                strLogicPath = strLogicPath.Replace(".xml", "");

                TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath);

                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(textAsset.text);
                XmlNode xRoot = xmldoc.SelectSingleNode("XML");

                XmlNode     xNodePropertys = xRoot.SelectSingleNode("Propertys");
                XmlNodeList xNodeList      = xNodePropertys.SelectNodes("Property");
                for (int i = 0; i < xNodeList.Count; ++i)
                {
                    XmlNode      xPropertyNode = xNodeList.Item(i);
                    XmlAttribute strID         = xPropertyNode.Attributes["Id"];
                    XmlAttribute strType       = xPropertyNode.Attributes["Type"];
                    XmlAttribute strUpload     = xPropertyNode.Attributes["Upload"];
                    bool         bUpload       = strUpload.Value.Equals("1");

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "float":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "string":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "object":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "vector2":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "vector3":
                    {
                        NFDataList.TData xValue    = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                        NFIProperty      xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
예제 #4
0
        private void LoadLogicClassProperty(string strName)
        {
            NFIClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                XmlDocument xmldoc       = new XmlDocument();
                string      strLogicPath = mstrPath + xLogicClass.GetPath();

                if (RuntimePlatform.Android == Application.platform ||
                    RuntimePlatform.IPhonePlayer == Application.platform)
                {
                    strLogicPath = strLogicPath.Replace(".xml", "");
                    TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath);
                    xmldoc.LoadXml(textAsset.text);
                }
                else
                {
                    try
                    {
                        xmldoc.Load(strLogicPath);
                    }
                    catch (Exception e)
                    {
                        Debug.LogFormat("Load Config Error {0}", e.ToString());
                    }
                }
                XmlNode xRoot = xmldoc.SelectSingleNode("XML");

                XmlNode     xNodePropertys = xRoot.SelectSingleNode("Propertys");
                XmlNodeList xNodeList      = xNodePropertys.SelectNodes("Property");
                for (int i = 0; i < xNodeList.Count; ++i)
                {
                    XmlNode      xPropertyNode = xNodeList.Item(i);
                    XmlAttribute strID         = xPropertyNode.Attributes["Id"];
                    XmlAttribute strType       = xPropertyNode.Attributes["Type"];
                    XmlAttribute strUpload     = xPropertyNode.Attributes["Upload"];
                    bool         bUpload       = strUpload.Value.Equals("1");

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFDataList xValue = new NFDataList();
                        xValue.AddInt(0);
                        NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "float":
                    {
                        NFDataList xValue = new NFDataList();
                        xValue.AddFloat(0.0);
                        NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "string":
                    {
                        NFDataList xValue = new NFDataList();
                        xValue.AddString("");
                        NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    case "object":
                    {
                        NFDataList xValue = new NFDataList();
                        xValue.AddObject(new NFGUID(0, 0));
                        NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                        xProperty.SetUpload(bUpload);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
예제 #5
0
        private void LoadInstanceElement(NFIClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(strLogicPath);

            XmlNode xRoot = xmldoc.SelectSingleNode("XML");

            XmlNodeList xNodeList = xRoot.SelectNodes("Object");

            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //NFCLog.Instance.Log("Class:" + xLogicClass.GetName());

                XmlNode      xNodeClass = xNodeList.Item(i);
                XmlAttribute strID      = xNodeClass.Attributes["Id"];

                //NFCLog.Instance.Log("ClassID:" + strID.Value);

                NFIElement xElement = GetElement(strID.Value);
                if (null == xElement)
                {
                    xElement = new NFCElement();
                    AddElement(strID.Value, xElement);
                    xLogicClass.AddConfigName(strID.Value);

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        NFIProperty  xProperty  = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            NFDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddInt(int.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddObject(new NFGUID(0, int.Parse(xAttribute.Value)));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #6
0
        private void LoadInstanceElement(NFIClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            strLogicPath = strLogicPath.Replace(".xml", "");

            TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath);

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.LoadXml(textAsset.text);
            XmlNode xRoot = xmldoc.SelectSingleNode("XML");

            XmlNodeList xNodeList = xRoot.SelectNodes("Object");

            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //NFCLog.Instance.Log("Class:" + xLogicClass.GetName());

                XmlNode      xNodeClass = xNodeList.Item(i);
                XmlAttribute strID      = xNodeClass.Attributes["Id"];

                //NFCLog.Instance.Log("ClassID:" + strID.Value);

                NFIElement xElement = GetElement(strID.Value);
                if (null == xElement)
                {
                    xElement = new NFElement();
                    AddElement(strID.Value, xElement);
                    xLogicClass.AddConfigName(strID.Value);

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        NFIProperty  xProperty  = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            NFDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                try
                                {
                                    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT);
                                    xValue.Set(int.Parse(xAttribute.Value));
                                    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    property.SetUpload(xProperty.GetUpload());
                                }
                                catch
                                {
                                    Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value);
                                }
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                try
                                {
                                    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT);
                                    xValue.Set(float.Parse(xAttribute.Value, CultureInfo.InvariantCulture.NumberFormat));
                                    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    property.SetUpload(xProperty.GetUpload());
                                }
                                catch
                                {
                                    Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value);
                                }
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);
                                xValue.Set(xAttribute.Value);
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                try
                                {
                                    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT);
                                    xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value)));
                                    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    property.SetUpload(xProperty.GetUpload());
                                }
                                catch
                                {
                                    Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value);
                                }
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                            {
                                try
                                {
                                    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2);
                                    //xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value)));
                                    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    property.SetUpload(xProperty.GetUpload());
                                }
                                catch
                                {
                                    Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value);
                                }
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                            {
                                try
                                {
                                    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                                    //xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value)));
                                    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    property.SetUpload(xProperty.GetUpload());
                                }
                                catch
                                {
                                    Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value);
                                }
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }