diff --git a/xiaofang/Assets/ProtoBuf/Proto/Common.cs b/xiaofang/Assets/ProtoBuf/Proto/Common.cs deleted file mode 100644 index 4e106243..00000000 --- a/xiaofang/Assets/ProtoBuf/Proto/Common.cs +++ /dev/null @@ -1,281 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: common.proto -// -#pragma warning disable 1591, 0612, 3021, 8981 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -/// Holder for reflection information generated from common.proto -public static partial class CommonReflection { - - #region Descriptor - /// File descriptor for common.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static CommonReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Cgxjb21tb24ucHJvdG8iLgoNUmVzdWx0TWVzc2FnZRIMCgRjb2RlGAEgASgF", - "Eg8KB21lc3NhZ2UYAiABKAlCB1oFLi87cGJiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::ResultMessage), global::ResultMessage.Parser, new[]{ "Code", "Message" }, null, null, null, null) - })); - } - #endregion - -} -#region Messages -[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] -public sealed partial class ResultMessage : pb::IMessage -#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage -#endif -{ - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResultMessage()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::CommonReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public ResultMessage() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public ResultMessage(ResultMessage other) : this() { - code_ = other.code_; - message_ = other.message_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public ResultMessage Clone() { - return new ResultMessage(this); - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 1; - private int code_; - /// - /// 错误码 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Code { - get { return code_; } - set { - code_ = value; - } - } - - /// Field number for the "message" field. - public const int MessageFieldNumber = 2; - private string message_ = ""; - /// - /// 错误信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Message { - get { return message_; } - set { - message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as ResultMessage); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(ResultMessage other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Code != other.Code) return false; - if (Message != other.Message) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); - if (Message.Length != 0) hash ^= Message.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Code != 0) { - output.WriteRawTag(8); - output.WriteInt32(Code); - } - if (Message.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Message); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Code != 0) { - output.WriteRawTag(8); - output.WriteInt32(Code); - } - if (Message.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Message); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); - } - if (Message.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(ResultMessage other) { - if (other == null) { - return; - } - if (other.Code != 0) { - Code = other.Code; - } - if (other.Message.Length != 0) { - Message = other.Message; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Code = input.ReadInt32(); - break; - } - case 18: { - Message = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Code = input.ReadInt32(); - break; - } - case 18: { - Message = input.ReadString(); - break; - } - } - } - } - #endif - -} - -#endregion - - -#endregion Designer generated code diff --git a/xiaofang/Assets/ProtoBuf/Proto/Common.cs.meta b/xiaofang/Assets/ProtoBuf/Proto/Common.cs.meta deleted file mode 100644 index 1f62f667..00000000 --- a/xiaofang/Assets/ProtoBuf/Proto/Common.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8f08a6ce1ce72944ab924e71bac47c6f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/xiaofang/Assets/ProtoBuf/Proto/Hall.cs b/xiaofang/Assets/ProtoBuf/Proto/Hall.cs index 88f09750..412b7f98 100644 --- a/xiaofang/Assets/ProtoBuf/Proto/Hall.cs +++ b/xiaofang/Assets/ProtoBuf/Proto/Hall.cs @@ -33,7 +33,7 @@ public static partial class HallReflection { "YXR1cxgDIAEoBRIQCghSb2xlTmFtZRgEIAEoCRIUCgxJc0xlYWRpbmdOUEMY", "BSABKAUSDgoGT25saW5lGAYgASgIEg4KBlJvbGVJZBgHIAEoBRITCgtHcm91", "cExlYWRlchgIIAEoBRISCgpBY3Rpb25Nb2RlGAkgASgFEg0KBUdyb3VwGAog", - "ASgFEgkKAVgYCyABKAISCQoBWRgMIAEoAhIJCgFaGA0gASgCEhMKC092ZXJz", + "ASgFEgkKAVgYCyABKAESCQoBWRgMIAEoARIJCgFaGA0gASgBEhMKC092ZXJz", "ZWVDb25kGA4gASgJEhYKDlNlbmRGcmFtZUNvdW50GA8gASgFEhYKDk1vdmVT", "cGVlZEZpcnN0GBAgASgFEhcKD01vdmVTcGVlZFNlY29uZBgRIAEoBRIWCg5N", "b3ZlU3BlZWRUaGlyZBgSIAEoBRIQCghCZWFyTG9hZBgTIAEoBRISCgpQcm90", @@ -1646,13 +1646,13 @@ public sealed partial class PlayerJoinResponse : pb::IMessageField number for the "X" field. public const int XFieldNumber = 11; - private float x_; + private double x_; /// /// 坐标x /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float X { + public double X { get { return x_; } set { x_ = value; @@ -1661,13 +1661,13 @@ public sealed partial class PlayerJoinResponse : pb::IMessageField number for the "Y" field. public const int YFieldNumber = 12; - private float y_; + private double y_; /// /// 坐标y /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Y { + public double Y { get { return y_; } set { y_ = value; @@ -1676,13 +1676,13 @@ public sealed partial class PlayerJoinResponse : pb::IMessageField number for the "Z" field. public const int ZFieldNumber = 13; - private float z_; + private double z_; /// /// 坐标z /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Z { + public double Z { get { return z_; } set { z_ = value; @@ -1864,9 +1864,9 @@ public sealed partial class PlayerJoinResponse : pb::IMessage public MoveRequest(MoveRequest other) : this() { roomId_ = other.roomId_; moveType_ = other.moveType_; + selectId_ = other.selectId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -567,6 +569,21 @@ public sealed partial class MoveRequest : pb::IMessage } } + /// Field number for the "selectId" field. + public const int SelectIdFieldNumber = 3; + private int selectId_; + /// + /// 选项的ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SelectId { + get { return selectId_; } + set { + selectId_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -584,6 +601,7 @@ public sealed partial class MoveRequest : pb::IMessage } if (RoomId != other.RoomId) return false; if (MoveType != other.MoveType) return false; + if (SelectId != other.SelectId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -593,6 +611,7 @@ public sealed partial class MoveRequest : pb::IMessage int hash = 1; if (RoomId.Length != 0) hash ^= RoomId.GetHashCode(); if (MoveType != 0) hash ^= MoveType.GetHashCode(); + if (SelectId != 0) hash ^= SelectId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -619,6 +638,10 @@ public sealed partial class MoveRequest : pb::IMessage output.WriteRawTag(16); output.WriteInt32(MoveType); } + if (SelectId != 0) { + output.WriteRawTag(24); + output.WriteInt32(SelectId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -637,6 +660,10 @@ public sealed partial class MoveRequest : pb::IMessage output.WriteRawTag(16); output.WriteInt32(MoveType); } + if (SelectId != 0) { + output.WriteRawTag(24); + output.WriteInt32(SelectId); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -653,6 +680,9 @@ public sealed partial class MoveRequest : pb::IMessage if (MoveType != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(MoveType); } + if (SelectId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SelectId); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -671,6 +701,9 @@ public sealed partial class MoveRequest : pb::IMessage if (other.MoveType != 0) { MoveType = other.MoveType; } + if (other.SelectId != 0) { + SelectId = other.SelectId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -698,6 +731,10 @@ public sealed partial class MoveRequest : pb::IMessage MoveType = input.ReadInt32(); break; } + case 24: { + SelectId = input.ReadInt32(); + break; + } } } #endif @@ -725,6 +762,10 @@ public sealed partial class MoveRequest : pb::IMessage MoveType = input.ReadInt32(); break; } + case 24: { + SelectId = input.ReadInt32(); + break; + } } } } @@ -1056,12 +1097,10 @@ public sealed partial class NpcData : pb::IMessage /// Field number for the "x" field. public const int XFieldNumber = 1; - private float x_; - /// - /// + private double x_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float X { + public double X { get { return x_; } set { x_ = value; @@ -1070,12 +1109,10 @@ public sealed partial class NpcData : pb::IMessage /// Field number for the "y" field. public const int YFieldNumber = 2; - private float y_; - /// - /// + private double y_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Y { + public double Y { get { return y_; } set { y_ = value; @@ -1084,12 +1121,10 @@ public sealed partial class NpcData : pb::IMessage /// Field number for the "z" field. public const int ZFieldNumber = 3; - private float z_; - /// - /// + private double z_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Z { + public double Z { get { return z_; } set { z_ = value; @@ -1186,9 +1221,9 @@ public sealed partial class NpcData : pb::IMessage if (ReferenceEquals(other, this)) { return true; } - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(X, other.X)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Y, other.Y)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Z, other.Z)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(X, other.X)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Y, other.Y)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Z, other.Z)) return false; if (UserId != other.UserId) return false; if (NickName != other.NickName) return false; if (Type != other.Type) return false; @@ -1201,9 +1236,9 @@ public sealed partial class NpcData : pb::IMessage [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (X != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(X); - if (Y != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Y); - if (Z != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Z); + if (X != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(X); + if (Y != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Y); + if (Z != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Z); if (UserId.Length != 0) hash ^= UserId.GetHashCode(); if (NickName.Length != 0) hash ^= NickName.GetHashCode(); if (Type != 0) hash ^= Type.GetHashCode(); @@ -1227,17 +1262,17 @@ public sealed partial class NpcData : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (X != 0F) { - output.WriteRawTag(13); - output.WriteFloat(X); + if (X != 0D) { + output.WriteRawTag(9); + output.WriteDouble(X); } - if (Y != 0F) { - output.WriteRawTag(21); - output.WriteFloat(Y); + if (Y != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Y); } - if (Z != 0F) { - output.WriteRawTag(29); - output.WriteFloat(Z); + if (Z != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Z); } if (UserId.Length != 0) { output.WriteRawTag(34); @@ -1269,17 +1304,17 @@ public sealed partial class NpcData : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (X != 0F) { - output.WriteRawTag(13); - output.WriteFloat(X); + if (X != 0D) { + output.WriteRawTag(9); + output.WriteDouble(X); } - if (Y != 0F) { - output.WriteRawTag(21); - output.WriteFloat(Y); + if (Y != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Y); } - if (Z != 0F) { - output.WriteRawTag(29); - output.WriteFloat(Z); + if (Z != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Z); } if (UserId.Length != 0) { output.WriteRawTag(34); @@ -1311,14 +1346,14 @@ public sealed partial class NpcData : pb::IMessage [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (X != 0F) { - size += 1 + 4; + if (X != 0D) { + size += 1 + 8; } - if (Y != 0F) { - size += 1 + 4; + if (Y != 0D) { + size += 1 + 8; } - if (Z != 0F) { - size += 1 + 4; + if (Z != 0D) { + size += 1 + 8; } if (UserId.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(UserId); @@ -1347,13 +1382,13 @@ public sealed partial class NpcData : pb::IMessage if (other == null) { return; } - if (other.X != 0F) { + if (other.X != 0D) { X = other.X; } - if (other.Y != 0F) { + if (other.Y != 0D) { Y = other.Y; } - if (other.Z != 0F) { + if (other.Z != 0D) { Z = other.Z; } if (other.UserId.Length != 0) { @@ -1390,16 +1425,16 @@ public sealed partial class NpcData : pb::IMessage default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 13: { - X = input.ReadFloat(); + case 9: { + X = input.ReadDouble(); break; } - case 21: { - Y = input.ReadFloat(); + case 17: { + Y = input.ReadDouble(); break; } - case 29: { - Z = input.ReadFloat(); + case 25: { + Z = input.ReadDouble(); break; } case 34: { @@ -1441,16 +1476,16 @@ public sealed partial class NpcData : pb::IMessage default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 13: { - X = input.ReadFloat(); + case 9: { + X = input.ReadDouble(); break; } - case 21: { - Y = input.ReadFloat(); + case 17: { + Y = input.ReadDouble(); break; } - case 29: { - Z = input.ReadFloat(); + case 25: { + Z = input.ReadDouble(); break; } case 34: { diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 22bc1ad7..d725ebb8 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -481,14 +481,24 @@ public class test : MonoBehaviour Debug.Log("move.Locationܵ"); NpcData npcData = ProtoBufffer.DeSerialize(bytes); Debug.Log(npcData); - float x = npcData.X; - float y = npcData.Y; - float z = npcData.Z; - GameObject npc = GameObject.CreatePrimitive(PrimitiveType.Cube); - npc.transform.name = npcData.UserId; - npc.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); - npc.transform.position = new Vector3(x, y + 0.25f, z); - npc.transform.parent = GameObject.Find("schoo103").transform; + if(npcData.Type == 1)//npc + { + float x = float.Parse(npcData.X.ToString()); + float y = float.Parse(npcData.Y.ToString()); + float z = float.Parse(npcData.Z.ToString()); + GameObject npc = GameObject.CreatePrimitive(PrimitiveType.Cube); + } + if(npcData.Type == 2)//npcƶ + { + Vector3 v = new Vector3(float.Parse(npcData.X.ToString()), float.Parse(npcData.Y.ToString()), float.Parse(npcData.Z.ToString())); + RecuseNpc.instance.SetNpcDes(v); + + } + + //npc.transform.name = npcData.UserId; + //npc.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); + //npc.transform.position = new Vector3(x, y + 0.25f, z); + //npc.transform.parent = GameObject.Find("schoo103").transform; break; diff --git a/xiaofang/Assets/Script/npc/RecuseNpc.cs b/xiaofang/Assets/Script/npc/RecuseNpc.cs index 8fc5e324..41b17db6 100644 --- a/xiaofang/Assets/Script/npc/RecuseNpc.cs +++ b/xiaofang/Assets/Script/npc/RecuseNpc.cs @@ -54,9 +54,9 @@ public class RecuseNpc : MonoBehaviour Debug.Log("Setnpcstate"); } - public void SetNpcDes(Transform tar) + public void SetNpcDes(Vector3 tar) { - target = tar; + target.position = tar; } private void Update()