void InitializeSubmodules()
 {
     textSpeedSettings = new TextSpeedSettings(textSettings.textSpeed, textSettings.higherTextSpeed);
     textWrapper       = new TSTTextWrapper(this, textSettings.linesPerTextbox);
     textDisplayer     = new TextDisplayer(this, textWrapper.wrappedText, textSettings, sfxPlayer,
                                           textSettings.audioSample);
 }
Exemple #2
0
        public TextTargetView(Target target, TextDisplayer displayer, Point2F drawPoint) : base(target)
        {
            _displayer   = displayer;
            leftTop      = drawPoint;
            _columnWidth = displayer.ColumnWidth;
            _rects       = CalculateRects();
            activeRect   = CalculateActiveRect();
            _texts       = new List <string>();
            TargetTrack track = (TargetTrack)target;

            _texts.Add(track.TrackId.ToString());
            _texts.Add(track.Az.ToString("0.0"));
            _texts.Add(track.El.ToString("0.0"));
            _texts.Add(track.Dis.ToString("0.0"));
            _texts.Add(track.Speed.ToString("0.0"));

            _borderBrush = displayer.Canvas.CreateSolidColorBrush(new ColorF(1, 1, 1));
            DWriteFactory dw = DWriteFactory.CreateFactory();

            _inactiveTextFormat = dw.CreateTextFormat("宋体", 20);
            _inactiveTextFormat.TextAlignment = TextAlignment.Center;
            _inactiveBrush = displayer.Canvas.CreateSolidColorBrush(new ColorF(0, 1, 1));

            _activeBrush = displayer.Canvas.CreateSolidColorBrush(new ColorF(0, 0, 1));
        }
    public void ShowWarning(string warnMsg, int duration)
    {
        warning.SetActive(true);
        TextDisplayer warnText = warning.GetComponent <TextDisplayer>();

        warnText.DisplayText("warning", warnMsg);

        DoIn(new EventBase(() => { warnText.ClearText();
                                   warning.SetActive(false); }), duration);
    }
Exemple #4
0
    void Start()
    {
        audio = GetComponent <AudioSource>();
        audio.PlayOneShot(a_spawn);

        health        = 100;
        controlPrefix = "p" + playerNum + "_";
        rb            = GetComponent <Rigidbody2D>();

        textDisplayer = new TextDisplayer(text);

        spawnPlayers();
    }
    public override void Notify(Exception e)
    {
        Debug.Log("Popup now displayed... invisibly");
        Debug.Log(e);

        // FIXME
        warning.SetActive(true);
        TextDisplayer warnText = warning.GetComponent <TextDisplayer>();

        warnText.DisplayText("warning", e.Message);


        DoIn(new EventBase(() => { warnText.ClearText();
                                   warning.SetActive(false); }), 5000);
    }
Exemple #6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ovd        = new OverViewDisplayer(panel1);
     svd        = new SideViewDisplayer(pnl_sideView);
     controller = new SystemController(ovd);
     controller.ConnectDataSource("UDP", MakeIpAddressAndPortString());    //默认链接UDP数据
     //dgvd = new DataGridViewDisplayer(pnl_gridView);
     textDisplayer = new TextDisplayer(pnl_gridView);
     ovd.RegisterObserver(this);
     svd.Distance         = 500;
     ovd.Distance         = 5000;
     btn_WaveGate.Enabled = false;
     MouseWheel          += OnMouseWheel;
     ShowTrackHeight();
     rb_5.Checked = true;
 }
Exemple #7
0
        /// <summary>
        /// Main program method that orchestrates all the individual services.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="runOptions"></param>
        static void Run(ServiceProvider serviceProvider, RunOptions runOptions)
        {
            var logger = serviceProvider?.GetService <ILogger>();

            try
            {
                logger.Log(LogType.Trace, "Running monthly payslip program..");


                //Create an employ with a salary
                logger.Log(LogType.Trace, "Creating an employee");
                var employee = new Employee()
                {
                    Name         = runOptions.FullName,
                    AnnualSalary = runOptions.GrossSalary
                };


                // Create a Tax Processor factory
                logger.Log(LogType.Trace, "Creating a tax processing factory.");
                var taxProcessorFactory = new TaxProcessorFactory(serviceProvider);

                // Create a type of taxProcessor class
                var taxProcessor = taxProcessorFactory.CreateTaxProcessor();

                if (taxProcessor == null)
                {
                    logger.Log(LogType.Error, $"TaxProcessorFactory returned null from CreateTaxProcessor().");
                    return;
                }

                // Run the calculations to calculate monthly gross income, monthly income tax and , monthly net income.
                logger.Log(LogType.Trace, "Tax processor crunching calculations.");
                taxProcessor.RunCalculations(employee);

                //Display payslip.
                var textDisplayer = new TextDisplayer(serviceProvider);
                textDisplayer.DisplayPayslip(employee, taxProcessor);

                logger.Log(LogType.Trace, "finished running monthly payslip program..");
            }
            catch (Exception e)
            {
                logger.Log(LogType.Error, $"Failed to run program exception: {e.Message}");
                return;
            }
        }
    public IEnumerator UpdateValuesTest()
    {
        Scene testScene = SceneManager.GetActiveScene();

        yield return(SceneManager.LoadSceneAsync("TestLevel", LoadSceneMode.Additive));

        SceneManager.SetActiveScene(SceneManager.GetSceneByName("TestLevel"));

        TextDisplayer textDisplayer = GameObject.Find("Score").GetComponent <TextDisplayer>();

        textDisplayer.UpdateValues("Hello World!");

        Assert.AreEqual("Hello World!", GameObject.Find("Score").GetComponent <Text>().text);

        SceneManager.SetActiveScene(testScene);
        yield return(SceneManager.UnloadSceneAsync("TestLevel"));
    }
    void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();
        m_DictationRecognizer.AutoSilenceTimeoutSeconds = 0.4f;

        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            //Debug.LogFormat("Dictation result: {0}", text);
            //m_Recognitions.text = text + "\n";

            //TextDisplayer.SetTextToDisplay(text);
        };
        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            //Debug.LogFormat("Dictation hypothesis: {0}", text);
            //m_Hypotheses.text = text;
            if (text.Length == 0)
            {
                return;
            }

            TextDisplayer.SetTextToDisplay(text);
            last = text;
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause == DictationCompletionCause.TimeoutExceeded || completionCause == DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);

                TextDisplayer.SetTextToDisplay(last + ". ");
                m_DictationRecognizer.Stop();
                m_DictationRecognizer.Start();
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();
    }
Exemple #10
0
    protected IEnumerator PressAnyKey(string displayText, KeyCode[] keyCodes, TextDisplayer pressAnyTextDisplayer)
    {
        yield return(null);

        pressAnyTextDisplayer.DisplayText("press any key prompt", displayText);
        Dictionary <KeyCode, bool> keysPressed = new Dictionary <KeyCode, bool>();

        foreach (KeyCode keycode in keyCodes)
        {
            keysPressed.Add(keycode, false);
        }
        while (true)
        {
            yield return(null);

            foreach (KeyCode keyCode in keyCodes)
            {
                if (Input.GetKeyDown(keyCode))
                {
                    keysPressed[keyCode] = true;
                }
                if (Input.GetKeyUp(keyCode))
                {
                    keysPressed[keyCode] = false;
                }
            }
            bool done = true;
            foreach (bool pressed in keysPressed.Values)
            {
                if (!pressed)
                {
                    done = false;
                }
            }
            if (done)
            {
                break;
            }
        }
        pressAnyTextDisplayer.ClearText();
    }
    //////////
    // collect references to managed objects
    // and release references to non-active objects
    //////////
    void onSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        onKey = new ConcurrentQueue <Action <string, bool> >(); // clear keyhandler queue on scene change

        if ((bool)GetSetting("isLegacyExperiment") == true)
        {
            Debug.Log("Legacy Experiment");
            return;
        }

        // text displayer
        GameObject canvas = GameObject.Find("MemoryWordCanvas");

        if (canvas != null)
        {
            textDisplayer = canvas.GetComponent <TextDisplayer>();
            Debug.Log("Found TextDisplay");
        }

        // input reporters
        GameObject inputReporters = GameObject.Find("DataManager");

        if (inputReporters != null)
        {
            scriptedInput   = inputReporters.GetComponent <ScriptedEventReporter>();
            peripheralInput = inputReporters.GetComponent <PeripheralInputReporter>();
            uiInput         = inputReporters.GetComponent <UIDataReporter>();
            Debug.Log("Found InputReporters");
        }

        GameObject voice = GameObject.Find("VAD");

        if (voice != null)
        {
            voiceActity = voice.GetComponent <VoiceActivityDetection>();
            Debug.Log("Found VoiceActivityDetector");
        }

        GameObject video = GameObject.Find("VideoPlayer");

        if (video != null)
        {
            videoControl = video.GetComponent <VideoControl>();
            video.SetActive(false);
            Debug.Log("Found VideoPlayer");
        }

        GameObject sound = GameObject.Find("Sounds");

        if (sound != null)
        {
            lowBeep   = sound.transform.Find("LowBeep").gameObject.GetComponent <AudioSource>();
            lowerBeep = sound.transform.Find("LowerBeep").gameObject.GetComponent <AudioSource>();
            highBeep  = sound.transform.Find("HighBeep").gameObject.GetComponent <AudioSource>();
            playback  = sound.transform.Find("Playback").gameObject.GetComponent <AudioSource>();
            Debug.Log("Found Sounds");
        }

        GameObject soundRecorder = GameObject.Find("SoundRecorder");

        if (soundRecorder != null)
        {
            recorder = soundRecorder.GetComponent <SoundRecorder>();
            Debug.Log("Found Sound Recorder");
        }
    }
Exemple #12
0
    //Scene() is the primary Coroutine for looping through lines of a conversation when the player talks to a character.

    //I modified this system designed by my co-programmer to, for each frame, check that frame's EmoteCheck class.

    //If the class says an emote should be played here, it then begins FindEmote() to find the correct character

    //and activate the correct emote.

    IEnumerator Scene()
    {
        //Debug.Log("Scene Started");
        //interactHandle = gameController.interactInput;

        if (dialogueManager != null)
        {
            //Debug.Log("Still working?");
            dialogueManager.hasActiveDialogue = true;
        }

        for (int i = 0; i < Frames.Length; i++)
        {
            frameIndex = i;
            //  Debug.Log("Depth Level 1");
            if (i != 0)
            {
                Frames[i - 1].SetActive(false);
            }
            Frames[i].SetActive(true);
            emoteCheck = Frames[i].GetComponent <EmoteCheck>();
            if (emoteCheck != null)
            {
                if (emoteCheck.play == true)
                {
                    StartCoroutine(FindEmote());
                }
            }

            yield return(new WaitForEndOfFrame());

            // Wait while the text hasn't finished or the player interacts to finish the text
            yield return(new WaitUntil(() => (Input.GetButtonDown(gameController.interactInput) || (hasFinishedDisplayingText || currentTextDisplayer == null))));

            if (i == Frames.Length - 1)
            {
                textIsDone = true;
            }

            //      Debug.Log("Depth Level 3");
            if (/*Input.GetButtonDown("Interact") ||*/ hasFinishedDisplayingText || currentTextDisplayer == null)
            {
                hasFinishedDisplayingText = false;
                currentTextDisplayer      = null;

                // Check if the Frame has a DialogueOption
                Frame tempFrame = Frames[i].GetComponent <Frame>();
                if (tempFrame != null)
                {
                    //Debug.Log("Unlocking Now!");
                    camControl.lockPosition = true;
                    Cursor.lockState        = CursorLockMode.None;
                    //Debug.Log("Can You See Me?");
                    Cursor.visible = true;
                    //Debug.Log("Cursor Unlocked");
                    if (tempFrame.dialogueButtons.firstSelectedGameObject != tempFrame.firstButton)
                    {
                        tempFrame.dialogueButtons.firstSelectedGameObject = tempFrame.firstButton;
                    }
                    yield return(new WaitWhile(() => tempFrame.Get_ShouldWait() == true));

                    //Debug.Log("Cursor Frozen");
                    camControl.lockPosition = false;
                    Cursor.lockState        = CursorLockMode.Locked;
                    Cursor.visible          = false;

                    if (tempFrame.Get_ShouldContinue() == false)
                    {
                        i = Frames.Length + 2;
                        break;
                    }
                    else
                    {
                        continue; // This skips the need to press the interact key again
                    }
                }
                else
                {
                    yield return(new WaitUntil(() => Input.GetButtonDown(gameController.interactInput)));
                }

                continue; // This continues to the next frame
            }
            else
            {
                currentTextDisplayer.DisplayFullText();
                //Wait for text to display full text
                yield return(new WaitForSeconds(0.1f));

                // Check if the Frame has a DialogueOption
                Frame tempFrame = Frames[i].GetComponent <Frame>();
                if (tempFrame != null)
                {
                    Debug.Log("Unlocking Now!");
                    Cursor.lockState = CursorLockMode.None;
                    Debug.Log("Can You See Me?");
                    Cursor.visible = true;
                    Debug.Log("Cursor Unlocked");
                    yield return(new WaitWhile(() => tempFrame.Get_ShouldWait() == true));

                    Debug.Log("Cursor Frozen");
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                    //tempFrame.Reset_ShouldWait();

                    if (tempFrame.Get_ShouldContinue() == false)
                    {
                        i = Frames.Length + 2;
                        //tempFrame.Reset_ShouldWait();
                        break;
                    }
                    else
                    {
                        tempFrame.Reset_ShouldWait();
                        continue; // This skips the need to press the interact key again
                    }
                }
            }



            yield return(new WaitUntil(() => Input.GetButtonDown(gameController.interactInput)));


            #region OldCode
            //yield return new WaitForEndOfFrame();
            //while (true)
            //{
            ////    Debug.Log("Depth Level 2");
            //    // TODO: Extremely high polling number for user input
            //    yield return new WaitForSeconds(0.00001f);
            //    if (Input.GetButtonDown("Interact"))
            //    {
            //  //      Debug.Log("Depth Level 3");
            //        if (hasFinishedDisplayingText || currentTextDisplayer == null)
            //        {
            //            hasFinishedDisplayingText = false;
            //            currentTextDisplayer = null;
            //            break;
            //        }
            //        else
            //        {
            //            currentTextDisplayer.DisplayFullText();
            //            //Wait for text to display full text
            //            yield return new WaitForSeconds(0.1f);


            //            while (true)
            //            {
            //    //            Debug.Log("Depth Level 4");
            //                // TODO: Extremely high polling number for user input
            //                yield return new WaitForSeconds(0.00001f);
            //                if (Input.GetButtonDown("Interact"))
            //                {
            //      //              Debug.Log("Depth Level 5");
            //                    break;
            //                }
            //            }

            //            break;
            //        }

            //    }
            //}
            #endregion
        }

        hasFinishedDisplayingText = false;
        Frames[Frames.Length - 1].SetActive(false);


        //The for loop below is a bit of a back-door solution to allow the player to properly exit a cinematic event which changes the camera angles per line of dialogue.

        //I needed a reference all the way back to the character the player was actually talking to in the moment to make this work. Though not designed originally to

        //perform this function, the Emote system's architecture allowed me access back to the character that would have otherwise necessitated the creation of additional functionality.

        for (int i = 0; i < dialogueManager.npcs.Length; i++)
        {
            if (NPC == dialogueManager.npcs[i].NPC)
            {
                dialogueManager.npcs[i].npcEmotes.interactable.doneTalking = true;
            }
        }

        //Calls on Event_Trigger to start a cam event
        //KNOWN BUG: Currently is causing the next (or last) frame of dialogue to repeat during cam event.
        //Debug.Log("Dialogue is done!");
        if (dialogueManager.prepCamEvent && isCamEventActive)
        {
            //dialogueManager.hasActiveDialogue = false;
            eventTrigger.InitiateEvent();
            yield return(new WaitUntil(() => eventTrigger.GetEventCam().startScene == false));
        }

        if (dialogueManager != null)
        {
            dialogueManager.hasActiveDialogue = false;
        }

        dialogueCam.RestPosition();

        //Camera.main.orthographicSize = tempNum;
        yield return(null);
    }
Exemple #13
0
    public bool ShouldOffset()
    {
        TextDisplayer textDisplayer = GetComponent <TextDisplayer>();

        return(textDisplayer != null && textDisplayer.HasCloseupText);
    }
 // Start is called before the first frame update
 public void Start()
 {
     td = this;
     StartCoroutine(Displaytext());
 }