public static GetItemIndex ( int count, byte index, bool back = false ) : byte | ||
count | int | |
index | byte | |
back | bool | |
return | byte |
public static byte GetItemIndex(int count, byte index, bool back = false)
{
if (index > 9)
{
index -= 0x40;
}
// TODO also try 1-3 & 6-8
var smallscreenOffset = count > 6 ? 0 : 2;
if (back)
{
if (index > 2 && index < smallscreenOffset + 3)
{
index += (byte)(3 + smallscreenOffset);
}
smallscreenOffset *= -1;
}
return (byte)(index <= 2 ? index : index + smallscreenOffset);
}