예제 #1
0
        private void CheckPlayVoice(DBDialogContent.DialogContentInfo dialogContentInfo)
        {
            if (mDialogInfo == null || mDialogInfo.mType != DBDialog.EDialogType.IST_DialogBox)
            {
                return;
            }

            if (dialogContentInfo == null || dialogContentInfo.mObjectType != DBDialogContent.EDialogObjectType.DOT_Other)
            {
                return;
            }

            if (mDialogInfo.mId == mPlayingVoiceDialogId)
            {
                return;
            }

            if (mOtherPlayer == null || !mOtherPlayer.IsNpc())
            {
                return;
            }

            NpcPlayer npc = (NpcPlayer)mOtherPlayer;

            if (npc != null)
            {
                mPlayingVoiceDialogId = mDialogInfo.mId;
                npc.PlayRandomVoice();
            }
        }
예제 #2
0
        void ShowDialogWindow()
        {
            if (mDialogInfo == null)
            {
                return;
            }

            UIManager uiMgr = UIManager.GetInstance();

            DBDialogContent dbDialogContent     = DBManager.GetInstance().GetDB <DBDialogContent>();
            uint            dialogContentInfoId = mDialogInfo.mDialogs[(int)mDialogIndex];

            DBDialogContent.DialogContentInfo dialogContentInfo = dbDialogContent.GetDialogContentInfo(dialogContentInfoId);
            if (dialogContentInfo != null)
            {
                uint dialogNum = (uint)mDialogInfo.mDialogs.Count;
                CheckPlayVoice(dialogContentInfo);
                if (mDialogIndex < (dialogNum - 1)) // 对话还没完
                {
                    uiMgr.ShowSysWindow("UIDialogWindow", mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, false);
                }
                else
                {
                    uiMgr.ShowSysWindow("UIDialogWindow", mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, true);
                }
            }
            else
            {
                GameDebug.LogError("Can not find dialog content info by id " + dialogContentInfoId);
            }
        }
예제 #3
0
        void UpdateDialogWindowInfo()
        {
            if (mDialogInfo == null)
            {
                return;
            }

            DBDialogContent dbDialogContent     = DBManager.GetInstance().GetDB <DBDialogContent>();
            uint            dialogContentInfoId = mDialogInfo.mDialogs[(int)mDialogIndex];

            DBDialogContent.DialogContentInfo dialogContentInfo = dbDialogContent.GetDialogContentInfo(dialogContentInfoId);
            if (dialogContentInfo != null)
            {
                uint dialogNum = (uint)mDialogInfo.mDialogs.Count;
                CheckPlayVoice(dialogContentInfo);
                if (mDialogIndex < (dialogNum - 1)) // 对话还没完
                {
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_UPDATE_DIALOG_WINDOW_INFO,
                                                           new CEventObjectArgs(mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, false));
                }
                else
                {
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_UPDATE_DIALOG_WINDOW_INFO,
                                                           new CEventObjectArgs(mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, true));
                }
            }
            else
            {
                GameDebug.LogError("Can not find dialog content info by id " + dialogContentInfoId);
            }
        }
예제 #4
0
        bool TriggerBubbleImpl(uint dialogIndex, DBDialog.DialogInfo dialogInfo)
        {
            if (dialogIndex >= dialogInfo.mDialogs.Count)
            {
                return(false);
            }

            List <uint>     dialogs         = dialogInfo.mDialogs;
            DBDialogContent dbDialogContent = DBManager.GetInstance().GetDB <DBDialogContent>();

            DBDialogContent.DialogContentInfo dialogContentInfo = dbDialogContent.GetDialogContentInfo(dialogs[(int)dialogIndex]);

            Actor actor = null;

            if (dialogContentInfo.mObjectType == DBDialogContent.EDialogObjectType.DOT_Player)
            {
                actor = Game.GetInstance().GetLocalPlayer();
            }
            else if (dialogContentInfo.mObjectType == DBDialogContent.EDialogObjectType.DOT_NPC)
            {
                actor = NpcManager.Instance.GetNpcByNpcId(dialogContentInfo.mObjectParam);
            }
            else if (dialogContentInfo.mObjectType == DBDialogContent.EDialogObjectType.DOT_Monster)
            {
                //List<Actor> actors = InstanceHelper.GetMonstersByMonsterGroupId((int)dialogContentInfo.mObjectParam);
                //if (actors != null && actors.Count > 0)
                //{
                //    actor = actors[0];
                //}
            }
            if (actor == null)
            {
                GameDebug.LogError("TriggerBubble error, actor is null!!!");
                return(false);
            }
            actor.ShowDialogBubble(dialogContentInfo.mWords, (int)dialogContentInfo.mLength);


            Utils.Timer bubbleTimer;
            if (mBubbleTimers.TryGetValue(dialogInfo.mId, out bubbleTimer))
            {
                if (bubbleTimer != null)
                {
                    bubbleTimer.Destroy();
                    bubbleTimer = null;
                }
                mBubbleTimers.Remove(dialogInfo.mId);
            }
            bubbleTimer = new Utils.Timer(1000 * (int)dialogContentInfo.mLength, false, 1000 * dialogContentInfo.mLength, GoToNextBubble, dialogInfo);
            mBubbleTimers.Add(dialogInfo.mId, bubbleTimer);

            return(true);
        }