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


C# Message.GetString方法代码示例

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


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

示例1: UpdateMetaReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="ReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public UpdateMetaReceiveEvent(Message message)
     : base(message)
 {
     this.OwnerUsername = message.GetString(0);
     this.WorldName = message.GetString(1);
     this.Plays = message.GetInteger(2);
     this.CurrentWoots = message.GetInteger(3);
     this.TotalWoots = message.GetInteger(4);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:13,代码来源:UpdateMetaReceiveEvent.cs

示例2: LabelPlaceReceiveEvent

 public LabelPlaceReceiveEvent(Message message)
     : base(message)
 {
     this.PosX = message.GetInteger(0);
     this.PosY = message.GetInteger(1);
     this.Block = (LabelBlock)message.GetInteger(2);
     this.Text = message.GetString(3);
     this.TextColor = message.GetString(4);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:9,代码来源:LabelPlaceReceiveEvent.cs

示例3: create_figure

 private void create_figure(Player player, Message message)
 {
     try {
         string position = message.GetString(0);
         string figure = message.GetString(1);
         player.GameModel.CreateFigure(position, figure);
         Broadcast("Create figure", player.ConnectUserId, position, figure);
     }
     catch (Exception e) {
         Log("Create figure message processing failed.", e);
         player.Send("Denied", "Incorrect message format.");
     }
 }
开发者ID:Kinrany,项目名称:OOP-multiplayer-chess-project,代码行数:13,代码来源:IncomingMessages.cs

示例4: OnAutotext

        /// <summary>
        /// Called when someone says a message using the auto text function.
        /// </summary>
        /// <param name="m">The m.</param>
        public void OnAutotext(Message m)
        {
            // Extract data.
            int id = m.GetInteger(0);

            string message = m.GetString(1);

            var autoTextConversions = new Dictionary<int, string>
                                          {
                                              { 0, "Left." },
                                              { 1, "Hi." },
                                              { 2, "Goodbye." },
                                              { 3, "Help me!" },
                                              { 4, "Thank you." },
                                              { 5, "Follow me." },
                                              { 6, "Stop!" },
                                              { 7, "Yes." },
                                              { 8, "No." },
                                              { 9, "Right." }
                                          };

            // Update relevant objects.
            Player subject = Tools.GetPlayer(id, this._in.Source);

            this._in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, subject));

            // Fire the event.
            var e = new ChatEventArgs(subject, m, this._in.Source, message);

            this._in.Source.Pull.Autotext.AutotextEvent(e);
        }
开发者ID:KylerM,项目名称:Skylight,代码行数:35,代码来源:Autotext.cs

示例5: SayReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="ReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public SayReceiveEvent(Message message)
     : base(message)
 {
     this.UserId = message.GetInteger(0);
     this.Text = message.GetString(1);
     this.IsMyFriend = message.GetBoolean(2);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:11,代码来源:SayReceiveEvent.cs

示例6: handleGameMessage

 /**
  * Handles game-specific messages (messages which are sent only during the game)
  */
 public void handleGameMessage(Player player, Message msg)
 {
     switch (msg.Type)
     {
         case MessageTypes.TRY_USE:
             tryUseSpell(msg.GetInt(0), player);
             break;
         case MessageTypes.TICK:
             player.onTick(msg.GetDouble(0), msg.GetString(1), msg.GetString(2));
                 //update sever duplication model
             break;
         default:
             handleSpecialGameMessage(msg);
             break;
     }
 }
开发者ID:hxzpily,项目名称:arkanoid_battle,代码行数:19,代码来源:Game.cs

示例7: SignPlaceReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="SignPlaceReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public SignPlaceReceiveEvent(Message message)
     : base(message)
 {
     this.PosX = message.GetInteger(0);
     this.PosY = message.GetInteger(1);
     this.Block = (SignBlock)message.GetInteger(2);
     this.Text = message.GetString(3);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:12,代码来源:SignPlaceReceiveEvent.cs

示例8: WorldPortalPlaceReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="ReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public WorldPortalPlaceReceiveEvent(Message message)
     : base(message)
 {
     this.PosX = message.GetInteger(0);
     this.PosY = message.GetInteger(1);
     this.Block = (WorldPortalBlock)message.GetInteger(2);
     this.WorldPortalTarget = message.GetString(3);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:12,代码来源:WorldPortalPlaceReceiveEvent.cs

示例9: OnUpdateMeta

        /// <summary>
        /// Called when the room metadata changes (such as title, woots or plays).
        /// </summary>
        /// <param name="m">
        /// The message.
        /// </param>
        public void OnUpdateMeta(Message m)
        {
            // Extract data.
            string ownerName = m.GetString(0), roomName = m.GetString(1);

            int plays = m.GetInteger(2), woots = m.GetInteger(3), totalWoots = m.GetInteger(4);

            // Update relevant objects.
            this._in.Source.Owner.Name = ownerName;
            this._in.Source.Name = roomName;
            this._in.Source.Plays = plays;
            this._in.Source.Woots = woots;
            this._in.Source.TotalWoots = totalWoots;

            // Fire the event.
            var e = new RoomEventArgs(this._in.Source, m);

            this._in.Source.Pull.Meta.UpdateMetaEvent(e);
        }
开发者ID:KylerM,项目名称:Skylight,代码行数:25,代码来源:Meta.cs

示例10: AllowPotionsReceiveEvent

        /// <summary>
        ///     Initializes a new instance of the <see cref="AllowPotionsReceiveEvent" /> class.
        /// </summary>
        /// <param name="message">The message.</param>
        public AllowPotionsReceiveEvent(Message message)
            : base(message)
        {
            this.Allowed = message.GetBoolean(0);

            var potsList = new List<Potion>();
            for (uint i = 1; i <= message.Count - 1; i += 1)
            {
                potsList.Add((Potion)Int32.Parse(message.GetString(i)));
            }
            this.DisabledPotions = potsList.ToArray();
        }
开发者ID:someone243,项目名称:CupCake,代码行数:16,代码来源:AllowPotionsReceiveEvent.cs

示例11: onUnitCreate

		public void onUnitCreate(Player player, Message message) {
			int entityID = ++entityIndex;
			int ownerID = player.Id;
			String type = message.GetString(0);
			double x = message.GetDouble(1);
			double y = message.GetDouble(2);

			Console.WriteLine("[ENGINE] " + player + ": create Unit - id=" + entityID + ", owner=" + ownerID + ", type=" + type + ", pos=" + x + "," + y);

			room.Broadcast(MessageTypes.SV_UNIT_CREATE, entityID, ownerID, type, x, y);

		}
开发者ID:DfKimera,项目名称:ggj2016,代码行数:12,代码来源:RTSMatch.cs

示例12: OnSayOld

        /// <summary>
        /// Called when premature messages are given to the client.
        /// </summary>
        /// <param name="m">The message.</param>
        public void OnSayOld(Message m)
        {
            // Extract data.
            string message = m.GetString(1);

            // Update relevant objects.

            _in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, null));

            // Fire the event.
            var e = new ChatEventArgs(null, m, _in.Source, message);

            _in.Source.Pull.ChatOld.SayOldEvent(e);
        }
开发者ID:KylerM,项目名称:Skylight,代码行数:18,代码来源:ChatOld.cs

示例13: InitReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="InitReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The EE message.</param>
 public InitReceiveEvent(Message message)
     : base(message)
 {
     this.OwnerUsername = message.GetString(0);
     this.WorldName = message.GetString(1);
     this.Plays = message.GetInteger(2);
     this.CurrentWoots = message.GetInteger(3);
     this.TotalWoots = message.GetInteger(4);
     this.Encryption = message.GetString(5);
     this.UserId = message.GetInteger(6);
     this.Face = (Smiley)message.GetInteger(7);
     // Aura
     this.SpawnX = message.GetInteger(9);
     this.SpawnY = message.GetInteger(10);
     this.ChatColor = message.GetUInt(11);
     this.Username = message.GetString(12);
     this.CanEdit = message.GetBoolean(13);
     this.IsOwner = message.GetBoolean(14);
     this.RoomWidth = message.GetInteger(15);
     this.RoomHeight = message.GetInteger(16);
     this.IsTutorialRoom = message.GetBoolean(17);
     this.Gravity = message.GetDouble(18);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:27,代码来源:InitReceiveEvent.cs

示例14: AddReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="AddReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The EE message.</param>
 public AddReceiveEvent(Message message)
     : base(message)
 {
     this.UserId = message.GetInteger(0);
     this.Username = message.GetString(1);
     this.Face = (Smiley)message.GetInteger(2);
     this.UserPosX = message.GetInteger(3);
     this.UserPosY = message.GetInteger(4);
     this.IsGod = message.GetBoolean(5);
     this.IsMod = message.GetBoolean(6);
     this.HasChat = message.GetBoolean(7);
     this.Coins = message.GetInteger(8);
     this.BlueCoins = message.GetInteger(9);
     this.IsMyFriend = message.GetBoolean(10);
     this.IsClubMember = message.GetBoolean(11);
     this.IsGuardian = message.GetBoolean(12);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:21,代码来源:AddReceiveEvent.cs

示例15: challenge_player

 private void challenge_player(Player player, Message message)
 {
     try {
         if (player.IsPlaying) {
             player.Send("Denied", "You are already playing.");
         }
         Player target = FindPlayerByName(message.GetString(0));
         if (target.IsPlaying) {
             player.Send("Denied", "Target is already playing.");
         }
         player.ChallengePlayer(target);
     }
     catch (Exception e) {
         Log("Challenge player message processing failed.", e);
         player.Send("Denied", "Incorrect message format.");
     }
 }
开发者ID:Kinrany,项目名称:OOP-multiplayer-chess-project,代码行数:17,代码来源:IncomingMessages.cs


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