public bool ConditionCheck(FSM pFSM) { if (transitionWithTime == null) { if (arrTransParam.Count == 0) { UDL.LogWarning("전이 조건이 없습니다. // FSM ID : " + pFSM.fsmID.ToString() + " / " + "CurrentState : " + pFSM.GetCurState().eID + " / OwnerState : " + "/ TransID : " + eTransID.ToString(), FSM.logOption, FSM.warningLoglv); return(false); } } bCheckCondResult = true; // &연산 true&true=true / true&false=false / false&false = false if (transitionWithTime != null) { bCheckCondResult &= transitionWithTime.TimeConditionChk(); } foreach (TransCondWithParam t in arrTransParam) { bCheckCondResult &= t.ConditionCheck(pFSM); } return(bCheckCondResult); }
void OnChangeUserStory(TRANS_ID transId, STATE_ID stateId, STATE_ID preStateId) { UDL.Log("UserStory current State : " + stateId); curUSState.Value = stateId.ToString(); FSM_Layer.Inst.SetInt_NoCondChk(FSM_LAYER_ID.MainUI, TRANS_PARAM_ID.INT_USERSTORY_STATE, (int)stateId); FSM_Layer.Inst.SetInt_NoCondChk(FSM_LAYER_ID.MainUI, TRANS_PARAM_ID.INT_USERSTORY_PRE_STATE, (int)preStateId); FSM_Layer.Inst.SetTrigger(FSM_LAYER_ID.MainUI, TRANS_PARAM_ID.TRIGGER_CHECK_ANY_CONDITION); switch (stateId) { case STATE_ID.USMain_BtnSample: FSM_Layer.Inst.ChangeFSM(FSM_LAYER_ID.UserStory, FSM_ID.USBtn); break; case STATE_ID.USMain_ScrollSample: FSM_Layer.Inst.ChangeFSM(FSM_LAYER_ID.UserStory, FSM_ID.USScroll); break; case STATE_ID.USMain_TimeSample: FSM_Layer.Inst.ChangeFSM(FSM_LAYER_ID.UserStory, FSM_ID.USTime); break; case STATE_ID.USMain_ExitConfirm: ExitConfirm(); break; default: break; } UserDataManager.Inst.AddExp(); }
public void ChangeFSM(FSM_LAYER_ID eLayer, FSM_ID fsmID) { layerNum = (int)eLayer; if (!CurLayerCheck(eLayer)) { UDL.LogWarning("Fail Change Layer : " + eLayer, nLogOption, warningLoglv); return; } if (!dicFSM_EachLayer[layerNum].TryGetValue(fsmID, out tFSMBuffer)) { UDL.LogWarning(eLayer + " 에 " + fsmID + " 가 등록되어 있지 않습니다", nLogOption, warningLoglv); return; } if (CurLayerCheck(eLayer)) { layerFSM_Buffer[layerNum] = curFSM_EachLayer[layerNum].fsmID; curFSM_EachLayer[layerNum].Pause(); UnRegisterToFSM_ChangeLayerState(eLayer); curFSM_EachLayer[layerNum] = dicFSM_EachLayer[layerNum][fsmID]; RegisterToFSM_ChangeLayerState(eLayer); curFSM_EachLayer[layerNum].Resume(); } UDL.Log("(ChangeFSM) curFSM : " + curFSM_EachLayer[layerNum].fsmID.ToString(), nLogOption, logLv); }
private void OnDestroy() { if (SceneChecker.IS_NOT_USING_FSM_SCENE) { return; } State pState; for (int idx = 0; idx < arrSwitch.Length; idx++) { pState = FSM_Layer.Inst.GetState(arrSwitch[idx].layer, arrSwitch[idx].fsm, arrSwitch[idx].state); #if UNITY_EDITOR if (pState == null) { UDL.LogError(gameObject.name + " // " + arrSwitch[idx].state, nLogOption); } #endif pState.EventStart_Before -= OnStartBefore; pState.EventStart -= OnStart; pState.EventStart_After1 -= OnStartAfter1; pState.EventStart_After2 -= OnStartAfter2; pState.EventEnd_Before -= OnEndBefore; pState.EventEnd -= OnEnd; pState.EventEnd_After -= OnEndAfter; pState.EventPause -= OnPause; pState.EventResume -= OnResume; } }
public void AddTransition(TransitionCondition value) { TransitionCondition[] tempArr; if (arrTransitionList == null) { tempArr = new TransitionCondition[1]; tempArr[0] = value; } else { for (int idx = 0; idx < arrTransitionList.Length; idx++) { if (value.eTransID != 0 && arrTransitionList[idx].eTransID == value.eTransID) { UDL.LogWarning("동일한 전이 ID를 추가합니다", FSM.logOption, FSM.warningLoglv); } } tempArr = new TransitionCondition[arrTransitionList.Length + 1]; for (int i = 0; i < arrTransitionList.Length; i++) { tempArr[i] = arrTransitionList[i]; } tempArr[arrTransitionList.Length] = value; } arrTransitionList = tempArr; value.SetOwnerForTimeCond(this); }
bool CurStateTransitionChk() { UDL.Log(fsmID + " CurStateTransitionChk", logOption, FSM.logLv); if (curState.arrTransitionList == null || curState.arrTransitionList.Length == 0) { UDL.LogWarning(fsmID + " No Transition List in curState", logOption, FSM.warningLoglv); } if (curState.arrTransitionList != null) { for (int idx = 0; idx < curState.arrTransitionList.Length; idx++) { if (curState.arrTransitionList[idx].ConditionCheck(this)) { UDL.Log(fsmID + " ConditionCheck Pass : "******"/ " + curState.eID, logOption, FSM.logLv); TransitionStart(curState.arrTransitionList[idx].eTransID, curState.arrTransitionList[idx].nextStateID); return(true); } } } return(false); }
bool BoolTypeConditionChk(bool value, FSM pFSM) { if (!pFSM.dicBoolParam.TryGetValue(m_uiParamID, out bParamBuffer)) { UDL.LogError(m_uiParamID.ToString() + ". 등록되지 않은 Trans_Param_ID 입니다. ", FSM.logOption, FSM.errorLoglv); } switch (m_eCompOperator) { case TransitionComparisonOperator.LESS: case TransitionComparisonOperator.GREATER: case TransitionComparisonOperator.OVER: case TransitionComparisonOperator.UNDER: UDL.LogWarning("bool 변수에 잘못된 조건연산자를 지정했음", FSM.logOption, FSM.warningLoglv); return(false); case TransitionComparisonOperator.EQUALS: if (bParamBuffer == value) { return(true); } break; case TransitionComparisonOperator.NOTEQUAL: if (bParamBuffer != value) { return(true); } break; } return(false); }
void ReactionProcess(ReactionID ss, int excuteId) { if (ss != ReactionID.None) { UDL.Log(gameObject.name + " ReactionProcess : " + ss + " // " + excuteId, nLogOption, isDebug, nLogLevel); } switch (ss) { case ReactionID.None: break; case ReactionID.Show: iReaction.Show(); break; case ReactionID.Hide: iReaction.Hide(); break; case ReactionID.Excute: iReaction.Excute(excuteId); break; case ReactionID.Change: iReaction.Change(); break; } }
public IEnumerator PopupTest() { AsyncOperation async = SceneManager.LoadSceneAsync("WorkingScene"); while (!async.isDone) { yield return(null); } GameObject.Instantiate(Resources.Load("UIPrefab/Overlay Canvas")); yield return(null); bool popupShow = true; System.Action <bool> callback = (result) => { UDL.LogWarning("Callback"); popupShow = false; }; EMC_MAIN.Inst.NoticeEventOccurrence(EMC_CODE.POPUP, "Title", "Content Message", 0, callback); while (popupShow) { yield return(null); } }
/// <summary> /// 用户数据编码 /// </summary> /// <param name="UDC">短信内容</param> /// <param name="UDH">用户数据头</param> /// <param name="DCS">编码方案</param> /// <returns>编码后的字符串</returns> /// <remarks> /// L:用户数据长度,长度1 /// M:用户数据,长度0~140 /// </remarks> private static String UDEncoding(Object UDC, PDUUDH[] UDH = null, EnumDCS DCS = EnumDCS.UCS2) { // 用户数据头编码 Int32 UDHL; String Header = UDHEncoding(UDH, out UDHL); // 用户数据内容编码 Int32 UDCL; String Body; if (UDC is String) { // 7-Bit编码或UCS2编码 Body = UDCEncoding(UDC as String, out UDCL, UDHL, DCS); } else { // 8-Bit编码 Body = UDCEncoding(UDC as Byte[], out UDCL); } // 用户数据区长度 Int32 UDL; if (DCS == EnumDCS.BIT7) { // 7-Bit编码 UDL = (UDHL * 8 + 6) / 7 + UDCL; // 字符数 } else { // UCS2编码或者8-Bit编码 UDL = UDHL + UDCL; // 字节数 } return(UDL.ToString("X2") + Header + Body); }
bool FloatTypeCondtionChk(float value, FSM pFSM) { if (!pFSM.dicFloatParam.TryGetValue(m_uiParamID, out fParamBuffer)) { UDL.LogError(m_uiParamID.ToString() + ". 등록되지 않은 Trans_Param_ID 입니다. ", FSM.logOption, FSM.errorLoglv); } switch (m_eCompOperator) { case TransitionComparisonOperator.EQUALS: UDL.LogWarning("float 변수는 Equal 조건을 만족시키지 못 할 위험이 있습니다. ", FSM.logOption, FSM.warningLoglv); if (fParamBuffer == value) { return(true); } break; case TransitionComparisonOperator.NOTEQUAL: UDL.LogWarning("float 변수는 NotEqual 조건을 사용하면 정확하지 않을 위험이 있습니다. ", FSM.logOption, FSM.warningLoglv); if (fParamBuffer != value) { return(true); } break; case TransitionComparisonOperator.GREATER: if (fParamBuffer >= value) { return(true); } break; case TransitionComparisonOperator.LESS: if (fParamBuffer <= value) { return(true); } break; case TransitionComparisonOperator.OVER: if (fParamBuffer > value) { return(true); } break; case TransitionComparisonOperator.UNDER: if (fParamBuffer < value) { return(true); } break; } return(false); }
void OwnerStart(TRANS_ID transID, STATE_ID stateid, STATE_ID preStateID) { fStartTime = UnityEngine.Time.realtimeSinceStartup; fPauseTIme = 0; fPauseInterval = 0; UDL.LogWarning("TransCondWithTime Owner Start // current :" + stateid.ToString() + " / " + fStartTime.ToString() + " / pre : " + preStateID + " / transID : " + transID + " / hashcode : " + this.GetHashCode(), FSM.logOption, FSM.warningLoglv); }
private void OnEnable() { if (hideFirstFrame) { StartCoroutine(DelayOneFrame()); } UDL.Log(gameObject.name + " OnEnable", nLogOption, isDebug, nLogLevel); }
private void OnDisable() { if (hideFirstFrame) { transform.localScale = Vector3.zero; } UDL.Log(gameObject.name + " Disable", nLogOption, isDebug, nLogLevel); }
public override void Show() { if (!gameObject.activeSelf) { gameObject.SetActive(true); } UDL.Log(gameObject.name + " Show after activeSelf : " + gameObject.activeSelf, nLogOption, bIsDebug, nLogLevel); }
public void SetOwnerState(State OwnerState) { UDL.Log("SetOwnerState : " + OwnerState.eID + " / " + this.GetHashCode(), FSM.logOption, FSM.logLv); OwnerState.EventStart += OwnerStart; OwnerState.EventEnd += OwnerEnd; OwnerState.EventPause += OwnerPause; OwnerState.EventResume += OwnerResume; }
/// <param name="args">0:titleText, 1:contentText, 2:btnType, 3:callback</param> void OnPopup(params object[] args) { if (args == null || args.Length < 2) { UDL.LogError("No Title Msg. No content Msg"); return; } if (args[0].GetType() != typeof(string)) { UDL.LogError("0 argument must string"); return; } if (args[1].GetType() != typeof(string)) { UDL.LogError("1 argument must string"); return; } title.text = (string)args[0]; msg.text = (string)args[1]; int btnType = 0; if (args.Length >= 3) { if (args[2].GetType() != typeof(int)) { UDL.LogError("2 argument must int"); return; } btnType = (int)args[2]; if (btnType < 0 || btnType > 1) { UDL.LogError("2 argument range 0 < btnType < 2"); return; } SetBtnType(btnType); if (args.Length > 3) { if (args[3].GetType() != typeof(Action <bool>)) { UDL.LogError("3 argument must Action<bool>"); return; } callback = (Action <bool>)args[3]; } } gameObject.SetActive(true); }
void OnChangePopupUI(TRANS_ID transId, STATE_ID stateId, STATE_ID preStateId) { UDL.Log("PopupUI current State : " + stateId); switch (stateId) { default: break; } }
public void OnBeforeDisable() { UDL.Log(gameObject.name + " OnBeforeDisable ", nLogOption, bIsDebug, nLogLevel); if (uAnim != null) { aniStateBuffer = uAnim.GetCurrentAnimatorStateInfo(0).shortNameHash; LogCurAnimInfo("OnBeforeDisable"); } }
public float GetParamFloat(TRANS_PARAM_ID param_id) { if (!dicFloatParam.TryGetValue(param_id, out fParamBuffer)) { UDL.LogError(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.errorLoglv); return(0); } return(fParamBuffer); }
public bool GetParamBool(TRANS_PARAM_ID param_id) { if (!dicBoolParam.TryGetValue(param_id, out bParamBuffer)) { UDL.LogError(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.errorLoglv); return(false); } return(bParamBuffer); }
bool IntTypeCondtionChk(int value, FSM pFSM) { if (!pFSM.dicIntParam.TryGetValue(m_uiParamID, out nParamBuffer)) { UDL.LogError(m_uiParamID.ToString() + ". 등록되지 않은 Trans_Param_ID 입니다. ", FSM.logOption, FSM.errorLoglv); } switch (m_eCompOperator) { case TransitionComparisonOperator.EQUALS: if (nParamBuffer == value) { return(true); } break; case TransitionComparisonOperator.NOTEQUAL: if (nParamBuffer != value) { return(true); } break; case TransitionComparisonOperator.GREATER: if (nParamBuffer >= value) { return(true); } break; case TransitionComparisonOperator.LESS: if (nParamBuffer <= value) { return(true); } break; case TransitionComparisonOperator.OVER: if (nParamBuffer > value) { return(true); } break; case TransitionComparisonOperator.UNDER: if (nParamBuffer < value) { return(true); } break; } return(false); }
public override void Hide() { BroadcastMessage("OnBeforeDisable", SendMessageOptions.DontRequireReceiver); if (gameObject.activeSelf) { gameObject.SetActive(false); } UDL.Log(gameObject.name + " Hide after activeSelf : " + gameObject.activeSelf, nLogOption, bIsDebug, nLogLevel); }
public void SetBool_NoCondChk(TRANS_PARAM_ID param_id, bool value) { if (!dicBoolParam.TryGetValue(param_id, out bParamBuffer)) { UDL.LogWarning(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.warningLoglv); } else { dicBoolParam[param_id] = value; } }
bool CurLayerCheck(FSM_LAYER_ID eLayer) { if (curFSM_EachLayer[(int)eLayer] == null) { UDL.LogWarning(eLayer + " 지정한 레이어에 FSM이 지정되 있지 않음", nLogOption, warningLoglv); return(false); } else { return(true); } }
public override void Excute(int _nExcuteId) { if (uAnim != null && uAnim.isActiveAndEnabled) { UDL.LogWarning(gameObject.name + " Excute ID : " + _nExcuteId, nLogOption, bIsDebug, nLogWarningLevel); aniStateBuffer = -1; uAnim.SetInteger("idx", _nExcuteId); uAnim.SetTrigger("go"); LogCurAnimInfo("Excute"); } }
public State GetState(STATE_ID stateID) { UDL.Log("GetState : " + stateID.ToString() + " / dicStateList.Count : " + dicStateList.Count.ToString(), logOption, FSM.logLv); if (dicStateList.TryGetValue(stateID, out tStateBuffer)) { return(tStateBuffer); } UDL.LogError("등록되지 않은 상태를 호출했음 " + stateID, logOption, FSM.errorLoglv); return(null); }
public void SetFloat(TRANS_PARAM_ID param_id, float value) { if (!dicFloatParam.TryGetValue(param_id, out fParamBuffer)) { UDL.LogWarning(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.warningLoglv); return; } dicFloatParam[param_id] = value; RequestTransitionChk(); }
public bool TimeConditionChk() { if (UnityEngine.Time.realtimeSinceStartup - fStartTime - fPauseInterval >= m_fConditionTimeValue) { UDL.LogWarning("CurrentTime : " + Time.realtimeSinceStartup + " // State start time : " + fStartTime + " // pause interval : " + fPauseInterval + " // condition time : " + m_fConditionTimeValue, FSM.logOption, FSM.warningLoglv); return(true); } return(false); }
void TransitionStart(TRANS_ID transParamID, STATE_ID nextStateID) { triggerID = TRANS_PARAM_ID.TRIGGER_NONE; if (!IsActive) { UDL.Log(fsmID + " Refuse TransitionStart", logOption, FSM.logLv); return; } if (nextStateID == STATE_ID.HistoryBack) { HistoryBack(); return; } if (!dicStateList.TryGetValue(nextStateID, out tStateBuffer)) { UDL.LogError(nextStateID.ToString() + " 등록된 씬이 아님!", logOption, FSM.errorLoglv); return; } calldepth++; if (calldepth > 1) { UDL.LogWarning(fsmID + " FSM Call Depth is : " + calldepth + " // 재귀호출구조가 되면서 EvnetStateChange callback이 현재 상태만을 매개변수로 역순으로 반복호출됩니다. ", logOption, FSM.warningLoglv); } UDL.Log(fsmID + " Transition Start// " + curState.eID + " -> " + dicStateList[nextStateID].eID + " // " + transParamID, logOption, FSM.logLv); STATE_ID preStateID = curState.eID; curState.End(transParamID, nextStateID); if (!curState.NoHistory) { history.Push(curState.eID); } curState = dicStateList[nextStateID]; curState.Start(transParamID, preStateID); if (EventStateChange != null) { EventStateChange(transParamID, curState.eID, preStateID); } calldepth--; }