Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new <see cref="NpcLoader"/> instance.
 /// </summary>
 /// <param name="logger">Logger</param>
 /// <param name="configuration">World server configuration</param>
 /// <param name="defines">Define loader</param>
 /// <param name="texts">Text loader</param>
 /// <param name="dialogs">Dialogs loader</param>
 /// <param name="shops">Shops loader</param>
 public NpcLoader(ILogger <NpcLoader> logger, WorldConfiguration configuration, DefineLoader defines, TextLoader texts, DialogLoader dialogs, ShopLoader shops)
 {
     this._logger        = logger;
     this._npcData       = new Dictionary <string, NpcData>();
     this._configuration = configuration;
     this._defines       = defines;
     this._texts         = texts;
     this._dialogs       = dialogs;
     this._shops         = shops;
 }
    void LoadFirstScenario()
    {
        DialogLoader loader = new DialogLoader(_speakersList);

        _choicesList   = loader._mca;
        _dialoguesList = loader._dialogue;

        OpenDialogue(_dialoguesList[0]);
        //OpenMCA(_choicesList[0]);

        //OpenDialogue(FindDialogueWithID("D31"));
    }
Ejemplo n.º 3
0
        /// <summary> This example shows how to use the DialogLoader manually to have full control over the UI presenter </summary>
        private async Task UseDialogLoaderManually()
        {
            var loader = new DialogLoader <ConfirmCancelDialog>(new ConfirmCancelDialog(caption: "I am a dialog",
                                                                                        message: "I can be awaited in the code, the async or coroutine can wait for the user " +
                                                                                        "to make a decision (select cancel or confirm) before the code continues!"));
            GameObject dialogUi = loader.LoadDialogPrefab(new ConfirmCancelDialog.DefaultPresenter(),
                                                          dialogPrefabName: "Dialogs/DefaultDialog1");

            RootCanvas.GetOrAddRootCanvas().gameObject.AddChild(dialogUi); // Add dialog UI in a canvas
            var waitForUserInputInDialogTask = loader.ShowDialogAsync();

            AssertV2.IsFalse(loader.data.dialogWasConfirmed, "Dialog was already confirmed!");
            await SimulateConfirmButtonClick();

            ConfirmCancelDialog dialog = await waitForUserInputInDialogTask; // Wait until user clicks cancel or confirm

            AssertV2.IsTrue(dialog.dialogWasConfirmed, "Dialog was not confirmed!");
        }
    IEnumerator Initialize()
    {
        if (Controller != null)
        {
            Debug.LogError("Multiple Dialogcontrollers Found");
        }
        Controller = this;
        Clean();
        while (!Character.Loaded)
        {
            yield return(null);
        }
        DialogLoader.Initialize(Application.streamingAssetsPath);
        foreach (var v in Character.CharactersByID.Values)
        {
//			Debug.Log(v.CharacterID + " " + v.CharacterName);
        }
        ChrisTestingDialog();
    }
Ejemplo n.º 5
0
    IEnumerator Load(string fileName, Curriculum cur, DialogLoader loadAction)
    {
        string path = Path.GetStreamAssetsPath(fileName);
        WWW    www  = new WWW(path);

        yield return(www);

        if (www.error != null)
        {
            Debug.Log(www.error);
            yield break;
        }

        string _result = Encoding.UTF8.GetString(www.bytes);

        string[] content = _result.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < content.Length; i++)
        {
            cur.dialogs.Add(loadAction(content[i]));
        }
    }
Ejemplo n.º 6
0
 void Start()
 {
     loader = new DialogLoader();
     loader.loadData();
     //initDialog("Scene1");
 }
Ejemplo n.º 7
0
 void Start()
 {
     dialogLoader = new DialogLoader(questXml);
     LoadMainCharacter();
     LoadQuestGivers();
 }