public void Test_ActionFunc() { var expected = "fred belotte"; var sut = new ActionFunc(); var actual = sut.Sharpie2("fred", "belotte"); Assert.True(expected == actual); }
void SetupCurrentActionFunc() { for (int i = 0; i < currentState.Actions.Count; i++) { if (ActionFunctionsDict.ContainsKey(currentState.Actions[i].Action)) { currentStateFunc += ActionFunctionsDict[currentState.Actions[i].Action]; } } }
public GRA(GoalFunc gf, RuleFunc rf, ActionFunc af, TimeSpan span) { GoalFunc = gf; RuleFunc = rf; ActionFunc = af; Span = span; MaxTries = int.MaxValue; Init(); }
public GRA_R(GoalFunc gf, RuleFunc rf, ActionFunc af, TimeSpan span, TimeSpan repeatSpan) : base(gf, rf, af, span) { RepeatSpan = repeatSpan; MaxRepeatCount = int.MaxValue; RepeatWaitedTime = repeatSpan; RepeatCount = 0; }
public void Delegate_Sharpie2() { var expected = "lauren benson"; var f = "lauren"; var l = "benson"; var sut = new ActionFunc(); var actual = sut.Sharpie2(f, l); Assert.True(expected == actual); }
void SwitchToNextState(string condition) { currentStateTime = 0; //Debug.Log(currentState.Name); //Debug.Log(condition); //Debug.Log(currentState.GetNextState(condition)); currentState = aIBehavior.StatesDict[currentState.GetNextState(condition)]; currentState.SetActionTime(); currentStateFunc = null; SetupCurrentActionFunc(); }
private int RunAction(ActionType type, ActionFunc func, int valueNeed) { var act = new Mock <IAction>(); act.Setup(x => x.Run(It.IsAny <BaseOptions>())).Returns(valueNeed); act.Setup(x => x.GetLastRunStatus()).Returns(valueNeed); var opt = new Mock <BaseOptions>(); UtilsAction.SetAction(type, act.Object); func(opt.Object); return(act.Object.GetLastRunStatus()); }
/// <summary> /// 显示通用消息弹框 /// </summary> /// <param name="title">标题</param> /// <param name="msg">内容</param> /// <param name="ok">确定按钮调用的方法,默认是直接关闭面板</param> /// <param name="cancel">取消按钮调用的方法,默认是直接关闭面板</param> /// <param name="buttonType">按钮类型</param> /// <param name="defaultOK">是否默认显示确定按钮</param> /// <param name="clock">倒计时时间,-1表示不显示倒计时</param> /// <param name="OkBtnLab">确定按钮显示内容</param> /// <param name="CancelBtnLab">取消按钮显示内容</param> public void Show(string title, string msg, ActionFunc ok, ActionFunc cancel, ButtonType buttonType, bool defaultOK, int clock, int OkBtnLab, int CancelBtnLab) { MessageBoxConfig config; if (buttonType == ButtonType.BT_OK) { config = new MessageBoxConfig(title, msg, ButtonType.BT_OK, ok, null, defaultOK, clock, OkBtnLab, CancelBtnLab); } else { config = new MessageBoxConfig(title, msg, ButtonType.BT_OK_CANCEL, ok, cancel, defaultOK, clock, OkBtnLab, CancelBtnLab); } allRequestList.Add(config); //Debug.LogError("消息框长度"+allRequestList.Count); if (!msgBoxShow) { _fetchNewRequest(); } }
static void Main(string[] args) { MementoTest.Testing(); Hr(); StateTest.Testing(); Hr(); IteratorTest.Testing(); Hr(); DelegateMiddlewareEx.Run(); Hr(); ActionFunc.Run(); Hr(); PipeConceptTest.Run(); Hr(); StategyPatternTest.Run(); Hr(); TemplateMethodTest.Run(); Hr(); CommandPatternTest.Run(); Hr(); ObserverPatternTest.Run(); }
/// <summary> /// 显示标题,内容,确认按钮的操作,只显示一个确定按钮 /// </summary> /// <param name="title"></param> /// <param name="msg"></param> /// <param name="ok"></param> public void Show(string title, string msg, ActionFunc ok) { Show(title, msg, ok, null, ButtonType.BT_OK, true, DEFAULT_TIME_LEN, 0, 0); }
public void Show(string msg, ActionFunc ok, ActionFunc cancel, int clock) { Show(TextConstant.GENERA_TITILE, msg, ok, cancel, ButtonType.BT_OK_CANCEL, false, clock, 0, 0); }
/// <summary> /// /// </summary> /// <param name="msg"></param> /// <param name="ok"></param> /// <param name="buttonType"></param> /// <param name="clock"></param> public void Show(string msg, ActionFunc ok, ButtonType buttonType, int clock) { Show(TextConstant.GENERA_TITILE, msg, ok, null, buttonType, false, clock, 0, 0); }
/// <summary> /// 接受新的请求 /// </summary> void _fetchNewRequest() { if (allRequestList.Count == 0) { CancelInvoke("OnTimer"); CloseSelf(); return; } clockEnable = allRequestList[0].Time >= 0; timeLeft = allRequestList[0].Time; okFunc = allRequestList[0].OnOkFunc; cancelFunc = allRequestList[0].OnCancelFunc; MsgTitle = allRequestList[0].Title; MsgStr = allRequestList[0].Msg; btnType = allRequestList[0].BtnType; defaultBtnOK = allRequestList[0].DefaultBtnIsOk; switch (allRequestList[0].OkBtnLab) { case 0: OK2Lab = "确 认"; break; case 1: OK2Lab = "确 定"; break; case 2: OK2Lab = "前往查看"; break; case 3: OK2Lab = "解散"; break; case 4: OK2Lab = "前往充值"; break; default: break; } switch (allRequestList[0].CancelBtnLab) { case 0: CancelLab = "取 消"; CancelIs = false; break; case 1: CancelLab = "取 消"; CancelIs = false; break; case 2: CancelLab = "客服"; CancelIs = false; break; default: break; } allRequestList.RemoveAt(0); BtnOK2Lab.text = OK2Lab; BtnOK1Lab.text = OK2Lab; BtnCancelLab.text = CancelLab; LblMsg.text = MsgStr; LblTitle.text = MsgTitle; if (clockEnable) { LblTimer.text = timeLeft.ToString(); if (btnType == ButtonType.BT_OK_CANCEL) { LblTimer.transform.localPosition = timerPos2; } else { LblTimer.transform.localPosition = timerPos1; } } else { LblTimer.text = ""; } if (btnType == ButtonType.BT_OK_CANCEL) { BtnCancel.SetActive(true); BtnOK2.SetActive(true); BtnOK1.SetActive(false); } else if (btnType == ButtonType.BT_OK) { BtnCancel.SetActive(false); BtnOK2.SetActive(false); BtnOK1.SetActive(true); } else { BtnCancel.SetActive(false); BtnOK2.SetActive(false); BtnOK1.SetActive(false); } gameObject.SetActive(true); InvokeRepeating("OnTimer", 1, 1); }
public Function(ActionFunc func) { }
public void Show(string msg, ActionFunc ok, ActionFunc cancel, int OkBtnLab, int CancelBtnLab) { Show(TextConstant.GENERA_TITILE, msg, ok, cancel, ButtonType.BT_OK_CANCEL, false, DEFAULT_TIME_LEN, OkBtnLab, CancelBtnLab); }
public void Show(string msg, ActionFunc ok, ActionFunc cancel, bool defaultOK) { Show(TextConstant.GENERA_TITILE, msg, ok, cancel, ButtonType.BT_OK_CANCEL, defaultOK, DEFAULT_TIME_LEN, 0, 0); }
/// <summary> /// 自己输入显示内容,调用确认按钮方法,倒计时时间,确认按钮显示文字 /// </summary> /// <param name="msg"></param> /// <param name="ok"></param> /// <param name="clock"></param> /// <param name="OkBtnLab"></param> public void Show(string msg, ActionFunc ok, int clock, int OkBtnLab) { Show(TextConstant.GENERA_TITILE, msg, ok, null, ButtonType.BT_OK, true, clock, OkBtnLab, 0); }
/// <summary> /// 玩家自己输入标题,显示内容,调用显示按钮方法,倒计时时间,只显示一个按钮 /// </summary> /// <param name="title"></param> /// <param name="msg"></param> /// <param name="ok"></param> /// <param name="clock"></param> public void Show(string title, string msg, ActionFunc ok, int clock) { Show(title, msg, ok, null, ButtonType.BT_OK, true, clock, 0, 0); }
/// <summary> /// 显示内容,确认按钮调用方法,自己选择按钮选择方式,不显示倒计时 /// </summary> /// <param name="msg"></param> /// <param name="ok"></param> /// <param name="buttonType"></param> public void Show(string msg, ActionFunc ok, ButtonType buttonType) { Show(TextConstant.GENERA_TITILE, msg, ok, null, buttonType, false, DEFAULT_TIME_LEN, 0, 0); }
/// <summary> /// 只显示内容,确定按钮调用方法,只显示一个确定按钮,不显示倒计时 /// </summary> /// <param name="msg"></param> /// <param name="ok"></param> public void Show(string msg, ActionFunc ok) { Show(TextConstant.GENERA_TITILE, msg, ok, null, ButtonType.BT_OK, true, DEFAULT_TIME_LEN, 0, 0); }
/// <summary> /// 只显示内容,确定按钮调用方法,只显示一个确定按钮,不显示倒计时 /// </summary> /// <param name="msg"></param> /// <param name="ok"></param> public void Show(string msg, ActionFunc ok) { //Debug.LogError("========================-1"); Show(TextConstant.GENERA_TITILE, msg, ok, null, ButtonType.BT_OK, true, DEFAULT_TIME_LEN, 0, 0); }
/// <summary> /// The CommandHandlerWithParameter Constructor gets as a parameter /// an ActionFunc action of the action to execute. /// </summary> public CommandHandlerWithParameter(ActionFunc action) { _action = action; }
public Object(ActionObject prototype, ActionFunc constructor) { }