Exemple #1
0
        public override bool SetString(int nRow, int nCol, string value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                NFDataList valueList = (NFDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFDataList.VARIANT_TYPE.VTYPE_STRING)
                {
                    if (valueList.StringVal(nCol) != value)
                    {
                        NFDataList.TData oldValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);
                        NFDataList.TData newValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);

                        oldValue.Set(valueList.StringVal(nCol));
                        newValue.Set(value);

                        valueList.SetString(nCol, value);

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

                return(true);
            }

            return(false);
        }
    // Use this for initialization
    void Start()
    {
        mxThis  = this.transform;
        xCamera = this.GetComponent <Camera>();

        NFrame.NFIClass xLogicClass = NFrame.NFCKernelModule.Instance.GetLogicClassModule().GetElement("Scene");
        List <string>   xList       = xLogicClass.GetConfigNameList();

        for (int i = 0; i < xList.Count; ++i)
        {
            string strName = (string)xList[i];

            string strCamOffestPos = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strName, "CamOffestPos");
            string strCamOffestRot = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strName, "CamOffestRot");

            NFrame.NFDataList xCamOffestPosList = new NFrame.NFDataList(strCamOffestPos, ',');
            NFrame.NFDataList xCamOffestRotList = new NFrame.NFDataList(strCamOffestRot, ',');
            if (xCamOffestPosList.Count() == 3 && xCamOffestRotList.Count() == 2)
            {
                OffestPos xOffestPos = new OffestPos();
                xOffestPos.offsetX = float.Parse(xCamOffestPosList.StringVal(0));
                xOffestPos.offsetY = float.Parse(xCamOffestPosList.StringVal(1));
                xOffestPos.offsetZ = float.Parse(xCamOffestPosList.StringVal(2));

                xOffestPos.XRot = float.Parse(xCamOffestRotList.StringVal(0));
                xOffestPos.YRot = float.Parse(xCamOffestRotList.StringVal(1));

                mxOffestPosList[int.Parse(strName)] = xOffestPos;
            }
        }
    }
Exemple #3
0
        public NFDataList(NFDataList src)
        {
            for (int i = 0; i < src.Count(); i++)
            {
                switch (src.GetType(i))
                {
                case VARIANT_TYPE.VTYPE_INT:
                    AddInt(src.IntVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_FLOAT:
                    AddFloat(src.FloatVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_STRING:
                    AddString(src.StringVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_OBJECT:
                    AddObject(src.ObjectVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_VECTOR2:
                    AddVector2(src.Vector2Val(i));
                    break;

                case VARIANT_TYPE.VTYPE_VECTOR3:
                    AddVector3(src.Vector3Val(i));
                    break;

                default:
                    break;
                }
            }
        }
Exemple #4
0
        public void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex)
        {
            if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE)
            {
                NFIObject xObject = NFCKernelModule.Instance.GetObject(self);

                NFIPropertyManager xPropertyManager  = xObject.GetPropertyManager();
                NFDataList         xPropertyNameList = xPropertyManager.GetPropertyList();
                for (int i = 0; i < xPropertyNameList.Count(); i++)
                {
                    string      strPropertyName = xPropertyNameList.StringVal(i);
                    NFIProperty xProperty       = xPropertyManager.GetProperty(strPropertyName);
                    if (xProperty.GetUpload())
                    {
                        xProperty.RegisterCallback(OnPropertyHandler);
                    }
                }

                NFIRecordManager xRecordManager  = xObject.GetRecordManager();
                NFDataList       xRecordNameList = xRecordManager.GetRecordList();
                for (int i = 0; i < xRecordNameList.Count(); i++)
                {
                    string    strRecodeName = xRecordNameList.StringVal(i);
                    NFIRecord xRecord       = xRecordManager.GetRecord(strRecodeName);
                    if (xRecord.GetUpload())
                    {
                        xRecord.RegisterCallback(OnRecordHandler);
                    }
                }
            }
        }
Exemple #5
0
        private void OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex)
        {
            if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH)
            {
                NFIClass           classObject     = mClassModule.GetElement(strClassName);
                NFIPropertyManager propertyManager = classObject.GetPropertyManager();
                NFIRecordManager   recordManager   = classObject.GetRecordManager();

                NFDataList propertyList = propertyManager.GetPropertyList();
                NFDataList recordList   = recordManager.GetRecordList();

                for (int i = 0; i < propertyList.Count(); ++i)
                {
                    NFIProperty propertyObject = propertyManager.GetProperty(propertyList.StringVal(i));
                    if (propertyObject.GetUpload())
                    {
                        mKernelModule.RegisterPropertyCallback(self, propertyObject.GetKey(), OnPropertyDataHandler);
                    }
                }

                for (int i = 0; i < recordList.Count(); ++i)
                {
                    NFIRecord recordObject = recordManager.GetRecord(recordList.StringVal(i));
                    if (recordObject.GetUpload())
                    {
                        mKernelModule.RegisterRecordCallback(self, recordObject.GetName(), RecordEventHandler);
                    }
                }
            }
        }
Exemple #6
0
        public override string QueryString(int nRow, int nCol)
        {
            NFDataList valueList = QueryRow(nRow);

            if (null != valueList)
            {
                return(valueList.StringVal(nCol));
            }

            return(NFDataList.NULL_STRING);
        }
Exemple #7
0
        public override int FindString(int nCol, string value, ref NFDataList varResult)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                NFDataList valueList = (NFDataList)mhtRecordVec[i];
                if (valueList.StringVal(nCol) == value)
                {
                    varResult.AddInt(i);
                }
            }

            return(varResult.Count());
        }
Exemple #8
0
        void AddBasePropertyFormOther(string strName, string strOther)
        {
            NFIClass xOtherClass = GetElement(strOther);
            NFIClass xLogicClass = GetElement(strName);

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

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string    strRecordyName = xDataList.StringVal(i);
                NFIRecord xRecord        = xLogicClass.GetRecordManager().GetRecord(strRecordyName);

                NFIObject        xObject        = GetObject(self);
                NFIRecordManager xRecordManager = xObject.GetRecordManager();

                NFIRecord record = xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData());
                if (record != null)
                {
                    record.SetUpload(xRecord.GetUpload());
                }
            }
        }
Exemple #10
0
        void InitProperty(NFGUID self, string strClassName)
        {
            NFIClass   xLogicClass = mxLogicClassModule.GetElement(strClassName);
            NFDataList xDataList   = xLogicClass.GetPropertyManager().GetPropertyList();

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

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

                NFIProperty property = xPropertyManager.AddProperty(strPropertyName, xProperty.GetData());
                //if property==null ,means this property alreay exist in manager
                if (property != null)
                {
                    property.SetUpload(xProperty.GetUpload());
                }
            }
        }
        public override void Update(float fPassTime)
        {
            NFDataList xRemoveKeyList = new NFDataList();;

            foreach (KeyValuePair <string, NFIHeartBeat> kv in mhtHeartBeat)
            {
                NFIHeartBeat xHeartBeat = (NFIHeartBeat)kv.Value;
                if (xHeartBeat.NeedRemove())
                {
                    xRemoveKeyList.AddString((string)kv.Key);
                }
                else
                {
                    xHeartBeat.Update(fPassTime);
                }
            }

            for (int i = 0; i < xRemoveKeyList.Count(); i++)
            {
                mhtHeartBeat.Remove(xRemoveKeyList.StringVal(i));
            }
        }
Exemple #12
0
        public override void Shut()
        {
            NFDataList xRecordList = mRecordManager.GetRecordList();

            if (null != xRecordList)
            {
                for (int i = 0; i < xRecordList.Count(); ++i)
                {
                    string    strRecordName = xRecordList.StringVal(i);
                    NFIRecord xRecord       = mRecordManager.GetRecord(strRecordName);
                    if (null != xRecord)
                    {
                        xRecord.Clear();
                    }
                }
            }

            mRecordManager   = null;
            mPropertyManager = null;
            mHeartManager    = null;

            return;
        }
Exemple #13
0
        public NFCProperty(NFGUID self, string strPropertyName, NFDataList varData)
        {
            mSelf          = self;
            msPropertyName = strPropertyName;
            mxData         = new NFDataList.TData(varData.GetType(0));

            switch (varData.GetType(0))
            {
            case NFDataList.VARIANT_TYPE.VTYPE_INT:
                mxData.Set(varData.IntVal(0));
                break;

            case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                mxData.Set(varData.FloatVal(0));
                break;

            case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                mxData.Set(varData.ObjectVal(0));
                break;

            case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                mxData.Set(varData.StringVal(0));
                break;

            case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                mxData.Set(varData.Vector2Val(0));
                break;

            case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                mxData.Set(varData.Vector3Val(0));
                break;

            default:
                break;
            }
        }
Exemple #14
0
        public void RequireAddRow(NFrame.NFGUID self, string strRecordName, int nRow)
        {
            NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow();
            xData.player_id   = NFNetController.NFToPB(self);
            xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

            NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct();
            xData.row_data.Add(xRecordAddRowStruct);
            xRecordAddRowStruct.row = nRow;

            NFIObject  xObject  = NFCKernelModule.Instance.GetObject(self);
            NFIRecord  xRecord  = xObject.GetRecordManager().GetRecord(strRecordName);
            NFDataList xRowData = xRecord.QueryRow(nRow);

            for (int i = 0; i < xRowData.Count(); i++)
            {
                switch (xRowData.GetType(i))
                {
                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                {
                    NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt();
                    xRecordInt.row  = nRow;
                    xRecordInt.col  = i;
                    xRecordInt.data = xRowData.IntVal(i);
                    xRecordAddRowStruct.record_int_list.Add(xRecordInt);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                {
                    NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat();
                    xRecordFloat.row  = nRow;
                    xRecordFloat.col  = i;
                    xRecordFloat.data = (float)xRowData.FloatVal(i);
                    xRecordAddRowStruct.record_float_list.Add(xRecordFloat);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                {
                    NFMsg.RecordString xRecordString = new NFMsg.RecordString();
                    xRecordString.row  = nRow;
                    xRecordString.col  = i;
                    xRecordString.data = System.Text.Encoding.Default.GetBytes(xRowData.StringVal(i));
                    xRecordAddRowStruct.record_string_list.Add(xRecordString);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                {
                    NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
                    xRecordObject.row  = nRow;
                    xRecordObject.col  = i;
                    xRecordObject.data = NFNetController.NFToPB(xRowData.ObjectVal(i));
                    xRecordAddRowStruct.record_object_list.Add(xRecordObject);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                {
                    NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2();
                    xRecordVector.row  = nRow;
                    xRecordVector.col  = i;
                    xRecordVector.data = NFNetController.NFToPB(xRowData.Vector2Val(i));
                    xRecordAddRowStruct.record_vector2_list.Add(xRecordVector);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                {
                    NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3();
                    xRecordVector.row  = nRow;
                    xRecordVector.col  = i;
                    xRecordVector.data = NFNetController.NFToPB(xRowData.Vector3Val(i));
                    xRecordAddRowStruct.record_vector3_list.Add(xRecordVector);
                }
                break;
                }
            }

            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);

            Debug.Log("send upload record addRow");
            SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, mxBody);
        }
Exemple #15
0
        public override NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

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

                NFDataList varConfigClass = new NFDataList();
                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);
                        NFDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                        case NFDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            NFDataList xDataList = new NFDataList();
                            xDataList.AddInt(arg.IntVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

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

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

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

                        case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                        {
                            NFDataList xDataList = new NFDataList();
                            xDataList.AddVector2(arg.Vector2Val(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                        {
                            NFDataList xDataList = new NFDataList();
                            xDataList.AddVector3(arg.Vector3Val(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);
                }

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

            return(null);
        }
Exemple #16
0
        public void RequireAddRow(NFGUID objectID, string strRecordName, int nRow)
        {
            NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow();
            xData.PlayerId   = mHelpModule.NFToPB(objectID);
            xData.RecordName = ByteString.CopyFromUtf8(strRecordName);

            NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct();
            xData.RowData.Add(xRecordAddRowStruct);
            xRecordAddRowStruct.Row = nRow;

            NFIObject  xObject  = mKernelModule.GetObject(objectID);
            NFIRecord  xRecord  = xObject.GetRecordManager().GetRecord(strRecordName);
            NFDataList xRowData = xRecord.QueryRow(nRow);

            for (int i = 0; i < xRowData.Count(); i++)
            {
                switch (xRowData.GetType(i))
                {
                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                {
                    NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt();
                    xRecordInt.Row  = nRow;
                    xRecordInt.Col  = i;
                    xRecordInt.Data = xRowData.IntVal(i);
                    xRecordAddRowStruct.RecordIntList.Add(xRecordInt);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                {
                    NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat();
                    xRecordFloat.Row  = nRow;
                    xRecordFloat.Col  = i;
                    xRecordFloat.Data = (float)xRowData.FloatVal(i);
                    xRecordAddRowStruct.RecordFloatList.Add(xRecordFloat);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                {
                    NFMsg.RecordString xRecordString = new NFMsg.RecordString();
                    xRecordString.Row  = nRow;
                    xRecordString.Col  = i;
                    xRecordString.Data = ByteString.CopyFromUtf8(xRowData.StringVal(i));
                    xRecordAddRowStruct.RecordStringList.Add(xRecordString);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                {
                    NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
                    xRecordObject.Row  = nRow;
                    xRecordObject.Col  = i;
                    xRecordObject.Data = mHelpModule.NFToPB(xRowData.ObjectVal(i));
                    xRecordAddRowStruct.RecordObjectList.Add(xRecordObject);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                {
                    NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2();
                    xRecordVector.Row  = nRow;
                    xRecordVector.Col  = i;
                    xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector2Val(i));
                    xRecordAddRowStruct.RecordVector2List.Add(xRecordVector);
                }
                break;

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                {
                    NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3();
                    xRecordVector.Row  = nRow;
                    xRecordVector.Col  = i;
                    xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector3Val(i));
                    xRecordAddRowStruct.RecordVector3List.Add(xRecordVector);
                }
                break;
                }
            }

            mxBody.SetLength(0);
            xData.WriteTo(mxBody);

            Debug.Log("send upload record addRow");
            SendMsg((int)NFMsg.EGameMsgID.AckAddRow, mxBody);
        }
Exemple #17
0
        public static void Main()
        {
            NFIKernelModule kernel = NFCKernelModule.Instance;

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

            NFDataList var = new NFDataList();

            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);
                double f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Console.WriteLine(n);
                Console.WriteLine(f);
                Console.WriteLine(str);
            }


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

            NFGUID    ident      = new NFGUID(0, 1);
            NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFDataList());

            NFDataList valueProperty = new NFDataList();

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

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

            NFDataList valueRecord = new NFDataList();

            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 NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFDataList());
            kernel.DestroyObject(new NFGUID(0, 2));


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

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.Execute(1.0f);
            }
        }
Exemple #18
0
        public void MainU3D()
        {
            Debug.Log("****************NFDataList******************");

            NFDataList var = new NFDataList();

            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);
                double f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Debug.Log(n);
                Debug.Log(f);
                Debug.Log(str);
            }


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

            NFGUID    ident      = new NFGUID(0, 1);
            NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "", "", new NFDataList());

            NFDataList valueProperty = new NFDataList();

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

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

            NFDataList valueRecord = new NFDataList();

            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 NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFDataList());
            xKernel.DestroyObject(new NFGUID(0, 2));


            Debug.Log(" ");
            Debug.Log("***************NFHeartBeat*******************");
            xKernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1);
        }