當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。