当前位置: 首页>>代码示例>>C#>>正文


C# NetBuffer.ReadDouble方法代码示例

本文整理汇总了C#中Lidgren.Network.NetBuffer.ReadDouble方法的典型用法代码示例。如果您正苦于以下问题:C# NetBuffer.ReadDouble方法的具体用法?C# NetBuffer.ReadDouble怎么用?C# NetBuffer.ReadDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lidgren.Network.NetBuffer的用法示例。


在下文中一共展示了NetBuffer.ReadDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StateUpdateEventArgs

		public StateUpdateEventArgs(NetBuffer msg) : base(msg)
		{
			EntitiesUpdatedState = new List<StateUpdateData>();
			RemarkableEvents = new List<RemarkableEventData>();

			LastAcknowledgedActionID = msg.ReadUInt64();
			Time = msg.ReadDouble();
			Vec2 velocity = new Vec2(msg.ReadFloat(), msg.ReadFloat());
			byte nbClients = msg.ReadByte();
			for (byte i = 0; i < nbClients; ++i) {
				ulong id = msg.ReadUInt64();
				Vec2 pos = new Vec2(msg.ReadFloat(), msg.ReadFloat());
				ChampionAnimation anim = (ChampionAnimation)msg.ReadByte();
				bool facingLeft = msg.ReadBoolean();

				EntitiesUpdatedState.Add(new StateUpdateData(id, pos, velocity, anim, facingLeft));
			}
			while (msg.Position != msg.LengthBits) {
				ServerCommand cmd = (ServerCommand)msg.ReadByte();
				RemarkableEventData data = null;
				switch (cmd) {
					case ServerCommand.SpellCast:
						data = new SpellCastEventData(
							msg.ReadUInt64(),
							msg.ReadUInt64(),
							(SpellTypes)msg.ReadByte(),
							msg.ReadFloat(),
							new Vec2(msg.ReadFloat(), msg.ReadFloat()),
							new Vec2(msg.ReadFloat(), msg.ReadFloat()),
							TimeSpan.FromSeconds(msg.ReadFloat()),
							msg.ReadFloat(),
							msg.ReadFloat());
						break;

					case ServerCommand.SpellDisappear:
						data = new SpellDisappearEventData(msg.ReadUInt64());
						break;

					case ServerCommand.StatsChanged:
						data = new StatsChangedEventData(msg.ReadUInt64(), msg.ReadFloat());
						break;

					case ServerCommand.ChampionDied:
						data = new ChampionDiedEventData(msg.ReadUInt64(),
						                                 msg.ReadUInt64(),
						                                 msg.ReadUInt32(), msg.ReadUInt32(), msg.ReadUInt32(), msg.ReadUInt32(),
						                                 TimeSpan.FromSeconds(msg.ReadUInt16()));
						break;

					case ServerCommand.StructureStatsChanged:
						data = new StructureStatsChangedEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
						                                          (StructureTypes)msg.ReadByte(),
						                                          msg.ReadFloat());
						break;

					case ServerCommand.StructureDestroyed:
						data = new StructureDestroyedEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
						                                       (StructureTypes)msg.ReadByte());
						break;

					case ServerCommand.EndOfGame:
						data = new EndOfGameEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right);
						break;

					case ServerCommand.TowerPreparingToShoot:
						data = new TowerPreparingToShootEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
						                                          (StructureTypes)msg.ReadByte());
						break;

					default:
						Debug.Fail("Unknown server command when updating (unknown remarkable event)");
						break;
				}
				if (data != null) {
					RemarkableEvents.Add(data);
				}
			}
		}
开发者ID:DrPandemic,项目名称:EraParadox,代码行数:78,代码来源:Client.cs

示例2: CommandImplementation

            public CommandImplementation(GameState game, NetBuffer buffer)
            {
                this.game = game;
                 var time = new Instant(buffer.ReadDouble());

                 this.game.SetTime(time);

                 int count = buffer.ReadByte();
                 this.parameters = new List<SingleParameters>(count);

                 for (int i = 0; i < count; i++)
                 {
                     this.parameters.Add(buffer.Read<SingleParameters>());
                 }
            }
开发者ID:BobTheHornyProgrammer,项目名称:syzygy,代码行数:15,代码来源:ParticleUpdate.cs

示例3: CommandImplementation

            public CommandImplementation(GameState game, NetBuffer buffer)
            {
                this.game = game;
                var time = new Instant(buffer.ReadDouble());

                int count = buffer.ReadByte();
                this.parameters = new List<ParameterGroup>(count);

                for (int i = 0; i < count; i++)
                {
                    this.parameters.Add(new ParameterGroup(buffer));
                }
            }
开发者ID:BobTheHornyProgrammer,项目名称:syzygy,代码行数:13,代码来源:EconomyUpdate.cs


注:本文中的Lidgren.Network.NetBuffer.ReadDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。