Beispiel #1
0
        //public override int FindRow( int nRow );
        public override int FindColValue(int nCol, NFDataList var, ref NFDataList varResult)
        {
            for (int i = 0; i < mhtRecordVec.Count; i++)
            {
                NFDataList valueList = (NFDataList)mhtRecordVec[i];
                switch (valueList.GetType(0))
                {
                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                    return(FindInt(nCol, var.IntVal(0), ref varResult));

                case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                    return(FindInt(nCol, var.IntVal(0), ref varResult));

                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                    return(FindInt(nCol, var.IntVal(0), ref varResult));

                case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                    return(FindObject(nCol, var.ObjectVal(0), ref varResult));

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                    return(FindVector2(nCol, var.Vector2Val(0), ref varResult));

                case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                    return(FindVector3(nCol, var.Vector3Val(0), ref varResult));

                default:
                    break;
                }
            }


            return(-1);
        }
Beispiel #2
0
        public override bool SetInt(int nRow, int nCol, Int64 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_INT)
                {
                    if (valueList.IntVal(nCol) != value)
                    {
                        NFDataList.TData oldValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT);
                        NFDataList.TData newValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT);

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

                        valueList.SetInt(nCol, value);

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Update, nRow, nCol, oldValue, newValue);
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
Beispiel #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;
                }
            }
        }
Beispiel #4
0
        public void OnPlayerMove(NFDataList valueList)
        {
            NFGUID tar = valueList.ObjectVal(0);

            if (tar == mPlayerModule.mRoleID)
            {
                return;
            }

            GameObject  player      = GetObject(tar);
            OtherPlayer otherPlayer = player.GetComponent <OtherPlayer>();

            double    fSpeed = valueList.FloatVal(1);
            long      nType  = valueList.IntVal(2);
            NFVector3 pos    = valueList.Vector3Val(3);
            Vector3   vPos   = new Vector3(pos.X(), pos.Y(), pos.Z());

            if (nType > 0)
            {
                otherPlayer.JumpTo(vPos);
            }
            else
            {
                otherPlayer.MoveTo((float)fSpeed, vPos);
            }

            Debug.Log("Player Move:" + vPos.ToString());
        }
Beispiel #5
0
        public override Int64 QueryInt(int nRow, int nCol)
        {
            NFDataList valueList = QueryRow(nRow);

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

            return(0);
        }
Beispiel #6
0
        public override int FindVector3(int nCol, NFVector3 value)
        {
            NFDataList varResult = new NFDataList();
            int        nCount    = FindVector3(nCol, value, ref varResult);

            if (nCount > 0 && varResult.Count() > 0)
            {
                return((int)varResult.IntVal(0));
            }

            return(-1);
        }
Beispiel #7
0
        public override int FindInt(int nCol, Int64 value, ref NFDataList varResult)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                NFDataList valueList = (NFDataList)mhtRecordVec[i];
                if (valueList.IntVal(nCol) == value)
                {
                    varResult.AddInt(i);
                }
            }

            return(varResult.Count());
        }
Beispiel #8
0
        public override int FindRecordRow(int nCol, int value)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                NFDataList valueList = (NFDataList)mhtRecordVec[i];
                if (valueList.IntVal(nCol) == value)
                {
                    return(i);
                }
            }

            return(-1);
        }
Beispiel #9
0
        public NFProperty(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;
            }
        }
Beispiel #10
0
        public override NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

                NFDataList.TData varConfigID = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);
                varConfigID.Set(strConfigIndex);
                xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID);

                NFDataList.TData varConfigClass = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING);
                varConfigClass.Set(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.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT);
                            var.Set(arg.IntVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, var);
                        }
                        break;

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

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

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

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

                        case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                        {
                            NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                            var.Set(arg.Vector3Val(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, var);
                        }
                        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);
        }