2 u013291805 u013291805 于 2014.05.12 14:38 提问

“CS$<>9__CachedAnonymousMethodDelegate1” 在哪里定义?

这是我反编译一个软件时,在 消息窗口 部分看到的。

MessageWidget.cs
public void DisplayMessage(string text, bool blinking)

    {
        this.m_message = text;
        this.m_messageStartTime = TimeManager.Time;
        if (!blinking)
        {
        }
        this.m_duration = (CS$<>9__CachedAnonymousMethodDelegate1 != null) ? 
          6f : 
         (4f + MathUtils.Min((float) (1f * this.m_message.Count<char>(CS$<>9__CachedAnonymousMethodDelegate1)), (float) 4f));
        this.m_blinking = blinking;
    } 

我在MessageWidget.cs中并没有找到关于CS$<>9__CachedAnonymousMethodDelegate1的定义。

使用Reflector查看到的定义是:
[CompilerGenerated]
private static Func CS$<>9__CachedAnonymousMethodDelegate1;

以下是MessageWidget.Cs的内容:
public class MessageWidget : CanvasWidget
{
private bool m_blinking;
private float m_duration;
private LabelWidget m_labelWidget;
private string m_message;
private double m_messageStartTime;

    public MessageWidget()
    {
        XElement node = ContentManager.Load<XElement>(@"Widgets\MessageWidget");
        WidgetsManager.LoadWidgetContents(this, this, node);
        this.m_labelWidget = base.FindWidget<LabelWidget>("Label", true);
    }

    public void DisplayMessage(string text, bool blinking)
    {
        this.m_message = text;
        this.m_messageStartTime = TimeManager.Time;
        if (!blinking)
        {
        }
        this.m_duration = (CS$<>9__CachedAnonymousMethodDelegate1 != null) ? 6f : (4f + MathUtils.Min((float) (1f * this.m_message.Count<char>(CS$<>9__CachedAnonymousMethodDelegate1)), (float) 4f));
        this.m_blinking = blinking;
    }

    public override void Update()
    {
        double time = TimeManager.Time;
        if (!string.IsNullOrEmpty(this.m_message))
        {
            float num2;
            if (this.m_blinking)
            {
                num2 = MathUtils.Saturate((float) (1f * ((float) ((this.m_messageStartTime + this.m_duration) - time))));
                if ((time - this.m_messageStartTime) < 0.417)
                {
                    num2 *= MathUtils.Lerp((float) 0.25f, (float) 1f, (float) (0.5f * (1f - MathUtils.Cos((float) (37.69911f * ((float) (time - this.m_messageStartTime)))))));
                }
            }
            else
            {
                num2 = MathUtils.Saturate(MathUtils.Min((float) (3f * ((float) (time - this.m_messageStartTime))), (float) (1f * ((float) ((this.m_messageStartTime + this.m_duration) - time)))));
            }
            this.m_labelWidget.Color = new Color(num2, num2, num2, num2);
            this.m_labelWidget.IsVisible = true;
            this.m_labelWidget.Text = this.m_message;
            if ((time - this.m_messageStartTime) > this.m_duration)
            {
                this.m_message = null;
            }
        }
        else
        {
            this.m_labelWidget.IsVisible = false;
        }
    }
}

它或许与Linq有关。
请问“CS$<>9__CachedAnonymousMethodDelegate1”这个委托是在哪里定义的呢?

1个回答

u013291805
u013291805   2014.05.12 18:53

Thx,调成None够就能看到了,接下来的自己解决。~

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!