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


C# BitUnpack.GetValue方法代碼示例

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


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

示例1: HandleSetActionButton

        public static void HandleSetActionButton(ref PacketReader packet, ref WorldClass session)
        {
            var pChar = session.Character;

            byte[] actionMask = { 4, 0, 3, 7, 1, 6, 2, 5 };
            byte[] actionBytes = { 3, 0, 1, 4, 7, 2, 6, 5 };

            var slotId = packet.ReadByte();

            BitUnpack actionUnpacker = new BitUnpack(packet);

            var actionId = actionUnpacker.GetValue(actionMask, actionBytes);

            if (actionId == 0)
            {
                var action = pChar.ActionButtons.Where(button => button.SlotId == slotId && button.SpecGroup == pChar.ActiveSpecGroup).Select(button => button).First();
                ActionMgr.RemoveActionButton(pChar, action, true);
                Log.Message(LogType.DEBUG, "Character (Guid: {0}) removed action button {1} from slot {2}.", pChar.Guid, actionId, slotId);
                return;
            }

            var newAction = new ActionButton
            {
                Action = actionId,
                SlotId = slotId,
                SpecGroup = pChar.ActiveSpecGroup
            };

            ActionMgr.AddActionButton(pChar, newAction, true);
            Log.Message(LogType.DEBUG, "Character (Guid: {0}) added action button {1} to slot {2}.", pChar.Guid, actionId, slotId);
        }
開發者ID:klobasvelky1,項目名稱:Arctium,代碼行數:31,代碼來源:MiscHandler.cs


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