本文整理汇总了C#中System.Func类的典型用法代码示例。如果您正苦于以下问题:C# System.Func类的具体用法?C# System.Func怎么用?C# System.Func使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Func类属于命名空间,在下文中一共展示了System.Func类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomFunction
public CustomFunction(string name, System.Func<double,double> func, bool enableSymbolicationTimeEvaluation)
{
this.func1d = func;
this.enableSymbolicationTimeEvaluation = enableSymbolicationTimeEvaluation;
this.paramCount = 1;
this.name = name;
}
示例2: TimedTick
/// Repeatable perform an action each frame for x amount of seconds until a condition is met.
/// Takes the action to perform, the condition for completion and the maximum amount of time each frame
/// to spend performing the action
public TimedTick( System.Action action, System.Func<bool> stopCondition, float time = .1f )
{
start_ = Time.realtimeSinceStartup;
action_ = action;
stopCondition_ = stopCondition;
maxTime_ = time;
}
示例3: AssignedTask
public AssignedTask(PartyMember member, AssignedTaskTypes type, System.Func<bool> check, System.Action mainAction)
{
taskType=type;
preconditionCheck=check;
actionToPerform=mainAction;
performingMember=member;
startTaskAction=null;
endTaskAction=null;
}
示例4: Start
void Start()
{
var lProperty = component.GetType().GetProperty(memberName);
if (lProperty.PropertyType == typeof(string))
getTextFunc = (System.Func<string>)System.Delegate.CreateDelegate(
typeof(System.Func<string>), component, lProperty.GetGetMethod());
else
getTextFunc = () => lProperty.GetValue(component, null).ToString();
}
示例5: SetParams
public void SetParams(float radius, System.Func<GameObject, bool> checkTrigger, System.Action callBack)
{
_checkTrigger = checkTrigger;
_callBack = callBack;
_radius = radius;
SphereCollider co = gameObject.AddComponent<SphereCollider>();
co.radius = radius;
co.isTrigger = true;
}
示例6: GUIButton
public GUIButton(GameObject obj, System.Func<bool> enableChecker)
{
m_button = obj.GetComponent<Button>();
m_lable = new GUILable(obj.transform.Find("Text").gameObject);
m_enableChecker = enableChecker;
Transform iconTrans = obj.transform.Find("Icon");
if (iconTrans != null)
{
RawImage rawImage = iconTrans.GetComponent<RawImage>();
m_icon = new GUIImageStatic(iconTrans.gameObject, rawImage.texture);
}
}
示例7: Construct
public void Construct(params object[] args)
{
#if DEBUG
Debug.Assert(!args.IsNullOrEmpty());
#endif // DEBUG
bkgProc = args[0] as System.Func<object, object>;
param = 1 < args.Length ? args[1] : null;
result = null;
#if DEBUG
Debug.Assert(null != bkgProc);
#endif // DEBUG
}
示例8: Start
///////////////////////////////////////////////////////////////////////////////
// functions
///////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------
// Desc:
// ------------------------------------------------------------------
public void Start( bool _rewind = false, float _duration = -1.0f )
{
duration = (_duration <= 0.0f) ? data.length : _duration;
callback = data.useEaseCurve ? exEase.GetEaseFunc(data.easeCurveType) : data.animationCurve.Evaluate;
lastTime = Time.time;
if ( _rewind || started == false ) {
if ( speed < 0.0f )
time = duration;
else
time = 0.0f;
}
timeup = false;
started = true;
}
示例9: ValidationDelegateTaken
/// <summary>
/// 初始化 HtmlDocumentValidation 的新实例。
/// </summary>
/// <param name="name">此验证的名称信息(用于向用户界面显示)。</param>
/// <param name="documentValidation">一个委托,用于验证 HtmlDocument 是否符合规则。</param>
/// <param name="errorMessage">验证不符合规则时的提示信息。</param>
public ValidationDelegateTaken(String name, ValidationType validationType, System.Func<HtmlAgilityPack.HtmlDocument, bool> documentValidation, String errorMessage)
{
this.documentValidation = documentValidation;
this.errorMessage = errorMessage;
this.Name = name;
this.Type = validationType;
if (documentValidation == null)
{
throw new ArgumentNullException("documentValidation");
}
if (errorMessage == null)
{
throw new ArgumentNullException("errorMessage");
}
}
示例10: Generate
public static List<Room> Generate(int LevelWidth, int LevelHeight, int MinRoomWidth, int MinRoomHeight, int MaxRoomWidth, int MaxRoomHeight, Object Tile, Object Wall)
{
//Make sure that the width and height of the tile array is the size of the level
tilePlacements = new int[LevelWidth, LevelHeight];
pathFinder = new PathFinder(tilePlacements);
pathFinder.pathDiagonal = false; //Stop diagonal path finding
getPathingValueFunc = CalculatePathingValue;
rooms = new List<Room>();
for (int y = 0; y < LevelHeight; y++)
{
for (int x = 0; x < LevelWidth; x++)
{
genRoom(x, y, MinRoomWidth, MinRoomHeight, MaxRoomWidth, MaxRoomHeight, LevelWidth, LevelHeight);
}
}
MakeCorridors();
placeInLevel(Tile,Wall);
return rooms;
}
示例11: DeploymentManagerFactory
public DeploymentManagerFactory(System.Func<IDeploymentManager> factory)
{
_factory = factory;
}
示例12: Initialize
// Public Methods
public virtual void Initialize(int id, System.Func<int, bool> isFocusedCallback) {
if(_initialized) {
Debug.LogError("Window is already initialized!");
return;
}
_id = id;
_isFocusedCallback = isFocusedCallback;
_timer = new Timer();
_contentText = new List<Text>();
_canvasGroup = GetComponent<CanvasGroup>();
_initialized = true;
}
示例13: FPS
public FPS( System.Func<float> _deltaTime )
{
DeltaTime = _deltaTime;
}
示例14: OnGUI
public bool OnGUI(Rect position, SerializedProperty property, GUIContent label, bool includeChildren)
{
var drawer = this.GetDrawer(property);
if(drawer != null)
{
EditorGUI.BeginChangeCheck();
drawer.OnGUI(position, property, label);
return EditorGUI.EndChangeCheck();
}
else
{
if (_imp_DefaultPropertyField == null) _imp_DefaultPropertyField = _editorGuiAccessWrapper.GetStaticMethod("DefaultPropertyField", typeof(System.Func<Rect, SerializedProperty, GUIContent, bool>)) as System.Func<Rect, SerializedProperty, GUIContent, bool>;
return _imp_DefaultPropertyField(position, property, label);
}
}
示例15: SetDeathCallback
public void SetDeathCallback( System.Func<Transform,System.Void> deathCallback ){
m_DeathCallback = deathCallback;
}