本文整理汇总了C#中Check类的典型用法代码示例。如果您正苦于以下问题:C# Check类的具体用法?C# Check怎么用?C# Check使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Check类属于命名空间,在下文中一共展示了Check类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClosestPlayer
public static Player ClosestPlayer(Level lvl, Check C) {
if (!lvl.ai) return null;
int closestDist = 75;
Player closetPlayer = null;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
Player.players.ForEach(
delegate(Player p)
{
if (p.level == lvl && !p.invincible) {
int curDist = Math.Abs((p.pos[0] / 32) - x) +
Math.Abs((p.pos[1] / 32) - y) +
Math.Abs((p.pos[2] / 32) - z);
if (curDist < closestDist) {
closestDist = curDist;
closetPlayer = p;
}
}
}
);
return closetPlayer;
}
示例2: newCheck
internal static ChequeView newCheck()
{
Check c = new Check();
ChequeView cv = new ChequeView(c);
new DAOs.CheckDAO(cv.db).insertOnSubmit(c);
return cv;
}
示例3: DoGeyser
public static void DoGeyser(Level lvl, Check C, Random rand) {
C.time++;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
byte below = lvl.GetTile(x, (ushort)(y - 1), z);
if (below == Block.air) {
lvl.AddUpdate(lvl.PosToInt(x, (ushort)(y - 1), z), Block.geyser);
} else if (below != Block.geyser) {
byte block = lvl.blocks[C.b];
lvl.PhysWater(lvl.PosToInt((ushort)(x + 1), y, z), block);
lvl.PhysWater(lvl.PosToInt((ushort)(x - 1), y, z), block);
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z + 1)), block);
lvl.PhysWater(lvl.PosToInt(x, y, (ushort)(z - 1)), block);
}
if (lvl.physics <= 1 || C.time <= 10) return;
C.time = 0;
bool flowUp = false;
GeyserFlow(lvl, x - 1, y, z, ref flowUp);
GeyserFlow(lvl, x + 1, y, z, ref flowUp);
GeyserFlow(lvl, x, y - 1, z, ref flowUp);
GeyserFlow(lvl, x, y, z - 1, ref flowUp);
GeyserFlow(lvl, x, y, z + 1, ref flowUp);
if (flowUp)
GeyserFlow(lvl, x, y + 1, z, ref flowUp);
}
示例4: DoFlood
public static void DoFlood(Level lvl, Check C, Random rand, AirFlood mode, byte block) {
if (C.time >= 1) {
lvl.AddUpdate(C.b, 0);
C.time = 255; return;
}
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
FloodAir(lvl, lvl.PosToInt((ushort)(x + 1), y, z), block);
FloodAir(lvl, lvl.PosToInt((ushort)(x - 1), y, z), block);
FloodAir(lvl, lvl.PosToInt(x, y, (ushort)(z + 1)), block);
FloodAir(lvl, lvl.PosToInt(x, y, (ushort)(z - 1)), block);
switch (mode) {
case AirFlood.Full:
FloodAir(lvl, lvl.PosToInt(x, (ushort)(y - 1), z), block);
FloodAir(lvl, lvl.PosToInt(x, (ushort)(y + 1), z), block);
break;
case AirFlood.Layer:
break;
case AirFlood.Down:
FloodAir(lvl, lvl.PosToInt(x, (ushort)(y - 1), z), block);
break;
case AirFlood.Up:
FloodAir(lvl, lvl.PosToInt(x, (ushort)(y + 1), z), block);
break;
}
C.time++;
}
示例5: AddCheck
public static Check AddCheck(Check check)
{
if (!isTesting)
return prov.AddCheck(check);
else
return testprov.AddCheck(check);
}
示例6: Upsert
void Upsert(Check check)
{
if (check.Id == 0)
repo.Add(check);
else
repo.Update(check);
}
示例7: CteateCheck
public Check CteateCheck()
{
Check newCheck = new Check();
checks.Add(newCheck);
newCheck.Show();
return newCheck;
}
示例8: update
// Update Check <check>
public static bool update(Check check)
{
using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString))
{
var query = from a in database.Checks
where (a.CheckID == check.CheckID)
select a;
foreach (var a in query)
{
a.CheckAmount = check.CheckAmount;
a.CheckAmountOwed = check.CheckAmountOwed;
a.CheckCashierID = check.CheckCashierID;
a.CheckDate = check.CheckDate;
a.CheckDeleted = check.CheckDeleted;
a.CheckNum = check.CheckNum;
a.CheckPaidDate = check.CheckPaidDate;
}
try
{
database.SubmitChanges();
return true;
}
catch (Exception e)
{
return false;
}
}
}
示例9: delete
// Delete Check <check> from database
public static bool delete(Check check)
{
using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString))
{
var query = from c in database.Checks
where (c.CheckID == check.CheckID)
select c;
// It seems to me that a single account renders the foreach unnecessary. However, I can't
// find another way to get the variable 'a' from 'query'.
foreach (var c in query)
{
database.Checks.DeleteOnSubmit(c);
try
{
database.SubmitChanges();
return true;
}
catch (Exception e)
{
return false;
}
}
return false;
}
}
示例10: Do
public static void Do(Level lvl, Check C, Random rand) {
int dirX = rand.Next(1, 10) <= 5 ? 1 : -1;
int dirY = rand.Next(1, 10) <= 5 ? 1 : -1;
int dirZ = rand.Next(1, 10) <= 5 ? 1 : -1;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
for (int cx = -dirX; cx != 2 * dirX; cx += dirX)
for (int cy = -dirY; cy != 2 * dirY; cy += dirY)
for (int cz = -dirZ; cz != 2 * dirZ; cz += dirZ)
{
byte rocketTail = lvl.GetTile((ushort)(x + cx), (ushort)(y + cy), (ushort)(z + cz));
if (rocketTail != Block.fire) continue;
int headIndex = lvl.PosToInt((ushort)(x - cx), (ushort)(y - cy), (ushort)(z - cz));
byte rocketHead = headIndex < 0 ? Block.Zero : lvl.blocks[headIndex];
bool unblocked = !lvl.ListUpdate.Exists(u => u.b == headIndex || u.b == C.b);
if (unblocked && (rocketHead == Block.air || rocketHead == Block.rocketstart)) {
lvl.AddUpdate(headIndex, Block.rockethead);
lvl.AddUpdate(C.b, Block.fire);
} else if (rocketHead == Block.fire) {
} else {
if (lvl.physics > 2)
lvl.MakeExplosion(x, y, z, 2);
else
lvl.AddUpdate(C.b, Block.fire);
}
}
}
示例11: Do
public static void Do(Level lvl, Check C, Random rand) {
int dirX = rand.Next(1, 10) <= 5 ? 1 : -1;
int dirY = rand.Next(1, 10) <= 5 ? 1 : -1;
int dirZ = rand.Next(1, 10) <= 5 ? 1 : -1;
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
for (int cx = -dirX; cx != 2 * dirX; cx += dirX)
for (int cy = -dirY; cy != 2 * dirY; cy += dirY)
for (int cz = -dirZ; cz != 2 * dirZ; cz += dirZ)
{
byte tileBelow = lvl.GetTile((ushort)(x + cx),(ushort)(y + cy - 1), (ushort)(z + cz));
byte tile = lvl.GetTile((ushort)(x + cx),(ushort)(y + cy), (ushort)(z + cz));
if ((tileBelow == Block.red || tileBelow == Block.op_air) &&
(tile == Block.air || tile == Block.water)) {
lvl.AddUpdate(lvl.PosToInt((ushort)(x + cx),
(ushort)(y + cy), (ushort)(z + cz)), Block.train);
lvl.AddUpdate(C.b, Block.air);
byte newBlock = tileBelow == Block.red ? Block.obsidian : Block.glass;
lvl.AddUpdate(lvl.IntOffset(C.b, 0, -1, 0), newBlock, true,
"wait 5 revert " + tileBelow.ToString());
return;
}
}
}
示例12: ContrainteCheck
public ContrainteCheck(Table entite, string nomContrainte)
: this()
{
arrayCK = entite.CK;
arrayAttributs = entite.attributs;
check = new Check (nomContrainte);
}
示例13: Do
public static void Do(Level lvl, Check C, Random rand) {
ushort x, y, z;
lvl.IntToPos(C.b, out x, out y, out z);
if (lvl.GetTile(x, (ushort)(y - 1), z) != Block.lavastill)
return;
if (lvl.GetTile(x, (ushort)(y + 1), z) == Block.air) {
bool keepGoing = true;
if ((lvl.Height * 80 / 100) < y)
keepGoing = rand.Next(1, 20) > 1;
if (keepGoing) {
int bAbove = lvl.PosToInt(x, (ushort)(y + 1), z);
bool unblocked = !lvl.ListUpdate.Exists(u => u.b == bAbove);
if (unblocked) {
lvl.AddUpdate(bAbove, Block.firework, false);
lvl.AddUpdate(C.b, Block.lavastill, false, "wait 1 dissipate 100");
C.extraInfo = "wait 1 dissipate 100";
return;
}
}
}
Firework(x, y, z, 4, lvl, rand);
}
示例14: GetList
private static List<List<string>> GetList(string fileName, Check check, DayOfWeek dayOfWeek = DayOfWeek.Monday, int numberOfWeek = -1, string subgroup = "-1")
{
var settings = new XmlReaderSettings { IgnoreComments = true, IgnoreWhitespace = true };
var elementsList = new List<List<string>>();
try
{
var xmlReader = XmlReader.Create(fileName, settings);
xmlReader.Read(); //декларация
xmlReader.Read(); //коренной элемент
xmlReader.Read(); //дочерний элемент
while (!xmlReader.EOF)
{
List<string> element = ReadOne(ref xmlReader);
if ((check == null && element != null && element.Count > 0) ||
(check != null && check(dayOfWeek, numberOfWeek, subgroup, element)))
{
elementsList.Add(element);
}
}
xmlReader.Close();
}
catch (FileNotFoundException)
{
File.Create(fileName);
}
catch (Exception)
{
elementsList = null;
}
return elementsList;
}
示例15: RemoveError
private static void RemoveError(Check check)
{
if (_tracker.ContainsKey(check))
{
_tracker.Remove(check);
}
}