public NFCPropertyManager(NFGUID self) { mSelf = self; mhtProperty = new Hashtable(); }
public abstract bool SetRecordFloat(NFGUID self, string strRecordName, int nRow, int nCol, double fValue);
public abstract bool SetRecordObject(NFGUID self, string strRecordName, int nRow, int nCol, NFGUID objectValue);
public abstract NFGUID QueryPropertyObject(NFGUID self, string strPropertyName);
public abstract NFIRecord FindRecord(NFGUID self, string strRecordName);
public abstract bool SetPropertyVector3(NFGUID self, string strPropertyName, NFVector3 objectValue);
public abstract double QueryPropertyFloat(NFGUID self, string strPropertyName);
///////////////////////////////////////////////////////////// public abstract void RegisterPropertyCallback(NFGUID self, string strPropertyName, NFIProperty.PropertyEventHandler handler);
public abstract void RegisterRecordCallback(NFGUID self, string strRecordName, NFIRecord.RecordEventHandler handler);
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); }
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); }
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); }
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; } } }
public int FindTargetObject(NFGUID ident, string strSkillConfigID, ref NFDataList valueList) { return(valueList.Count()); }
public abstract bool SetPropertyString(NFGUID self, string strPropertyName, string strValue);
public abstract void RegisterEventCallBack(NFGUID self, int nEventID, NFIEvent.EventHandler handler);
public abstract bool SetPropertyObject(NFGUID self, string strPropertyName, NFGUID objectValue);
///////////////////////////////////////////////////////////////// public abstract NFIObject GetObject(NFGUID ident);
public abstract Int64 QueryPropertyInt(NFGUID self, string strPropertyName);
public abstract NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFDataList arg);
public abstract string QueryPropertyString(NFGUID self, string strPropertyName);
public abstract bool DestroyObject(NFGUID self);
public abstract NFVector3 QueryPropertyVector3(NFGUID self, string strPropertyName);
public abstract bool FindProperty(NFGUID self, string strPropertyName);
public abstract bool SetRecordInt(NFGUID self, string strRecordName, int nRow, int nCol, Int64 nValue);
public abstract bool SetPropertyInt(NFGUID self, string strPropertyName, Int64 nValue);
public abstract bool SetRecordString(NFGUID self, string strRecordName, int nRow, int nCol, string strValue);
public abstract bool SetPropertyFloat(NFGUID self, string strPropertyName, double fValue);
public abstract bool SetRecordVector2(NFGUID self, string strRecordName, int nRow, int nCol, NFVector2 objectValue);
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); }