Exemple #1
0
        public bool SetVector3(int index, NFVector3 value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_VECTOR3)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
Exemple #2
0
        public override bool SetPropertyVector3(string strPropertyName, NFVector3 obj)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

            if (null == property)
            {
                NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                property = mPropertyManager.AddProperty(strPropertyName, xValue);
            }

            property.SetVector3(obj);
            return(true);
        }
Exemple #3
0
        public override int FindVector3(int nCol, NFVector3 value, ref NFIDataList varResult)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                NFIDataList valueList = (NFIDataList)mhtRecordVec[i];
                if (valueList.Vector3Val(nCol) == value)
                {
                    varResult.AddInt(i);
                }
            }

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

            return(-1);
        }
        public override bool SetPropertyVector3(string strPropertyName, NFVector3 obj)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);

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

            property.SetVector3(obj);
            return(true);
        }
Exemple #6
0
            public bool Set(NFVector3 value)
            {
                if (nType == VARIANT_TYPE.VTYPE_UNKNOWN)
                {
                    nType = VARIANT_TYPE.VTYPE_VECTOR3;
                }

                if (nType == VARIANT_TYPE.VTYPE_VECTOR3)
                {
                    mData = value;
                    return(true);
                }

                return(false);
            }
Exemple #7
0
        private void OnSwapScene(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckSwapScene xData = NFMsg.ReqAckSwapScene.Parser.ParseFrom(xMsg.msg_data);

            mUIModule.ShowUI <UIMain>();

            NFDataList var = new NFDataList();
            NFVector3  v   = new NFVector3(xData.x, xData.y, xData.z);

            var.AddInt(xData.scene_id);
            var.AddVector3(v);

            mEventModule.DoEvent((int)Event.SwapScene, var);
        }
        private void OnSwapScene(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

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

            mUIModule.ShowUI <UIMain>();

            NFDataList var = new NFDataList();
            NFVector3  v   = new NFVector3(xData.x, xData.y, xData.z);

            var.AddInt(xData.scene_id);
            var.AddVector3(v);

            mEventModule.DoEvent((int)Event.SwapScene, var);
        }
        public override bool SetVector3(NFVector3 value)
        {
            if (mxData.Vector3Val() != value)
            {
                NFIDataList.TData oldValue = new NFIDataList.TData(mxData);
                NFIDataList.TData newValue = new NFIDataList.TData(NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3);
                newValue.Set(value);

                mxData.Set(value);

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

            return(true);
        }
Exemple #10
0
        private void OnClassNPCEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex)
        {
            if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE)
            {
                string    strConfigID = mKernelModule.QueryPropertyString(self, NFrame.Player.ConfigID);
                Vector3   vec         = new Vector3();
                NFVector3 vector3     = mKernelModule.QueryPropertyVector3(self, NFrame.Player.Position);
                //vec.x = vector3.X();
                //vec.y = vector3.Y();
                //vec.z = vector3.Z();

                string strPrefabPath = "";
                //    if (strConfigID.Length <= 0)
                //    {
                //        strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab");
                //    }
                //    else
                //    {
                //        strPrefabPath = NFCElementModule.Instance()..QueryPropertyString(strConfigID, "Prefab");
                //    }

                strPrefabPath = "Player/AIThirdPersonController";
                GameObject playerPerf = Resources.Load <GameObject>(strPrefabPath);
                GameObject player     = GameObject.Instantiate(playerPerf);


                mGameObjectMap.Add(self, player);
            }
            else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY)
            {
                GameObject go = GetObject(self);
                if (go != null)
                {
                    mGameObjectMap.Remove(self);

                    GameObject.DestroyObject(go);
                }
            }
        }
Exemple #11
0
        public void OnPlayerMove(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ReqAckPlayerMove xData = NFMsg.ReqAckPlayerMove.Parser.ParseFrom(xMsg.msg_data);

            if (xData.target_pos.Count <= 0)
            {
                return;
            }

            NFGUID tar = mHelpModule.PBToNF(xData.mover);

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

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

            float fSpeed = xData.speed;

            long      nType = xData.moveType;
            NFVector3 pos   = mHelpModule.PBToNF(xData.target_pos[0]);
            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());
        }
 public abstract bool AddVector3(NFVector3 value);
Exemple #13
0
        private void OnConfigIDChangeHandler(NFGUID self, string strProperty, NFDataList.TData oldVar, NFDataList.TData newVar, Int64 reason)
        {
            Vector3 vec = GetRenderObjectPosition(self);

            DestroyObject(self);

            if (vec.Equals(Vector3.zero))
            {
                NFVector3 vec3 = mKernelModule.QueryPropertyVector3(self, NPC.Position);
                vec.x = vec3.X();
                vec.y = vec3.Y();
                vec.z = vec3.Z();
            }

            string strCnfID      = newVar.StringVal();
            string strPrefabPath = mElementModule.QueryPropertyString(strCnfID, NPC.Prefab);

            if (strPrefabPath.Length <= 0)
            {
                strPrefabPath = mElementModule.QueryPropertyString("DefaultObject", NPC.Prefab);
            }
            GameObject xPlayer = CreateObject(self, strPrefabPath, vec, NFrame.Player.ThisName);

            if (xPlayer)
            {
                xPlayer.name = NFrame.Player.ThisName;
                xPlayer.transform.Rotate(new Vector3(0, 90, 0));

                NFBodyIdent xBodyIdent = xPlayer.GetComponent <NFBodyIdent>();
                if (null != xBodyIdent)
                {//不能没有
                    xBodyIdent.enabled = true;
                    xBodyIdent.SetObjectID(self);
                    xBodyIdent.cnfID = strCnfID;
                }
                else
                {
                    Debug.LogError("No 'BodyIdent' component in " + strPrefabPath);
                }

                if (self == mLoginModule.mRoleID)
                {
                    InitPlayerComponent(self, xPlayer, true);
                }
                else
                {
                    InitPlayerComponent(self, xPlayer, false);
                }

                if (Camera.main && self == mLoginModule.mRoleID)
                {
                    NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>();
                    if (!xHeroCameraFollow)
                    {
                        xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>();
                    }

                    xHeroCameraFollow.SetPlayer(xPlayer.transform);
                }

                Debug.Log("Create Object successful" + NFrame.Player.ThisName + " " + vec.ToString() + " " + self.ToString());
            }
            else
            {
                Debug.LogError("Create Object failed" + NFrame.Player.ThisName + " " + vec.ToString() + " " + self.ToString());
            }
        }
Exemple #14
0
 public abstract bool SetVector3(NFVector3 value);
 public abstract bool SetVector3(int index, NFVector3 value);
Exemple #16
0
 public abstract int FindRecordRow(NFGUID self, string strRecordName, int nCol, NFVector3 value);
Exemple #17
0
 public abstract int FindVector3(int nCol, NFVector3 value, ref NFDataList varResult);
Exemple #18
0
 public abstract bool SetVector3(NFVector3 value, Int64 reason = 0);
Exemple #19
0
        public static float Distance(NFVector3 va, NFVector3 vb)
        {
            NFVector3 vector = NFVector3.sub(va, vb);

            return(vector.Length());
        }
Exemple #20
0
        public override int FindRecordRow(NFGUID self, string strRecordName, int nCol, NFVector3 nValue, ref NFDataList xDatalist)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                NFIRecord xRecord     = xGameObject.GetRecordManager().GetRecord(strRecordName);
                if (null != xRecord)
                {
                    return(xRecord.FindVector3(nCol, nValue, ref xDatalist));
                }
            }

            return(-1);
        }
Exemple #21
0
        public override bool SetRecordVector3(NFGUID self, string strRecordName, int nRow, int nCol, NFVector3 objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return(xGameObject.SetRecordVector3(strRecordName, nRow, nCol, objectValue));
            }

            return(false);
        }
Exemple #22
0
 public abstract bool SetPropertyVector3(NFGUID self, string strPropertyName, NFVector3 objectValue);
Exemple #23
0
 public abstract int FindRecordRow(NFGUID self, string strRecordName, int nCol, NFVector3 nValue, ref NFDataList xDatalist);
Exemple #24
0
 public abstract bool SetVector3(int nRow, int nCol, NFVector3 value);
Exemple #25
0
 public abstract int FindRecordRow(int nCol, NFVector3 value);
        public NFVector3 PBToNF(NFMsg.Vector3 xVector)
        {
            NFVector3 xData = new NFVector3(xVector.x, xVector.y, xVector.z);

            return(xData);
        }
Exemple #27
0
 public abstract int FindVector3(int nCol, NFVector3 value);
Exemple #28
0
 public abstract bool SetRecordVector3(NFGUID self, string strRecordName, int nRow, int nCol, NFVector3 objectValue);
        static public NFVector3 PBToNF(NFMsg.Position xVector)
        {
            NFVector3 xData = new NFVector3(xVector.x, xVector.y, xVector.z);

            return(xData);
        }
Exemple #30
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)
            {
                Debug.Log("OBJECT_CREATE:" + self.ToString());

                string    strConfigID = mKernelModule.QueryPropertyString(self, NFrame.Player.ConfigID);
                Vector3   vec         = new Vector3();
                NFVector3 vector3     = mKernelModule.QueryPropertyVector3(self, NFrame.Player.Position);
                //vec.x = vector3.X();
                //vec.y = vector3.Y();
                //vec.z = vector3.Z();

                //MainPlayer
                string strPrefabPath = "Player/AIThirdPersonController";
                if (self == mLoginModule.mRoleID)
                {
                    strPrefabPath = "Player/ThirdPersonController";
                }
                //if (strConfigID.Length <= 0)
                //{
                //    strPrefabPath = NFCElementModule.Instance().QueryPropertyString("Player", "Prefab");
                //}
                //else
                //{
                //    strPrefabPath = NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, "Prefab");
                //}

                //CreateObject(self, strPrefabPath, vec, strClassName);

                GameObject perfb  = Resources.Load <GameObject>(strPrefabPath);
                GameObject player = GameObject.Instantiate(perfb);

                mGameObjectMap.Add(self, player);

                GameObject.DontDestroyOnLoad(player);

                player.name = self.ToString();
                player.transform.position = vec;

                //MainPlayer
                if (self == mLoginModule.mRoleID)
                {
                    player.AddComponent <MainPlayer>();
                }
                else
                {
                    player.AddComponent <OtherPlayer>();
                }
            }
            else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY)
            {
                //DestroyObject(transform.Find(self.ToString()));
                GameObject go = GetObject(self);
                if (go != null)
                {
                    mGameObjectMap.Remove(self);

                    GameObject.DestroyObject(go);
                }
            }
        }