Example #1
0
        public void Play(string uid)
        {
            if (!dialogObjs.ContainsKey(uid))
            {
                DialogLocate.Log.LogError("播放对话失败>>>>没有此对话", uid);
                return;
            }
            DialogObj dialog = dialogObjs[uid];

            if (DialogLocate.Config.GetDialogStepModel(dialog.Model, dialog.CurrStep, out var model))
            {
                //执行函数
                if (model.onPlayFuncs != null && model.onPlayFuncs.Count > 0)
                {
                    for (int i = 0; i < model.onPlayFuncs.Count; i++)
                    {
                        model.onPlayFuncs[i].Execute(dialog, dialog.CurrStep);
                    }
                }
                //执行表现
                DialogLocate.Display.OnPlayDialog(dialog, model);
            }
            else
            {
                Close(uid);
            }
        }
Example #2
0
        public string CreateDialog(AddDialogInfo addDialogInfo)
        {
            string uid = CalcDialogUid(addDialogInfo);

            if (dialogObjs.ContainsKey(uid))
            {
                DialogLocate.Log.LogError("创建对话失败>>>>Uid重复", uid);
                return("");
            }
            if (DialogLocate.Config.GetDialogModel(addDialogInfo.DialogType, addDialogInfo.DialogId, out var model))
            {
                List <int> actorUids = GetDialogActorUids(addDialogInfo, model);
                for (int i = 0; i < actorUids.Count; i++)
                {
                    if (speakIngActors.Contains(actorUids[i]))
                    {
                        DialogLocate.Log.Log("创建对话失败>>>>对话需要的演员正在对话", uid, actorUids[i]);
                        return("");
                    }
                }
                DialogObj dialogObj = new DialogObj(uid, addDialogInfo.DialogType, addDialogInfo.DialogId, addDialogInfo.DialogStep, model);
                dialogObj.SetSponsor(addDialogInfo.Sponsor);
                dialogObj.SetTargets(addDialogInfo.Targets);
                dialogObjs.Add(uid, dialogObj);
                DialogLocate.Display.OnCreateDialog(dialogObj, actorUids);
                return(uid);
            }
            else
            {
                DialogLocate.Log.LogError("创建对话失败>>>>没有配置", uid);
                return("");
            }
        }
Example #3
0
        public void PlayNext(string uid)
        {
            if (!dialogObjs.ContainsKey(uid))
            {
                DialogLocate.Log.LogError("播放下一步对话失败>>>>没有此对话", uid);
                return;
            }
            DialogObj dialog = dialogObjs[uid];

            dialog.SetStep(dialog.CurrStep + 1);
            Play(uid);
        }
Example #4
0
        public void ClickDispose(string uid, int disposeId)
        {
            if (!dialogObjs.ContainsKey(uid))
            {
                DialogLocate.Log.LogError("点击选项失败>>>>没有此对话", uid);
                return;
            }
            DialogObj dialog = dialogObjs[uid];

            if (DialogLocate.Config.GetDialogStepModel(dialog.Model, dialog.CurrStep, out var model))
            {
                if (DialogLocate.Config.GetDialogDisposeModel(model, disposeId, out var disposeModel))
                {
                    //返回判断
                    if (disposeModel.backToStep > 0)
                    {
                        if (DialogLocate.Config.GetDialogStepModel(dialog.Model, disposeModel.backToStep, out var nextStepModel))
                        {
                            dialog.SetStep(disposeModel.backToStep);
                            Play(uid);
                        }
                        else
                        {
                            DialogLocate.Log.LogError("点击选项失败>>>>返回步骤出错", uid, disposeModel.backToStep);
                            return;
                        }
                    }
                    else
                    {
                        Close(uid);
                    }
                    //执行函数
                    if (disposeModel.onChooseFuncs != null && disposeModel.onChooseFuncs.Count > 0)
                    {
                        for (int i = 0; i < disposeModel.onChooseFuncs.Count; i++)
                        {
                            disposeModel.onChooseFuncs[i].Execute(dialog, disposeId);
                        }
                    }
                    //执行表现
                    DialogLocate.Display.OnClickDispose(dialog, disposeId);
                }
                else
                {
                    DialogLocate.Log.LogError("点击选项失败>>>>没有此选项", uid, disposeId);
                }
            }
            else
            {
                DialogLocate.Log.LogError("点击选项失败>>>>没有此步骤", uid, dialog.CurrStep);
            }
        }
Example #5
0
        public void Close(string uid)
        {
            if (!dialogObjs.ContainsKey(uid))
            {
                DialogLocate.Log.LogError("关闭对话失败>>>>没有此对话", uid);
                return;
            }
            DialogObj dialog = dialogObjs[uid];

            dialogObjs.Remove(uid);
            //执行表现
            DialogLocate.Display.OnCloseDialog(dialog);
        }
Example #6
0
 /// <summary>
 /// 执行函数
 /// </summary>
 public abstract void Execute(DialogObj dialog, int disposeId);
Example #7
0
 /// <summary>
 /// 执行函数
 /// </summary>
 public abstract void Execute(DialogObj dialog, int step);