void Awake() { Debug.Assert(instance == null); instance = this; dialogueVeil.SetActive(false); dialogueUI.SetActive(false); }
void Awake() { dialogueData = GetComponent <DialogueData>(); dialogueUi = GameObject.Find("DialogueOutput").GetComponent <DialogueUI>(); dialoguePlayer = GameObject.Find("PlayerCharacter").GetComponent <DialoguePlayer>(); allDoorsInScene = FindObjectsOfType <DialogueSceneDoor>(); }
private void OnEnable() { this.titleContent = new GUIContent("对话预览"); mTitleStyle.fontSize = 18; mTitleStyle.alignment = TextAnchor.UpperLeft; mTitleStyle.padding = new RectOffset(5, 5, 5, 5); mTitleStyle.normal.textColor = TinaX.Core.XEditorStyleDefine.Color_Text_Normal; mContentStyle.fontSize = 16; mContentStyle.alignment = TextAnchor.MiddleLeft; mContentStyle.padding = new RectOffset(5, 5, 5, 5); mContentStyle.normal.textColor = TinaX.Core.XEditorStyleDefine.Color_Text_Normal; //初始化播放器 mPlayer = new DialoguePlayer(); mPlayer.OnChoose = (data) => { mTitle = data.GetTitle(); mContent = ""; mSpeaker = data.GetSpeaker(); //按钮列表 var chooseList = data.GetChooseList(); List <Button> btns = new List <Button>(); foreach (var item in chooseList) { btns.Add(new Button() { Title = item, callback = () => { mPlayer.NextWithString(item); } }); } mButtonGroup = btns.ToArray(); mCurStatus = GUIStatus.choose; }; mPlayer.OnContent = (data) => { mTitle = ""; mContent = data.GetContent(); mSpeaker = data.GetSpeaker(); mCurStatus = GUIStatus.content; }; mPlayer.OnFinish = (data) => { mCurStatus = GUIStatus.finish; mContent = data; }; }
private void Awake() { m_BtnBg.onClick.AddListener(() => { m_Player.Next(); }); m_ChooseRoot.gameObject.SetActive(false); m_Player = new DialoguePlayer(); m_Player.OnDoChoose = (choose) => { m_ChooseRoot.gameObject.SetActive(true); m_ChooseBtnRoot.transform.RemoveAllChild(); m_TxtTitle.text = choose.GetTitle(); m_TxtContent.text = choose.GetContent(); var chooses = choose.Chooses; for (int i = 0; i < chooses.Count; i++) { var choosePicked = chooses[i]; var go = Instantiate(m_BtnPrefab.gameObject, Vector3.zero, Quaternion.identity, m_ChooseBtnRoot.transform); var chooseBtn = go.GetComponent <DramaChooseBtn>(); chooseBtn.Txt.text = chooses[i].Title; chooseBtn.Btn.onClick.AddListener(() => { m_Player.PickChoose(choosePicked); m_ChooseBtnRoot.transform.RemoveAllChild(); m_ChooseRoot.gameObject.SetActive(false); }); } }; m_Player.OnDoContent = (content) => { m_TxtTitle.text = content.GetTitle(); m_TxtContent.text = content.GetContent(); }; m_Player.OnDoFinish = (finish) => { m_TxtTitle.text = ""; m_TxtContent.text = ""; gameObject.SetActive(false); }; m_Player.PlayDialogue(m_BluePrint); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); DialoguePlayer player = (DialoguePlayer)target; EditorGUILayout.Space(); string[] options = AssetDatabase.FindAssets("t:DialogueConversation").Select(o => AssetDatabase.GUIDToAssetPath(o)).ToArray(); selectedConversationIndex = EditorGUILayout.Popup("Conversation: ", selectedConversationIndex, options); if (GUILayout.Button("Load")) { player.conversation = (DialogueConversation)AssetDatabase.LoadAssetAtPath(options[selectedConversationIndex], typeof(DialogueConversation)); } }
private void OnDestroy() { //释放播放器 mPlayer = null; }
private void Awake() { tracker = FindObjectOfType <ObjectTracker>(); sRenderer = GetComponent <SpriteRenderer>(); dialoguePlayer = FindObjectOfType <DialoguePlayer>(); }
private void Start() { dialoguePlayer = FindObjectOfType <DialoguePlayer>(); }