static public DialogueModel Create() { DialogueModel model = (DialogueModel)ScriptableObject.CreateInstance <DialogueModel>(); model.name = InitialName; return(model); }
public override bool inited() { SolaEngine engine = SolaEngine.getInstance(); HeroMgr hMgr = (HeroMgr)engine.getMgr(typeof(HeroMgr)); List <DialogueInfoConfig> infoCfgs = (List <DialogueInfoConfig>)engine.getCfg(DialogueInfoConfigData.NAME); for (int i = 0; i < infoCfgs.Count; i++) { DialogueInfoConfig infoCfg = infoCfgs[i]; DialogueInfoModel infoModel = new DialogueInfoModel(); infoModel.setCfg(infoCfg, hMgr); int id = infoModel.getId(); _dialogueInfoModels.Add(id, infoModel); } List <DialogueConfig> cfgs = (List <DialogueConfig>)engine.getCfg(DialogueConfigData.NAME); for (int i = 0; i < cfgs.Count; i++) { DialogueConfig cfg = cfgs[i]; DialogueModel model = new DialogueModel(); model.setCfg(cfg, this); int id = model.getId(); _dialogueModels.Add(id, model); } MissionMgr mMgr = (MissionMgr)engine.getMgr(typeof(MissionMgr)); mMgr.initDialogueInfo(this); return(true); }
private void OnEnable() { dialoguelist = new ReorderableList(serializedObject, serializedObject.FindProperty("DialogueItems"), true, true, true, true); dialoguelist.elementHeight = 110f; dialoguelist.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { List <DialogueModel> _dlist = ((Dialogue)dialoguelist.serializedProperty.serializedObject.targetObject).DialogueItems; DialogueModel item = _dlist[index]; EditorGUI.LabelField(new Rect(rect.x, rect.y, 40, EditorGUIUtility.singleLineHeight), "Title: "); item.name = EditorGUI.TextField(new Rect(rect.x + 40, rect.y, rect.width - 40, EditorGUIUtility.singleLineHeight), item.name); EditorGUI.LabelField(new Rect(rect.x, rect.y + 20, 40, EditorGUIUtility.singleLineHeight), "Event: "); item.event_key = EditorGUI.TextField(new Rect(rect.x + 40, rect.y + 20, rect.width - 40, EditorGUIUtility.singleLineHeight), item.event_key); EditorGUI.LabelField(new Rect(rect.x, rect.y + 40, 60, EditorGUIUtility.singleLineHeight), "Message: "); item.message = EditorGUI.TextArea(new Rect(rect.x + 60, rect.y + 40, rect.width - 60, 50), item.message); }; dialoguelist.onAddCallback = (ReorderableList l) => { List <DialogueModel> _dlist = ((Dialogue)dialoguelist.serializedProperty.serializedObject.targetObject).DialogueItems; _dlist.Add(new DialogueModel()); }; dialoguelist.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Dialogue Items"); }; dialoguelist.onRemoveCallback = (ReorderableList l) => { if (EditorUtility.DisplayDialog("Warning1", "Are you sure you want to delete this dialogue entry.", "Yes", "No")) { ReorderableList.defaultBehaviours.DoRemoveButton(l); } }; }
IEnumerator DisplayDialogue(DialogueModel DI) { //Flip the trigger for progression _next = false; Text txtName = GameObject.Find("SDH_txtName").GetComponent <Text>(); Text txtMessage = GameObject.Find("SDH_txtMessage").GetComponent <Text>(); AudioSource sfx = GameObject.Find("SDH_UI_GROUP").GetComponent <AudioSource>(); txtName.text = DI.name; for (int i = 0; i <= DI.message.Length; i++) { txtMessage.text = DI.message.Substring(0, i); sfx.Play(); yield return(new WaitForSeconds(MessageSpeed)); } ; if (DI.event_key.Length > 0) { OnEvent(DI.event_key); } if (_next) //if the player pressed next before the last message was finished rendering.... wait a bit before progressing { yield return(new WaitForSeconds(MinimumWaitSpeed)); } yield return(StartCoroutine(WaitForNext())); }
private void _updateView() { DialogueModel model = _model; if (model.isEnded() == true) { if (onEnded != null) { onEnded(); } return; } DialogueInfoModel infoModel = model.next(); string content = infoModel.getContent(); speakContent.text = content; HeroModel speakerModel = infoModel.getSperkerModel(); speakerName.text = speakerModel.getName(); HeroModel leftModel = infoModel.getLeftModel(); _updateImg(leftModel, leftBodyImg); HeroModel rightModel = infoModel.getRightModel(); _updateImg(rightModel, rightBodyImg); }
private void SetupModels() { _worldModel = new WorldModel(); _dialogueModel = new DialogueModel(_worldModel); _dialogueModel.ParseDialogueFromCSVPathList(ParameterFlag.GoogleSheetPath.Dialogue(persistentDataPath)); }
public bool SetAndShowDialogue(DialogueModel dialogueModel, Func <bool> dialogueCompletedCb) { // No models available. if (dialogueModel == null) { return(false); } dialogueView_.Model = dialogueModel; // Create list of dialogue completion callbacks. List <Func <bool> > dialogueCompletedCbs = new List <Func <bool> >(2); dialogueCompletedCbs.Add(dialogueCompletedCb); dialogueCompletedCbs.Add(() => { flagManager_.SetFlagCompletion(dialogueModel.FlagsToMarkComplete); dialogueView_.SetRenderersEnabled(false); return(true); }); dialogueView_.DialogueCompletedCbs = dialogueCompletedCbs; // Start scrollin'. bool result = dialogueView_.StartDialogueScroll(); if (result) { dialogueView_.SetRenderersEnabled(true); } return(result); }
public static DialogueModel getInstance() { if (_instance == null) { _instance = createFromFile(); } return(_instance); }
public void SetUp(ModelOrganizer modelOrganizer) { this.modelOrganizer = modelOrganizer; this.dialogueModel = modelOrganizer.dialogueModel; this.dialogueProcessor = modelOrganizer.dialogueModel.dialogueProcessor; this.dialogueTypeTable = new Dictionary <string, ProcessDialogueComp>(); this.dialogueTypeTable.Add(EventFlag.DialogueType.TEXT, ProcessTextLog); }
public DisplayTextService(NewTextEventRepository newTextEventRepository, DialogueModel dialogueModel, DialogueContainerMarker dialogueContainerMarker, NameRepository nameRepository) { this.newTextEventRepository = newTextEventRepository ?? throw new ArgumentNullException(nameof(newTextEventRepository)); this.dialogueContainerMarker = dialogueContainerMarker ?? throw new ArgumentNullException(nameof(dialogueContainerMarker)); this.dialogueModel = dialogueModel ?? throw new ArgumentNullException(nameof(dialogueModel)); this.nameRepository = nameRepository ?? throw new ArgumentNullException(nameof(nameRepository)); }
public void SetTalking(DialogueModel model) { if (state_ == PlayerDialogueState.InDialogue) { return; } if (uiManager_.SetAndShowDialogue(model, dialogueCompletedCb_)) { state_ = PlayerDialogueState.InDialogue; } }
private void _onComfirmClicked(GameObject src) { SolaEngine engine = SolaEngine.getInstance(); DialogueModel[] dialogueModels = new DialogueModel[0]; MapModel mapModel = _mapModel; List <HeroModel> monsterModels = mapModel.getRandomMonster(); int monsterSize = monsterModels.Count; BattleInfoModel[] battleInfos = new BattleInfoModel[3]; for (int j = 0; j < battleInfos.Length; j++) { List <BattleHeroModel> rdModels = new List <BattleHeroModel> (); for (int i = 0; i < 3; i++) { int monsterIndex = engine.randomInt(0, monsterSize); HeroModel monster = monsterModels [monsterIndex]; Vector3 pos = new Vector3(); pos.x = engine.randomInt(-200, 200); pos.y = engine.randomInt(-300, 300); pos.z = 0; BattleHeroModel bhModel = new BattleHeroModel(); bhModel.setModel(monster, true, pos); rdModels.Add(bhModel); } BattleInfoModel bInfoModel = new BattleInfoModel(); bInfoModel.mapBattleInfo(0, 3, rdModels); battleInfos[j] = bInfoModel; } MissionModel missionModel = new MissionModel(); missionModel.formatMapBattle(battleInfos, dialogueModels); BattleMgr bMgr = (BattleMgr)engine.getMgr(typeof(BattleMgr)); bMgr.setMissionModel(missionModel); string sceneName = ScenesName.BATTLE; engine.enterScene(sceneName); Destroy(himeScroll.gameObject); Application.LoadLevel(sceneName); }
public void initDialogue(DialogueMgr dMgr) { int dialogueLength = _dialogueModelIds.Length; _dialogueModels = new DialogueModel[dialogueLength]; for (int i = 0; i < dialogueLength; i++) { int dialogueId = _dialogueModelIds [i]; DialogueModel dModel = dMgr.getModel(dialogueId); _dialogueModels [i] = dModel; } }
private void applySaveGame(SaveGame save) { Game.knowledge = save.Knowledge; // Models gameInput = new GameInput(); gameDialogue = new DialogueModel(); levelModel = new LevelModel(LevelLoader.Load(save.LevelName, ll)); characterModel = new CharacterModel(levelModel.Avatar); characterModel.character.X = save.X; characterModel.character.Y = save.Y; // Controllers gameInputController = new GameInputController(); gameInputController.SetModel(gameInput); characterController = new CharacterController(); characterController.SetModel(characterModel); characterController.setInput(gameInput); characterController.SetLevel(levelModel); dialogueController = new DialogueController(); dialogueController.setInput(gameInput); dialogueController.SetModel(gameDialogue); dialogueController.SetLevel(levelModel); levelController = new LevelController(); levelController.SetModel(levelModel); levelController.SetInput(gameInput); levelController.SetDialogue(gameDialogue); buffers = new BooleanCanvas[] { new BooleanCanvas(GetWidth(), GetHeight()), new BooleanCanvas(GetWidth(), GetHeight()) }; bufferIndex = 0; }
private void _onNextRound() { SolaEngine engine = SolaEngine.getInstance(); BattleMgr bMgr = (BattleMgr)engine.getMgr(typeof(BattleMgr)); List <BattleHeroModel> monsters = bMgr.getMonsters(); foreach (BattleHeroModel model in monsters) { _createHeroBall(model); } DialogueModel dialogueModel = bMgr.getDialogueModel(); if (dialogueModel == null) { _nextAction(null); return; } dialogue.gameObject.SetActive(true); dialogue.setDialogueModel(dialogueModel); }
public IActionResult UserDialogue(string login) { var user1 = db.Users.Include("Dialogues").Include("Friends").First(u => u.Login == HttpContext.User.Identity.Name); ViewBag.auth_user_id = user1.Id; ViewBag.auth_user_name = user1.Name; var user2 = db.Users.Include("Dialogues").Include("Friends").First(u => u.Login == login); var user_dialogue = db.Dialogues.Include("Content").FirstOrDefault(d => (d.User1_Id == user1.Id && d.User2_Id == user2.Id) || (d.User1_Id == user2.Id && d.User2_Id == user1.Id)); if (user1.Dialogues == null) { user1.Dialogues = new List <DialogueModel>(); } if (user2.Dialogues == null) { user2.Dialogues = new List <DialogueModel>(); } if (user_dialogue == null) { DialogueModel new_dialogue = new DialogueModel { User1_Id = user1.Id, User2_Id = user2.Id, Content = new List <MessageModel>() }; db.Dialogues.Add(new_dialogue); user1.Dialogues.Add(new_dialogue); user2.Dialogues.Add(new_dialogue); db.Users.Update(user1); db.Users.Update(user2); db.SaveChanges(); return(View(new_dialogue)); } return(View(user_dialogue)); }
public void ReadCSV() { //Read the text from directly from the test.txt file StreamReader reader = new StreamReader(filepath); string firstLine = reader.ReadLine(); string secondLine = reader.ReadLine(); string currCharID = ""; Dialogue currDialogue = null; DialogueModelSO currSO = null; int currDialogueIndex = 0; int currDialogueModelIndex = 0; DialogueModel currDialogueModel = null; Dictionary <string, DialogueModelSO> idToModelSO = new Dictionary <string, DialogueModelSO>(); try { while (true) { if (reader.EndOfStream) { break; } string line = reader.ReadLine(); //Debug.Log(line); string[] splitByComma = line.Split('\t'); // Check char id if (splitByComma[0] != "") { currCharID = splitByComma[0]; if (!idToModelSO.ContainsKey(currCharID)) { idToModelSO.Add(currCharID, ScriptableObject.CreateInstance <DialogueModelSO>()); } currSO = idToModelSO[currCharID]; currSO.DialogueModels = new DialogueModel[0]; } string completionFlag = splitByComma[1]; string modelPreReqFlag = splitByComma[2]; string modelPreReqUnmetFlag = splitByComma[3]; string name = splitByComma[4]; if (OneOfThemIsntEmpty(completionFlag, modelPreReqFlag, modelPreReqUnmetFlag, name)) { // Expand DialogueModels by 1 DialogueModel[] temp = new DialogueModel[currSO.DialogueModels.Length]; currSO.DialogueModels.CopyTo(temp, 0); currSO.DialogueModels = new DialogueModel[currSO.DialogueModels.Length + 1]; temp.CopyTo(currSO.DialogueModels, 0); // Create new currDialogueModelIndex = currSO.DialogueModels.Length - 1; currSO.DialogueModels[currDialogueModelIndex] = new DialogueModel(); currDialogueModel = currSO.DialogueModels[currDialogueModelIndex]; currDialogueModel.Dialogue = new Dialogue[0]; // Convert fields currDialogueModel.FlagsToMarkComplete = FlagsFromString(completionFlag); currDialogueModel.PrereqFlags = FlagsFromString(modelPreReqFlag); currDialogueModel.PrereqUnmetFlags = FlagsFromString(modelPreReqUnmetFlag); currDialogueModel.Name = name; // Audio { string str = splitByComma[23]; float outFloat; if (str != "" && float.TryParse(str, out outFloat)) { currDialogueModel.Speed = outFloat; } } { string str = splitByComma[24]; float outFloat; if (str != "" && float.TryParse(str, out outFloat)) { currDialogueModel.Pitch = outFloat; } } { string str = splitByComma[25]; float outFloat; if (str != "" && float.TryParse(str, out outFloat)) { currDialogueModel.PitchVariance = outFloat; } } { string str = splitByComma[26]; float outFloat; if (str != "" && float.TryParse(str, out outFloat)) { currDialogueModel.Volume = outFloat; } } { string str = splitByComma[27]; float outFloat; if (str != "" && float.TryParse(str, out outFloat)) { currDialogueModel.VolumeVariance = outFloat; } } // Audio Clip string audioStr = splitByComma[28]; if (audioStr == "") { audioStr = "DialogueTick"; } currDialogueModel.TickAudioClip = (AudioClip)AssetDatabase.LoadAssetAtPath("Assets/Audio/" + audioStr, typeof(AudioClip)); } string dialogueText = splitByComma[5]; if (dialogueText == "") { Debug.LogWarning("DIALOGUE TEXT SHOULD NEVER BY EMPTY, OFF BY ONE ERROR?"); } else { Dialogue[] temp = new Dialogue[currDialogueModel.Dialogue.Length]; currDialogueModel.Dialogue.CopyTo(temp, 0); currDialogueModel.Dialogue = new Dialogue[currDialogueModel.Dialogue.Length + 1]; temp.CopyTo(currDialogueModel.Dialogue, 0); // Create new currDialogueIndex = currDialogueModel.Dialogue.Length - 1; currDialogueModel.Dialogue[currDialogueIndex] = new Dialogue(); currDialogue = currDialogueModel.Dialogue[currDialogueIndex]; currDialogue.Text = dialogueText; } currDialogue.PrereqFlag = FlagsFromString(splitByComma[6]); currDialogue.PrereqUnmetFlags = FlagsFromString(splitByComma[7]); string[] optionText = { splitByComma[8], splitByComma[11], splitByComma[14], splitByComma[17], splitByComma[20], }; string[] preReqForOpt = { splitByComma[9], splitByComma[12], splitByComma[15], splitByComma[18], splitByComma[21], }; string[] flagToFlipForOpt = { splitByComma[10], splitByComma[13], splitByComma[16], splitByComma[19], splitByComma[22], }; int optionsSize = CountNotEmpty(optionText); currDialogue.Options = new DialogueOption[optionsSize]; for (int i = 0; i < optionsSize; i++) { currDialogue.Options[i] = new DialogueOption(); DialogueOption opt = currDialogue.Options[i]; opt.DialogueText = optionText[i]; opt.RequiredFlagsForDialogue = FlagsFromString(preReqForOpt[i]); opt.FlagsToMarkAsComplete = FlagsFromString(flagToFlipForOpt[i]); } } } finally { reader.Close(); } foreach (string id in idToModelSO.Keys) { AssetDatabase.CreateAsset(idToModelSO[id], "Assets/DialogueModels/" + id + ".asset"); AssetDatabase.SaveAssets(); } }
public void Display(DialogueModel data) { _nameTextUI.text = data.CharacterName; _bodyTextUI.text = data.Dialogue; _characterPortraitUI.sprite = data.CharacterPortrait; }
public DisplayDialogueService(DialogueRepository dialogueRepository, NewTextEventRepository newTextEventRepository, DialogueModel dialogueModel) { this.dialogueRepository = dialogueRepository ?? throw new ArgumentNullException(nameof(dialogueRepository)); this.newTextEventRepository = newTextEventRepository ?? throw new ArgumentNullException(nameof(newTextEventRepository)); this.dialogueModel = dialogueModel ?? throw new ArgumentNullException(nameof(dialogueModel)); }
internal void SetModel(DialogueModel model) { this.model = model; }
public FinishDialogueService(FinishDialogueEventRepository finishDialogueEventRepository, DialogueModel dialogueModel) { this.dialogueModel = dialogueModel ?? throw new ArgumentNullException(nameof(dialogueModel)); this.finishDialogueEventRepository = finishDialogueEventRepository ?? throw new ArgumentNullException(nameof(finishDialogueEventRepository)); }
/// <summary> /// Sets the dialog model /// </summary> /// <param name="gameDialogue"></param> internal void SetDialogue(DialogueModel gameDialogue) { this.gameDialogue = gameDialogue; }
public void setDialogueModel(DialogueModel model) { _model = model; _updateView(); }
public DialogueContainerController(GameObject gameObject, IServiceProvider serviceProvider, DialogueContainerMarker dialogueContainerMarker) : base(gameObject, serviceProvider) { this.dialogueContainerMarker = dialogueContainerMarker; dialogueModel = DialogueModel.FromGameObject(gameObject); }
void begin() { var ds = DialogueModel.getInstance().dialogues; DialogueBehaviour.onShowDialogue(ds[0]); }
public DialogueProcessor(WorldModel worldModel, DialogueModel dialogueModel) { this.worldModel = worldModel; this.dialogueModel = dialogueModel; }