Exemplo n.º 1
0
        /// <summary>
        ///     Loads integer mapping of NodeIDs.
        /// </summary>
        /// <returns></returns>
        public static Dictionary <int, long> LoadMappedDict()
        {
            var fileName          = $"{Parameters.DictFolder}mapped.dict.bin";
            var reverseMappedDict = BinaryIO.ReadFromBinaryFile <Dictionary <int, long> >(fileName);

            return(reverseMappedDict);
        }
Exemplo n.º 2
0
        private void LoadDialogues()
        {
            string filePath = Application.dataPath + editorDialogueSavePath + "dialogueeditor.data";
            DialogueEditorSaveData dialogueEditorSaveData = BinaryIO.ReadFromBinaryFile <DialogueEditorSaveData>(filePath);

            if (dialogueEditorSaveData == null)
            {
                return;
            }

            dialogues = dialogueEditorSaveData.Deserialize(NodeConnectionPointClicked, RemoveNode, NodeActorIDChanged, RemoveNodeConnection);
            ChangeCurrentDialogue(dialogues.Count - 1);
        }
Exemplo n.º 3
0
        public void OpenDialogue(int id, Type dialogueUIHandlerType, bool poolDialogue, Action onDialogueClosed, params DialogueActor[] actors)
        {
            if (!(dialogueUIHandlerType.IsSubclassOf(typeof(DialogueUIHandler))))
            {
                return;
            }

            DialogueUIHandler dialogueUIHandler = null;

            // Find the object of the right type in "dialogueUIPrefabs" array.
            foreach (DialogueUIHandler dialogueUI in dialogueUIHanlders)
            {
                if (dialogueUI.GetType() == dialogueUIHandlerType)
                {
                    dialogueUIHandler = dialogueUI;
                }
            }
            if (dialogueUIHandler == null)
            {
                return;
            }

            Dialogue dialogue = GetPooledDialogue(id);

            // If Dialogue is not pooled, then load from file.
            if (dialogue == null)
            {
                string filePath = GetDialogueFilePath(id);
                dialogue = BinaryIO.ReadFromBinaryFile <Dialogue>(filePath);
                if (dialogue == null)
                {
                    return;
                }
            }
            // Pool dialogue if "poolDialogue" is marked true.
            if (poolDialogue)
            {
                AddPooledDialogue(dialogue);
            }

            // Open dialogue in DialogueUIHandler.
            dialogueUIHandler.OpenDialogue(dialogue, onDialogueClosed, actors);
        }