Example #1
0
        public override void Update(float fPassTime)
        {
            NFIDataList keyList = null;

            foreach (KeyValuePair <string, NFIHeartBeat> kv in mhtHeartBeat)
            {
                NFIHeartBeat heartBeat = (NFIHeartBeat)kv.Value;
                if (heartBeat.Update(fPassTime))
                {
                    if (null == keyList)
                    {
                        keyList = new NFCDataList();
                    }

                    keyList.AddString((string)kv.Key);
                }
            }

            if (null != keyList)
            {
                for (int i = 0; i < keyList.Count(); i++)
                {
                    mhtHeartBeat.Remove(keyList.StringVal(i));
                }
            }
        }
Example #2
0
        public override void Update(float fPassTime)
        {
            NFCDataList keyList = null;

            foreach (System.Collections.DictionaryEntry heartObject in mhtHeartBeat)
            {
                NFIHeartBeat heartBeat = (NFIHeartBeat)heartObject.Value;
                if (heartBeat.Update(fPassTime))
                {
                    if (null == keyList)
                    {
                        keyList = new NFCDataList();
                    }

                    keyList.AddString((string)heartObject.Key);
                }
            }

            if (null != keyList)
            {
                for (int i = 0; i < keyList.Count(); i++)
                {
                    mhtHeartBeat.Remove(keyList.StringVal(i));
                }
            }
        }
Example #3
0
 public NFCRecord(NFIDENTID self, string strRecordName, int nRow, NFIDataList varData)
 {
     mSelf          = self;
     mnRow          = nRow;
     mstrRecordName = strRecordName;
     mVarRecordType = new NFCDataList(varData);
 }
Example #4
0
        public override bool SetDouble(int nRow, int nCol, double value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }

                NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE)
                {
                    if (valueList.DoubleVal(nCol) - value > 0.01f ||
                        valueList.DoubleVal(nCol) - value < -0.01f)
                    {
                        NFCDataList oldValue = new NFCDataList();
                        oldValue.AddDouble(valueList.DoubleVal(nCol));

                        valueList.SetDouble(nCol, value);

                        NFCDataList newValue = new NFCDataList();
                        newValue.AddDouble(valueList.DoubleVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
        public override void Update(float fPassTime)
        {
            NFIDataList keyList = null;

            foreach (KeyValuePair<string, NFIHeartBeat> kv in mhtHeartBeat)
            {
                NFIHeartBeat heartBeat = (NFIHeartBeat)kv.Value;
                if (heartBeat.Update(fPassTime))
                {
                    if (null == keyList)
                    {
                        keyList = new NFCDataList();
                    }

                    keyList.AddString((string)kv.Key);
                }
            }

            if (null != keyList)
            {
                for (int i = 0; i < keyList.Count(); i++)
                {
                    mhtHeartBeat.Remove(keyList.StringVal(i));
                }
            }
        }
Example #6
0
        public override bool SetInt(int nRow, int nCol, Int64 value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_INT)
                {
                    if (valueList.IntVal(nCol) != value)
                    {
                        NFCDataList oldValue = new NFCDataList();
                        oldValue.AddInt(valueList.IntVal(nCol));

                        valueList.SetInt(nCol, value);

                        NFCDataList newValue = new NFCDataList();
                        newValue.AddInt(valueList.IntVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
        public override void Update(float fPassTime)
        {
            NFCDataList keyList = null;

            foreach (System.Collections.DictionaryEntry heartObject in mhtHeartBeat)
            {
                NFIHeartBeat heartBeat = (NFIHeartBeat)heartObject.Value;
                if (heartBeat.Update(fPassTime))
                {
                    if (null == keyList)
                    {
                        keyList = new NFCDataList();
                    }

                    keyList.AddString((string)heartObject.Key);
                }
            }

            if (null != keyList)
            {
                for (int i = 0; i < keyList.Count(); i++)
                {
                    mhtHeartBeat.Remove(keyList.StringVal(i));
                }
            }
        }
        public override NFIDataList GetPropertyList()
        {
            NFIDataList varData = new NFCDataList();
            foreach( DictionaryEntry de in mhtProperty)
            {
                varData.AddString(de.Key.ToString());
            }

            return varData;
        }
        public override NFIDataList GetRecordList()
        {
            NFIDataList varData = new NFCDataList();
            foreach (KeyValuePair<string, NFIRecord> de in mhtRecord)
            {
                varData.AddString(de.Key);
            }

            return varData;
        }
Example #10
0
        public override NFIDataList GetRecordList()
        {
            NFIDataList varData = new NFCDataList();

            foreach (KeyValuePair <string, NFIRecord> de in mhtRecord)
            {
                varData.AddString(de.Key);
            }

            return(varData);
        }
Example #11
0
        public override NFIDataList GetPropertyList()
        {
            NFIDataList varData = new NFCDataList();

            foreach (DictionaryEntry de in mhtProperty)
            {
                varData.AddString(de.Key.ToString());
            }

            return(varData);
        }
Example #12
0
        public override NFIDataList GetObjectList()
        {
            NFIDataList varData = new NFCDataList();

            foreach (KeyValuePair <NFIDENTID, NFIObject> kv in mhtObject)
            {
                varData.AddObject(kv.Key);
            }

            return(varData);
        }
Example #13
0
        public override bool SetPropertyObject(string strPropertyName, NFIDENTID obj)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddObject(new NFIDENTID());
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetObject(obj);
            return(true);
        }
Example #14
0
        public override bool SetPropertyInt(string strPropertyName, Int64 nValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddInt(0);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetInt(nValue);
            return(true);
        }
Example #15
0
        public override bool SetPropertyDouble(string strPropertyName, double dwValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddDouble(0);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetDouble(dwValue);
            return(true);
        }
Example #16
0
        public override bool SetPropertyFloat(string strPropertyName, float fValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddFloat(0.0f);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetFloat(fValue);
            return(true);
        }
Example #17
0
        public override bool SetPropertyString(string strPropertyName, string strValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddString("");
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetString(strValue);
            return(true);
        }
Example #18
0
        public override int AddRow(int nRow, NFIDataList var)
        {
            if(nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    mhtRecordVec[nRow] = new NFCDataList(var);

                    if (null != doHandleDel)
                    {
                        doHandleDel(mSelf, mstrRecordName, eRecordOptype.Add, nRow, 0, var, var);
                    }
                    return nRow;
                }
            }

            return -1;
        }
Example #19
0
        public override bool SetInt(Int64 value)
        {
            if (mVarProperty.IntVal(0) != value)
            {
                NFCDataList oldValue = new NFCDataList(mVarProperty);

                mVarProperty.SetInt(0, value);

                NFCDataList newValue = new NFCDataList(mVarProperty);

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, msPropertyName, oldValue, newValue);
                }
            }

            return(true);
        }
Example #20
0
        public override bool SetDouble(double value)
        {
            if (mVarProperty.DoubleVal(0) - value > 0.01f
                || mVarProperty.DoubleVal(0) - value < -0.01f)
            {
                NFCDataList oldValue = new NFCDataList(mVarProperty);

                mVarProperty.SetDouble(0, value);

                NFCDataList newValue = new NFCDataList(mVarProperty);

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, msPropertyName, oldValue, newValue);
                }
            }

            return true;
        }
Example #21
0
        public override bool SetFloat(float value)
        {
            if (mVarProperty.FloatVal(0) - value > 0.01f ||
                mVarProperty.FloatVal(0) - value < -0.01f)
            {
                NFCDataList oldValue = new NFCDataList(mVarProperty);

                mVarProperty.SetFloat(0, value);

                NFCDataList newValue = new NFCDataList(mVarProperty);

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, msPropertyName, oldValue, newValue);
                }
            }

            return(true);
        }
Example #22
0
        public override int AddRow(int nRow, NFIDataList var)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    mhtRecordVec[nRow] = new NFCDataList(var);

                    if (null != doHandleDel)
                    {
                        doHandleDel(mSelf, mstrRecordName, eRecordOptype.Add, nRow, 0, var, var);
                    }
                    return(nRow);
                }
            }


            return(-1);
        }
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

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

                XmlDocument xmldoc = new XmlDocument();

                //xmldoc.Load(strLogicPath);
                ///////////////////////////////////////////////////////////////////////////////////////
                StreamReader cepherReader = new StreamReader(strLogicPath);;
                string       strContent   = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                MemoryStream stream = new MemoryStream(data);
                XmlReader    x      = XmlReader.Create(stream);
                x.MoveToContent();
                string res = x.ReadOuterXml();

                xmldoc.LoadXml(res);
                /////////////////////////////////////////////////////////////////

                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"];

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddInt(0);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "float":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddFloat(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "double":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddDouble(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "string":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddString("");
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "object":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddObject(new NFIDENTID(0, 0));
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
Example #24
0
        public static void Main()
        {
            NFIKernel kernel = new NFCKernel();

            Console.WriteLine("****************NFIDataList******************");

            NFIDataList var = new NFCDataList();

            for (int i = 0; i < 9; i += 3)
            {
                var.AddInt(i);
                var.AddFloat((float)i + 1);
                var.AddString((i + 2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64  n   = var.IntVal(i);
                float  f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Console.WriteLine(n);
                Console.WriteLine(f);
                Console.WriteLine(str);
            }


            Console.WriteLine("***************NFProperty*******************");

            NFIDENTID ident      = new NFIDENTID(0, 1);
            NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFCDataList());

            NFIDataList valueProperty = new NFCDataList();

            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Console.WriteLine(gameObject.QueryPropertyInt("111"));

            Console.WriteLine("***************NFRecord*******************");

            NFIDataList valueRecord = new NFCDataList();

            valueRecord.AddInt(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            kernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            kernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            kernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            kernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Console.WriteLine(gameObject.QueryRecordInt("testRecord", 0, 0));
            Console.WriteLine(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Console.WriteLine(gameObject.QueryRecordString("testRecord", 0, 2));
            Console.WriteLine(gameObject.QueryRecordObject("testRecord", 0, 3));

            Console.WriteLine(" ");
            Console.WriteLine("***************PropertyNFEvent*******************");

            //挂属性回调,挂表回调
            kernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            kernel.SetPropertyInt(ident, "111", 2456);

            Console.WriteLine(" ");
            Console.WriteLine("***************RecordNFEvent*******************");

            kernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            kernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Console.WriteLine(" ");
            Console.WriteLine("***************ClassNFEvent*******************");

            kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            kernel.CreateObject(new NFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList());
            kernel.DestroyObject(new NFIDENTID(0, 2));


            Console.WriteLine(" ");
            Console.WriteLine("***************NFHeartBeat*******************");
            kernel.AddHeartBeat(new NFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new NFCDataList());

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.UpDate(1.0f);
            }
        }
Example #25
0
        public override bool SetPropertyFloat(string strPropertyName, float fValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddFloat(0.0f);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetFloat(fValue);
            return true;
        }
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;
            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();
            //xmldoc.Load(strLogicPath);
            ///////////////////////////////////////////////////////////////////////////////////////
            StreamReader cepherReader = new StreamReader(strLogicPath); ;
            string strContent = cepherReader.ReadToEnd();
            cepherReader.Close();

            byte[] data = Convert.FromBase64String(strContent);

            MemoryStream stream = new MemoryStream(data);
            XmlReader x = XmlReader.Create(stream);
            x.MoveToContent();
            string res = x.ReadOuterXml();

            xmldoc.LoadXml(res);
            /////////////////////////////////////////////////////////////////

            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)
                        {
                            NFIDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                                case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddInt(int.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddFloat(float.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddDouble(double.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddString(xAttribute.Value);
                                        NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddObject(new NFIDENTID(0, int.Parse(xAttribute.Value)));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }
            }
        }
Example #27
0
        public override bool SetString(int nRow, int nCol, string value)
        {
            if(nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_STRING)
                {
                    if (valueList.StringVal(nCol) != value)
                    {
                        NFCDataList oldValue = new NFCDataList();
                        oldValue.AddString(valueList.StringVal(nCol));

                        valueList.SetString(nCol, value);

                        NFCDataList newValue = new NFCDataList();
                        newValue.AddString(valueList.StringVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }

                return true;
            }

            return false;
        }
Example #28
0
        private void EGMI_ACK_PROPERTY_STRING(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream);

            NFMsg.ObjectPropertyString propertyData = new NFMsg.ObjectPropertyString();
            propertyData = Serializer.Deserialize<NFMsg.ObjectPropertyString>(new MemoryStream(xMsg.msg_data));

            NFIObject go = NFCKernel.Instance.GetObject(PBToNF(propertyData.player_id));

            for(int i = 0; i < propertyData.property_list.Count; i++)
            {
                NFIPropertyManager propertyManager = go.GetPropertyManager();
                NFIProperty property = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name));
                if (null == property)
                {
                    NFIDataList varList = new NFCDataList();
                    varList.AddString("");

                    property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name), varList);
                }

                property.SetString(System.Text.Encoding.Default.GetString(propertyData.property_list[i].data));
            }
        }
Example #29
0
        private void EGMI_ACK_OBJECT_ENTRY(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream);

            NFMsg.AckPlayerEntryList xData = new NFMsg.AckPlayerEntryList();
            xData = Serializer.Deserialize<NFMsg.AckPlayerEntryList>(new MemoryStream(xMsg.msg_data));

            for (int i = 0; i < xData.object_list.Count; ++i)
            {
                NFMsg.PlayerEntryInfo xInfo = xData.object_list[i];

                NFIDataList var = new NFCDataList();
                var.AddString("X");
                var.AddFloat(xInfo.x);
                var.AddString("Y");
                var.AddFloat(xInfo.y);
                var.AddString("Z");
                var.AddFloat(xInfo.z);
                NFIObject xGO = NFCKernel.Instance.CreateObject(PBToNF(xInfo.object_guid), xInfo.scene_id, 0, System.Text.Encoding.Default.GetString(xInfo.class_id), System.Text.Encoding.Default.GetString(xInfo.config_id), var);
                if (null == xGO)
                {
                    Debug.LogError("ID��ͻ: " + xInfo.object_guid + "  ConfigID:" + System.Text.Encoding.Default.GetString(xInfo.config_id));
                    continue;
                }
            }
        }
Example #30
0
        public override NFIObject CreateObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

                NFCDataList varConfigID = new NFCDataList();
                varConfigID.AddString(strConfigIndex);
                xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID);

                NFCDataList varConfigClass = new NFCDataList();
                varConfigClass.AddString(strClassName);
                xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass);

                if (arg.Count() % 2 == 0)
                {
                    for (int i = 0; i < arg.Count() - 1; i += 2)
                    {
                        string strPropertyName = arg.StringVal(i);
                        NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddInt(arg.IntVal(i+1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddFloat(arg.FloatVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddDouble(arg.DoubleVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddString(arg.StringVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddObject(arg.ObjectVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }

                InitProperty(self, strClassName);
                InitRecord(self, strClassName);

                ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName];
                if (null != xHandleDel && null != xHandleDel.GetHandler())
                {
                    NFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler();
                    xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex);
                    xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex);
                    xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex);
                }
                return xNewObject;
            }

            return null;
        }
Example #31
0
        public override NFIObject CreateObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

                NFCDataList varConfigID = new NFCDataList();
                varConfigID.AddString(strConfigIndex);
                xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID);

                NFCDataList varConfigClass = new NFCDataList();
                varConfigClass.AddString(strClassName);
                xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass);

                if (arg.Count() % 2 == 0)
                {
                    for (int i = 0; i < arg.Count() - 1; i += 2)
                    {
                        string strPropertyName         = arg.StringVal(i);
                        NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                        case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddInt(arg.IntVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddFloat(arg.FloatVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddDouble(arg.DoubleVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddString(arg.StringVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddObject(arg.ObjectVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }

                InitProperty(self, strClassName);
                InitRecord(self, strClassName);

                if (mhtClassHandleDel.ContainsKey(strClassName))
                {
                    ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName];
                    if (null != xHandleDel && null != xHandleDel.GetHandler())
                    {
                        NFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler();
                        xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex);
                    }
                }

                //NFCLog.Instance.Log(NFCLog.LOG_LEVEL.DEBUG, "Create object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + nContainerID + " GroupID: " + nGroupID);
                return(xNewObject);
            }

            return(null);
        }
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);
            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                XmlNode xRoot = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string strID = xRecordNode.Attributes["Id"].Value;
                            string strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];

                                switch (strTagType.Value)
                                {
                                    case "int":
                                        {
                                            xValue.AddInt(0);
                                        }
                                        break;
                                    case "float":
                                        {
                                            xValue.AddFloat(0.0f);
                                        }
                                        break;
                                    case "double":
                                        {
                                            xValue.AddDouble(0.0f);
                                        }
                                        break;
                                    case "string":
                                        {
                                            xValue.AddString("");
                                        }
                                        break;
                                    case "object":
                                        {
                                            xValue.AddObject(new NFIDENTID(0, 0));
                                        }
                                        break;
                                    default:
                                        break;

                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);
            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                //xmldoc.Load(strLogicPath);
                ///////////////////////////////////////////////////////////////////////////////////////
                StreamReader cepherReader = new StreamReader(strLogicPath); ;
                string strContent = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                MemoryStream stream = new MemoryStream(data);
                XmlReader x = XmlReader.Create(stream);
                x.MoveToContent();
                string res = x.ReadOuterXml();

                xmldoc.LoadXml(res);
                /////////////////////////////////////////////////////////////////

                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"];

                    switch (strType.Value)
                    {
                        case "int":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddInt(0);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "float":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddFloat(0.0f);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "double":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddDouble(0.0f);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "string":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString("");
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "object":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddObject(new NFIDENTID(0, 0));
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        default:
                            break;

                    }
                }
            }
        }
Example #34
0
        public override bool SetPropertyObject(string strPropertyName, NFIDENTID obj)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddObject(new NFIDENTID());
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetObject(obj);
            return true;
        }
Example #35
0
        public override bool SetPropertyInt(string strPropertyName, Int64 nValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddInt(0);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetInt(nValue);
            return true;
        }
Example #36
0
        public static void Main()
        {
            NFIKernel kernel = new NFCKernel();

            Console.WriteLine("****************NFIDataList******************");

            NFIDataList var = new NFCDataList();

            for (int i = 0; i < 9; i +=3)
            {
                var.AddInt(i);
                var.AddFloat((float)i+1);
                var.AddString((i+2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64 n = var.IntVal(i);
                float f = var.FloatVal(i+1);
                string str = var.StringVal(i+2);
                Console.WriteLine(n);
                Console.WriteLine(f);
                Console.WriteLine(str);
            }

            Console.WriteLine("***************NFProperty*******************");

            NFIDENTID ident = new NFIDENTID(0, 1);
            NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFCDataList());

            NFIDataList valueProperty = new NFCDataList();
            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Console.WriteLine(gameObject.QueryPropertyInt("111"));

            Console.WriteLine("***************NFRecord*******************");

            NFIDataList valueRecord = new NFCDataList();
            valueRecord.AddInt(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            kernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            kernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            kernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            kernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Console.WriteLine(gameObject.QueryRecordInt("testRecord", 0,0));
            Console.WriteLine(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Console.WriteLine(gameObject.QueryRecordString("testRecord", 0, 2));
            Console.WriteLine(gameObject.QueryRecordObject("testRecord", 0, 3));

            Console.WriteLine(" ");
            Console.WriteLine("***************PropertyNFEvent*******************");

            //挂属性回调,挂表回调
            kernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            kernel.SetPropertyInt(ident, "111", 2456);

            Console.WriteLine(" ");
            Console.WriteLine("***************RecordNFEvent*******************");

            kernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            kernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Console.WriteLine(" ");
            Console.WriteLine("***************ClassNFEvent*******************");

            kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            kernel.CreateObject(new NFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList());
            kernel.DestroyObject(new NFIDENTID(0, 2));

            Console.WriteLine(" ");
            Console.WriteLine("***************NFHeartBeat*******************");
            kernel.AddHeartBeat(new NFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new NFCDataList());

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.UpDate(1.0f);
            }
        }
Example #37
0
        private void ADD_ROW(NFIDENTID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct)
        {
            NFIObject go = NFCKernel.Instance.GetObject(self);
            NFIRecordManager xRecordManager = go.GetRecordManager();

            Hashtable recordVecDesc = new Hashtable();
            Hashtable recordVecData = new Hashtable();

            for (int k = 0; k < xAddStruct.record_int_list.Count; ++k)
            {
                NFMsg.RecordInt addIntStruct = (NFMsg.RecordInt)xAddStruct.record_int_list[k];

                if (addIntStruct.col >= 0)
                {
                    recordVecDesc[addIntStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_INT;
                    recordVecData[addIntStruct.col] = addIntStruct.data;
                }
            }

            for (int k = 0; k < xAddStruct.record_float_list.Count; ++k)
            {
                NFMsg.RecordFloat addFloatStruct = (NFMsg.RecordFloat)xAddStruct.record_float_list[k];

                if (addFloatStruct.col >= 0)
                {
                    recordVecDesc[addFloatStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_FLOAT;
                    recordVecData[addFloatStruct.col] = addFloatStruct.data;

                }
            }

            for (int k = 0; k < xAddStruct.record_string_list.Count; ++k)
            {
                NFMsg.RecordString addStringStruct = (NFMsg.RecordString)xAddStruct.record_string_list[k];

                if (addStringStruct.col >= 0)
                {
                    recordVecDesc[addStringStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_STRING;
                    recordVecData[addStringStruct.col] = System.Text.Encoding.Default.GetString(addStringStruct.data);

                }
            }

            for (int k = 0; k < xAddStruct.record_object_list.Count; ++k)
            {
                NFMsg.RecordObject addObjectStruct = (NFMsg.RecordObject)xAddStruct.record_object_list[k];

                if (addObjectStruct.col >= 0)
                {
                    recordVecDesc[addObjectStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_OBJECT;
                    recordVecData[addObjectStruct.col] = PBToNF(addObjectStruct.data);

                }
            }

            NFIDataList varListDesc = new NFCDataList();
            NFIDataList varListData = new NFCDataList();
            for (int m = 0; m < recordVecDesc.Count; m++)
            {
                if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m))
                {
                    NFIDataList.VARIANT_TYPE nType = (NFIDataList.VARIANT_TYPE)recordVecDesc[m];
                    switch (nType)
                    {
                        case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                varListDesc.AddInt(0);
                                varListData.AddInt((Int64)recordVecData[m]);
                            }

                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                varListDesc.AddFloat(0.0f);
                                varListData.AddFloat((float)recordVecData[m]);
                            }
                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                varListDesc.AddString("");
                                varListData.AddString((string)recordVecData[m]);
                            }
                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                varListDesc.AddObject(new NFIDENTID());
                                varListData.AddObject((NFIDENTID)recordVecData[m]);
                            }
                            break;
                        default:
                            break;

                    }
                }
                else
                {
                    //����
                    //Debug.LogException(i);
                }
            }

            NFIRecord xRecord = xRecordManager.GetRecord(strRecordName);
            if (null == xRecord)
            {
                xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc);
            }

            xRecord.AddRow(xAddStruct.row, varListData);
        }
Example #38
0
        public override NFIDataList GetObjectList()
        {
            NFIDataList varData = new NFCDataList();
            foreach (KeyValuePair<NFIDENTID, NFIObject> kv in mhtObject)
            {
                varData.AddObject(kv.Key);
            }

            return varData;
        }
Example #39
0
        private void EGMI_ACK_OBJECT_PROPERTY_ENTRY(MsgHead head, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream);

            NFMsg.MultiObjectPropertyList xMultiObjectPropertyList = new NFMsg.MultiObjectPropertyList();
            xMultiObjectPropertyList = Serializer.Deserialize<NFMsg.MultiObjectPropertyList>(new MemoryStream(xMsg.msg_data));

            for (int i = 0; i < xMultiObjectPropertyList.multi_player_property.Count; i++)
            {
                NFMsg.ObjectPropertyList xPropertyData = xMultiObjectPropertyList.multi_player_property[i];
                NFIObject go = NFCKernel.Instance.GetObject(PBToNF(xPropertyData.player_id));
                NFIPropertyManager xPropertyManager = go.GetPropertyManager();

                for (int j = 0; j < xPropertyData.property_int_list.Count; j++)
                {
                    string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_int_list[j].property_name);
                    NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName);
                    if (null == xProperty)
                    {
                        NFIDataList varList = new NFCDataList();
                        varList.AddInt(0);

                        xProperty = xPropertyManager.AddProperty(strPropertyName, varList);
                    }

                    xProperty.SetInt(xPropertyData.property_int_list[j].data);
                }

                for (int j = 0; j < xPropertyData.property_float_list.Count; j++)
                {
                    string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_float_list[j].property_name);
                    NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName);
                    if (null == xProperty)
                    {
                        NFIDataList varList = new NFCDataList();
                        varList.AddFloat(0);

                        xProperty = xPropertyManager.AddProperty(strPropertyName, varList);
                    }

                    xProperty.SetFloat(xPropertyData.property_float_list[j].data);
                }

                for (int j = 0; j < xPropertyData.property_string_list.Count; j++)
                {
                    string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].property_name);
                    NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName);
                    if (null == xProperty)
                    {
                        NFIDataList varList = new NFCDataList();
                        varList.AddString("");

                        xProperty = xPropertyManager.AddProperty(strPropertyName, varList);
                    }

                    xProperty.SetString(System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].data));
                }

                for (int j = 0; j < xPropertyData.property_object_list.Count; j++)
                {
                    string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_object_list[j].property_name);
                    NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName);
                    if (null == xProperty)
                    {
                        NFIDataList varList = new NFCDataList();
                        varList.AddObject(new NFIDENTID());

                        xProperty = xPropertyManager.AddProperty(strPropertyName, varList);
                    }

                    xProperty.SetObject(PBToNF(xPropertyData.property_object_list[j].data));
                }
            }
        }
Example #40
0
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

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

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                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"];

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddInt(0);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "float":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddFloat(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "double":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddDouble(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "string":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddString("");
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "object":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddObject(new NFIDENTID(0, 0));
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
Example #41
0
        public override bool SetFloat(int nRow, int nCol, float value)
        {
            if(nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_FLOAT)
                {
                    if (valueList.FloatVal(nCol) - value > 0.01f
                        || valueList.FloatVal(nCol) - value < -0.01f)
                    {
                        NFCDataList oldValue = new NFCDataList();
                        oldValue.AddFloat(valueList.FloatVal(nCol));

                        valueList.SetFloat(nCol, value);

                        NFCDataList newValue = new NFCDataList();
                        newValue.AddFloat(valueList.FloatVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }

                }

                return true;
            }
            return false;
        }
Example #42
0
        public void MainU3D()
        {
            Debug.Log("****************NFIDataList******************");

            NFIDataList var = new NFCDataList();

            for (int i = 0; i < 9; i +=3)
            {
                var.AddInt(i);
                var.AddFloat((float)i+1);
                var.AddString((i+2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64 n = var.IntVal(i);
                float f = var.FloatVal(i+1);
                string str = var.StringVal(i+2);
                Debug.Log(n);
                Debug.Log(f);
                Debug.Log(str);
            }

            Debug.Log("***************NFProperty*******************");

            NFIDENTID ident = new NFIDENTID(0, 1);
            NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "Player", "", new NFCDataList());

            NFIDataList valueProperty = new NFCDataList();
            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Debug.Log(gameObject.QueryPropertyInt("111"));

            Debug.Log("***************NFRecord*******************");

            NFIDataList valueRecord = new NFCDataList();
            valueRecord.AddInt(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Debug.Log(gameObject.QueryRecordInt("testRecord", 0,0));
            Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2));
            Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3));

            Debug.Log(" ");
            Debug.Log("***************PropertyNFEvent*******************");

            //挂属性回调,挂表回调
            xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            xKernel.SetPropertyInt(ident, "111", 2456);

            Debug.Log(" ");
            Debug.Log("***************RecordNFEvent*******************");

            xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Debug.Log(" ");
            Debug.Log("***************ClassNFEvent*******************");

            xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            xKernel.CreateObject(new NFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList());
            xKernel.DestroyObject(new NFIDENTID(0, 2));

            Debug.Log(" ");
            Debug.Log("***************NFHeartBeat*******************");
            xKernel.AddHeartBeat(new NFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new NFCDataList());
        }
Example #43
0
        public override bool SetString(string value)
        {
            if (mVarProperty.StringVal(0) != value)
            {
                NFCDataList oldValue = new NFCDataList(mVarProperty);

                mVarProperty.SetString(0, value);

                NFCDataList newValue = new NFCDataList(mVarProperty);

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, msPropertyName, oldValue, newValue);
                }
            }

            return true;
        }
Example #44
0
        private void LoadInstanceElement(NFILogicClass 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)
                        {
                            NFIDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddInt(int.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddDouble(double.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddObject(new NFIDENTID(0, int.Parse(xAttribute.Value)));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #45
0
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

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

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                XmlNode xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string      strID  = xRecordNode.Attributes["Id"].Value;
                            string      strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID   = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];


                                switch (strTagType.Value)
                                {
                                case "int":
                                {
                                    xValue.AddInt(0);
                                }
                                break;

                                case "float":
                                {
                                    xValue.AddFloat(0.0f);
                                }
                                break;

                                case "double":
                                {
                                    xValue.AddDouble(0.0f);
                                }
                                break;

                                case "string":
                                {
                                    xValue.AddString("");
                                }
                                break;

                                case "object":
                                {
                                    xValue.AddObject(new NFIDENTID(0, 0));
                                }
                                break;

                                default:
                                    break;
                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
Example #46
0
        public override bool SetPropertyDouble(string strPropertyName, double dwValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddDouble(0);
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetDouble(dwValue);
            return true;
        }
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

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

                XmlDocument xmldoc = new XmlDocument();
                ///////////////////////////////////////////////////////////////////////////////////////
                if (mbCepher)
                {
                    StreamReader cepherReader = new StreamReader(strLogicPath);;
                    string       strContent   = cepherReader.ReadToEnd();
                    cepherReader.Close();

                    byte[] data = Convert.FromBase64String(strContent);

                    MemoryStream stream = new MemoryStream(data);
                    XmlReader    x      = XmlReader.Create(stream);
                    x.MoveToContent();
                    string res = x.ReadOuterXml();

                    xmldoc.LoadXml(res);
                }
                else
                {
                    xmldoc.Load(strLogicPath);
                }
                /////////////////////////////////////////////////////////////////
                XmlNode xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string      strID  = xRecordNode.Attributes["Id"].Value;
                            string      strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID   = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];


                                switch (strTagType.Value)
                                {
                                case "int":
                                {
                                    xValue.AddInt(0);
                                }
                                break;

                                case "float":
                                {
                                    xValue.AddFloat(0.0f);
                                }
                                break;

                                case "double":
                                {
                                    xValue.AddDouble(0.0f);
                                }
                                break;

                                case "string":
                                {
                                    xValue.AddString("");
                                }
                                break;

                                case "object":
                                {
                                    xValue.AddObject(new NFIDENTID(0, 0));
                                }
                                break;

                                default:
                                    break;
                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
Example #48
0
        public override bool SetObject(NFIDENTID value)
        {
            if (mVarProperty.ObjectVal(0) != value)
            {
                NFCDataList oldValue = new NFCDataList(mVarProperty);

                mVarProperty.SetObject(0, value);

                NFCDataList newValue = new NFCDataList(mVarProperty);

                if (null != doHandleDel)
                {
                    doHandleDel(mSelf, msPropertyName, oldValue, newValue);
                }
            }

            return true;
        }
Example #49
0
        public override bool SetPropertyString(string strPropertyName, string strValue)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddString("");
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetString(strValue);
            return true;
        }
Example #50
0
        public void MainU3D()
        {
            Debug.Log("****************NFIDataList******************");

            NFIDataList var = new NFCDataList();

            for (int i = 0; i < 9; i += 3)
            {
                var.AddInt(i);
                var.AddFloat((float)i + 1);
                var.AddString((i + 2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64  n   = var.IntVal(i);
                float  f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Debug.Log(n);
                Debug.Log(f);
                Debug.Log(str);
            }


            Debug.Log("***************NFProperty*******************");

            NFIDENTID ident      = new NFIDENTID(0, 1);
            NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "Player", "", new NFCDataList());

            NFIDataList valueProperty = new NFCDataList();

            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Debug.Log(gameObject.QueryPropertyInt("111"));

            Debug.Log("***************NFRecord*******************");

            NFIDataList valueRecord = new NFCDataList();

            valueRecord.AddInt(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Debug.Log(gameObject.QueryRecordInt("testRecord", 0, 0));
            Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2));
            Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3));

            Debug.Log(" ");
            Debug.Log("***************PropertyNFEvent*******************");

            //挂属性回调,挂表回调
            xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            xKernel.SetPropertyInt(ident, "111", 2456);

            Debug.Log(" ");
            Debug.Log("***************RecordNFEvent*******************");

            xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Debug.Log(" ");
            Debug.Log("***************ClassNFEvent*******************");

            xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            xKernel.CreateObject(new NFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList());
            xKernel.DestroyObject(new NFIDENTID(0, 2));


            Debug.Log(" ");
            Debug.Log("***************NFHeartBeat*******************");
            xKernel.AddHeartBeat(new NFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new NFCDataList());
        }
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);
            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                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"];

                    switch (strType.Value)
                    {
                        case "int":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddInt(0);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "float":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddFloat(0.0f);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "double":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddDouble(0.0f);
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "string":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString("");
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        case "object":
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddObject(new NFIDENTID(0, 0));
                                xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                            }
                            break;
                        default:
                            break;

                    }
                }
            }
        }
Example #52
0
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            ///////////////////////////////////////////////////////////////////////////////////////
            if (NFCLogicClassManager.Instance.GetCepher())
            {
                StreamReader cepherReader = new StreamReader(strLogicPath);;
                string       strContent   = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                MemoryStream stream = new MemoryStream(data);
                XmlReader    x      = XmlReader.Create(stream);
                x.MoveToContent();
                string res = x.ReadOuterXml();

                xmldoc.LoadXml(res);
            }
            else
            {
                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)
                        {
                            NFIDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddInt(int.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddDouble(double.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddObject(new NFIDENTID(0, int.Parse(xAttribute.Value)));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);
            if (null != xLogicClass)
            {
                string strLogicPath = mstrRootPath + xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();
                ///////////////////////////////////////////////////////////////////////////////////////
                if (mbCepher)
                {
                    StreamReader cepherReader = new StreamReader(strLogicPath); ;
                    string strContent = cepherReader.ReadToEnd();
                    cepherReader.Close();

                    byte[] data = Convert.FromBase64String(strContent);

                    MemoryStream stream = new MemoryStream(data);
                    XmlReader x = XmlReader.Create(stream);
                    x.MoveToContent();
                    string res = x.ReadOuterXml();

                    xmldoc.LoadXml(res);
                }
                else
                {
                    xmldoc.Load(strLogicPath);
                }
                /////////////////////////////////////////////////////////////////
                XmlNode xRoot = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string strID = xRecordNode.Attributes["Id"].Value;
                            string strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];

                                switch (strTagType.Value)
                                {
                                    case "int":
                                        {
                                            xValue.AddInt(0);
                                        }
                                        break;
                                    case "float":
                                        {
                                            xValue.AddFloat(0.0f);
                                        }
                                        break;
                                    case "double":
                                        {
                                            xValue.AddDouble(0.0f);
                                        }
                                        break;
                                    case "string":
                                        {
                                            xValue.AddString("");
                                        }
                                        break;
                                    case "object":
                                        {
                                            xValue.AddObject(new NFIDENTID(0, 0));
                                        }
                                        break;
                                    default:
                                        break;

                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
Example #54
0
 public NFCProperty(NFIDENTID self, string strPropertyName, NFIDataList varData)
 {
     mSelf          = self;
     msPropertyName = strPropertyName;
     mVarProperty   = new NFCDataList(varData);
 }