/// <summary> /// 初始化组件 /// </summary> /// <param name="endAction"></param> /// <param name="roleSpeakAeforeAction"></param> /// <param name="roleSpeakRearAction"></param> /// <param name="roleDialogueBoxCloseAction"></param> public virtual void Initial(Action endAction, Action <ChapterDialogueTextDefine> roleSpeakAeforeAction = null, Action <ChapterDialogueTextDefine> roleSpeakRearAction = null, Action <ChapterDialogueTextDefine> roleDialogueBoxCloseAction = null, Action <ChapterDialogueTextDefine> roleBoxCloseAeforeAction = null) { base.Initial(endAction, roleSpeakAeforeAction, roleSpeakRearAction, roleDialogueBoxCloseAction, roleBoxCloseAeforeAction); _bgButton = GetComponent <Button>(); _bgButton.onClick.RemoveAllListeners(); _bgButton.onClick.AddListener(() => { ClickBtn(); }); _multiDialogueData = new MultiDialogueData(_dialogueData._Data.ID); for (int i = 0; i < _roles.Count; i++) { if (!_roleDic.ContainsKey(_roles[i]._RoleId)) { _roleDic.Add(_roles[i]._RoleId, _roles[i]); } } foreach (var item in _multiDialogueData._DataDic) { if (_roleDic.ContainsKey(item.Key)) { _roleDic[item.Key].Initial(item.Value); } } Debug.Log("对话初始化完毕"); }
/// <summary> /// 设置初始id 和主角id,聊天对象id /// </summary> /// <param name="starId">初始对话id</param> /// <param name="protagonistID">主角id</param> /// <param name="anotherId">聊天对象id</param> public void SetInitialData(int starId, int protagonistID, int anotherId) { _startDialogueId = starId; _protagonistID = protagonistID; _anotherId = anotherId; SetProtagonistName(); _dialogueData = new SingleDialogueData(_startDialogueId); _multiDialogueData = new MultiDialogueData(_startDialogueId); Show(); }