feature: Created audio manager
This commit is contained in:
parent
cb907bc76a
commit
2f9b516605
10 changed files with 778 additions and 22 deletions
|
@ -23,7 +23,7 @@ namespace Messaging {
|
|||
answerContainer.InitializeTypers();
|
||||
}
|
||||
|
||||
public void SetMessageText(string text, bool animate, bool isAnswer) {
|
||||
public Coroutine SetMessageText(string text, bool animate, bool isAnswer) {
|
||||
Text = text;
|
||||
IsAnswer = isAnswer;
|
||||
IsReal = false;
|
||||
|
@ -32,17 +32,19 @@ namespace Messaging {
|
|||
SetText(ref answerContainer.TypingCoroutine, answerContainer.messageText, answerContainer.TextTyper,
|
||||
text, animate);
|
||||
|
||||
if(string.IsNullOrEmpty(text)) return;
|
||||
if(string.IsNullOrEmpty(text)) return null;
|
||||
answerContainer.container.SetActive(true);
|
||||
questionContainer.container.SetActive(false);
|
||||
} else {
|
||||
SetText(ref questionContainer.TypingCoroutine, questionContainer.messageText,
|
||||
questionContainer.TextTyper, text, animate);
|
||||
|
||||
if(string.IsNullOrEmpty(text)) return;
|
||||
questionContainer.container.SetActive(true);
|
||||
answerContainer.container.SetActive(false);
|
||||
return answerContainer.TypingCoroutine;
|
||||
}
|
||||
|
||||
SetText(ref questionContainer.TypingCoroutine, questionContainer.messageText,
|
||||
questionContainer.TextTyper, text, animate);
|
||||
|
||||
if(string.IsNullOrEmpty(text)) return null;
|
||||
questionContainer.container.SetActive(true);
|
||||
answerContainer.container.SetActive(false);
|
||||
return questionContainer.TypingCoroutine;
|
||||
}
|
||||
|
||||
public Coroutine SetMessageRealText(string text, bool animate, bool isAnswer) {
|
||||
|
|
|
@ -56,11 +56,12 @@ namespace Messaging {
|
|||
}
|
||||
|
||||
public void CreateMessage(string message, bool isAnswer) {
|
||||
ModifyMessageText(message, _messages.Length - 1, isAnswer);
|
||||
ModifyMessageText(message, _messages.Length - 1, isAnswer, true);
|
||||
if (isAnswer) {
|
||||
_currentJokeIndex--;
|
||||
_currentJokeIndex = Mathf.Max(_currentJokeIndex, 0);
|
||||
if (message == _currentJoke.AnswerMessage.Key) {
|
||||
_sendButton.Lock();
|
||||
StartCoroutine(ShowRealTexts());
|
||||
if(_currentJokeIndex == 0)
|
||||
SendRandomJoke(sendJokeLongDelay);
|
||||
|
@ -69,6 +70,7 @@ namespace Messaging {
|
|||
} else {
|
||||
_lives.Wrong();
|
||||
if (_lives.CurrentLives == 0) {
|
||||
_sendButton.Lock();
|
||||
StartCoroutine(ShowRealTexts());
|
||||
SendRandomJoke(sendJokeLongDelay);
|
||||
_lives.ResetLives();
|
||||
|
@ -81,6 +83,7 @@ namespace Messaging {
|
|||
|
||||
private IEnumerator ShowRealTexts() {
|
||||
yield return ModifyRealMessageText(_currentJoke.QuestionMessage.Value, _currentJokeIndex, false);
|
||||
yield return ModifyMessageText(_currentJoke.AnswerMessage.Key, _messages.Length - 1, true, false);
|
||||
yield return ModifyRealMessageText(_currentJoke.AnswerMessage.Value, _messages.Length - 1, true);
|
||||
}
|
||||
|
||||
|
@ -111,9 +114,11 @@ namespace Messaging {
|
|||
return emojiStrings;
|
||||
}
|
||||
|
||||
private void ModifyMessageText(string message, int index, bool isAnswer) {
|
||||
ModifyPreviousMessage(index);
|
||||
_messages[index].SetMessageText(message, true, isAnswer);
|
||||
private Coroutine ModifyMessageText(string message, int index, bool isAnswer, bool createNew) {
|
||||
if(createNew)
|
||||
ModifyPreviousMessage(index);
|
||||
|
||||
return _messages[index].SetMessageText(message, true, isAnswer);
|
||||
}
|
||||
|
||||
private Coroutine ModifyRealMessageText(string message, int index, bool isAnswer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue