Esempio n. 1
0
        protected void EndSpeech(int i, bool stopCharacter = false)
        {
            Speech oldSpeech = speechList[i];

            KickStarter.playerMenus.RemoveSpeechFromMenu(oldSpeech);
            if (stopCharacter)
            {
                if (oldSpeech.GetSpeakingCharacter())
                {
                    oldSpeech.GetSpeakingCharacter().StopSpeaking();
                }
                else
                {
                    oldSpeech.EndSpeechAudio();
                }
            }
            oldSpeech.isAlive = false;
            speechList.RemoveAt(i);

            if (oldSpeech.hasAudio)
            {
                KickStarter.stateHandler.UpdateAllMaxVolumes();
            }

            // Call event
            KickStarter.eventManager.Call_OnStopSpeech(oldSpeech, oldSpeech.GetSpeakingCharacter());
        }
Esempio n. 2
0
        private void EndSpeech(int i, bool stopCharacter = false)
        {
            Speech oldSpeech = speechList[i];

            KickStarter.playerMenus.RemoveSpeechFromMenu(oldSpeech);
            if (stopCharacter && oldSpeech.GetSpeakingCharacter())
            {
                oldSpeech.GetSpeakingCharacter().StopSpeaking();
            }
            speechList.RemoveAt(i);

            if (oldSpeech.hasAudio)
            {
                KickStarter.stateHandler.UpdateAllMaxVolumes();
            }
        }
Esempio n. 3
0
 private void EndBackgroundSpeechAudio(Speech speech)
 {
     foreach (Speech _speech in speechList)
     {
         if (_speech != speech)
         {
             _speech.EndBackgroundSpeechAudio(speech.GetSpeakingCharacter());
         }
     }
 }
Esempio n. 4
0
        /**
         * <summary>Performs all calculations necessary to display the element.</summary>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "languageNumber">The index number of the language to display text in</param>
         * <param name = "isActive">If True, then the element will be drawn as though highlighted</param>
         */
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            if (Application.isPlaying)
            {
                if (labelType == AC_LabelType.Hotspot)
                {
                    string _newLabel = "";
                    if (invItem != null)
                    {
                        _newLabel = invItem.GetFullLabel(languageNumber);
                    }
                    else if (hotspot != null)
                    {
                        _newLabel = hotspot.GetFullLabel(languageNumber);
                    }
                    else if (!showPendingWhileMovingToHotspot && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && KickStarter.playerInteraction.GetHotspotMovingTo() != null && KickStarter.playerCursor.GetSelectedCursorID() == -1)
                    {
                        _newLabel = KickStarter.playerInteraction.MovingToHotspotLabel;
                    }
                    else
                    {
                        _newLabel = KickStarter.playerMenus.GetHotspotLabel();
                    }

                    if (_newLabel != "" || updateIfEmpty)
                    {
                        newLabel = _newLabel;
                    }
                }
                else if (labelType == AC_LabelType.Normal)
                {
                    newLabel = TranslateLabel(label, languageNumber);
                }
                else if (labelType == AC_LabelType.GlobalVariable)
                {
                    GVar variable = GlobalVariables.GetVariable(variableID);
                    if (variable != null)
                    {
                        newLabel = variable.GetValue(languageNumber);
                    }
                    else
                    {
                        ACDebug.LogWarning("Label element '" + title + "' cannot display Global Variable " + variableID + " as it does not exist!");
                    }
                }
                else if (labelType == AC_LabelType.ActiveSaveProfile)
                {
                    newLabel = KickStarter.options.GetProfileName();
                }
                else if (labelType == AC_LabelType.InventoryProperty)
                {
                    newLabel = "";

                    if (inventoryPropertyType == InventoryPropertyType.SelectedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.SelectedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.LastClickedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.lastClickedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.MouseOverItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.hoverItem);
                    }
                }
                else if (labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
                {
                    if (linkedMenu != null && linkedMenu.IsFadingOut())
                    {
                        return;
                    }

                    UpdateSpeechLink();

                    if (labelType == AC_LabelType.DialogueLine)
                    {
                        if (speech != null)
                        {
                            string line = speech.displayText;
                            if (line != "" || updateIfEmpty)
                            {
                                newLabel = line;
                            }

                            if (useCharacterColour)
                            {
                                speechColour = speech.GetColour();
                                if (uiText)
                                {
                                    uiText.color = speechColour;
                                }
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                    else if (labelType == AC_LabelType.DialogueSpeaker)
                    {
                        if (speech != null)
                        {
                            string line = speech.GetSpeaker(languageNumber);

                            if (line != "" || updateIfEmpty || speech.GetSpeakingCharacter() == null)
                            {
                                newLabel = line;
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                }
            }
            else
            {
                newLabel = label;
            }

            newLabel = AdvGame.ConvertTokens(newLabel, languageNumber);

            if (uiText != null && Application.isPlaying)
            {
                uiText.text = newLabel;
                UpdateUIElement(uiText);
            }
        }
Esempio n. 5
0
 private void EndBackgroundSpeechAudio(Speech speech)
 {
     foreach (Speech _speech in speechList)
     {
         if (_speech != speech)
         {
             _speech.EndBackgroundSpeechAudio (speech.GetSpeakingCharacter ());
         }
     }
 }
        /**
         * Updates the label's text buffer.  This is normally done internally at runtime, but can be called manually to update it in Edit mode.
         */
        public void UpdateLabelText(int languageNumber = 0)
        {
            string _oldLabel = newLabel;

            switch (labelType)
            {
            case AC_LabelType.Normal:
                newLabel = TranslateLabel(label, languageNumber);
                break;

            case AC_LabelType.Hotspot:
                string _newLabel = string.Empty;

                if (showPendingWhileMovingToHotspot &&
                    KickStarter.playerInteraction.GetHotspotMovingTo() != null &&
                    KickStarter.playerCursor.GetSelectedCursorID() == -1 &&
                    KickStarter.runtimeInventory.SelectedItem == null)
                {
                    _newLabel = KickStarter.playerInteraction.MovingToHotspotLabel;
                }

                if (string.IsNullOrEmpty(_newLabel))
                {
                    _newLabel = KickStarter.playerMenus.GetHotspotLabel();
                }

                if (!string.IsNullOrEmpty(_newLabel) || updateIfEmpty)
                {
                    newLabel = _newLabel;
                }
                break;

            case AC_LabelType.GlobalVariable:
                GVar variable = GlobalVariables.GetVariable(variableID);
                if (variable != null)
                {
                    newLabel = variable.GetValue(languageNumber);
                }
                else
                {
                    ACDebug.LogWarning("Label element '" + title + "' cannot display Global Variable " + variableID + " as it does not exist!");
                }
                break;

            case AC_LabelType.ActiveSaveProfile:
                newLabel = KickStarter.options.GetProfileName();
                break;

            case AC_LabelType.InventoryProperty:
                newLabel = string.Empty;
                if (inventoryPropertyType == InventoryPropertyType.SelectedItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.SelectedItem);
                }
                else if (inventoryPropertyType == InventoryPropertyType.LastClickedItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.lastClickedItem);
                }
                else if (inventoryPropertyType == InventoryPropertyType.MouseOverItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.hoverItem);
                }
                break;

            case AC_LabelType.DialogueLine:
            case AC_LabelType.DialogueSpeaker:
                if (parentMenu != null && parentMenu.IsFadingOut())
                {
                    return;
                }

                UpdateSpeechLink();

                if (labelType == AC_LabelType.DialogueLine)
                {
                    if (speech != null)
                    {
                        string line = speech.displayText;
                        if (line != string.Empty || updateIfEmpty)
                        {
                            newLabel = line;
                        }

                        if (useCharacterColour)
                        {
                            speechColour = speech.GetColour();
                            if (uiText)
                            {
                                uiText.color = speechColour;
                            }
                        }
                    }
                    else if (!KickStarter.speechManager.keepTextInBuffer)
                    {
                        newLabel = string.Empty;
                    }
                }
                else if (labelType == AC_LabelType.DialogueSpeaker)
                {
                    if (speech != null)
                    {
                        string line = speech.GetSpeaker(languageNumber);

                        if (line != string.Empty || updateIfEmpty || speech.GetSpeakingCharacter() == null)
                        {
                            newLabel = line;
                        }
                    }
                    else if (!KickStarter.speechManager.keepTextInBuffer)
                    {
                        newLabel = string.Empty;
                    }
                }
                break;

            case AC_LabelType.DocumentTitle:
                if (Document != null)
                {
                    newLabel = KickStarter.runtimeLanguages.GetTranslation(Document.title,
                                                                           Document.titleLineID,
                                                                           languageNumber);
                }
                break;
            }

            if (newLabel != _oldLabel && sizeType == AC_SizeType.Automatic && parentMenu != null && parentMenu.menuSource == MenuSource.AdventureCreator)
            {
                parentMenu.Recalculate();
            }
        }
Esempio n. 7
0
        /**
         * <summary>Performs all calculations necessary to display the element.</summary>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "languageNumber">The index number of the language to display text in</param>
         * <param name = "isActive">If True, then the element will be drawn as though highlighted</param>
         */
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            if (Application.isPlaying)
            {
                if (labelType == AC_LabelType.Hotspot)
                {
                    string _newLabel = "";
                    if (invItem != null)
                    {
                        _newLabel = invItem.GetFullLabel(languageNumber);
                    }
                    else if (hotspot != null)
                    {
                        _newLabel = hotspot.GetFullLabel(languageNumber);
                    }
                    else
                    {
                        _newLabel = KickStarter.playerMenus.GetHotspotLabel();
                    }

                    if (_newLabel != "" || updateIfEmpty)
                    {
                        newLabel = _newLabel;
                    }
                }
                else if (labelType == AC_LabelType.Normal)
                {
                    newLabel = TranslateLabel(label, languageNumber);
                }
                else if (labelType == AC_LabelType.GlobalVariable)
                {
                    newLabel = GlobalVariables.GetVariable(variableID).GetValue(languageNumber);
                }
                else if (labelType == AC_LabelType.ActiveSaveProfile)
                {
                    newLabel = KickStarter.options.GetProfileName();
                }
                else if (labelType == AC_LabelType.InventoryProperty)
                {
                    newLabel = "";

                    if (inventoryPropertyType == InventoryPropertyType.SelectedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.selectedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.LastClickedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.lastClickedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.MouseOverItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.hoverItem);
                    }
                }
                else if (labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
                {
                    if (linkedMenu != null && linkedMenu.IsFadingOut())
                    {
                        return;
                    }

                    UpdateSpeechLink();

                    if (labelType == AC_LabelType.DialogueLine)
                    {
                        if (speech != null)
                        {
                            string line = speech.displayText;
                            if (line != "" || updateIfEmpty)
                            {
                                newLabel = line;
                            }

                            if (useCharacterColour)
                            {
                                speechColour = speech.GetColour();
                                if (uiText)
                                {
                                    uiText.color = speechColour;
                                }
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                    else if (labelType == AC_LabelType.DialogueSpeaker)
                    {
                        if (speech != null)
                        {
                            string line = speech.GetSpeaker(languageNumber);

                            if (line != "" || updateIfEmpty || speech.GetSpeakingCharacter() == null)
                            {
                                newLabel = line;
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                }
            }
            else
            {
                newLabel = label;
            }

            newLabel = AdvGame.ConvertTokens(newLabel, languageNumber);

            if (uiText != null && Application.isPlaying)
            {
                uiText.text = newLabel;
                UpdateUIElement(uiText);
            }
        }