public void Init(TalkIdConfigData talkIdConfigData, bool hasTips) { ContinueIcon.SetActive(hasTips); ContinueTips.gameObject.SetActive(hasTips); m_talkIdConfigData = talkIdConfigData; if (talkIdConfigData.isTaskTalkMark) { string[] talkStrArry = m_talkIdConfigData.TalkText.Split('|'); int vocattion = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION; foreach (string str in talkStrArry) { string[] talkStr = str.Split('+'); if (vocattion == int.Parse(talkStr [0])) { talkTexts = new string[talkStr.Length - 1]; for (int i = 1; i < talkStr.Length; i++) { talkTexts[i - 1] = talkStr[i]; } break; } } } else { talkTexts = m_talkIdConfigData.TalkText.Split('+'); } m_talkTextIndex = 0; FillTackContent(m_talkIdConfigData.TalkType); AddClientEvent(); }
public void ShowDialogPanel(StroyDialogConfigData item) { m_curDialogData = item; /*if (m_signText == null) * { * m_signText = GameObject.Instantiate(SignText) as GameObject; * m_signText.transform.parent = this.transform; * m_signText.transform.localScale = Vector3.one; * }*/ /*if (StroyLineDataManager.Instance.GetNpcList.ContainsKey(m_curDialogData._NpcID)) * m_curNpcBehaviour = StroyLineDataManager.Instance.GetNpcList[m_curDialogData._NpcID]; * else * { * TraceUtil.Log("指定的NpcID不存在"); * m_curNpcBehaviour = null; * }*/ if (m_dialogPanel != null) { DestroyImmediate(m_dialogPanel); } m_dialogPanel = GameObject.Instantiate(lineDialogList[(int)item._DialogType - 1], this.m_curDialogData._ViewOffset, Quaternion.identity) as GameObject; if (m_dialogPanel != null) { m_dialogPanel.transform.parent = dialogAnchorParent.transform; m_dialogPanel.transform.localPosition = this.m_curDialogData._ViewOffset; m_dialogPanel.transform.localScale = Vector3.one; //jamfing //m_dialogPanel.GetComponentsInChildren<UIAnchor>().ApplyAllItem(P => P.uiCamera = UICamera); TalkIdConfigData talkIdConfigData = new TalkIdConfigData(); talkIdConfigData.DialogPrefab = (DialogBoxType)m_curDialogData._DialogType; talkIdConfigData.TalkType = (StoryTallType)m_curDialogData._NpcOrPlayer; if (talkIdConfigData.TalkType == StoryTallType.NPC) { talkIdConfigData.NPCName = m_curDialogData._NpcName; talkIdConfigData.TalkHead = m_curDialogData.npcIconPrefab; } else { talkIdConfigData.NPCName = PlayerManager.Instance.FindHeroDataModel().Name; } talkIdConfigData.TalkText = m_curDialogData._Content; talkIdConfigData.TalkID = 0; talkIdConfigData.TextPos = "0"; talkIdConfigData.isTaskTalkMark = false; StoryDialogBehaviour storyPanelBehaviour = m_dialogPanel.GetComponent <StoryDialogBehaviour>(); storyPanelBehaviour.StoryGuideFinishAct = () => { SoundManager.Instance.PlaySoundEffect("Sound_Button_TaskStory_Next"); DialogButtonHandle(null); }; storyPanelBehaviour.Init(talkIdConfigData); //m_dialogPanel.GetComponent<StroyLinePanel>().InitDialogPanel(item); } }
/// <summary> /// 根据NewGuideConfig的TalkIds,找到TalkIdConfigData列表 /// </summary> /// <param name="groupIds"></param> /// <returns></returns> public TalkIdConfigData[] GetTalkIdConfigDataByGroup(int[] talkIds) { if (talkIds == null) { return(null); } TalkIdConfigData[] talkIdConfigData = new TalkIdConfigData[talkIds.Length]; for (int i = 0; i < talkIds.Length; i++) { talkIdConfigData[i] = Datas.SingleOrDefault(P => P.TalkID == talkIds[i]); } return(talkIdConfigData); }
public StoryDialogBehaviour Show(GameObject dialogBox, TalkIdConfigData talkIdConfigData) { var storyPanel = NGUITools.AddChild(gameObject, dialogBox); var storyPanelBehaviour = storyPanel.GetComponent <StoryDialogBehaviour>(); storyPanelBehaviour.transform.localPosition = DialogPanelPoint.transform.localPosition; storyPanelBehaviour.Init(talkIdConfigData, false); storyPanelBehaviour.StoryGuideFinishAct = () => { //send event to joystick of TownUI UIEventManager.Instance.TriggerUIEvent(UIEventType.OnNpcTalkCloseEvent, null); SoundManager.Instance.PlaySoundEffect("Sound_Button_TownMain_Leave"); GameObject.Destroy(gameObject); }; return(storyPanelBehaviour); }
public void Init(TalkIdConfigData talkIdConfigData) { Init(talkIdConfigData, true); }
private GameObject MakeNPC(int index, TaskNewConfigData runningTaskConfigData) { GameObject npc = null; StoryPersonInfo storyPersonInfo = runningTaskConfigData.GetStoryPersonInfo(index); if (storyPersonInfo != null && storyPersonInfo.SrotyPersonPrefab != null) { var pos = storyPersonInfo.PersonPos; Quaternion npcDir = Quaternion.Euler(0, storyPersonInfo.StartAngle, 0); npc = GameObjectPool.Instance.AcquireLocal(storyPersonInfo.SrotyPersonPrefab, pos, npcDir); if (npc.GetComponent <NPCBehaviour>() != null) { npc.RemoveComponent <NPCBehaviour>("NPCBehaviour"); } var tasknpcBehaviour = npc.GetComponent <TaskNPCBehaviour>(); if (tasknpcBehaviour == null) { tasknpcBehaviour = npc.AddComponent <TaskNPCBehaviour>(); } tasknpcBehaviour.InitTaskNPCData(storyPersonInfo); tasknpcBehaviour.ShowTaskNpcPanel = (personInfo) => { if (personInfo != null) { var playerBehaviour = (PlayerBehaviour)PlayerManager.Instance.FindHeroEntityModel().Behaviour; if (playerBehaviour.FSMSystem.CurrentStateID == StateID.PlayerFindPathing) { PlayerManager.Instance.HeroAgent.enabled = false; //playerBehaviour.FSMSystem.PerformTransition(Transition.PlayerToIdle); } //显示面板 var taskNpcTalkPanelBehaviour = UI.CreatObjectToNGUI.InstantiateObj(TaskNpcTalkPanelGo, npcTalkParent).GetComponent <TaskNpcTalkPanelBehaviour>(); // NGUITools.AddChild(gameObject, TaskNpcTalkPanelGo).GetComponent<TaskNpcTalkPanelBehaviour>(); int storyBoxStyle = personInfo.StoryBoxStyle - 1; var storyPanel = StoryDialogPrefabs[storyBoxStyle]; TalkIdConfigData talkIdConfigData = new TalkIdConfigData(); talkIdConfigData.DialogPrefab = (DialogBoxType)personInfo.StoryBoxStyle; talkIdConfigData.NPCName = personInfo.PersonNameIDS; talkIdConfigData.TalkHead = personInfo.SrotyPersonHeadPrefab; talkIdConfigData.TalkID = 0; talkIdConfigData.TalkText = personInfo.DialogIDS; talkIdConfigData.TalkType = StoryTallType.NPC; talkIdConfigData.isTaskTalkMark = false; talkIdConfigData.TextPos = "0"; taskNpcTalkPanelBehaviour.Show(storyPanel, talkIdConfigData); if (personInfo.DialogVoiceIDS != "0") { SoundManager.Instance.PlaySoundEffect(personInfo.DialogVoiceIDS); } m_showingNpcTalkPanel = taskNpcTalkPanelBehaviour.gameObject; //send event to joystick of TownUI UIEventManager.Instance.TriggerUIEvent(UIEventType.OnNpcTalkOpenEvent, null); } }; string npcName = storyPersonInfo.PersonNameIDS;// string szNpcTitle = ""; var npcTitleGo = GameObjectPool.Instance.AcquireLocal(NpcTitle, Vector3.zero, Quaternion.identity); npcTitleGo.transform.parent = BattleManager.Instance.UICamera.transform; npcTitleGo.transform.localScale = new Vector3(20, 20, 20); npcTitleGo.GetComponent <NPCTitle>().SetNpcTitle(npcName, szNpcTitle, npc.transform.FindChild("NPCTitle").position); m_NPCTitles.Add(npcTitleGo); } return(npc); }