本文整理汇总了C#中Rope类的典型用法代码示例。如果您正苦于以下问题:C# Rope类的具体用法?C# Rope怎么用?C# Rope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rope类属于命名空间,在下文中一共展示了Rope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachRopeToCharacter
private void AttachRopeToCharacter(GameObject pBalloonObject, Rope pRope, Rigidbody2D pTackBody)
{
pRope.GetStartOfRope().GetComponent<HingeJoint2D>().connectedBody = pTackBody;
DistanceJoint2D balloonJoint= pBalloonObject.GetComponent<DistanceJoint2D> ();
balloonJoint.distance = GetMaxBalloonRopeDistance (pBalloonObject);
balloonJoint.connectedBody = pTackBody;
}
示例2: AppendLongTextToEmptyRope
public void AppendLongTextToEmptyRope()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>();
rope.AddText(text);
Assert.AreEqual(text, rope.ToString());
}
示例3: RopeTextSource
/// <summary>
/// Creates a new RopeTextSource.
/// </summary>
public RopeTextSource(Rope<char> rope, ITextSourceVersion version)
{
if (rope == null)
throw new ArgumentNullException("rope");
this.rope = rope.Clone();
this.version = version;
}
示例4: AttachRopeToBalloon
private void AttachRopeToBalloon(GameObject pBalloon, Rope pRope)
{
HingeJoint2D balloonHinge = pBalloon.GetComponent<HingeJoint2D> ();
balloonHinge.connectedBody = pRope.GetEndOfRope().GetComponent<Rigidbody2D>();
balloonHinge.connectedAnchor = new Vector2 (0, pRope.GetLengthOfEachSegment());
pRope.transform.parent = pBalloon.transform;
}
示例5: InitializeRopeFromLongString
public void InitializeRopeFromLongString()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>(text);
Assert.AreEqual(text.Length, rope.Length);
Assert.AreEqual(text, rope.ToString());
Assert.AreEqual(text.ToCharArray(), rope.ToArray());
}
示例6: OnFireRope
public void OnFireRope(Rope newRope)
{
lock (m_ropeLock)
{
if (m_rope != null)
CutRope();
m_rope = newRope;
}
}
示例7: CutRope
public void CutRope()
{
lock (m_ropeLock)
{
if (m_rope != null)
{
m_rope.Cut();
m_rope = null;
}
}
}
示例8: ConcatenateSmallRopesToRope
public void ConcatenateSmallRopesToRope()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
b.Append(' ');
rope.AddRange(CharRope.Create(i.ToString() + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例9: RopeFired
public void RopeFired(Rope newRope)
{
lock (m_ropeLock)
{
if (newRope != null)
{
m_player.SetState(CharacterState.ROPING);
m_player.ToAirMaterial();
}
}
}
示例10: ConcatenateStringToRope
public void ConcatenateStringToRope()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
rope.AddText(i.ToString());
b.Append(' ');
rope.Add(' ');
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例11: ConcatenateSmallRopesToRopeBackwards
public void ConcatenateSmallRopesToRopeBackwards()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
b.Append(' ');
}
for (int i = 1000; i >= 1; i--) {
rope.InsertRange(0, CharRope.Create(i.ToString() + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例12: TestToArrayAndToStringWithParts
public void TestToArrayAndToStringWithParts()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>(text);
string textPart = text.Substring(1200, 600);
char[] arrayPart = textPart.ToCharArray();
Assert.AreEqual(textPart, rope.ToString(1200, 600));
Assert.AreEqual(arrayPart, rope.ToArray(1200, 600));
Rope<char> partialRope = rope.GetRange(1200, 600);
Assert.AreEqual(textPart, partialRope.ToString());
Assert.AreEqual(arrayPart, partialRope.ToArray());
}
示例13: TextDocument
/// <summary>
/// Create a new text document with the specified initial text.
/// </summary>
public TextDocument(IEnumerable<char> initialText)
{
if (initialText == null)
throw new ArgumentNullException("initialText");
rope = new Rope<char>(initialText);
lineTree = new DocumentLineTree(this);
lineManager = new LineManager(lineTree, this);
lineTrackers.CollectionChanged += delegate {
lineManager.UpdateListOfLineTrackers();
};
anchorTree = new TextAnchorTree(this);
undoStack = new UndoStack();
FireChangeEvents();
}
示例14: ConcateRope
public ConcateRope(Rope left, Rope right)
{
if (left == null) throw new ArgumentNullException("left");
if (right == null) throw new ArgumentNullException("right");
_depth = Math.Max(GetDepth(left), GetDepth(right)) + 1;
if (_depth > MaxDepth) {
throw new ArgumentException(
String.Format("The result tree of rope cannot be over {0} in depth.", MaxDepth));
}
_left = left;
_right = right;
_length = left.Length + right.Length;
}
示例15: ConcatenateSmallRopesByInsertionInMiddle
public void ConcatenateSmallRopesByInsertionInMiddle()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString("d3"));
b.Append(' ');
}
int middle = 0;
for (int i = 1; i <= 500; i++) {
rope.InsertRange(middle, CharRope.Create(i.ToString("d3") + " "));
middle += 4;
rope.InsertRange(middle, CharRope.Create((1001-i).ToString("d3") + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}