示例#1
0
        protected void Awake()
        {
            if (instance != null && instance != this)
            {
                Destroy(gameObject);
                return;
            }

            instance = this;
            w        = new NetWriter();
            NetLogFilter.CurrentLogLevel    = (int)logLevel;
            NetLogFilter.spew               = debugSpew;
            NetLogFilter.messageDiagnostics = messageDiagnostics;
            Application.targetFrameRate     = serverUpdateRate;
            QualitySettings.vSyncCount      = 0;

            connectedPeers     = new Dictionary <int, Peer>();
            this.modules       = new Dictionary <Type, ServerModule>();
            initializedModules = new HashSet <Type>();
            handlers           = new Dictionary <short, PacketHandler>();

            isInitialized = false;

            var modules = GetComponentsInChildren <ServerModule>();

            foreach (var mod in modules)
            {
                AddModule(mod);
            }

            DontDestroyOnLoad(gameObject);
        }
示例#2
0
 public void Serialize(NetWriter writer)
 {
     writer.WritePackedUInt64(identity);
 }
示例#3
0
 public static void CreateAndFinalize(NetWriter w, short opCode, ISerializablePacket packet /*, int responseID = -1, bool comepleteResponse = false, ResponseStatus status = ResponseStatus.Default*/)
 {
     w.Write(opCode);
     packet.Serialize(w);
 }
示例#4
0
 public void Serialize(NetWriter w)
 {
     w.Write(Command);
     w.WriteBytesAndSizeSegment(data);
 }
 public void Serialize(NetWriter w)
 {
     w.WritePackedUInt64(id);
     w.Write(flag);
 }
示例#6
0
 public void Serialize(NetWriter writer)
 {
     writer.Write(lastPingPacketTime);
 }
示例#7
0
 public void Serialize(NetWriter writer)
 {
     writer.Write(clientTime);
     writer.Write(serverTime);
 }
示例#8
0
 public void Serialize(NetWriter writer)
 {
 }