本文整理汇总了C#中Encoding.Int方法的典型用法代码示例。如果您正苦于以下问题:C# Encoding.Int方法的具体用法?C# Encoding.Int怎么用?C# Encoding.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encoding
的用法示例。
在下文中一共展示了Encoding.Int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
public virtual bool Decode (Encoding encoding)
{
IntVector2 newLocation = new IntVector2(encoding.Int(0)-31, encoding.Int (1)-31);
Mechanism placedMechanism = GridManager.instance.GetHexCell(newLocation).placedMechanism;
bool didReplacedPart = false;
if (placedMechanism != null) // we are replacing a part
{
if (placedMechanism.MechanismType == MechanismType && // we are replacing the same type of part
placedMechanism.Location.IsEqualTo(newLocation) && // the location of the old part is the same as this new one (important for multicell mechanisms e.g. weldingRig)
!placedMechanism.isSolutionMechanism) // is a level mechanism (not part of the solution, part of the problem ;p)
{
ObjectPoolManager.DestroyObject(placedMechanism);
PlaceAtLocation(newLocation);
isSolutionMechanism = false; // we use the already on board's movable (i.e. immovable)
}
else
{
// something went wrong, we are loading a mechanism on top of one that is different, or a solution mechanism
Debug.LogError("Something went wrong, we are loading a mechanism on top of one that is different, or a solution mechanism");
return false;
}
}
else // this is a new part
{
PlaceAtLocation(newLocation);
isSolutionMechanism = (int)encoding.Int(2) == 1;
}
return true;
}
示例2: Decode
public bool Decode (Encoding encodings)
{
intValue = encodings.Int(0);
return true;
}
示例3: Decode
public override bool Decode(Encoding encoding)
{
base.Decode(encoding.SubEncoding(0));
_startState.direction = (HexMetrics.Direction)encoding.Int(1);
_startState.extention = encoding.Int(2);
MoveToStartState();
for (int i = 0 ; i < instructions.Count ; i++)
{
instructions[i] = Instruction.None;
}
for (int i = 3 ; i < encoding.Count ; i++)
{
instructions.Add((Instruction)encoding.Int(i));
}
return true;
}