本文整理汇总了C#中Cursor类的典型用法代码示例。如果您正苦于以下问题:C# Cursor类的具体用法?C# Cursor怎么用?C# Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cursor类属于命名空间,在下文中一共展示了Cursor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create
public override void Create()
{
base.Create();
cControl = new XboxController(SlimDX.XInput.UserIndex.One);
pControl = new XboxController(SlimDX.XInput.UserIndex.Two);
GameObject cursor = new Cursor(cControl);
GameObject player = new Player(pControl);
GameObject cannon1 = new Cannon();
cannon1.Position.X = 365;
cannon1.Position.Y = -265;
GameObject cannon2 = new Cannon();
cannon2.Position.X = 365;
cannon2.Position.Y = 265;
GameObject cannon3 = new Cannon();
cannon3.Position.X = -365;
cannon3.Position.Y = 265;
GameObject cannon4 = new Cannon();
cannon4.Position.X = -365;
cannon4.Position.Y = -265;
ObjectManager.AddGameObject(cursor);
ObjectManager.AddGameObject(player);
ObjectManager.AddGameObject(cannon1);
ObjectManager.AddGameObject(cannon2);
ObjectManager.AddGameObject(cannon3);
ObjectManager.AddGameObject(cannon4);
}
开发者ID:QuantumPhi,项目名称:SpaceDefense,代码行数:28,代码来源:Level.cs
示例2: Constructor_WhenGivenANullExpression_ThrowsException
public void Constructor_WhenGivenANullExpression_ThrowsException()
{
var start = new Cursor("OK");
var end = start.Advance(2);
var codeSpan = new CodeSpan("OK", start, end);
Assert.That(() => new TypedExpression(codeSpan, null), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:8,代码来源:TypedExpressionTests.cs
示例3: ToString_WhenConstructedWithANullValue_ReturnsTheCodeVerbatim
public void ToString_WhenConstructedWithANullValue_ReturnsTheCodeVerbatim()
{
var start = new Cursor("OK");
var end = start.Advance(2);
var codeSpan = new CodeSpan("OK", start, end);
Assert.That(codeSpan.ToString(), Is.EqualTo("OK"));
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:8,代码来源:CodeSpanTests.cs
示例4: Quantifier
/// <summary>
/// Initializes a new instance of the <see cref="Quantifier"/> class.
/// </summary>
/// <param name="start">The cursor just before the <see cref="Quantifier"/>.</param>
/// <param name="end">The cursor just after the <see cref="Quantifier"/>.</param>
/// <param name="min">The minimum number of times to match.</param>
/// <param name="max">The maximum number of times to match, if limited; or null, otherwise.</param>
/// <param name="delimiter">The expression to use as a delimiter.</param>
public Quantifier(Cursor start, Cursor end, int min, int? max = null, Expression delimiter = null)
{
if (start == null)
{
throw new ArgumentNullException(nameof(start));
}
if (end == null)
{
throw new ArgumentNullException(nameof(end));
}
this.Start = start;
this.End = end;
this.Min = min;
this.Max = max;
if (delimiter != null)
{
SequenceExpression sequenceExpression;
if ((sequenceExpression = delimiter as SequenceExpression) == null || sequenceExpression.Sequence.Count != 0)
{
this.Delimiter = delimiter;
}
}
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:34,代码来源:Quantifier.cs
示例5: Awake
void Awake()
{
Instance = this;
GetComponent<FsmBehaviour>().GlobalState = new CursorGlobalFsm();
GetComponent<FsmBehaviour>().CurrentState = new CursorDefaultFsm();
}
开发者ID:luukholleman,项目名称:Imperator-Fundum,代码行数:7,代码来源:Cursor.cs
示例6: Main
static int Main (string [] args)
{
string icoFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory,
"earth.ico");
Icon ico1 = new Icon (icoFile);
if (ico1.Size != new Size (32, 32))
return 1;
#if NET_2_0
Icon ico2 = new Icon (icoFile, 20, 40);
if (ico2.Size != new Size (32, 32))
return 2;
Icon ico3 = new Icon (icoFile, new Size (20, 40));
if (ico3.Size != new Size (32, 32))
return 3;
#endif
string curFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory,
"text.cur");
Cursor cursor = new Cursor (curFile);
if (cursor.Size != new Size (32, 32))
return 4;
return 0;
}
开发者ID:mono,项目名称:gert,代码行数:28,代码来源:test.cs
示例7: init
public Define init(Flash flash, byte[] data, Cursor cursor){
//parse
_flash = flash;
parse (data, cursor);
return this;
}
开发者ID:BigWoodGames,项目名称:cocos2d-unity,代码行数:7,代码来源:Define.cs
示例8: SimpleKey
public SimpleKey(bool isPossible, bool isRequired, int tokenNumber, Cursor cursor)
{
IsPossible = isPossible;
IsRequired = isRequired;
TokenNumber = tokenNumber;
this.cursor = new Cursor(cursor);
}
开发者ID:kitsilanosoftware,项目名称:YamlDotNet,代码行数:7,代码来源:SimpleKey.cs
示例9: Constructor_WhenGivenNullStartCursor_ThrowsException
public void Constructor_WhenGivenNullStartCursor_ThrowsException()
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new CodeSpan("OK", null, end), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:CodeSpanTests.cs
示例10: Constructor_WhenGivenANullValue_ThrowsException
public void Constructor_WhenGivenANullValue_ThrowsException(bool ignoreCase, bool fromResource)
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new LiteralExpression(start, end, null, ignoreCase, fromResource), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:LiteralExpressionTests.cs
示例11: GetHashCode_WithEqualSubjectsAndIndexesAndStateKey_ReturnsSameValue
public void GetHashCode_WithEqualSubjectsAndIndexesAndStateKey_ReturnsSameValue([Values(0, 1, 2)] int index)
{
var subjectA = new Cursor("OK", index);
var subjectB = subjectA.Advance(0);
Assert.That(subjectB.GetHashCode(), Is.EqualTo(subjectA.GetHashCode()));
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:CursorTests.cs
示例12: AddCompilerError
internal void AddCompilerError(Cursor cursor, System.Linq.Expressions.Expression<Func<string>> error, params object[] args)
{
var parts = ((System.Linq.Expressions.MemberExpression)error.Body).Member.Name.Split('_');
var errorId = parts[0];
bool? isWarning = null;
switch (parts[1])
{
case "ERROR":
isWarning = false;
break;
case "WARNING":
isWarning = true;
break;
#if DEBUG
default:
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Unknown error type '{0}'.", parts[1]), "error");
#endif
}
var errorFormat = error.Compile()();
var errorText = string.Format(CultureInfo.CurrentCulture, errorFormat, args);
this.Errors.Add(new CompilerError(cursor.FileName ?? string.Empty, cursor.Line, cursor.Column, errorId, errorText) { IsWarning = isWarning ?? true });
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:26,代码来源:CompileResult.cs
示例13: Tokenize
protected override IEnumerable<Token> Tokenize(string source)
{
Cursor c = new Cursor(source);
while (c.Offset < source.Length)
{
var currentChar = source[c.Offset];
if (operators.Contains(currentChar))
{
yield return new Token(c.Offset, c.Offset + 1, "Operator.Symbol");
c.Advance(1);
continue;
}
if (grouping.Contains(currentChar))
{
yield return new Token(c.Offset, c.Offset + 1, "Grouping.Statements");
c.Advance(1);
continue;
}
var match = whitespace.Match(source, c.Offset);
if (match.Success && match.Index == c.Offset)
{
yield return new Token(c.Offset, c.Offset + match.Length, "Whitespace.Insignificant");
c.Advance(match.Length);
continue;
}
match = nonOperator.Match(source, c.Offset);
yield return new Token(c.Offset, c.Offset + match.Length, "Comment.Block");
c.Advance(match.Length);
}
}
开发者ID:chromaton,项目名称:Chromaton,代码行数:34,代码来源:BrainfuckLexer.cs
示例14: Constructor_WhenGivenANullSettingsCollection_DoesNotThrow
public void Constructor_WhenGivenANullSettingsCollection_DoesNotThrow()
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new Grammar(new Rule[0], null, end), Throws.Nothing);
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:GrammarTests.cs
示例15: Constructor_WhenGivenANullCollectionOfRules_ThrowsException
public void Constructor_WhenGivenANullCollectionOfRules_ThrowsException()
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new Grammar(null, new Dictionary<Identifier, object>(), end), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:GrammarTests.cs
示例16: CodeSpan
/// <summary>
/// Initializes a new instance of the <see cref="CodeSpan"/> class.
/// </summary>
/// <param name="code">The string contents of the code span.</param>
/// <param name="start">The start of the code region.</param>
/// <param name="end">The end of the code region.</param>
/// <param name="value">The value of the code span.</param>
public CodeSpan(string code, Cursor start, Cursor end, string value = null)
{
this.code = code;
this.start = start;
this.end = end;
this.value = value ?? code;
}
开发者ID:KevinKelley,项目名称:Pegasus,代码行数:14,代码来源:CodeSpan.cs
示例17: Constructor_WhenGivenANullFlagsCollection_DoesNotThrow
public void Constructor_WhenGivenANullFlagsCollection_DoesNotThrow()
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new Rule(new Identifier("OK", start, end), new WildcardExpression(), null), Throws.Nothing);
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:RuleTests.cs
示例18: Constructor_WhenGivenANullExpression_ThrowsException
public void Constructor_WhenGivenANullExpression_ThrowsException()
{
var start = new Cursor("OK");
var end = start.Advance(2);
Assert.That(() => new Identifier(null, start, end), Throws.InstanceOf<ArgumentNullException>());
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:IdentifierTests.cs
示例19: Constructor_WhenGivenASpecificLocation_SetsTheCorrectLineAndColumn
public void Constructor_WhenGivenASpecificLocation_SetsTheCorrectLineAndColumn(string subject, int location, int line, int column)
{
var cursor = new Cursor(subject, location);
Assert.That(cursor.Line, Is.EqualTo(line));
Assert.That(cursor.Column, Is.EqualTo(column));
}
开发者ID:otac0n,项目名称:Pegasus,代码行数:7,代码来源:CursorTests.cs
示例20: Awake
protected virtual void Awake()
{
blockLayer = 1 << LayerMask.NameToLayer("Block");
buildController = FindObjectOfType<BuildController>();
buildController.InputModeSelected += (sender, args) => { currentBuildMode = args.buildMode; };
cursor = GetComponent<Cursor>();
}
开发者ID:extraneus,项目名称:voxel-proto,代码行数:7,代码来源:BlockManipulator.cs
注:本文中的Cursor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论