當前位置: 首頁>>代碼示例>>C#>>正文


C# BitStream.ReadBool方法代碼示例

本文整理匯總了C#中NetGore.IO.BitStream.ReadBool方法的典型用法代碼示例。如果您正苦於以下問題:C# BitStream.ReadBool方法的具體用法?C# BitStream.ReadBool怎麽用?C# BitStream.ReadBool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NetGore.IO.BitStream的用法示例。


在下文中一共展示了BitStream.ReadBool方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RecvAttack

        void RecvAttack(IIPSocket conn, BitStream r)
        {
            User user;
            MapEntityIndex? targetIndex = null;

            var hasTarget = r.ReadBool();
            if (hasTarget)
                targetIndex = r.ReadMapEntityIndex();

            if ((user = TryGetUser(conn)) != null)
            {
                if (user.IsPeerTrading)
                    return;

                user.Attack(GetTargetCharacter(user, targetIndex));
            }
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:17,代碼來源:ServerPacketHandler.cs

示例2: RecvCreateActionDisplayAtEntity

        void RecvCreateActionDisplayAtEntity(IIPSocket conn, BitStream r)
        {
            ActionDisplayID actionDisplayId = r.ReadActionDisplayID();
            MapEntityIndex sourceEntityIndex = r.ReadMapEntityIndex();
            bool hasTarget = r.ReadBool();
            MapEntityIndex? targetEntityIndex = hasTarget ? r.ReadMapEntityIndex() : (MapEntityIndex?)null;

            // Get the entities
            var sourceEntity = _objGrabber.GetDynamicEntity<Character>(sourceEntityIndex);
            if (sourceEntity == null)
                return;

            var targetEntity = targetEntityIndex.HasValue ? _objGrabber.GetDynamicEntity<Character>(targetEntityIndex.Value) : null;

            // Get the action display
            var ad = ActionDisplayScripts.ActionDisplays[actionDisplayId];
            if (ad == null)
                return;

            // Create
            ad.Execute(Map, sourceEntity, targetEntity);
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:22,代碼來源:ClientPacketHandler.cs

示例3: RecvSkillUse

        void RecvSkillUse(IIPSocket conn, BitStream r)
        {
            var casterEntityIndex = r.ReadMapEntityIndex();
            var hasTarget = r.ReadBool();
            MapEntityIndex? targetEntityIndex = null;
            if (hasTarget)
                targetEntityIndex = r.ReadMapEntityIndex();
            var skillType = r.ReadEnum<SkillType>();

            var casterEntity = _objGrabber.GetDynamicEntity<CharacterEntity>(casterEntityIndex);
            CharacterEntity targetEntity = null;
            if (targetEntityIndex.HasValue)
                targetEntity = _objGrabber.GetDynamicEntity<CharacterEntity>(targetEntityIndex.Value);

            if (casterEntity == null)
                return;

            // Get the SkillInfo for the skill being used
            var skillInfo = _objGrabber.GetSkillInfo(skillType);
            if (skillInfo == null)
                return;

            // If an ActionDisplay is available for this skill, display it
            if (skillInfo.CastActionDisplay.HasValue)
            {
                var ad = ActionDisplayScripts.ActionDisplays[skillInfo.CastActionDisplay.Value];
                if (ad != null)
                    ad.Execute(Map, casterEntity, targetEntity);
            }
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:30,代碼來源:ClientPacketHandler.cs

示例4: RecvSetInventorySlot

        void RecvSetInventorySlot(IIPSocket conn, BitStream r)
        {
            var slot = r.ReadInventorySlot();
            var hasGraphic = r.ReadBool();
            var graphic = hasGraphic ? r.ReadGrhIndex() : GrhIndex.Invalid;
            var amount = r.ReadByte();

            UserInfo.Inventory.Update(slot, graphic, amount, GetTime());
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:9,代碼來源:ClientPacketHandler.cs

示例5: RecvSkillSetKnown

        void RecvSkillSetKnown(IIPSocket conn, BitStream r)
        {
            var skillType = r.ReadEnum<SkillType>();
            var isKnown = r.ReadBool();

            if (!EnumHelper<SkillType>.IsDefined(skillType))
            {
                const string errmsg = "Invalid SkillType received: `{0}`";
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, skillType);
                Debug.Fail(string.Format(errmsg, skillType));
                return;
            }

            // Set the skill's known state
            UserInfo.KnownSkills.SetSkill(skillType, isKnown);
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:17,代碼來源:ClientPacketHandler.cs

示例6: 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

示例7: RecvSetClickWarpMode

 void RecvSetClickWarpMode(IIPSocket conn, BitStream r)
 {
     bool enabled = r.ReadBool();
     GameplayScreen.AppendToChatOutput("Click warp mode: " + (enabled ? "Enabled" : "Disabled"), Color.Green);
     GameplayScreen.ClickWarpMode = enabled;
 }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:6,代碼來源:ClientPacketHandler.cs

示例8: RecvCreateAccount

        void RecvCreateAccount(IIPSocket conn, BitStream r)
        {
            var successful = r.ReadBool();
            var errorMessage = string.Empty;

            if (!successful)
            {
                var failureGameMessage = r.ReadEnum<GameMessage>();
                errorMessage = GameMessageCollection.CurrentLanguage.GetMessage(failureGameMessage);
            }

            if (ReceivedCreateAccount != null)
                ReceivedCreateAccount.Raise(conn, new CreateAccountEventArgs(successful, errorMessage));
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:14,代碼來源:ClientPacketHandler.cs

示例9: 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

示例10: RecvAcceptOrTurnInQuestReply

        void RecvAcceptOrTurnInQuestReply(IIPSocket conn, BitStream r)
        {
            var questID = r.ReadQuestID();
            var successful = r.ReadBool();
#pragma warning disable 168
            var accepted = r.ReadBool();
#pragma warning restore 168

            if (successful)
            {
                // Remove the quest from the available quests list
                var aqf = GameplayScreen.AvailableQuestsForm;
                if (aqf.IsVisible)
                {
                    aqf.AvailableQuests = aqf.AvailableQuests.Where(x => x.QuestID != questID).ToArray();
                }
            }
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:18,代碼來源:ClientPacketHandler.cs

示例11: RecvCharAttack

        void RecvCharAttack(IIPSocket conn, BitStream r)
        {
            // Read the values
            var attackerID = r.ReadMapEntityIndex();

            MapEntityIndex? attackedID;
            if (r.ReadBool())
                attackedID = r.ReadMapEntityIndex();
            else
                attackedID = null;

            ActionDisplayID? actionDisplayIDNullable;
            if (r.ReadBool())
                actionDisplayIDNullable = r.ReadActionDisplayID();
            else
                actionDisplayIDNullable = null;

            // Get the object references using the IDs provided
            var attacker = _objGrabber.GetDynamicEntity<Character>(attackerID);
            if (attacker == null)
                return;

            DynamicEntity attacked = attackedID.HasValue ? Map.GetDynamicEntity(attackedID.Value) : null;

            // Use the default ActionDisplayID if we were provided with a null value
            ActionDisplayID actionDisplayID = !actionDisplayIDNullable.HasValue ? GameData.DefaultActionDisplayID : actionDisplayIDNullable.Value;

            // Get the ActionDisplay to use and, if valid, execute it
            var actionDisplay = ActionDisplayScripts.ActionDisplays[actionDisplayID];
            if (actionDisplay != null)
                actionDisplay.Execute(Map, attacker, attacked);
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:32,代碼來源:ClientPacketHandler.cs

示例12: RecvUpdateStat

        void RecvUpdateStat(IIPSocket conn, BitStream r)
        {
            var isBaseStat = r.ReadBool();
            var stat = r.ReadStat<StatType>();

            var coll = isBaseStat ? UserInfo.BaseStats : UserInfo.ModStats;
            coll[stat.StatType] = stat.Value;
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:8,代碼來源:ClientPacketHandler.cs

示例13: RecvUpdateEquipmentSlot

        void RecvUpdateEquipmentSlot(IIPSocket conn, BitStream r)
        {
            var slot = r.ReadEnum<EquipmentSlot>();
            var hasValue = r.ReadBool();

            if (hasValue)
            {
                var graphic = r.ReadGrhIndex();
                UserInfo.Equipped.SetSlot(slot, graphic);
            }
            else
                UserInfo.Equipped.ClearSlot(slot);
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:13,代碼來源:ClientPacketHandler.cs

示例14: 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

示例15: RecvStartNPCChatDialog

        void RecvStartNPCChatDialog(IIPSocket conn, BitStream r)
        {
            var npcIndex = r.ReadMapEntityIndex();
            var forceSkipQuestDialog = r.ReadBool();

            User user;
            Map map;
            if (!TryGetMap(conn, out user, out map))
                return;

            if (user.IsPeerTrading)
                return;

            var npc = map.GetDynamicEntity<NPC>(npcIndex);
            if (npc == null)
                return;

            // Check the distance and state
            if (user.Map != npc.Map || user.Map == null || !npc.IsAlive || npc.IsDisposed || user.GetDistance(npc) > GameData.MaxNPCChatDistance)
                return;

            // If the NPC provides any quests that this user can do or turn in, show that instead
            if (!forceSkipQuestDialog && !npc.Quests.IsEmpty())
            {
                IQuest<User>[] availableQuests;
                IQuest<User>[] turnInQuests;
                QuestHelper.GetAvailableQuests(user, npc, out availableQuests, out turnInQuests);

                if (availableQuests.Length > 0 || turnInQuests.Length > 0)
                {
                    using (var pw = ServerPacket.StartQuestChatDialog(npcIndex, availableQuests.Select(x => x.QuestID), turnInQuests.Select(x => x.QuestID)))
                    {
                        user.Send(pw, ServerMessageType.GUI);
                    }
                    return;
                }
            }

            // Force-skipped the quest dialog, or there was no available quests, so start the chat dialog
            user.ChatState.StartChat(npc);
        }
開發者ID:mateuscezar,項目名稱:netgore,代碼行數:41,代碼來源:ServerPacketHandler.cs


注:本文中的NetGore.IO.BitStream.ReadBool方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。