コード例 #1
0
        public void Dispose()
        {
            msgTypeGenerator.DeallocateValue(msgType);
            msgTypeGenerator = null;

            // attempt to unregister the message
            NetworkServer.UnregisterHandler(msgType);

            // dispose of this to get rid of cycle reference
            Master = null;
        }
コード例 #2
0
        public void SetAutomaticMsgType(byte scopeIdentifier, ShortGenerator msgTypeGen)
        {
            if (msgTypeGenerator != null)
            {
                throw new Exception(string.Format("The Scope {0} has already been assigned a MsgType value", GetType()));
            }

            this.scopeIdentifier = scopeIdentifier;

            msgType          = msgTypeGen.AllocateValue();
            msgTypeGenerator = msgTypeGen;

            // register with the Server's Scope msgType
            NetworkServer.RegisterHandler(msgType, ProcessPeerMessage);
        }
コード例 #3
0
        public void SetManualMsgType(byte scopeIdentifier, ShortGenerator msgTypeGen, short manualMsgType)
        {
            if (msgTypeGenerator != null)
            {
                throw new Exception(string.Format("The Scope {0} has already been assigned a MsgType value", GetType()));
            }

            this.scopeIdentifier = scopeIdentifier;

            // use up the value manually in the generator
            msgTypeGen.AllocateManualValue(manualMsgType);

            msgType          = manualMsgType;
            msgTypeGenerator = msgTypeGen;
        }