public TutorialStepInfo ForcedProgressStep( int _stepIdx) { // check achievement count if( CheckActionAchievementCount() == false) return null; if( CheckCompleteAchievement() == false) return null; nowStep = listStep[_stepIdx]; nowStepIdx = _stepIdx; return nowStep; }
public TutorialStepInfo ProcessMessage( QuestTutorialMsgInfo _msgInfo) { // 시작 메시지를 찾는다 if( listStartStepMsg.Count > 0) { if( _msgInfo.message == listStartStepMsg[0].msg) { nowStep = listStep[0]; nowStepIdx = 0; return nowStep; } } // check next msg int count = 0; foreach ( TutorialStepInfo step in listStep) { if( _msgInfo.message == step.nextMsg) { if( _msgInfo.message == QuestTutorialMsg.TAP_INVEN_ITEM) { if( !listTapInvenItemID.Contains( _msgInfo.value)) return null; } else if( _msgInfo.message == QuestTutorialMsg.USE_ITEM) { if( !listUseItemID.Contains( _msgInfo.value)) return null; } else if( _msgInfo.message == QuestTutorialMsg.TAP_DESIGNATION) { if( !( listSelectDesgination.Contains( _msgInfo.value))) return null; } nowStep = listStep[count + 1]; nowStepIdx = count + 1; return nowStep; } count++; } return null; }
public TutorialStepInfo ForcedStartStepZero() { // check have Start Step Msg if( listStartStepMsg.Count >= 1) return null; nowStep = listStep[0]; nowStepIdx = 0; return nowStep; }
public void LoadFromXml( XmlNode _node) { XmlNodeList childNodes = _node.ChildNodes; foreach ( XmlNode node in childNodes) { if( node.Name == TutorialConditionBase.NodeName) { TutorialConditionBase condBase = new TutorialConditionBase(); condBase.LoadFromXml( node); if( condBase.type == TutorialConditionType.NPC || condBase.type == TutorialConditionType.QUEST_ID || condBase.type == TutorialConditionType.SKILL_NOT_HAVE) { TutorialConditionUseInt cond = new TutorialConditionUseInt(); cond.LoadFromXml( node); listCondition.Add( cond); if( cond.type == TutorialConditionType.QUEST_ID) listQuestID.Add( cond.value); } else if( condBase.type == TutorialConditionType.NOT_COMPLETE_ACHIEVEMENT) { TutorialConditionUseInt cond = new TutorialConditionUseInt(); cond.LoadFromXml( node); listConditionAchievement.Add( cond); } else if( condBase.type == TutorialConditionType.NOT_ACTION_ACHIEVEMENT_OVER_COUNT) { TutorialConditionUseInt cond = new TutorialConditionUseInt(); cond.LoadFromXml( node); listConditionAchievementCount.Add( cond); } else if( condBase.type == TutorialConditionType.NOT_COMPLETE_ACHIEVEMENT_UPDATE) { TutorialConditionUseInt conditionAchievementUpdate = new TutorialConditionUseInt(); conditionAchievementUpdate.LoadFromXml( node); listConditionAchievementUpdate.Add( conditionAchievementUpdate); } else if( condBase.type == TutorialConditionType.START_STEP_MSG) { TutorialConditionStartStep startStepCon = new TutorialConditionStartStep(); startStepCon.LoadFromXml( node); listStartStepMsg.Add( startStepCon); } else if( condBase.type == TutorialConditionType.NOT_RESTART_STEP_AFTER_CLOSE) { notRestartAfterClose = true; } } else if( node.Name == TutorialStepInfo.NodeName) { TutorialStepInfo step = new TutorialStepInfo(); step.LoadFromXml( node); // tap inven item if( step.nextMsg == QuestTutorialMsg.TAP_INVEN_ITEM) { foreach ( int id in step.listOption) { if( id != 0) listTapInvenItemID.Add( id); } } if( step.nextMsg == QuestTutorialMsg.USE_ITEM) { foreach ( int id in step.listOption) { if( id != 0) listUseItemID.Add( id); } } if( step.nextMsg == QuestTutorialMsg.TAP_DESIGNATION) { foreach ( int id in step.listOption) { if( id != 0) listSelectDesgination.Add( id); } } if( !listNextStepMsg.Contains( step.nextMsg)) listNextStepMsg.Add( step.nextMsg); listStep.Add( step); } else if( node.Name == "Close") { if( node.Attributes["Msg"] != null) listCloseMsg.Add( ( QuestTutorialMsg)Enum.Parse( typeof( QuestTutorialMsg), node.Attributes["Msg"].Value, true)); } else if( node.Name == "Update") { if( node.Attributes["Msg"] != null) listUpdateMsg.Add( ( QuestTutorialMsg)Enum.Parse( typeof( QuestTutorialMsg), node.Attributes["Msg"].Value, true)); } } }
public void ProcessQuestTutorialMsg( QuestTutorialMsgInfo _msgInfo) { // accept quest if( _msgInfo.message == QuestTutorialMsg.ACCEPT_QUEST) { foreach ( QuestTutorial tutorial in listTutorial) { if( tutorial.CanProcess( _msgInfo) == true) { nowSelectTutorial = tutorial; TutorialStepInfo stepInfo = nowSelectTutorial.ForcedStartStepZero(); if( stepInfo != null) { nowStep = stepInfo; ShowFinger( stepInfo); return; } } } } if( nowSelectTutorial == null) return; // clear Quest if( _msgInfo.message == QuestTutorialMsg.CLEAR_QUEST || _msgInfo.message == QuestTutorialMsg.DROP_QUEST) { nowStep = null; if( _msgInfo.message == QuestTutorialMsg.DROP_QUEST) { if( nowSelectTutorial.notProcessMsg == true) nowSelectTutorial.notProcessMsg = false; } nowSelectTutorial = null; HideFinger(); } else if( nowSelectTutorial != null) { // close Msg if( nowSelectTutorial.listCloseMsg.Contains( _msgInfo.message)) { Debug.LogWarning( "Close accept this msg = "+_msgInfo.message); nowStep = null; HideFinger(); // check restart step if( nowSelectTutorial.listStartStepMsg.Count == 0 && nowSelectTutorial.notRestartAfterClose == false) { TutorialStepInfo stepInfo = nowSelectTutorial.ForcedProgressStep( 0); if( stepInfo != null) { nowStep = stepInfo; ShowFinger( stepInfo); } } } else if( nowSelectTutorial.listUpdateMsg.Contains( _msgInfo.message)) { nowStep = nowSelectTutorial.ProcessUpdateMessage(); if( nowStep != null) ShowFinger( nowStep); } else { if( nowSelectTutorial.CanProcess( _msgInfo) == false) return; TutorialStepInfo step = nowSelectTutorial.ProcessMessage( _msgInfo); if( step == null) return; if( step.type == TutorialStepType.HIDE || step.type == TutorialStepType.LAST_HIDE) { nowStep = step; HideFinger(); if( step.type == TutorialStepType.LAST_HIDE) nowSelectTutorial.notProcessMsg = true; } else { // check not process ----> last hide if( nowSelectTutorial.notProcessMsg == false) { nowStep = step; if( nowStep.type == TutorialStepType.OVER_INVEN_ITEM) SetInvenPageExistThisItem( nowStep.listOption[0]); ShowFinger( step); } } } } }
public static GameObject FindTargetObject( TutorialStepInfo _step) { string[] splits; if( _step.type == TutorialStepType.OVER_QUEST_LIST) { Transform tm = AsHUDController.Instance.m_NpcMenu.m_questScroll.transform.GetChild( 0).GetChild( _step.listOption[0]); if( tm != null) return tm.gameObject; else return null; } else if( _step.type == TutorialStepType.OVER_LISTITEM_OUT_HUD) { if( AsSocialManager.Instance == null) return null; if( AsSocialManager.Instance.IsOpenSocialDlg() == false) return null; if( AsSocialManager.Instance.SocialUI.IsOpenSocailStoreDlg == false) return null; IUIListObject findItem = AsSocialManager.Instance.SocialUI.m_SocialStoreDlg.GetStoreItemInfo( _step.listOption[0]); if( findItem == null) return null; else return findItem.gameObject; } else if( _step.type == TutorialStepType.OVER_DESIGNATION_LIST || _step.type == TutorialStepType.OVER_SOCIALHISTORY_LIST) { GameObject findObject = GetGameObjectOutHUD( _step.uiPath, out splits); if( findObject != null) { Transform tm = findObject.transform.FindChild( _step.uiPath.Replace( splits[0] + "/", "")); if( tm == null) return null; UIScrollList scroll = tm.gameObject.GetComponentInChildren<UIScrollList>(); if( scroll == null) return null; if( _step.type == TutorialStepType.OVER_DESIGNATION_LIST) { int idx = AsDesignationManager.Instance.GetDesignationIdx( _step.listOption[0]); if( idx == -1) return null; int realIdx = scroll.Count - idx - 1; IUIListObject listItem = scroll.GetItem( realIdx); if( listItem == null) return null; scroll.ScrollToItem( realIdx, 0.0f); return listItem.gameObject; } else if( _step.type == TutorialStepType.OVER_SOCIALHISTORY_LIST) { List<IUIListObject> listItem = scroll.GetItems(); foreach ( IUIListObject item in listItem) { AsGameHistoryItem history = item.gameObject.GetComponentInChildren<AsGameHistoryItem>(); if( history.m_FaceBookBtn.controlIsEnabled == true) return history.m_FaceBookBtn.gameObject; } return null; } } else { return null; } } else if( _step.type == TutorialStepType.OVER_KILLSHOP) { if( false == AsHudDlgMgr.Instance.IsOpenedSkillshop) return null; AsSkillshopDlg dlg = AsHudDlgMgr.Instance.skillShopObj.GetComponentInChildren<AsSkillshopDlg>(); Debug.Assert( null != dlg); UIScrollList list = dlg.tab.panels[( int)eShopTabState.ChoiceTab].getList(); if( list.transform.GetChild( 0).childCount > 0) { Transform tm = list.transform.GetChild( 0).GetChild( _step.listOption[0]); if( tm != null) return tm.gameObject; else return null; } } else if( _step.type == TutorialStepType.OVER_INVEN_ITEM) { GameObject findObject = null; Transform tm = GameObject.Find( _step.uiPath).transform; if( tm != null) findObject = tm.gameObject; else return null; RealItem findItem = null; foreach ( int itemID in _step.listOption) { RealItem item = ItemMgr.HadItemManagement.Inven.GetRealItem( itemID); if( item != null) { findItem = item; break; } } if( findItem != null) { UIInvenDlg invenDlg = findObject.GetComponent<UIInvenDlg>(); if( invenDlg != null) { if( invenDlg.page == null) return null; int itemPage = ( int)( ( float)( findItem.getSlot - Inventory.useInvenSlotBeginIndex) / ( float)Inventory.useInvenSlotNumInPage); if( itemPage == invenDlg.page.curPage) { int itemSlot = ( findItem.getSlot - Inventory.useInvenSlotBeginIndex) % Inventory.useInvenSlotNumInPage; return invenDlg.invenslots[itemSlot].gameObject; } else { return null; } } else return null; } } else if( _step.type == TutorialStepType.OVER_OBJECT || _step.type == TutorialStepType.OVER_OBJECT_UPDATE) { Transform tm = AsHUDController.Instance.transform.FindChild( _step.uiPath); if( tm != null) return tm.gameObject; else return null; } else if( _step.type == TutorialStepType.OVER_OBJECT_OUT_HUD || _step.type == TutorialStepType.OVER_OBJECT_OUT_HUD_UPDATE) { GameObject findObject = GetGameObjectOutHUD( _step.uiPath, out splits); if (findObject != null) { string path = _step.uiPath.Remove(0, splits[0].Length + 1); Transform tm = findObject.transform.FindChild(path); if (tm == null) return null; else return tm.gameObject; } else { Debug.Log("Not found = " + _step.uiPath); return null; } } return null; }
public void Reset() { firstConnect = false; attendBonus = false; HideFinger(); nowSelectTutorial = null; if( nowStep != null) { nowStep.objectTarget = null; nowStep = null; } }
void ShowFinger( TutorialStepInfo _step) { GameObject findTarget = FindTargetObject( _step); if( findTarget != null) { ShowFingerCore( _step.fingerType, _step.doubleTouch, findTarget); //if( nowStep.type == TutorialStepType.OVER_OBJECT_UPDATE || nowStep.type == TutorialStepType.OVER_OBJECT_OUT_HUD_UPDATE || // nowStep.type == TutorialStepType.OVER_DESIGNATION_LIST || nowStep.type == TutorialStepType.OVER_INVEN_ITEM || // nowStep.type == TutorialStepType.OVER_KILLSHOP) nowStep.objectTarget = findTarget; } else { HideFinger(); } }