本文整理汇总了C#中Kind类的典型用法代码示例。如果您正苦于以下问题:C# Kind类的具体用法?C# Kind怎么用?C# Kind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Kind类属于命名空间,在下文中一共展示了Kind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeKind
public static int ChangeKind(int sourceKId, Kind kind)
{
if (sourceKId == InvalidKId)
return InvalidKId;
return sourceKId & 0x00ffffff | (int)kind;
}
示例2: Card
public Card(int kind, int rank)
{
_kind = (Kind)kind;
_rank = (CardRank)rank;
_image = new Image();
_image.Stretch = Stretch.Fill;
}
示例3: TranslateSkinString
/// <summary>
/// Translate the skin string, create the skin string if not found.
/// </summary>
/// <param name="line"></param>
/// <param name="kind"></param>
/// <returns></returns>
public static int TranslateSkinString(string line, Kind kind)
{
Dictionary<int, SkinString>.Enumerator enumer = _skinStringSettings.GetEnumerator();
while (enumer.MoveNext())
{
SkinString skin = enumer.Current.Value;
if (skin.Name == line)
{
return enumer.Current.Key;
}
}
SkinString newString = new SkinString();
newString.Name = line;
newString.Value = line;
newString.Kind = kind;
// Create the setting as a property if not already present.
if (!GUIPropertyManager.PropertyIsDefined(newString.Name))
{
GUIPropertyManager.SetProperty(newString.Name, newString.Value);
}
else
{
newString.Value = GUIPropertyManager.GetProperty(newString.Name);
}
int key;
lock (_skinStringSettings) //Lock the dictionary, it might be getting saved at the moment
{
key = _skinStringSettings.Count;
_skinStringSettings[key] = newString;
}
return key;
}
示例4: AddStat
public void AddStat(Kind kind, int amount, int turn)
{
if(turn >= MAX_TURNS)
throw new Exception("Statistic can have only " + MAX_TURNS + " columns");
statistic[(int)kind][turn] += amount;
}
示例5: CreateSinkOrSource
private object CreateSinkOrSource(Kind kind, bool isOut)
{
switch (kind)
{
case Kind.Stream:
return isOut ? new MemoryStream() : new MemoryStream(Encoding.Default.GetBytes(Content));
case Kind.File:
var path = GetPath(isOut);
if (!isOut)
{
File.WriteAllText(path, Content);
}
return new FileInfo(path);
case Kind.ReaderWriter:
return isOut ? new StringWriter() : new StringReader(Content).As<object>();
case Kind.String:
return Content;
case Kind.Chars:
return isOut ? new List<char>() : Content.ToCharArray().As<object>();
case Kind.Lines:
return isOut ? new List<string>() : Content.Split(new[] { Environment.NewLine }, StringSplitOptions.None).As<object>();
default:
throw new InvalidOperationException();
}
}
示例6: StopEmotion
public void StopEmotion(Kind k)
{
if( emotionRequests.Contains(k) ) {
emotionRequests.RemoveAll(x => x == k);
_PlayEmotionOfLastCapables();
}
}
示例7: SwitchKind
internal void SwitchKind()
{
if (!changed)
{
if ((int)kind < 2)
{
kind++;
}
else
{
kind = (Kind)0;
}
switch (kind)
{
case Kind.Rock:
couleur = Color.Red;
chiffre = 0;
break;
case Kind.Turret:
couleur = Color.Green;
chiffre = 2;
break;
case Kind.Creep:
couleur = Color.White;
chiffre = 1;
break;
default:
break;
}
changed = true;
}
}
示例8: _IsOnceAnimation
private bool _IsOnceAnimation(Kind k)
{
switch(k) {
case Kind.Exclamation:
return true;
case Kind.Question:
return true;
case Kind.Berserk:
return false;
case Kind.Hungry:
return false;
case Kind.Kirakira:
return false;
case Kind.Ohana:
return false;
case Kind.Onpu:
return true;
case Kind.Paralize:
return false;
case Kind.Poison:
return false;
case Kind.Sleep:
return false;
case Kind.Star:
return false;
case Kind.Wakatta:
return true;
}
return false;
}
示例9: BinWrite
/// <summary>
/// Writes a binary field to data file.
/// </summary>
/// <param name="stream"></param>
/// <param name="kind"></param>
/// <param name="offset"></param>
/// <param name="v"></param>
public static void BinWrite(FileStream stream, Kind kind, long offset, object v)
{
var v_str = v.ToString();
stream.Position = offset;
var writer = new BinaryWriter(stream);
switch (kind)
{
case Kind.Byte:
writer.Write(byte.Parse(v_str));
break;
case Kind.Int16:
writer.Write(short.Parse(v_str));
break;
case Kind.Int32:
writer.Write(int.Parse(v_str));
break;
case Kind.Int64:
writer.Write(long.Parse(v_str));
break;
case Kind.Single:
writer.Write(float.Parse(v_str));
break;
case Kind.Double:
writer.Write(double.Parse(v_str));
break;
default:
throw new Exception("Invalid type code.");
}
writer.Flush();
}
示例10: SetIterator
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new set iterator.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="set"> The set to iterate over. </param>
/// <param name="list"> The linked list to iterate over. </param>
/// <param name="kind"> The type of values to return. </param>
internal SetIterator(ObjectInstance prototype, SetInstance set, LinkedList<object> list, Kind kind)
: base(prototype)
{
this.set = set;
this.set.BeforeDelete += Set_BeforeDelete;
this.list = list;
this.kind = kind;
}
示例11: VariableDeclaration
public VariableDeclaration(string name, string type, bool isArray,
Kind kind, int row, int col)
: base(name, type, isArray, row, col)
{
VariableKind = kind;
LocalIndex = 0;
Used = false;
}
示例12: Outcome
public Outcome(string type, Kind kind, Vector vector, string message, int nesting = 0)
{
this.Type = type;
this.Kind = kind;
this.Vector = vector;
this.Message = message;
this.Nesting = nesting;
}
示例13: MapIterator
// INITIALIZATION
//_________________________________________________________________________________________
/// <summary>
/// Creates a new map iterator.
/// </summary>
/// <param name="prototype"> The next object in the prototype chain. </param>
/// <param name="map"> The map to iterate over. </param>
/// <param name="list"> The linked list to iterate over. </param>
/// <param name="kind"> The type of values to return. </param>
internal MapIterator(ObjectInstance prototype, MapInstance map, LinkedList<KeyValuePair<object, object>> list, Kind kind)
: base(prototype)
{
this.map = map;
this.map.BeforeDelete += Map_BeforeDelete;
this.list = list;
this.kind = kind;
}
示例14: Concept
public Concept(string name, Kind kind)
{
id = 0;
this.name = name;
this.kind = kind;
loaded = false;
}
示例15: CleanupWorkItem
public CleanupWorkItem(Kind task, string relativePath, string physicalPath)
{
this.task = task;
this.relativePath = relativePath;
this.physicalPath = physicalPath;
if (this.relativePath.StartsWith("/")) {
Debug.WriteLine("Invalid relativePath value - should never have leading slash!");
}
}