Beispiel #1
0
        private void TypeMessage()
        {
            //Gives the player time to read the message
            Kōkako.Wait((int)(Math.Sqrt(_branches[_currentBranch].PreviousMessageLength()) * 20));

            //Types out the Message character by character
            ScriptManager.GetScript <InputWindow>().TypeMessage(_branches[_currentBranch].CurrentMessage);

            //Waits for the player to press enter before contiuning and sending the typed message
            while (!_keyEvents.Contains(KeyboardEvent.ENTER))
            {
                InputManager.InvokeInputEvents(null);
                RenderEngine.Render();
            }

            //Destroys the typed message before it's added to the chatwindow
            ScriptManager.GetScript <InputWindow>().ReomveTypedMessage();
        }
Beispiel #2
0
        private void WaitForResponse()
        {
            //Simulates the character reading your message
            Kōkako.Wait((int)(Math.Sqrt(_branches[_currentBranch].PreviousMessageLength()) * 20));

            //Adds the is typing... text and renders it
            ScriptManager.GetScript <ChatWindow>().AddIsTyping(_branches[_currentBranch].CurrentMessage._Sender);
            RenderEngine.Render();

            //Simulates the character writing their message
            Kōkako.Wait((int)(Math.Sqrt(_branches[_currentBranch].NextMessageLength()) * 20));

            //If there was no previous message, wait anyway
            if (_branches[_currentBranch].PreviousMessageLength() == 0)
            {
                Kōkako.Wait(300);
            }

            //Remove the is typing... text
            ScriptManager.GetScript <ChatWindow>().RemoveIsTyping();
        }
Beispiel #3
0
        public void TypeMessage(Message message)
        {
            //Skapar ett GameObject av medelandet
            /*-------------------------------------------------------------------*/

            GameObject gameObject = new GameObject("text");

            Text textComponent = gameObject.GetComponent <Text>();

            textComponent.Wrapper = (uint)(GetComponent <Sprite>()._transform.w - (_textMargin * 2));

            gameObject.SetParent(this);
            gameObject.SetParentScene(ParentScene);

            gameObject._transform.y = _textMargin;
            gameObject._transform.x = _textMargin;

            //Lägger till GameObjectet i Scenen
            /*-------------------------------------------------------------------*/

            _gameObjects.Add(gameObject);
            ParentScene.AddGameObject(gameObject);

            //Lägger till en karaktär i medelandet, väntar och renderar
            /*-------------------------------------------------------------------*/

            for (int i = 0; i < message.Text.Length; i++)
            {
                textComponent.Message += message.Text[i];
                RenderEngine.Render();
                InputManager.InvokeInputEvents(null);
                Kōkako.Wait(Kōkako.random.Next(1, 7));
            }

            /*-------------------------------------------------------------------*/
        }