Example #1
0
        public int PlaybackEvents(NetFrames frames, int fromFrame, int toFrame)
        {
            int num = -1;
            int count;

            lock (frames.framesLock)
            {
                count = frames.eventQueue.Count;
            }
            for (int i = 0; i < count; i++)
            {
                FrameState frameState;
                lock (frames.framesLock)
                {
                    frameState = frames.eventQueue[i];
                }
                int frameId = frameState.frameId;
                if (frameId > fromFrame && frameId <= toFrame)
                {
                    num = Mathf.Max(num, frameId);
                    NetStream stream = frameState.stream;
                    stream.Seek(0);
                    uint        num2 = stream.ReadNetId();
                    NetIdentity value;
                    while (num2 != 0 && (!map.TryGetValue(num2, out value) || value.DeliverEvent(stream)))
                    {
                        num2 = stream.ReadNetId();
                    }
                }
            }
            return(num);
        }
Example #2
0
        public bool DeliverEvent(NetStream stream)
        {
            if (scope == null)
            {
                scope = GetComponentInParent <NetScope>();
            }
            uint num = stream.ReadNetId();

            if (num - 1 < subscriptions.Count)
            {
                subscriptions[(int)(num - 1)](stream);
                return(true);
            }
            return(false);
        }
Example #3
0
	private void OnReceiveChatServer(NetHost client, NetStream stream)
		{
			uint clientId = stream.ReadNetId();
			string nick = stream.ReadString();
			string text = stream.ReadString();
			if (text.ToLower().Substring(0, 4).Equals("toup") || text.ToLower().Substring(0, 4).Equals("kill"))
			{
				Human_Mod_GraduateSchool.getins().Init_Client_mod(client, text);
				return;
			}
			NetChat.OnReceive(clientId, nick, text);
			for (int i = 0; i < this.readyclients.Count; i++)
			{
				if (this.readyclients[i] != client)
				{
					this.SendReliable(this.readyclients[i], stream);
				}
			}
			Human_Mod_GraduateSchool.getins().Init_Client_mod(client, text);
		}