Exemplo n.º 1
0
 public NFCPropertyManager(NFGUID self)
 {
     mSelf       = self;
     mhtProperty = new Hashtable();
 }
Exemplo n.º 2
0
 public abstract bool SetRecordFloat(NFGUID self, string strRecordName, int nRow, int nCol, double fValue);
Exemplo n.º 3
0
 public abstract bool SetRecordObject(NFGUID self, string strRecordName, int nRow, int nCol, NFGUID objectValue);
Exemplo n.º 4
0
 public abstract NFGUID QueryPropertyObject(NFGUID self, string strPropertyName);
Exemplo n.º 5
0
 public abstract NFIRecord FindRecord(NFGUID self, string strRecordName);
Exemplo n.º 6
0
 public abstract bool SetPropertyVector3(NFGUID self, string strPropertyName, NFVector3 objectValue);
Exemplo n.º 7
0
 public abstract double QueryPropertyFloat(NFGUID self, string strPropertyName);
Exemplo n.º 8
0
 /////////////////////////////////////////////////////////////
 public abstract void RegisterPropertyCallback(NFGUID self, string strPropertyName, NFIProperty.PropertyEventHandler handler);
Exemplo n.º 9
0
 public abstract void RegisterRecordCallback(NFGUID self, string strRecordName, NFIRecord.RecordEventHandler handler);
Exemplo n.º 10
0
        public override bool SetRecordObject(NFGUID self, string strRecordName, int nRow, int nCol, NFGUID objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return(xGameObject.SetRecordObject(strRecordName, nRow, nCol, objectValue));
            }

            return(false);
        }
Exemplo n.º 11
0
        public override int FindRecordRow(NFGUID self, string strRecordName, int nCol, NFGUID nValue, ref NFIDataList xDatalist)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                NFIRecord xRecord     = xGameObject.GetRecordManager().GetRecord(strRecordName);
                if (null != xRecord)
                {
                    return(xRecord.FindObject(nCol, nValue, ref xDatalist));
                }
            }

            return(-1);
        }
Exemplo n.º 12
0
        public override NFIObject CreateObject(NFGUID 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_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;

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

                        case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            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);
        }
Exemplo n.º 13
0
        public void InitPlayerComponent(NFGUID xID, GameObject self, bool bMainRole)
        {
            if (null == self)
            {
                return;
            }

            if (!self.GetComponent <Rigidbody>())
            {
                self.AddComponent <Rigidbody>();
            }

            if (!self.GetComponent <NFHeroSyncBuffer>())
            {
                self.AddComponent <NFHeroSyncBuffer>();
            }

            if (!self.GetComponent <NFHeroSync>())
            {
                self.AddComponent <NFHeroSync>();
            }

            NFHeroInput xInput = self.GetComponent <NFHeroInput>();

            if (!xInput)
            {
                xInput = self.AddComponent <NFHeroInput>();
            }

            if (bMainRole)
            {
                xInput.enabled = true;
                xInput.SetInputEnable(true);
            }
            else
            {
                xInput.enabled = false;
                xInput.SetInputEnable(false);
            }

            if (!self.GetComponent <GroundDetection>())
            {
                GroundDetection groundDetection = self.AddComponent <GroundDetection>();
                groundDetection.enabled    = true;
                groundDetection.groundMask = -1;
            }

            if (!self.GetComponent <CharacterMovement>())
            {
                CharacterMovement characterMovement = self.AddComponent <CharacterMovement>();
                characterMovement.enabled = true;
            }

            if (!self.GetComponent <NFHeroMotor>())
            {
                NFHeroMotor xHeroMotor = self.AddComponent <NFHeroMotor>();
                xHeroMotor.enabled = true;
            }

            if (!self.GetComponent <NFAnimatStateController>())
            {
                NFAnimatStateController xHeroAnima = self.AddComponent <NFAnimatStateController>();
                xHeroAnima.enabled = true;
            }

            if (!self.GetComponent <NFAnimaStateMachine>())
            {
                NFAnimaStateMachine xHeroAnima = self.AddComponent <NFAnimaStateMachine>();
                xHeroAnima.enabled = true;
            }

            if (bMainRole)
            {
                if (Camera.main)
                {
                    NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>();
                    if (!xHeroCameraFollow)
                    {
                        xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>();
                    }

                    xHeroCameraFollow.target = self.transform;
                }


                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                xHeroCapsuleCollider.isTrigger = false;
            }
            else
            {
                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                Rigidbody       rigidbody            = self.GetComponent <Rigidbody>();

                string         configID = mKernelModule.QueryPropertyString(xID, NFrame.IObject.ConfigID);
                NFMsg.ENPCType npcType  = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCType);
                //NFMsg.esub npcSubType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCSubType);
                if (npcType == NFMsg.ENPCType.TurretNpc)
                {
                    //is trigger must false if it is a building
                    // and the kinematic must true
                    xHeroCapsuleCollider.isTrigger = false;
                    //rigidbody.isKinematic = true;
                    //rigidbody.useGravity = true;
                    rigidbody.mass = 10000;
                }
                else
                {
                    xHeroCapsuleCollider.isTrigger = true;
                }
            }
        }
Exemplo n.º 14
0
 public int FindTargetObject(NFGUID ident, string strSkillConfigID, ref NFDataList valueList)
 {
     return(valueList.Count());
 }
Exemplo n.º 15
0
 public abstract bool SetPropertyString(NFGUID self, string strPropertyName, string strValue);
Exemplo n.º 16
0
 public abstract void RegisterEventCallBack(NFGUID self, int nEventID, NFIEvent.EventHandler handler);
Exemplo n.º 17
0
 public abstract bool SetPropertyObject(NFGUID self, string strPropertyName, NFGUID objectValue);
Exemplo n.º 18
0
        /////////////////////////////////////////////////////////////////

        public abstract NFIObject GetObject(NFGUID ident);
Exemplo n.º 19
0
 public abstract Int64 QueryPropertyInt(NFGUID self, string strPropertyName);
Exemplo n.º 20
0
 public abstract NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFDataList arg);
Exemplo n.º 21
0
 public abstract string QueryPropertyString(NFGUID self, string strPropertyName);
Exemplo n.º 22
0
 public abstract bool DestroyObject(NFGUID self);
Exemplo n.º 23
0
 public abstract NFVector3 QueryPropertyVector3(NFGUID self, string strPropertyName);
Exemplo n.º 24
0
 public abstract bool FindProperty(NFGUID self, string strPropertyName);
Exemplo n.º 25
0
 public abstract bool SetRecordInt(NFGUID self, string strRecordName, int nRow, int nCol, Int64 nValue);
Exemplo n.º 26
0
 public abstract bool SetPropertyInt(NFGUID self, string strPropertyName, Int64 nValue);
Exemplo n.º 27
0
 public abstract bool SetRecordString(NFGUID self, string strRecordName, int nRow, int nCol, string strValue);
Exemplo n.º 28
0
 public abstract bool SetPropertyFloat(NFGUID self, string strPropertyName, double fValue);
Exemplo n.º 29
0
 public abstract bool SetRecordVector2(NFGUID self, string strRecordName, int nRow, int nCol, NFVector2 objectValue);
Exemplo n.º 30
0
        public override bool SetRecordObject(string strRecordName, int nRow, int nCol, NFGUID obj)
        {
            NFIRecord record = mRecordManager.GetRecord(strRecordName);

            if (null != record)
            {
                record.SetObject(nRow, nCol, obj);
                return(true);
            }

            return(false);
        }