本文整理汇总了C#中Level类的典型用法代码示例。如果您正苦于以下问题:C# Level类的具体用法?C# Level怎么用?C# Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于命名空间,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: log
private void log(string message, Level currentLevel)
{
if (LevelComparator.pass(currentLevel, logLevel))
{
parentNode.forward(_name, currentLevel, message);
}
}
示例2: LogTo
public static void LogTo(Level level, Boolean fireEvent, String rawMessage)
{
String message = Regex.Replace(rawMessage, "cardno=[^&]*", "****************");
switch (level)
{
case Level.INFO:
NLogger.Info(message);
break;
case Level.TRACE:
NLogger.Trace(message);
break;
case Level.DEBUG:
NLogger.Debug(message);
break;
case Level.WARNING:
NLogger.Warn(message);
break;
case Level.ERROR:
NLogger.Error(message);
break;
case Level.FATAL:
NLogger.Fatal(message);
break;
}
if (fireEvent)
{
InvokeLogToGui(new GuiEventArgs(level, message));
}
}
示例3: Log
public static void Log(Level level, String message)
{
Config cfg = Config.Load();
if (cfg.LogVerbosity <= level)
{
string line = String.Format("{0} [{1}] - {2}", DateTime.Now, level, message);
if ((cfg.LogOutput & Outputs.Console) == Outputs.Console)
{
if (level <= Level.Info)
{
Console.WriteLine(line);
} else
{
Console.Error.WriteLine(line);
}
}
if ((cfg.LogOutput & Outputs.File) == Outputs.File)
{
Stream.WriteLine(line);
Stream.Flush();
}
}
}
示例4: interact
public override bool interact(Level level, int xt, int yt, Player player, Item item, int attackDir)
{
if (item is ToolItem)
{
ToolItem tool = (ToolItem)item;
if (tool.type == ToolType.shovel)
{
if (player.payStamina(4 - tool.level))
{
level.setTile(xt, yt, Tile.hole, 0);
level.add(new ItemEntity(new ResourceItem(Resource.dirt), xt * 16 + random.nextInt(10) + 3, yt * 16 + random.nextInt(10) + 3));
Sound.monsterHurt.play();
return true;
}
}
if (tool.type == ToolType.hoe)
{
if (player.payStamina(4 - tool.level))
{
level.setTile(xt, yt, Tile.farmland, 0);
Sound.monsterHurt.play();
return true;
}
}
}
return false;
}
示例5: UnityLog
public static void UnityLog(int i, Level level = Level.DEBUG)
{
string s = i.ToString();
switch (level) {
case Level.DEBUG:
s = "[DEBUG]" + s;
Debug.Log(s);
break;
case Level.INFO:
s = "[INFO]" + s;
Debug.Log(s);
break;
case Level.WARNING:
s = "[WARNING]" + s;
Debug.LogWarning(s);
break;
case Level.ERROR:
Debug.LogError(s);
s = "[ERROR]" + s;
break;
default:
s = "[DEFAULT]" + s;
UnityLog("I was given a log level that doesn't exist.", Level.WARNING);
break;
}
}
示例6: PanTool
public PanTool(Level pointer, Tool prevTool, Point startPoint)
: base(pointer)
{
this.pointer = pointer;
this.prevTool = prevTool;
this.startPoint = startPoint;
}
示例7: SaveToFile
public static void SaveToFile(Level data, string fileName)
{
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(string.Format("{0}.level", fileName), FileMode.Create, FileAccess.Write, FileShare.Write);
formatter.Serialize(stream, data);
stream.Close();
}
示例8: IsEnabledFor
/// <summary>
/// 获取指定级别的日志是否可记录。
/// </summary>
/// <param name="level">级别</param>
/// <returns>是否可记录</returns>
public bool IsEnabledFor(Level level)
{
var cacheValue = this.Cache.Get<string>(Constants.LogerLevelCacheKey);
if (string.IsNullOrWhiteSpace(cacheValue))
{
try
{
cacheValue = this.SqlMapperManager[RW.Read].QueryForObject<string>(string.Format(StatementFormatter, this.SqlMapNamespace, "GetLoggerLevel"), null);
if (string.IsNullOrWhiteSpace(cacheValue))
{
cacheValue = "1";
}
else
{
this.Cache.Add(Constants.LogerLevelCacheKey, cacheValue);
}
}
catch
{
cacheValue = "1";
}
}
var iLevel = int.Parse(cacheValue);
var minLevel = (Level)iLevel;
return level >= minLevel;
}
示例9: Get
public static LevelClearState? Get(WorldType world, Level level)
{
var key = MakeKey(world, level);
if (!PlayerPrefs.HasKey(key))
return null;
return (LevelClearState)Enum.Parse(typeof (LevelClearState), PlayerPrefs.GetString(key));
}
示例10: EasyTraceEvent
// EasyTraceEvent
// Checks the keyword and level before emiting the event
static internal void EasyTraceEvent(Keyword keywords, Level level, Event eventID)
{
if (IsEnabled(keywords, level))
{
EventProvider.TraceEvent(eventID, keywords, level);
}
}
示例11: LevelManager
/// <summary>
/// Constructor for testing purposes
/// </summary>
/// <param name="game"></param>
/// <param name="testConstructor"></param>
public LevelManager(Game game, bool testConstructor)
: base(game)
{
//updateCam = false;
//curLevelInfo = 0;
//levels = new List<LevelInfo>();
//currentLevel = new Level();
////levels.Add(new LevelInfo("", 3, 72, 8, 1, 200, 0, 25, Constants.RED_PLATFORM));
////generator = new LevelGenerator(currentLevel, levels, 42, new ChunkType[,] { {ChunkType.FLOOR}, {ChunkType.STAIRS}, {ChunkType.FLOATING_PLATFORMS_SAFE},
//// {ChunkType.FLOATING_PLATFORMS_NOT_SAFE}, {ChunkType.MOUNTAIN_LEFT}, {ChunkType.MOUNTAIN_RIGHT}, {ChunkType.JAGGIES_LEFT}, {ChunkType.JAGGIES_RIGHT},
//// {ChunkType.TALL_GROUND}});
//levels.Add(new LevelInfo("", 3, 8, 8, 0, 200, 0, 0, Constants.RED_PLATFORM));
//generator = new LevelGenerator(currentLevel, levels, 42, new ChunkType[,] { {ChunkType.TALL_GROUND}});
//currentLevel = generator.GenerateNewLevel(0, 1);
//this.SetUpCameraDefault();
//this.projectiles = new List<Projectile>();
//this.expOrbs = new List<ExperienceOrb>();
updateCam = false;
curLevelInfo = 0;
setUpLevels();
currentLevel = new Level(levels[curLevelInfo].width, levels[curLevelInfo].height, 1);
generator = new LevelGenerator(currentLevel, levels, new Random().Next());
currentLevel = generator.GenerateNewLevel(curLevelInfo, 1);
this.SetUpCameraDefault();
this.projectiles = new List<Projectile>();
this.expOrbs = new List<ExperienceOrb>();
}
示例12: Tick
public override void Tick(Level l)
{
if (l.GetBlock(X, Z, Y - 1) == Block.BlockList.AIR) {
Add(l, new Active_Water(X, Z, Y - 1));
Remove(l);
//l.BlockChange((ushort)X, (ushort)Z, (ushort)(Y - 1), this);
}
else {
if (l.GetBlock(X + 1, Z, Y) == Block.BlockList.AIR) {
Add(l, new Active_Water(X + 1, Z, Y));
//l.BlockChange((ushort)(X + 1), (ushort)Z, (ushort)Y, this);
}
if (l.GetBlock(X - 1, Z, Y) == Block.BlockList.AIR) {
Add(l, new Active_Water(X - 1, Z, Y));
//l.BlockChange((ushort)(X - 1), (ushort)Z, (ushort)Y, this);
}
if (l.GetBlock(X, Z + 1, Y) == Block.BlockList.AIR) {
Add(l, new Active_Water(X, Z + 1, Y));
//l.BlockChange((ushort)X, (ushort)(Z + 1), (ushort)Y, this);
}
if (l.GetBlock(X, Z - 1, Y) == Block.BlockList.AIR) {
Add(l, new Active_Water(X, Z - 1, Y));
// l.BlockChange((ushort)X, (ushort)(Z - 1), (ushort)Y, this);
}
}
}
示例13: Message
public void Message(string str, Level level)
{
string message = string.Format("{0}", str);
switch (level)
{
case Level.Normal:
{
System.Console.WriteLine(message);
Save(message);
break;
}
case Level.Warning:
{
message = "[Warn]" + message;
System.Console.WriteLine(message);
Save(message);
break;
}
case Level.Error:
{
message = "[Error]" + message;
System.Console.WriteLine(message);
Save(message);
break;
}
}
}
示例14: FunctionEntry
public FunctionEntry(Level level, Label label, Types.RECORD formals, Types.Type result)
{
Level = level;
Label = label;
Formals = formals;
Result = result;
}
示例15: SendToLevel
public static void SendToLevel(Level l, string[] message)
{
for (int i = 0; i < message.Length; i++)
{
l.ChatLevel(message[i]);
}
}