public void S_C_NPC_Generator(CMD_SC_NPC_GENERATOR _npcGen) { // 通过名字获取路径. string _npcName = IdMap.GetIdMapInfo(_npcGen.gsActorId); NavigParam _np = NavigationMap.GetActorNavigation(_npcGen.gsNavigId); Vector3 [] _pathNodes = _np.path.ToArray(); // 把路径适配到本地设备. _pathNodes = Utility.TransformPosZ2X(_pathNodes); // 路径时间. float _timeLength = _np.timeLength; PathCtrl.Instance.S_C_NPC_Generator(_npcGen.gsServerTime, _npcGen.gsServerId, _npcName, _pathNodes, _timeLength, _npcGen.gsNavigRot, _npcGen.gsZ, _npcGen.gsY); }
internal void LoadFromStream(Stream st) { /* * if(Application.platform==RuntimePlatform.WindowsEditor || Application.platform==RuntimePlatform.Android) * { * UnityEngine.Object obj = Resources.Load("game"); * TextAsset ta = (TextAsset)obj; * st = new MemoryStream(ta.bytes); * } * else * { * st = new FileStream(Application.streamingAssetsPath+"/"+"game.navigPak",FileMode.Open); * } */ using (st) { ProtoReader pReader = new ProtoReader(st, null, null); navDict = new Dictionary <UInt32, NavigParam>(); long fsSize = st.Length; while (fsSize > 0) { int readHeadSize = ProtoReader.DirectReadVarintInt32(st); fsSize -= 4; byte[] tempHeadByte = ProtoReader.DirectReadBytes(st, (int)readHeadSize); fsSize -= readHeadSize; NavigHead nHead = ProtobufHelper.Deserialize <NavigHead>(tempHeadByte); int bodaySizeHead = ProtoReader.DirectReadVarintInt32(st); byte[] tempBodayByte = ProtoReader.DirectReadBytes(st, bodaySizeHead); fsSize -= bodaySizeHead; NavigationA nA = ProtobufHelper.Deserialize <NavigationA>(tempBodayByte); List <Vector3> v3List = new List <Vector3>(); foreach (Pak.Vector3 tempV3 in nA.frame) { Vector3 tempV = new Vector3(); tempV.x = tempV3.x; tempV.y = tempV3.y; tempV.z = tempV3.z; v3List.Add(tempV); } NavigParam np = new NavigParam(); np.path = v3List; np.timeLength = nHead.cycleTime; navDict.Add(nHead.idUInt, np); // Debug.LogError("****************************************"); // Debug.LogError("HeadDataType====="+nHead.type); // Debug.LogError("HeadDataIdStr===="+nHead.idStr); // Debug.LogError("HeadDateUint====="+nHead.idUInt); // Debug.LogError("HeadDataCyTime=============================================="+nHead.cycleTime); // Debug.LogWarning("BodayListCount="+nA.frame.Count); // Debug.LogError("****************************************"); } } }