本文整理汇总了C#中Rope类的典型用法代码示例。如果您正苦于以下问题:C# Rope类的具体用法?C# Rope怎么用?C# Rope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rope类属于命名空间,在下文中一共展示了Rope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ysucae,项目名称:Balloune,代码行数:7,代码来源:RopeManager.cs
示例2: AppendLongTextToEmptyRope
public void AppendLongTextToEmptyRope()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>();
rope.AddText(text);
Assert.AreEqual(text, rope.ToString());
}
开发者ID:nic0lae,项目名称:filewatcher,代码行数:7,代码来源:RopeTests.cs
示例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;
}
开发者ID:AkshayVats,项目名称:SuperShell,代码行数:10,代码来源:RopeTextSource.cs
示例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;
}
开发者ID:ysucae,项目名称:Balloune,代码行数:7,代码来源:RopeManager.cs
示例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());
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:RopeTests.cs
示例6: OnFireRope
public void OnFireRope(Rope newRope)
{
lock (m_ropeLock)
{
if (m_rope != null)
CutRope();
m_rope = newRope;
}
}
开发者ID:rkdrnf,项目名称:fortresswar,代码行数:10,代码来源:RopeController.cs
示例7: CutRope
public void CutRope()
{
lock (m_ropeLock)
{
if (m_rope != null)
{
m_rope.Cut();
m_rope = null;
}
}
}
开发者ID:rkdrnf,项目名称:fortresswar,代码行数:11,代码来源:RopeController.cs
示例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());
}
开发者ID:nic0lae,项目名称:filewatcher,代码行数:11,代码来源:RopeTests.cs
示例9: RopeFired
public void RopeFired(Rope newRope)
{
lock (m_ropeLock)
{
if (newRope != null)
{
m_player.SetState(CharacterState.ROPING);
m_player.ToAirMaterial();
}
}
}
开发者ID:rkdrnf,项目名称:fortresswar,代码行数:11,代码来源:RopeController.cs
示例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());
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:12,代码来源:RopeTests.cs
示例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());
}
开发者ID:nic0lae,项目名称:filewatcher,代码行数:13,代码来源:RopeTests.cs
示例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());
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:14,代码来源:RopeTests.cs
示例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();
}
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:18,代码来源:TextDocument.cs
示例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;
}
开发者ID:JeffreyZhao,项目名称:NRopes,代码行数:15,代码来源:ConcateRope.cs
示例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());
}
开发者ID:nic0lae,项目名称:filewatcher,代码行数:16,代码来源:RopeTests.cs
示例16: RopeTextReader
/// <summary>
/// Creates a new RopeTextReader.
/// Internally, this method creates a Clone of the rope; so the text reader will always read through the old
/// version of the rope if it is modified. <seealso cref="Rope{T}.Clone()"/>
/// </summary>
public RopeTextReader(Rope<char> rope)
{
if (rope == null)
throw new ArgumentNullException("rope");
// We force the user to iterate through a clone of the rope to keep the API contract of RopeTextReader simple
// (what happens when a rope is modified while iterating through it?)
rope.root.Publish();
// special case for the empty rope:
// leave currentNode initialized to null (RopeTextReader doesn't support empty nodes)
if (rope.Length != 0) {
currentNode = rope.root;
GoToLeftMostLeaf();
}
}
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:21,代码来源:RopeTextReader.cs
示例17: RopeTextSource
/// <summary>
/// Creates a new RopeTextSource.
/// </summary>
public RopeTextSource(Rope<char> rope)
{
if (rope == null)
throw new ArgumentNullException("rope");
this.rope = rope;
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:ITextSource.cs
示例18: ConcatenateStringToRopeBackwards
public void ConcatenateStringToRopeBackwards()
{
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.Insert(0, ' ');
rope.InsertText(0, i.ToString());
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:14,代码来源:RopeTests.cs
示例19: ConcatenateStringToRopeByInsertionInMiddle
public void ConcatenateStringToRopeByInsertionInMiddle()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 998; i++) {
b.Append(i.ToString("d3"));
b.Append(' ');
}
int middle = 0;
for (int i = 1; i <= 499; i++) {
rope.InsertText(middle, i.ToString("d3"));
middle += 3;
rope.Insert(middle, ' ');
middle++;
rope.InsertText(middle, (999-i).ToString("d3"));
rope.Insert(middle + 3, ' ');
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:19,代码来源:RopeTests.cs
示例20: RopeController
public RopeController(ServerPlayer player)
{
m_player = player;
m_rope = null;
}
开发者ID:rkdrnf,项目名称:fortresswar,代码行数:5,代码来源:RopeController.cs
注:本文中的Rope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论