/// <summary> ///检测是否有新功能开启 /// </summary> /// <param name="triggerType">检测触发类型</param> private void CheckNewFuncOpen(CheckWorkFlowData checkData) { if (null == checkData || checkData.CheckTypeMask == 0) { return; } table.GuideTriggerCondiDataBase triggerData = null; foreach (KeyValuePair <uint, GuideDefine.LocalFuncOpenData> pair in m_dic_funcOpenDatas) { if ((m_lst_canDoFuncOpen.Contains(pair.Key) || m_lst_alreadyDoFuncOpen.Contains(pair.Key)) && pair.Value.CloseTriggerId == 0) { continue; } if (pair.Value.AutoOpen) { if (pair.Value.CloseTriggerId != 0 && IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param)) { CloseNewFuncOpen(pair.Key); } else { CompleteNewFuncOpen(new GuideDefine.FuncOpenShowData() { FOT = GuideDefine.FuncOpenType.Base, FuncOpenId = pair.Key, }); } } else { triggerData = GameTableManager.Instance.GetTableItem <table.GuideTriggerCondiDataBase>(pair.Value.TriggerId); if (null == triggerData) { continue; } if (GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, GuideDefine.GuideTriggerType.Always) || GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, triggerData.triggerType) || triggerData.triggerType == (uint)GuideDefine.GuideTriggerType.Always) { if (IsMatchTriggerCondition(pair.Value.TriggerId, checkData.Param)) { if (pair.Value.CloseTriggerId == 0 || !IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param)) { AddNewFuncOpen(pair.Key); } else if (IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param)) { CloseNewFuncOpen(pair.Key); } } } } } }
/// <summary> /// 是否triggerId满足触发条件 /// </summary> /// <param name="triggerId"></param> /// <returns></returns> public bool IsMatchTriggerCondition(uint triggerId, object param = null) { table.GuideTriggerCondiDataBase db = GameTableManager.Instance.GetTableItem <table.GuideTriggerCondiDataBase>(triggerId); bool isMatch = false; if (null != db) { switch (db.triggerType) { case (uint)GuideDefine.GuideTriggerType.Always: isMatch = true; break; case (uint)GuideDefine.GuideTriggerType.Level: { if (DataManager.Instance.PlayerLv >= db.triggerParamType) { isMatch = true; } } break; case (uint)GuideDefine.GuideTriggerType.ChapterEnd: { if (null != param && param is uint && db.triggerParamType == ((uint)param)) { isMatch = true; } } break; case (uint)GuideDefine.GuideTriggerType.Task: { bool canCheck = false; if (null != param && param is GuideDefine.RecycleTriggerGuidePassData) { GuideDefine.RecycleTriggerGuidePassData passData = (GuideDefine.RecycleTriggerGuidePassData)param; if (db.triggerParamType == passData.TaskID) { canCheck = true; } } else { canCheck = true; } if (canCheck) { GuideDefine.TaskSubTriggerType taskSubTriggerType = GetTaskStatus(db.triggerParamType); if ((int)taskSubTriggerType == db.taskTriggerStatus) { isMatch = true; } } } break; case (uint)GuideDefine.GuideTriggerType.Condition: { isMatch = CheckGuideConditionMatch((GuideDefine.ConditonSubTriggerType)db.triggerParamType, db.panelTriggerID); } break; case (uint)GuideDefine.GuideTriggerType.ItemGet: { int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(db.triggerParamType); isMatch = (num > 0); } break; } } return(isMatch); }
/// <summary> /// 检测引导是否可以触发 /// </summary> /// <param name="checkData"></param> private void CheckGuide(CheckWorkFlowData checkData) { if (null == checkData || checkData.CheckTypeMask == 0) { return; } GuideDefine.LocalGuideGroupData tempGroup = null; bool newAdd = false; for (int i = 0, max = m_lstGuideGroups.Count; i < max; i++) { if (!TryGetGuideGroupData(m_lstGuideGroups[i], out tempGroup) || null == tempGroup) { Engine.Utility.Log.Error("GuideManager_Guide->CheckGuide faield,groupData null groupID:{0}", tempGroup.GroupId); continue; } if (!tempGroup.LoopTrigger && (IsGuideGroupComplete(tempGroup.GroupId) || IsTriggerGuideGroup(tempGroup.GroupId))) { continue; } if (null == tempGroup.TriggerIds || tempGroup.TriggerIds.Count == 0) { Engine.Utility.Log.Error("GuideManager_Guide->CheckGuide faield,triggerData error GroupID:{0}", tempGroup.GroupId); continue; } bool matchCheck = false; table.GuideTriggerCondiDataBase tempTriggerData = null; if (!tempGroup.LoopTrigger || null != checkData.Param && checkData.Param is GuideDefine.RecycleTriggerGuidePassData) { for (int k = 0, triggerCount = tempGroup.TriggerIds.Count; k < triggerCount; k++) { tempTriggerData = GameTableManager.Instance.GetTableItem <table.GuideTriggerCondiDataBase>(tempGroup.TriggerIds[k]); if (null == tempTriggerData) { break; } if (GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, GuideDefine.GuideTriggerType.Always) || GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, tempTriggerData.triggerType) || tempTriggerData.triggerType == (uint)GuideDefine.GuideTriggerType.Always) { matchCheck = true; break; } } } bool triggerGuideGroup = true; if (matchCheck) { for (int j = 0, maxCount = tempGroup.TriggerIds.Count; j < maxCount; j++) { if (!IsMatchTriggerCondition(tempGroup.TriggerIds[j], checkData.Param)) { triggerGuideGroup = false; break; } } } else { triggerGuideGroup = false; } if (triggerGuideGroup) { Engine.Utility.Log.LogGroup("WJH", "TriggerGuideGroup:{0}", tempGroup.GroupId); newAdd = true; if (tempGroup.LoopTrigger) { if (IsGuideGroupComplete(tempGroup.GroupId)) { m_lst_completeGroupGuide.Remove(tempGroup.GroupId); } ResetGuideGroup(tempGroup.GroupId); if (null != CurDoRepeatUnConstraintGuide) { ResetGuideGroup(CurDoRepeatUnConstraintGuide.GroupId); } } OnNewGuideGroupTrigger(tempGroup.GroupId); //非强制引导触发就发送服务器保存 if (tempGroup.GType == GuideDefine.GuideType.Unconstrain && !tempGroup.LoopTrigger) { SendGuideComplete(tempGroup.GroupId); } } } if (newAdd) { //执行引导工作流 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW); } }