本文整理匯總了C#中Block.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# Block.GetType方法的具體用法?C# Block.GetType怎麽用?C# Block.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Block
的用法示例。
在下文中一共展示了Block.GetType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetDrillMiningValidityOfBlocksIfYouBoughtTheRightDrill
public static bool GetDrillMiningValidityOfBlocksIfYouBoughtTheRightDrill(Drill thisIsTheDrillThatThePlayerHas, Block thisIsTheBlockThatThePlayerIsCurrentlyAttemptingToRemoveFromTheWorldExceptTheyMightNotHaveTheRightDrill)
{
foreach (var thisIsOneOfTheBlockOptionsInTheListOfValidBlocksInTheDrill in thisIsTheDrillThatThePlayerHas.mineableBlocks) {
if (thisIsTheBlockThatThePlayerIsCurrentlyAttemptingToRemoveFromTheWorldExceptTheyMightNotHaveTheRightDrill.GetType() == thisIsOneOfTheBlockOptionsInTheListOfValidBlocksInTheDrill)
{
return true;
}
}
return false;
}
示例2: DirectClicked
void DirectClicked(ToolStripMenuItem clickeditem, Block blockobject,BlockData bdata,ManyToOneBlockData mtodata)
{
BlockData getbd;
ManyToOneBlockData getmanytoone;
Block acquireBlock;
getbd = bdata;
getmanytoone = mtodata;
acquireBlock = blockobject;
//set some defaults.
if (getmanytoone != null)
{
//manyto one block. Should show name of "actual" type.
Text = getmanytoone.DisplayText;
ToolTipText = blockobject.GetType().Name + " - " + getmanytoone.DisplayText;
//we need to draw it speshul.
Bitmap resultimage = null;
Graphics resultg = null;
Block.DrawBlock(blockobject, out resultimage, out resultg);
Image = resultimage;
}
else
{
Text = bdata.BlockType.Name;
ToolTipText = Text;
Image = bdata.useBlockImage;
}
var gotargs = new BlockToolStripButtonBlockSelectedArgs(blockobject, getmanytoone, bdata);
var copied = BlockSelected;
if (copied != null) copied(this, gotargs);
SelectedItem = gotargs;
}
示例3: ValidateDefinition
protected void ValidateDefinition(string expStr, int expVariations, int expChildCount, Block org)
{
var tp = org.GetType().Name;
var name = tp.Substring(5, 1);
var rot = tp.Substring(6);
Block.RotationType rotation = Block.RotationType.None;
if (!String.IsNullOrEmpty(rot) && !Enum.TryParse<Block.RotationType>(rot, out rotation))
{
Assert.Fail("Type '{0}', name does not fit into contract.", tp);
}
Assert.AreEqual(name, org.Name, "Name");
Assert.AreEqual(rotation, org.Rotation, "Rotation");
Assert.AreEqual(expStr, org.ToString(), "ToString().");
Assert.AreEqual(4, org.Count, "Count should be 4.");
Assert.AreEqual(expVariations, org.Variations.Length, "Variations.Length");
Assert.AreEqual(expChildCount, org.ChildCount, "ChildCount");
}