本文整理匯總了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);
}