public void Close()
        {
            this.Character.CloseDialog(this);
            this.Prism.OnDialogClosed(this);

            DialogHandler.SendLeaveDialogMessage(this.Character.Client, this.DialogType);
        }
Exemple #2
0
    /// <summary>
    /// Set template
    /// </summary>
    /// <param name="commandContext">Command context</param>
    /// <param name="appointmentId">Id of the appointment</param>
    /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
    public async Task <bool> SetTemplate(CommandContextContainer commandContext, long appointmentId)
    {
        var success = false;

        var dialogHandler = new DialogHandler(commandContext);

        await using (dialogHandler.ConfigureAwait(false))
        {
            var templateId = await dialogHandler.Run <RaidTemplateSelectionDialogElement, long>()
                             .ConfigureAwait(false);

            if (templateId > 0)
            {
                using (var dbFactory = RepositoryFactory.CreateInstance())
                {
                    success = dbFactory.GetRepository <RaidAppointmentRepository>()
                              .Refresh(obj => obj.Id == appointmentId,
                                       obj => obj.TemplateId = templateId);

                    if (success)
                    {
                        await RefreshAppointment(appointmentId).ConfigureAwait(false);
                    }
                }
            }
        }

        return(success);
    }
Exemple #3
0
        public void Close()
        {
            Character.CloseDialog(this);
            TaxCollector.OnDialogClosed(this);

            DialogHandler.SendLeaveDialogMessage(Character.Client, DialogType);
        }
Exemple #4
0
        private void ClipPolygons()
        {
            if (Polygons.Count != 2)
            {
                throw new InvalidOperationException("Clipping is only possible for two and exactly two polygons");
            }

            if (Clipper == null)
            {
                throw new InvalidOperationException("No polygon clipper set");
            }

            var resultPolygon = Clipper.GetIntersectedPolygon(Polygons[0].Points, Polygons[1].Points);

            if (resultPolygon.IsEmpty)
            {
                DialogHandler?.ShowMessageBox("No overlap");
            }
            else
            {
                Polygons.Clear();
                var color = GenerateRandomColor();
                Polygons.Add(new Polygon
                {
                    Description = "Clipped Polygon",
                    Points      = resultPolygon,
                    StrokeColor = color,
                    FillColor   = Color.FromArgb(128, color)
                });
            }
        }
Exemple #5
0
 public void triggerDialog(string dialogName)
 {
     Debug.Log("Show dialog " + dialogName);
     currentDialog = dialogues.transform.Find(dialogName).GetComponent <DialogHandler>();
     textPanelGameObject.SetActive(true);
     nextDialog();
 }
        private readonly VoiceToText _voiceToText; //Speech recognition from cognative services 

        public MainWindow()
        {
            UiLog.Info("bio info UI started");
            InitializeComponent();
            _messageSide = MessageSide.BioInfoSide;
            Messages = new MessageCollection
            {
                new Message
                {
                    Side = MessageSide.BioInfoSide,
                    Text = "Welcome to the B,M,S, Bio Info A,I Terminal. How may I help you today?"
                }
            };

            _updater = new BioInfoUpdater(); // version checks & updates
            _dialogHandler = new DialogHandler(this); // DialogHandler
            _bioInfoVoice = new SpeechSynthesizer();
            _voiceToText = new VoiceToText();

            DataContext = Messages;
            _scrollViewerScrollToEndAnim = new DoubleAnimation
            {
                Duration = TimeSpan.FromSeconds(1),
                EasingFunction = new SineEase()
            };
            Storyboard.SetTarget(_scrollViewerScrollToEndAnim, this);
            Storyboard.SetTargetProperty(_scrollViewerScrollToEndAnim, new PropertyPath(_verticalOffsetProperty));

            _scrollViewerStoryboard = new Storyboard();
            _scrollViewerStoryboard.Children.Add(_scrollViewerScrollToEndAnim);
            Resources.Add("foo", _scrollViewerStoryboard);
            tbTextInput.Focus();
        }
    void OnDialogHandlerLifetimeEnded(GameObject sender)
    {
        DialogHandler handler    = sender.GetComponent <DialogHandler>();
        DialogSO      nextDialog = handler.dialogSO.nextDialog;


        if (!handler.dialogSO.isWithNext)        // not in the same line
        {
            foreach (var item in dialogContainer)
            {
                item.GetComponent <DialogHandler>().FadeOutTransition();
            }
            dialogContainer.Clear();
        }

        if (nextDialog != null)
        {
            //still on the same character talk
            if (nextDialog.actor == actor)
            {
                Talk(nextDialog);
            }
            else
            {
                handler.OnObjectDestroyed += OnDialogHandlerObjectDestroyed;
            }
        }
    }
Exemple #8
0
        /// <summary>
        /// The on create method.
        /// </summary>
        /// <param name="savedInstanceState">The saved instance state.</param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //Start by calling the base create method.
            base.OnCreate(savedInstanceState);

            //Initialize the essentials with Androids activity and bundle.
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            //Create the dialog handler.
            this.dialogHandler = new DialogHandler(this);

            //Set the context view to the main view.
            this.SetContentView(Resource.Layout.activity_main);

            //Set the tool bar.
            this.SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar));

            //From here on in we need permissions so we need to check and see if we have them.
            //If we do we'll continue, if not we'll wait until the permissions have been resolved.
            if (this.CheckPermissions())
            {
                //Create the location database handler.
                this.locationDatabaseHandler = new LocationDatabaseHandler();

                //Setup the location manager.
                this.SetupLocationManager();

                //Setup the list view.
                this.SetupListView();
            }
        }
        /// <summary>
        /// Generic method that deletes a row from a given table (type) from the database, via HTTP requests.
        /// </summary>
        /// <param name="id">The ID that corresponds to the Booking that needs to be deleted (Comes from the SelectedBooking property in UserBookingsVM).</param>
        /// <param name="uriIdentifier">The string that represents the table (in plural) that gets called in the URL to call HTTP requests. For exampel: api/Bookings, where "Bookings" needs to be specified in the uriIdentifier.</param>
        public static void DeleteFromDatabaseAsync(string uriIdentifier, int id)
        {
            HttpClientHandler handler = new HttpClientHandler();

            handler.UseDefaultCredentials = true;
            using (var client = new HttpClient(handler))
            {
                client.BaseAddress = new Uri(serverUrl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                try
                {
                    var response = client.DeleteAsync("api/" + uriIdentifier + "/" + id).Result;
                }
                catch (ArgumentNullException e)
                {
                    DialogHandler.Dialog(e.Message + "\nPrøv at genstart programmet og prøv derefter igen", "Parameter blev ikke fundet");
                }
                catch (InvalidOperationException e)
                {
                    DialogHandler.Dialog(e.Message + "\nKontant appens administratorer for yderligere hjælp", "Ugyldig aktion");
                }
                catch (HttpRequestException e)
                {
                    DialogHandler.Dialog(e.Message + "\nPrøv igen senere\nTjek eventuelt din forbindelse til internettet", "Ingen kontakt med serveren");
                }
                catch (Exception)
                {
                    DialogHandler.Dialog("Der gik noget galt ved sletning af dette object\nKontakt programmets administratorer for yderligere hjælp", "Noget gik galt");
                }
            }
        }
    override public void StartSpeech()
    {
        if (!quest)
        {
            Debug.LogError("There is no quest set in the inspector for the Conversation Descision.");
            return;
        }

        DialogHandler dh = DialogHandler.Instance;

        if (!dh)
        {
            Debug.LogError("There is no Dialog Handler instance in the current scene/s");
            return;
        }

        if (!quest.IsUnlocked)
        {
            beforeUnlockedConversation.StartSpeech();
        }
        else if (!quest.IsCompleted)
        {
            afterUnlockedConversation.StartSpeech();
        }
        else
        {
            afterCompletedConversation.StartSpeech();
        }
    }
Exemple #11
0
    public void Continue()
    {
        List <Sprite> sp  = new List <Sprite>();
        List <int>    ids = new List <int>();

        for (int i = 0; i < characterSprites.Length; i++)
        {
            if (SaveHandler.GetSave(i) != null)
            {
                sp.Add(characterSprites[i]);
                ids.Add(i);
            }
        }

        SliderHandler.OpenScene(sp, (i) => {
            if (i != -1)
            {
                MapGenerator.saveid = ids[i];
                Sprite[] ff         = new Sprite[1];
                ff[0] = FunfactSprites[Random.Range(0, FunfactSprites.Length)];
                DialogHandler.OpenDialogScene(ff, () => UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene"), 0);
                //UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
            }
            else
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene("Menu");
            }
        });
    }
Exemple #12
0
    /// <summary>
    /// Adding a one time event
    /// </summary>
    /// <param name="commandContext">Command context</param>
    /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
    public async Task AddOneTimeEvent(CommandContextContainer commandContext)
    {
        var data = await DialogHandler.RunForm <CreateOneTimeEventFormData>(commandContext, false)
                   .ConfigureAwait(false);

        if (data != null)
        {
            using (var dbFactory = RepositoryFactory.CreateInstance())
            {
                var appointmentTime = dbFactory.GetRepository <CalendarAppointmentTemplateRepository>()
                                      .GetQuery()
                                      .Where(obj => obj.Id == data.TemplateId)
                                      .Select(obj => obj.AppointmentTime)
                                      .First();

                if (dbFactory.GetRepository <CalendarAppointmentRepository>()
                    .Add(new CalendarAppointmentEntity
                {
                    CalendarAppointmentScheduleId = null,
                    CalendarAppointmentTemplateId = data.TemplateId,
                    TimeStamp = data.Day.Add(appointmentTime)
                }))
                {
                    await _messageBuilder.RefreshMessages(commandContext.Guild.Id)
                    .ConfigureAwait(false);
                }
            }
        }
    }
Exemple #13
0
    public void CheckForUpdate()
    {
        if (DialogHandler.NpcResponse == null)
        {
            return;
        }
        DialogModel.NpcName.text = DialogHandler.DialogNpc != null?DialogHandler.DialogNpc.GetName() : DialogHandler.CustomDialogName;

        DialogModel.NpcText.text = DialogHandler.NpcResponse.DialogText;

        DialogModel.NpcImage.sprite = DialogHandler.DialogNpc != null?GeneralMethods.CreateSprite(DialogHandler.DialogNpc.GetImage()) : DialogHandler.CustomDialogSprite;

        DialogModel.PlayerResponseHolder.transform.DestroyChildren();

        DialogHandler.CheckResponses();
        var        responses   = DialogHandler.GetResponses();
        GameObject firstButton = null;

        foreach (var response in responses)
        {
            var go = Instantiate(PlayerResponsePrefab, Vector3.zero, Quaternion.identity) as GameObject;
            go.transform.SetParent(DialogModel.PlayerResponseHolder.transform, false);
            var playerResponseModel = go.GetComponent <PlayerResponseModel>();
            playerResponseModel.Init(response, response.DialogText);
            firstButton = firstButton ?? go;
        }

        EventSystem.SetSelectedGameObject(firstButton);
    }
Exemple #14
0
 public MainWindow()
 {
     _dialogHandler     = new DialogHandler();
     _resEdit           = new ResourceEdit();
     _entityContentList = new List <EntityContent>();
     InitializeComponent();
 }
Exemple #15
0
 void Start()
 {
     sliderHandler = GameObject.Find("SliderHandler").GetComponent <SliderHandler>();
     dialogHandler = GameObject.Find("DialogBorder").GetComponent <DialogHandler>();
     computerAI    = GameObject.Find("ComputerAI").GetComponent <ComputerAI>();
     diceHandler   = GameObject.Find("DicePanel").GetComponent <DiceHandler>();
     buttonHandler = GameObject.Find("ButtonHandler").GetComponent <ButtonHandler>();
 }
Exemple #16
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.Log("Multiple PropertyPurchaseHandler. Something went wrong");
     }
     instance = this;
 }
Exemple #17
0
    /// <summary>
    /// Managing the templates
    /// </summary>
    /// <param name="commandContext">Command context</param>
    /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
    public async Task RunAssistantAsync(CommandContextContainer commandContext)
    {
        bool repeat;

        do
        {
            repeat = await DialogHandler.Run <CalendarTemplateSetupDialogElement, bool>(commandContext).ConfigureAwait(false);
        }while (repeat);
    }
 void Awake()
 {
     playerMovement   = GetComponent <Movement>();
     dialogController = GetComponent <DialogHandler>();
     westFacing       = new Vector2(-1, 0);
     northFacing      = new Vector2(0, 1);
     eastFacing       = new Vector2(1, 0);
     southFacing      = new Vector2(0, -1);
 }
    public static void AddDestroyAction(DialogHandler handler, UnityAction action)
    {
        if (handler == null)
        {
            return;
        }

        handler.destroyedAction += action;
    }
Exemple #20
0
    public static void OpenDialogScene(IList <Sprite> sprites, Action then, float timeout = 0, bool clickAllowed = true)
    {
        UnityEngine.SceneManagement.SceneManager.LoadScene("DialogScene");
        DialogHandler dh = GameObject.FindObjectOfType <DialogHandler>();

        crossSceneAfter   = then;
        crossSceneSprites = sprites;
        crossSceneTimeout = timeout;
        allowClick        = clickAllowed;
    }
Exemple #21
0
    /// <summary>
    /// Editing a existing account
    /// </summary>
    /// <param name="commandContext">Command context</param>
    /// <param name="name">Name</param>
    /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
    private async Task Edit(CommandContextContainer commandContext, string name)
    {
        bool repeat;

        do
        {
            repeat = await DialogHandler.Run <AccountEditDialogElement, bool>(commandContext, dialogContext => dialogContext.SetValue("AccountName", name))
                     .ConfigureAwait(false);
        }while (repeat);
    }
    void OnDialogHandlerObjectDestroyed(GameObject sender)
    {
        DialogHandler handler    = sender.GetComponent <DialogHandler>();
        DialogSO      nextDialog = handler.dialogSO.nextDialog;

        if (nextDialog != null)
        {
            ActorSingleton.shared(nextDialog.actor.ToString()).Talk(nextDialog);
        }
    }
Exemple #23
0
 public void addDosis(float dosis)
 {
     maxDosis    = map.width * map.height * 65;
     this.dosis += dosis;
     if (this.dosis >= maxDosis)
     {
         MapGenerator m = GetComponent <MapGenerator>();
         SaveHandler.SaveGame(MapGenerator.saveid, m.width, m.height, m.cells);
         DialogHandler.OpenDialogScene(TreatmentFinishedSprites, () => UnityEngine.SceneManagement.SceneManager.LoadScene("Menu"), 3000, false);
     }
 }
Exemple #24
0
    public void startDialog(DialogHandler handler, string initialText)
    {
        currentHandler = handler;

        ActiveDialog = true;
        if (!hasStartedDialog)
        {
            hasStartedDialog = true;
            initiateDialog(initialText);
        }
    }
Exemple #25
0
    private string fullText        = "";   //the full text to show.

    private void Awake()
    {
        if (singleton_ && singleton_ != this)
        {
            Destroy(this);
        }
        else
        {
            singleton_ = this;
        }
    }
Exemple #26
0
    void Start()
    {
        player      = manager.getPlayer();
        cardObjects = new List <GameObject>();

        dialogHandler = selectDialog.GetComponentInChildren <DialogHandler>();
        dialogHandler.setActionManager(this);

        skipButton.GetComponent <Button>().onClick.AddListener(skip);

        showSpecialCards();
    }
Exemple #27
0
    public void ShowTestDialog()
    {
        var handler = DialogHandler.ShowDialog(
            "タイトル",
            "恥の多い生涯を送って来ました。自分には、人間の生活というものが、見当つかないのです。自分は東北の田舎に生れましたので、汽車をはじめて見たのは、よほど大きくなってからでした。自分は停車場のブリッジを、上って、降りて、そうしてそれが線路をまたぎ越えるために造られたものだという事には全然気づかず、ただそれは停車場の構内を外国の遊戯場みたいに、複雑に楽しく、ハイカラにするためにのみ、設備せられてあるものだ",
            "失格",
            "合格");

        DialogHandler.SetNoAction(handler, () => { Debug.Log("失格"); });
        DialogHandler.SetYesAction(handler, () => { Debug.Log("合格"); });
        DialogHandler.AddDestroyAction(handler, () => { Debug.Log("人類滅亡"); });
    }
Exemple #28
0
 public void AddExporter(IExporter exporter)
 {
     OnBeginDialogs         += new DialogsHandler(exporter.BeginDialogs);
     OnBeginDialog          += new DialogHandler(exporter.BeginDialog);
     OnBeginMessage         += new AbsMessageHandler(exporter.BeginMessage);
     OnExportMessage        += new MessageHandler(exporter.ExportMessage);
     OnExportMessageService += new MessageServiceHandler(exporter.ExportMessageService);
     OnEndMessage           += new AbsMessageHandler(exporter.EndMessage);
     OnEndDialog            += new DialogHandler(exporter.EndDialog);
     OnEndDialogs           += new DialogsHandler(exporter.EndDialogs);
     OnAbort += new Action(exporter.Abort);
 }
        public ManageDataSetViewModel(IDataSetManager dataSetManager, DialogHandler dialogHandler)
        {
            _dataSetManager = dataSetManager;
            _dialogHandler  = dialogHandler;

            AddCommand               = new RelayCommand(async() => await Add());
            CloneDatasetCommand      = new RelayCommand(async() => await Add(SelectedDataSet));
            ImportDocumentCommand    = new RelayCommand(ImportJson <object>);
            ImportTagCommand         = new RelayCommand(ImportJson <Tag>);
            ImportDocumentCsvCommand = new RelayCommand(ImportCsv <object>);
            ImportTagCsvCommand      = new RelayCommand(ImportCsv <Tag>);
            DoubleClickCommand       = new RelayCommand(() =>
            {
                if (SelectedDataSet != null)
                {
                    Messenger.Default.Send(new UpdateMessage(UpdateType.OpenNewTab,
                                                             new HeaderedItemViewModel(SelectedDataSet.Name + " -Data",
                                                                                       new ManageData {
                        DataContext = new ManageDataViewModel(SelectedDataSet, _dialogHandler)
                    }, true)));
                }
            });
            DeleteCommand = new RelayCommand(Delete);
            RenameCommand = new RelayCommand(Rename);
            LoadedCommand = new RelayCommand(async() =>
            {
                try
                {
                    Mouse.SetCursor(Cursors.Arrow);
                    if (_loadedFirst)
                    {
                        _loadedFirst = false;
                        await _dialogHandler.ShowProgress(null, async() =>
                        {
                            DispatcherHelper.CheckBeginInvokeOnUI(() => DataSets.Clear());
                            var response = await _dataSetManager.GetDataSetsAsync();
                            if (ResponseValidator.Validate(response))
                            {
                                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                {
                                    response.ResponseObject.ToList().ForEach(ds => DataSets.Add(ds));
                                });
                            }
                        });
                    }
                }
                catch (Exception exception)
                {
                    Messenger.Default.Send(exception);
                }
            });
        }
Exemple #30
0
    private void Awake()
    {
        player = this.gameObject;
        GameObject gh = GameObject.Find("GameHandler");

        cam              = transform.Find("PlayerCamera").gameObject.GetComponent <Camera>();
        gameHandler      = gh.GetComponent <GameHandler>();
        guiHandler       = gh.GetComponent <GUIHandler>();
        dialogHandler    = gh.GetComponent <DialogHandler>();
        crosshair        = GameObject.Find("Crosshair").GetComponent <Image>();
        crosshair.sprite = crosshairImage[0];
        inventory        = GetComponent <Inventory>();
    }
Exemple #31
0
    //    public static SunDialogue[] SunDialogues;
    // Use this for initialization
    void Start()
    {
        if (Instance != null)
        {
            Debug.LogError("More than one Dialog Handler in scene!");
            return;
        }
        Instance = this;

        DialogUI = gameObject.GetComponentsInChildren<Image>();

        NPCDialogues = FindObjectsOfType(typeof(NPCDialogue)) as NPCDialogue[];

        //SunDialogues = FindObjectsOfType(typeof(SunDialogue)) as SunDialogue[];

        ToggleUI(false);
    }
Exemple #32
0
	void Start () {
		handler = GameObject.Find("DialogHandler").GetComponent<DialogHandler>();
	}