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


C# BitStream.ReadString方法代码示例

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


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

示例1: RecvSetCharacterPaperDoll

        void RecvSetCharacterPaperDoll(IIPSocket conn, BitStream r)
        {
            var mapEntityIndex = r.ReadMapEntityIndex();
            var count = r.ReadByte();

            var layers = new string[count];
            for (var i = 0; i < layers.Length; i++)
            {
                layers[i] = r.ReadString();
            }

            var character = _objGrabber.GetDynamicEntity<Character>(mapEntityIndex);
            if (character == null)
                return;

            character.CharacterSprite.SetPaperDollLayers(layers);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:17,代码来源:ClientPacketHandler.cs

示例2: RecvCreateAccountCharacter

        void RecvCreateAccountCharacter(IIPSocket conn, BitStream r)
        {
            var successful = r.ReadBool();
            var errorMessage = successful ? string.Empty : r.ReadString();

            if (ReceivedCreateAccountCharacter != null)
                ReceivedCreateAccountCharacter.Raise(conn, new CreateAccountEventArgs(successful, errorMessage));
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:8,代码来源:ClientPacketHandler.cs

示例3: RecvNotifyGetItem

        void RecvNotifyGetItem(IIPSocket conn, BitStream r)
        {
            var name = r.ReadString();
            var amount = r.ReadByte();

            string msg;
            if (amount > 1)
                msg = string.Format("You got {0} {1}s", amount, name);
            else
                msg = string.Format("You got a {0}", name);

            GameplayScreen.InfoBox.Add(msg);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:13,代码来源:ClientPacketHandler.cs

示例4: ReadRemoveMember

        /// <summary>
        /// Handles <see cref="GroupInfoMessages.RemoveMember"/>.
        /// </summary>
        /// <param name="bs">The <see cref="BitStream"/> to read from.</param>
        void ReadRemoveMember(BitStream bs)
        {
            var name = bs.ReadString();

            if (!_members.Remove(name))
            {
                const string errmsg = "Tried to remove `{0}` from the group member list, but they were not in the list!";
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, name);
                Debug.Fail(string.Format(errmsg, name));
            }

            // Raise events
            OnMemberRemoved(name);

            if (MemberRemoved != null)
                MemberRemoved.Raise(this, EventArgsHelper.Create(name));
        }
开发者ID:wtfcolt,项目名称:game,代码行数:22,代码来源:UserGroupInformation.cs

示例5: RecvChatSay

        void RecvChatSay(IIPSocket conn, BitStream r)
        {
            var name = r.ReadString(GameData.MaxServerSayNameLength);
            var mapEntityIndex = r.ReadMapEntityIndex();
            var text = r.ReadString(GameData.MaxServerSayLength);

            var chatText = CreateChatText(name, text);
            GameplayScreen.AppendToChatOutput(chatText);

            var entity = Map.GetDynamicEntity(mapEntityIndex);
            if (entity == null)
                return;

            GameplayScreen.AddChatBubble(entity, text);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:15,代码来源:ClientPacketHandler.cs

示例6: RecvLogin

        void RecvLogin(IIPSocket conn, BitStream r)
        {
            ThreadAsserts.IsMainThread();

            var name = r.ReadString();
            var password = r.ReadString();

            Server.LoginAccount(conn, name, password);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:9,代码来源:ServerPacketHandler.cs

示例7: RecvSaveFriends

        void RecvSaveFriends(IIPSocket conn, BitStream r)
        {
            var account = TryGetAccount(conn);
            if (account == null)
                return;

            account.SetFriends(r.ReadString());
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:8,代码来源:ServerPacketHandler.cs

示例8: RecvStartShopping

        void RecvStartShopping(IIPSocket conn, BitStream r)
        {
            var shopOwnerIndex = r.ReadMapEntityIndex();
            var canBuy = r.ReadBool();
            var name = r.ReadString();
            var itemCount = r.ReadByte();

            var items = new IItemTemplateTable[itemCount];
            for (var i = 0; i < itemCount; i++)
            {
                var value = new ItemTemplateTable();
                value.ReadState(r);
                items[i] = value;
            }

            var shopOwner = Map.GetDynamicEntity(shopOwnerIndex);
            var shopInfo = new ShopInfo<IItemTemplateTable>(shopOwner, name, canBuy, items);

            GameplayScreen.ShopForm.DisplayShop(shopInfo);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:20,代码来源:ClientPacketHandler.cs

示例9: RecvReceiveFriends

        void RecvReceiveFriends(IIPSocket conn, BitStream r)
        {
            List<String> _onlineFriends = new List<String>();
            _onlineFriends = r.ReadString().Split(',').ToList<string>();
            string[] FriendsMap = r.ReadString().Split(',');
            string[] FriendsList = r.ReadString().Split(',');

            _onlineFriends.RemoveAll(x => x == "");
            int i = 0;
            FriendsForm._myFriends = new List<Friends>();

            foreach (string friend in _onlineFriends)
            {
                FriendsForm._myFriends.Add(new Friends
                {
                    Name = friend,
                    Map = FriendsMap[i],
                    Online = true
                });
            }

            foreach (string _friend in FriendsList)
            {
                FriendsForm._myFriends.Add(new Friends
                {
                    Name = _friend,
                    Online = false
                });

                i++;
            }

            FriendsForm._myFriends.RemoveDuplicates((x, y) => x.Name == y.Name);
            FriendsForm._myFriends.RemoveAll((x) => x.Name == "");
            FriendsForm.SortList();
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:36,代码来源:ClientPacketHandler.cs

示例10: ReadSetGuild

        /// <summary>
        /// Reads the <see cref="GuildInfoMessages.SetGuild"/> message.
        /// </summary>
        /// <param name="r">The stream to read the message from.</param>
        void ReadSetGuild(BitStream r)
        {
            _members.Clear();
            _onlineMembers.Clear();

            InGuild = r.ReadBool();

            if (InGuild)
            {
                Name = r.ReadString();
                Tag = r.ReadString();

                var numMembers = r.ReadUShort();
                for (var i = 0; i < numMembers; i++)
                {
                    var v = r.ReadGuildMemberNameRank(null);
                    _members.Add(v);
                }

                var onlineMembers = r.ReadUShort();
                for (var i = 0; i < onlineMembers; i++)
                {
                    var name = r.ReadString();
                    SetOnlineValue(name, true);
                }

                _members.Sort();
            }

            OnGuildChanged();

            if (GuildChanged != null)
                GuildChanged.Raise(this, EventArgs.Empty);
        }
开发者ID:wtfcolt,项目名称:game,代码行数:38,代码来源:UserGuildInformation.cs

示例11: ReadUpdateNameTag

 /// <summary>
 /// Reads the <see cref="GuildInfoMessages.UpdateNameTag"/> message.
 /// </summary>
 /// <param name="r">The stream to read the message from.</param>
 void ReadUpdateNameTag(BitStream r)
 {
     Name = r.ReadString();
     Tag = r.ReadString();
 }
开发者ID:wtfcolt,项目名称:game,代码行数:9,代码来源:UserGuildInformation.cs

示例12: ReadRemoveOnlineMember

        /// <summary>
        /// Reads the <see cref="GuildInfoMessages.RemoveOnlineMember"/> message.
        /// </summary>
        /// <param name="r">The stream to read the message from.</param>
        void ReadRemoveOnlineMember(BitStream r)
        {
            var name = r.ReadString();
            SetOnlineValue(name, false);

            OnOnlineMemberRemoved(name);

            if (OnlineMemberRemoved != null)
                OnlineMemberRemoved.Raise(this, EventArgsHelper.Create(name));
        }
开发者ID:wtfcolt,项目名称:game,代码行数:14,代码来源:UserGuildInformation.cs

示例13: ReadRemoveMember

        /// <summary>
        /// Reads the <see cref="GuildInfoMessages.RemoveMember"/> message.
        /// </summary>
        /// <param name="r">The stream to read the message from.</param>
        void ReadRemoveMember(BitStream r)
        {
            var name = r.ReadString();
            var removeCount = _members.RemoveAll(x => StringComparer.OrdinalIgnoreCase.Equals(x.Name, name));

            Debug.Assert(removeCount != 0, "Nobody with the name " + name + " existed in the collection.");
            Debug.Assert(removeCount < 2, "How the hell did we remove more than one item?");

            OnMemberRemoved(name);

            if (MemberRemoved != null)
                MemberRemoved.Raise(this, EventArgsHelper.Create(name));
        }
开发者ID:wtfcolt,项目名称:game,代码行数:17,代码来源:UserGuildInformation.cs

示例14: ReadSetGroup

        /// <summary>
        /// Handles <see cref="GroupInfoMessages.SetGroup"/>.
        /// </summary>
        /// <param name="bs">The <see cref="BitStream"/> to read from.</param>
        void ReadSetGroup(BitStream bs)
        {
            _members.Clear();
            _founder = null;

            var isInGroup = bs.ReadBool();

            if (isInGroup)
            {
                // Read the group members
                var numMembers = bs.ReadByte();
                var members = bs.ReadStrings(numMembers);
                _members.AddRange(members);

                // Read the founder's name
                _founder = bs.ReadString();
            }

            // Raise events
            OnGroupChanged();

            if (GroupChanged != null)
                GroupChanged.Raise(this, EventArgs.Empty);
        }
开发者ID:wtfcolt,项目名称:game,代码行数:28,代码来源:UserGroupInformation.cs

示例15: RecvCreateNewAccount

        void RecvCreateNewAccount(IIPSocket conn, BitStream r)
        {
            ThreadAsserts.IsMainThread();

            var name = r.ReadString();
            var password = r.ReadString();
            var email = r.ReadString();

            // Ensure the connection isn't logged in
            var user = TryGetUser(conn, false);
            if (user != null)
            {
                const string errmsg = "User `{0}` tried to create a new account while already logged in.";
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, user);
                return;
            }

            // Create the new account
            Server.CreateAccount(conn, name, password, email);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:21,代码来源:ServerPacketHandler.cs


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