当前位置: 首页>>代码示例>>C#>>正文


C# Encoding.Int方法代码示例

本文整理汇总了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;
	}
开发者ID:raxter,项目名称:6-Fold-Mass-Production,代码行数:32,代码来源:Mechanism.cs

示例2: Decode

	public bool Decode (Encoding encodings)
	{
		intValue = encodings.Int(0);
		
		return true;
	}
开发者ID:raxter,项目名称:6-Fold-Mass-Production,代码行数:6,代码来源:Encoding.cs

示例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;
	}
开发者ID:raxter,项目名称:6-Fold-Mass-Production,代码行数:18,代码来源:Grabber.cs


注:本文中的Encoding.Int方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。