本文整理汇总了C#中Offset类的典型用法代码示例。如果您正苦于以下问题:C# Offset类的具体用法?C# Offset怎么用?C# Offset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Offset类属于命名空间,在下文中一共展示了Offset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FigureBase
private FigureBase(PositionsCollection positions, byte positionNumber, Offset placement)
{
_positions = positions;
_positionNumber = positionNumber;
_sprite = _positions.GetPositionByNumber(positionNumber);
_placement = placement;
}
示例2: CreateSecondTableInA
public static Offset<SecondTableInA> CreateSecondTableInA(FlatBufferBuilder builder,
Offset<NamespaceC.TableInC> refer_to_cOffset = default(Offset<NamespaceC.TableInC>))
{
builder.StartObject(1);
SecondTableInA.AddReferToC(builder, refer_to_cOffset);
return SecondTableInA.EndSecondTableInA(builder);
}
示例3: PostProcessWithCut
public Offset PostProcessWithCut(Offset cutOffset, out int cutIndex, out Offset botOffset)
{
Offset offset = PostProcess1();
cutIndex = FindCutPoint(cutOffset);
botOffset = _members[cutIndex - 1].BotOffset;
return offset;
}
示例4: PostProcessWithCut
public Offset PostProcessWithCut(out AnonymousStruct lastStruct, out int beginIndex)
{
// just to satisfy c# compiler (can't you be smarter?)
beginIndex = -1;
AnonymousStruct last = (AnonymousStruct)_members.Last();
Offset maxBotOffset = Offset.Zero;
foreach (AnonymousStruct struc in _members)
{
Offset offset;
if (object.ReferenceEquals(last, struc))
{
Offset offsetBeforeCut;
offset = struc.PostProcessWithCut(
maxBotOffset,
out beginIndex,
out offsetBeforeCut
);
_botOffset = Offset.Max(maxBotOffset, offsetBeforeCut);
}
else
{
offset = struc.PostProcessWithoutCut();
}
maxBotOffset = Offset.Max(offset, maxBotOffset);
}
lastStruct = last;
return maxBotOffset;
}
示例5: ZoneRuleSet
internal ZoneRuleSet(List<ZoneRecurrence> rules, Offset standardOffset, int upperYear, ZoneYearOffset upperYearOffset)
{
this.rules = rules;
this.StandardOffset = standardOffset;
this.upperYear = upperYear;
this.upperYearOffset = upperYearOffset;
}
示例6: Render
public void Render(ISprite sprite, Offset offset)
{
if (sprite == null)
throw new ArgumentNullException("sprite");
if (offset == null)
throw new ArgumentNullException("offset");
var consoleColorBackup = Console.BackgroundColor;
Console.Clear(); // yeaks!
var width = sprite.Size.Width;
var height = sprite.Size.Height;
for (int i = widthBorderOffset; i < width + widthBorderOffset; i++)
{
Console.SetCursorPosition(i, 0);
Console.Write('-');
Console.SetCursorPosition(i, height + heightBorderOffset);
Console.Write('-');
}
for (int j = heightBorderOffset; j < height + heightBorderOffset; j++)
{
Console.SetCursorPosition(0, j);
Console.Write('|');
Console.SetCursorPosition(width + widthBorderOffset, j);
Console.Write('|');
}
Console.SetCursorPosition(0, 0);
Console.Write('/');
Console.SetCursorPosition(width + widthBorderOffset, 0);
Console.Write('\\');
Console.SetCursorPosition(0, height + heightBorderOffset);
Console.Write('\\');
Console.SetCursorPosition(width + widthBorderOffset, height + heightBorderOffset);
Console.Write('/');
var consoleBounds = new { Width = Console.WindowWidth, Height = Console.WindowHeight };
for (var i = 0; i < sprite.Size.Width; i++)
{
for (var j = 0; j < sprite.Size.Height; j++)
{
var x = offset.Left + i + widthBorderOffset;
var y = offset.Top + j + heightBorderOffset;
var brushBackground = sprite[i, j];
if (!((x >= 0) && (x < consoleBounds.Width) && (y >= 0)) || brushBackground == Color.Transparent)
{
continue;
}
Console.SetCursorPosition(x, y);
Console.BackgroundColor = brushBackground.ToConsoleColor();
Console.Write(_brushSymbol);
}
}
Console.BackgroundColor = consoleColorBackup;
}
示例7: CreateInputCommand
public static Offset<InputCommand> CreateInputCommand(FlatBufferBuilder builder,
Offset<CommandFrame> frame = default(Offset<CommandFrame>))
{
builder.StartObject(1);
InputCommand.AddFrame(builder, frame);
return InputCommand.EndInputCommand(builder);
}
示例8: ToInt32FromBigEndian
public static int ToInt32FromBigEndian(byte[] input, int index, Offset offset)
{
if (input.Length == 0)
return 0;
if (index >= input.Length)
throw new ArgumentOutOfRangeException("index");
// If we're offset from the MinValue, calculate the lowest value possible with the given amount of input bytes
int offsetValue = offset == Offset.Zero ? 0 : (-1 * (1 << Math.Min(input.Length - index, sizeof(int)) * 8 - 1));
switch (input.Length - index)
{
case 1:
return offsetValue + input[index];
case 2:
return offsetValue + (input[index] << 8 | input[index + 1]);
case 3:
return offsetValue + (input[index] << 16 | input[index + 1] << 8 | input[index + 2]);
default:
return offsetValue + (input[index] << 24 | input[index + 1] << 16 | input[index + 2] << 8 | input[index + 3]);
}
}
示例9: Timezone
public Timezone(string name, string abbreviation, Offset? offset, bool tokenizeOnAbbreviation = true)
{
Name = name;
Abbreviation = abbreviation;
_offset = offset;
TimezoneId = null;
TokenizeOnAbbreviation = tokenizeOnAbbreviation;
}
示例10: SymbolStyle
public SymbolStyle()
{
SymbolOffset = new Offset();
SymbolScale = 1f;
Opacity = 1f;
Width = 32;
Height = 32;
}
示例11: SingleTransitionDateTimeZone
/// <summary>
/// Creates a zone with a single transition between two offsets.
/// </summary>
/// <param name="transitionPoint">The transition point as an <see cref="Instant"/>.</param>
/// <param name="offsetBefore">The offset of local time from UTC before the transition.</param>
/// <param name="offsetAfter">The offset of local time from UTC before the transition.</param>
/// <param name="id">ID for the newly created time zone.</param>
public SingleTransitionDateTimeZone(Instant transitionPoint, Offset offsetBefore, Offset offsetAfter, string id)
: base(id, false, Offset.Min(offsetBefore, offsetAfter), Offset.Max(offsetBefore, offsetAfter))
{
EarlyInterval = new ZoneInterval(id + "-Early", null, transitionPoint,
offsetBefore, Offset.Zero);
LateInterval = new ZoneInterval(id + "-Late", transitionPoint, null,
offsetAfter, Offset.Zero);
}
示例12: ZoneTransition
/// <summary>
/// Initializes a new instance of the <see cref="ZoneTransition"/> class.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="instant">The instant that this transistion occurs at.</param>
/// <param name="name">The name for the time at this transition e.g. PDT or PST.</param>
/// <param name="standardOffset">The standard offset at this transition.</param>
/// <param name="savings">The actual offset at this transition.</param>
internal ZoneTransition(Instant instant, String name, Offset standardOffset, Offset savings)
{
Preconditions.CheckNotNull(name, "name");
this.Instant = instant;
this.Name = name;
this.StandardOffset = standardOffset;
this.Savings = savings;
}
示例13: Equals
public bool Equals(Offset offset)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (X != offset.X) return false;
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (Y != offset.Y) return false;
return true;
}
示例14: CreateTableInC
public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder,
Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>),
Offset<SecondTableInA> refer_to_a2Offset = default(Offset<SecondTableInA>)) {
builder.StartObject(2);
TableInC.AddReferToA2(builder, refer_to_a2Offset);
TableInC.AddReferToA1(builder, refer_to_a1Offset);
return TableInC.EndTableInC(builder);
}
示例15: FigureO
public FigureO(Offset placement, Color color)
: base(placement, new PositionsCollection(color, new List<int[,]>
{ _layout,
_layout,
_layout,
_layout }))
{
}