本文整理汇总了C#中System.Diagnostics.StackFrame.StartsWith方法的典型用法代码示例。如果您正苦于以下问题:C# System.Diagnostics.StackFrame.StartsWith方法的具体用法?C# System.Diagnostics.StackFrame.StartsWith怎么用?C# System.Diagnostics.StackFrame.StartsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.StackFrame
的用法示例。
在下文中一共展示了System.Diagnostics.StackFrame.StartsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSegment
public new bool CreateSegment(out ushort segment, ref Randomizer randomizer, NetInfo info, ushort startNode, ushort endNode, Vector3 startDirection, Vector3 endDirection, uint buildIndex, uint modifiedIndex, bool invert)
{
// Call original method
RedirectionHelper.RevertRedirect(_NetManager_CreateSegment_original, _NetManager_CreateSegment_state);
var success = NetManager.instance.CreateSegment(out segment, ref randomizer, info, startNode, endNode, startDirection, endDirection, buildIndex, modifiedIndex, invert);
RedirectionHelper.RedirectCalls(_NetManager_CreateSegment_original, _NetManager_CreateSegment_detour);
var caller = new System.Diagnostics.StackFrame(1).GetMethod().Name;
//Debug.Log("CreateSegment (" + info.name + ") called by " + caller);
switch (caller)
{
case "CreateNode":
var caller2 = new System.Diagnostics.StackFrame(2).GetMethod().Name;
//Debug.Log("... called by " + caller2);
if (caller2 == "CreateNode") // check that caller was called by NetTool
{
var caller3Type = new System.Diagnostics.StackFrame(3).GetMethod().DeclaringType?.Name;
//Debug.Log("... called by " + caller3Type);
if (caller3Type != null && caller3Type.StartsWith("NetTool", StringComparison.Ordinal)) // new segment created by user, apply selected style
// use StartsWith to cover NetToolFine from FineRoadHeights, and other possible NetTools
{
if (success) EventSegmentCreate?.Invoke(segment);
// Delete data of deleted segments
if (MoveMiddleNode_releasedSegment > 0) EventSegmentRelease?.Invoke(MoveMiddleNode_releasedSegment);
if (SplitSegment_releasedSegment > 0) EventSegmentRelease?.Invoke(SplitSegment_releasedSegment);
SplitSegment_releasedSegment = 0;
MoveMiddleNode_releasedSegment = 0;
}
}
else if (caller2 == "LoadPaths") // segment created because user placed building with integrated networks
{
// TODO SementDataManager should not appear here. Instead, add argument to CreateEvent!
if (SegmentDataManager.Instance.AssetMode && success) EventSegmentCreate?.Invoke(segment);
}
break;
case "MoveMiddleNode": // segment that was modified because user added network, apply style of previous segment
if (MoveMiddleNode_releasedSegment > 0)
{
if (success) EventSegmentTransferData?.Invoke(MoveMiddleNode_releasedSegment, segment);
// Delete data of previous segment
EventSegmentRelease?.Invoke(MoveMiddleNode_releasedSegment);
MoveMiddleNode_releasedSegment = 0;
}
break;
case "SplitSegment": // segment that was split by new node, apply style of previous segment
if (SplitSegment_releasedSegment > 0)
{
if (success) EventSegmentTransferData?.Invoke(SplitSegment_releasedSegment, segment);
}
break;
default: // unknown caller, ignore
break;
}
return success;
}