/** * <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) { CalculateValue(); fullText = AdvGame.ConvertTokens(TranslateLabel(label, languageNumber)); if (uiSlider) { uiSlider.value = visualAmount; UpdateUISelectable(uiSlider, uiSelectableHideStyle); } }
/** * <summary>Gets the display label of a dialogue option.</summary> * <param name = "slot">The index number of the dialogue option to find</param> * <returns>The display label of the dialogue option</returns> */ public string GetOptionName(int slot) { int i = ConvertSlotToOption(slot); if (i == -1) { i = 0; } string translatedLine = KickStarter.runtimeLanguages.GetTranslation(options[i].label, options[i].lineID, Options.GetLanguage()); return(AdvGame.ConvertTokens(translatedLine)); }
public int NameToIndex(string sceneName) { sceneName = AdvGame.ConvertTokens(sceneName); foreach (SceneInfo buildSceneInfo in buildScenes) { if (buildSceneInfo.Filename == sceneName) { return(buildSceneInfo.BuildIndex); } } ACDebug.LogWarning("The scene named '" + sceneName + "' was not found in the Build settings."); return(0); }
/** * <summary>Gets the item's display name.</summary> * <param name = "languageNumber">The index of the current language, as set in SpeechManager</param> * <returns>The item's display name</returns> */ public string GetLabel(int languageNumber) { if (languageNumber > 0) { return(AdvGame.ConvertTokens(KickStarter.runtimeLanguages.GetTranslation(label, lineID, languageNumber, GetTranslationType(0)))); } else { if (!string.IsNullOrEmpty(altLabel)) { return(AdvGame.ConvertTokens(altLabel)); } } return(AdvGame.ConvertTokens(label)); }
/** * <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) { SetEffectiveVisibility(true); fullText = TranslateLabel(label, languageNumber); fullText = AdvGame.ConvertTokens(fullText, languageNumber); if (uiButton != null) { UpdateUISelectable(uiButton, uiSelectableHideStyle); if (uiText != null) { uiText.text = fullText; } } }
/** * <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 && journalType == JournalType.DisplayExistingJournal) { if (otherJournal != null) { int index = otherJournal.showPage + pageOffset - 1; if (otherJournal.pages.Count > index) { fullText = TranslatePage(otherJournal.pages[index], languageNumber); } else { fullText = ""; } fullText = AdvGame.ConvertTokens(fullText, languageNumber); } } else { if (Application.isPlaying && journalType == JournalType.DisplayActiveDocument) { if (ownDocument != KickStarter.runtimeDocuments.ActiveDocument && KickStarter.runtimeDocuments.ActiveDocument != null) { ownDocument = KickStarter.runtimeDocuments.ActiveDocument; pages = ownDocument.pages; showPage = KickStarter.runtimeDocuments.GetLastOpenPage(ownDocument); } } if (pages.Count == 0) { fullText = ""; } else if (pages.Count >= showPage && showPage > 0) { fullText = TranslatePage(pages[showPage - 1], languageNumber); fullText = AdvGame.ConvertTokens(fullText, languageNumber); } } if (uiText != null) { UpdateUIElement(uiText); uiText.text = fullText; } }
override public bool CheckCondition() { int actualSceneNumber = 0; string actualSceneName = ""; if (sceneToCheck == SceneToCheck.Previous) { actualSceneNumber = KickStarter.sceneChanger.previousSceneInfo.number; actualSceneName = KickStarter.sceneChanger.previousSceneInfo.name; } else { actualSceneNumber = UnityVersionHandler.GetCurrentSceneNumber(); actualSceneName = UnityVersionHandler.GetCurrentSceneName(); } if (intCondition == IntCondition.EqualTo) { if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName == AdvGame.ConvertTokens(sceneName)) { return(true); } if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber == sceneNumber) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName != AdvGame.ConvertTokens(sceneName)) { return(true); } if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber != sceneNumber) { return(true); } } return(false); }
public override void PreDisplay(int _slot, int languageNumber, bool isActive) { if (Application.isPlaying) { UpdateLabelText(languageNumber); } else { newLabel = label; } newLabel = AdvGame.ConvertTokens(newLabel, languageNumber); if (uiText != null && Application.isPlaying) { uiText.text = newLabel; UpdateUIElement(uiText); } }
protected void ChangeScene() { if (sceneNumber > -1 || chooseSceneBy == ChooseSceneBy.Name) { SceneInfo sceneInfo = new SceneInfo(chooseSceneBy, AdvGame.ConvertTokens(sceneName), sceneNumber); if (sceneInfo.IsNull) { return; } if (onlyPreload) { if (AdvGame.GetReferences().settingsManager.useAsyncLoading) { KickStarter.sceneChanger.PreloadScene(sceneInfo); } else if (AdvGame.GetReferences().settingsManager.useLoadingScreen) { LogWarning("Scenes cannot be preloaded when loading scenes are used in the Settings Manager."); } else { LogWarning("To pre-load scenes, 'Load scenes asynchronously?' must be enabled in the Settings Manager."); } return; } if (relativePosition && runtimeRelativeMarker != null) { KickStarter.sceneChanger.SetRelativePosition(runtimeRelativeMarker.transform); } bool isSuccesful = KickStarter.sceneChanger.ChangeScene(sceneInfo, true, forceReload); if (!isSuccesful && assignScreenOverlay) { KickStarter.mainCamera.SetFadeTexture(null); KickStarter.mainCamera.FadeIn(0f); } } }
/** * <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 && journalType == JournalType.DisplayExistingJournal) { if (otherJournal != null) { int index = otherJournal.showPage + pageOffset - 1; if (otherJournal.pages.Count > index) { fullText = TranslatePage(otherJournal.pages[index], languageNumber); } else { fullText = ""; } fullText = AdvGame.ConvertTokens(fullText, languageNumber); } } else { if (pages.Count == 0) { fullText = ""; } else if (pages.Count >= showPage) { fullText = TranslatePage(pages[showPage - 1], languageNumber); fullText = AdvGame.ConvertTokens(fullText, languageNumber); } } if (uiText != null) { UpdateUIElement(uiText); uiText.text = fullText; } }
public override void PreDisplay(int _slot, int languageNumber, bool isActive) { SetEffectiveVisibility(true); fullText = TranslateLabel(label, languageNumber); fullText = AdvGame.ConvertTokens(fullText, languageNumber); if (uiButton) { if (uiSelectableHideStyle == UISelectableHideStyle.DisableInteractability && disabledUI) { // Ignore in this special case, since we're already disabling the Menu UI } else { UpdateUISelectable(uiButton, uiSelectableHideStyle); } if (uiText) { uiText.text = fullText; } } }
protected bool CheckCondition(InvVar attribute) { if (attribute == null) { LogWarning("Cannot check state of attribute since it cannot be found!"); return(false); } switch (attribute.type) { case VariableType.Boolean: { int fieldValue = attribute.val; int compareValue = (int)boolValue; if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } break; } case VariableType.Integer: case VariableType.PopUp: { int fieldValue = attribute.val; int compareValue = intValue; if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } break; } case VariableType.Float: { float fieldValue = attribute.floatVal; float compareValue = floatValue; if (intCondition == IntCondition.EqualTo) { if (Mathf.Approximately(fieldValue, compareValue)) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (!Mathf.Approximately(fieldValue, compareValue)) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } break; } case VariableType.String: { string fieldValue = attribute.textVal; string compareValue = AdvGame.ConvertTokens(stringValue); if (!checkCase) { fieldValue = fieldValue.ToLower(); compareValue = compareValue.ToLower(); } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } break; } default: break; } return(false); }
private void SetVariable(GVar var, VariableLocation location, bool doSkip) { if (var == null) { return; } if (location == VariableLocation.Global) { var.Download(); } if (var.type == VariableType.Integer) { int _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { if (setVarMethod == SetVarMethod.Formula) { _value = (int)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula)); } else { _value = intValue; } } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && parameterName != "") { _value = animator.GetInteger(parameterName); setVarMethod = SetVarMethod.SetValue; } } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue(); } var.SetValue(_value, setVarMethod); if (doSkip) { var.BackupValue(); } } if (var.type == VariableType.Float) { float _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { if (setVarMethod == SetVarMethod.Formula) { _value = (float)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula)); } else { _value = floatValue; } } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && parameterName != "") { _value = animator.GetFloat(parameterName); setVarMethod = SetVarMethod.SetValue; } } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue(); } var.SetValue(_value, setVarMethod); if (doSkip) { var.BackupValue(); } } else if (var.type == VariableType.Boolean) { int _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { _value = (int)boolValue; } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && parameterName != "") { if (animator.GetBool(parameterName)) { _value = 1; } } } var.SetValue(_value, SetVarMethod.SetValue); } else if (var.type == VariableType.PopUp) { var.SetValue(intValue); } else if (var.type == VariableType.String) { string _value = ""; if (setVarMethodString == SetVarMethodString.EnteredHere) { _value = AdvGame.ConvertTokens(stringValue); } else if (setVarMethodString == SetVarMethodString.SetAsMenuElementText) { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null) { if (menuElement is MenuInput) { MenuInput menuInput = (MenuInput)menuElement; _value = menuInput.GetContents(); if ((Options.GetLanguageName() == "Arabic" || Options.GetLanguageName() == "Hebrew") && _value.Length > 0) { // Invert char[] charArray = _value.ToCharArray(); _value = ""; for (int i = charArray.Length - 1; i >= 0; i--) { _value += charArray[i]; } } } else { PlayerMenus.GetMenuWithName(menuName).Recalculate(); menuElement.PreDisplay(slotNumber, Options.GetLanguage(), false); _value = menuElement.GetLabel(slotNumber, Options.GetLanguage()); } } else { Debug.LogWarning("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'"); } } var.SetValue(_value); } if (location == VariableLocation.Global) { var.Upload(); } KickStarter.actionListManager.VariableChanged(); }
public override void AssignValues(System.Collections.Generic.List <ActionParameter> parameters) { convertedText = AdvGame.ConvertTokens(commentText, 0, null, parameters); }
/** * <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); } }
override public float Run() { SceneInfo sceneInfo = new SceneInfo(chooseSceneBy, AdvGame.ConvertTokens(sceneName), sceneNumber); if (!isRunning) { waitedOneMoreFrame = false; isRunning = true; if (KickStarter.sceneSettings.OverridesCameraPerspective()) { ACDebug.LogError("The current scene overrides the default camera perspective - this feature should not be used in conjunction with multiple-open scenes."); } if (sceneAddRemove == SceneAddRemove.Add) { if (KickStarter.sceneChanger.AddSubScene(sceneInfo)) { return(defaultPauseTime); } } else if (sceneAddRemove == SceneAddRemove.Remove) { KickStarter.sceneChanger.RemoveScene(sceneInfo); } } else { if (!waitedOneMoreFrame) { waitedOneMoreFrame = true; return(defaultPauseTime); } if (sceneAddRemove == SceneAddRemove.Add) { bool found = false; foreach (SubScene subScene in KickStarter.sceneChanger.GetSubScenes()) { if (subScene.SceneInfo.Matches(sceneInfo)) { found = true; if (runCutsceneOnStart && subScene.SceneSettings != null && subScene.SceneSettings.cutsceneOnStart != null) { subScene.SceneSettings.cutsceneOnStart.Interact(); } } } if (!found) { LogWarning("Adding a non-AC scene additively! A GameEngine prefab must be placed in scene '" + sceneInfo.GetLabel() + "'."); } } isRunning = false; } return(0f); }
/** * <summary>Gets the display text of the element</summary> * <param name = "slot">Ignored by this subclass</param> * <param name = "languageNumber">The index number of the language number to get the text in</param> * <returns>The display text of the element</returns> */ public override string GetLabel(int slot, int languageNumber) { return(AdvGame.ConvertTokens(TranslateLabel(label, languageNumber))); }
private float StartSpeech() { string _text = messageText; int _lineID = lineID; int languageNumber = Options.GetLanguage(); if (languageNumber > 0) { // Not in original language, so pull translation in from Speech Manager _text = KickStarter.runtimeLanguages.GetTranslation(_text, lineID, languageNumber); } bool isSplittingLines = false; bool isLastSplitLine = false; _text = _text.Replace("\\n", "\n"); if (KickStarter.speechManager.separateLines) { string[] textArray = messageText.Replace("\\n", "\n").Split(stringSeparators, System.StringSplitOptions.None); if (textArray.Length > 1) { _text = textArray [splitIndex]; isSplittingLines = true; if (splitIndex > 0) { if (multiLineIDs != null && multiLineIDs.Length > (splitIndex - 1)) { _lineID = multiLineIDs[splitIndex - 1]; } else { _lineID = -1; } } if (textArray.Length > splitIndex) { isLastSplitLine = true; } if (languageNumber > 0) { _text = KickStarter.runtimeLanguages.GetTranslation(_text, _lineID, languageNumber); } } } if (_text != "") { _text = AdvGame.ConvertTokens(_text, languageNumber, localVariables); speech = KickStarter.dialog.StartDialog(runtimeSpeaker, _text, isBackground, _lineID, noAnimation); float displayDuration = speech.displayDuration; if (runtimeSpeaker && !noAnimation) { if (runtimeSpeaker.GetAnimEngine() != null) { runtimeSpeaker.GetAnimEngine().ActionSpeechRun(this); } } if (isLastSplitLine) { return(displayDuration + waitTimeOffset); } if (isSplittingLines) { return(displayDuration); } if (!isBackground) { return(displayDuration + waitTimeOffset); } } return(0f); }
/** * <summary>The default Constructor.</summary> * <param name = "_speaker">The speaking character. If null, the line is considered a narration</param> * <param name = "_message">The subtitle text to display</param> * <param name = "lineID">The unique ID number of the line, as generated by the Speech Manager</param> * <param name = "_language">The currently-selected language</param> * <param name = "_isBackground">True if the line should play in the background, and not interrupt Actions or gameplay</param> * <param name = "_noAnimation">True if the speaking character should not play a talking animation</param> */ public Speech(Char _speaker, string _message, int lineID, string _language, bool _isBackground, bool _noAnimation) { // Clear rich text boldTagIndex = italicTagIndex = sizeTagIndex = colorTagIndex = -1; closingTags = ""; log.Clear(); isBackground = _isBackground; if (_speaker) { speaker = _speaker; speaker.isTalking = !_noAnimation; log.speakerName = _speaker.name; if (_speaker.GetComponent <Player>()) { if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow || !KickStarter.speechManager.usePlayerRealName) { log.speakerName = "Player"; } } if (_speaker.GetComponent <Hotspot>()) { if (_speaker.GetComponent <Hotspot>().hotspotName != "") { log.speakerName = _speaker.GetComponent <Hotspot>().hotspotName; } } _speaker.ClearExpression(); if (!_noAnimation) { if (KickStarter.speechManager.lipSyncMode == LipSyncMode.Off) { speaker.isLipSyncing = false; } else if (KickStarter.speechManager.lipSyncMode == LipSyncMode.Salsa2D || KickStarter.speechManager.lipSyncMode == LipSyncMode.FromSpeechText || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadPamelaFile || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadSapiFile || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadPapagayoFile) { speaker.StartLipSync(KickStarter.dialog.GenerateLipSyncShapes(KickStarter.speechManager.lipSyncMode, lineID, speaker.name, _language, _message)); } else if (KickStarter.speechManager.lipSyncMode == LipSyncMode.RogoLipSync) { RogoLipSyncIntegration.Play(_speaker, speaker.name, lineID, _language); } } } else { if (speaker) { speaker.isTalking = false; } speaker = null; log.speakerName = "Narrator"; } _message = AdvGame.ConvertTokens(_message); _message = DetermineGaps(_message); if (speechGaps.Count > 0) { gapIndex = 0; foreach (SpeechGap gap in speechGaps) { if (gap.expressionID < 0) { displayDuration += (float)gap.waitTime; } } } else { gapIndex = -1; } if (lineID > -1) { log.lineID = lineID; } // Play sound and time displayDuration to it if (lineID > -1 && log.speakerName != "" && KickStarter.speechManager.searchAudioFiles) { AudioClip clipObj = null; if (KickStarter.speechManager.autoNameSpeechFiles) { string fullFilename = "Speech/"; string filename = KickStarter.speechManager.GetLineFilename(lineID); if (_language != "" && KickStarter.speechManager.translateAudio) { // Not in original language fullFilename += _language + "/"; } if (KickStarter.speechManager.placeAudioInSubfolders) { fullFilename += filename + "/"; } fullFilename += filename + lineID; clipObj = Resources.Load(fullFilename) as AudioClip; if (clipObj == null && KickStarter.speechManager.fallbackAudio && Options.GetLanguage() > 0) { fullFilename = "Speech/"; if (KickStarter.speechManager.placeAudioInSubfolders) { fullFilename += filename + "/"; } fullFilename += filename + lineID; clipObj = Resources.Load(fullFilename) as AudioClip; } if (clipObj == null) { ACDebug.Log("Cannot find audio file: " + fullFilename); } } else { clipObj = KickStarter.speechManager.GetLineCustomAudioClip(lineID, Options.GetLanguage()); if (clipObj == null && KickStarter.speechManager.fallbackAudio && Options.GetLanguage() > 0) { clipObj = KickStarter.speechManager.GetLineCustomAudioClip(lineID, 0); } } if (clipObj) { AudioSource audioSource = null; if (_speaker != null) { if (!_noAnimation) { if (KickStarter.speechManager.lipSyncMode == LipSyncMode.FaceFX) { FaceFXIntegration.Play(speaker, log.speakerName + lineID, clipObj); } } if (_speaker.speechAudioSource) { audioSource = _speaker.speechAudioSource; if (_speaker.speechAudioSource.GetComponent <Sound>()) { _speaker.speechAudioSource.GetComponent <Sound>().SetVolume(Options.optionsData.speechVolume); } else { _speaker.speechAudioSource.volume = Options.optionsData.speechVolume; } } else { ACDebug.LogWarning(_speaker.name + " has no audio source component!"); } } else if (KickStarter.player && KickStarter.player.speechAudioSource) { KickStarter.player.speechAudioSource.volume = Options.optionsData.speechVolume; audioSource = KickStarter.player.speechAudioSource; } else { audioSource = KickStarter.dialog.GetDefaultAudioSource(); } if (audioSource != null) { audioSource.clip = clipObj; audioSource.loop = false; audioSource.Play(); hasAudio = true; } displayDuration = clipObj.length; } else { displayDuration += KickStarter.speechManager.screenTimeFactor * GetLengthWithoutRichText(_message); displayDuration = Mathf.Max(displayDuration, KickStarter.speechManager.minimumDisplayTime); } } else { displayDuration += KickStarter.speechManager.screenTimeFactor * GetLengthWithoutRichText(_message); displayDuration = Mathf.Max(displayDuration, KickStarter.speechManager.minimumDisplayTime); } log.fullText = _message; KickStarter.eventManager.Call_OnStartSpeech(_speaker, log.fullText, lineID); if (!CanScroll()) { if (continueIndex > 0) { continueTime = (continueIndex / KickStarter.speechManager.textScrollSpeed); } if (speechGaps.Count > 0) { displayText = log.fullText.Substring(0, speechGaps[0].characterIndex); } else { displayText = log.fullText; } } else { displayText = ""; KickStarter.eventManager.Call_OnStartSpeechScroll(_speaker, log.fullText, lineID); } isAlive = true; isSkippable = true; pauseGap = false; endTime = displayDuration; }
protected bool CheckCondition(GVar _var, GVar _compareVar) { if (_var == null) { LogWarning("Cannot check state of variable since it cannot be found!"); return(false); } if (_compareVar != null && _var != null && _compareVar.type != _var.type) { LogWarning("Cannot compare " + _var.label + " and " + _compareVar.label + " as they are not the same type!"); return(false); } if (_var.type == VariableType.Boolean) { int fieldValue = _var.IntegerValue; int compareValue = (int)boolValue; if (_compareVar != null) { compareValue = _compareVar.IntegerValue; } switch (boolCondition) { case BoolCondition.EqualTo: return(fieldValue == compareValue); case BoolCondition.NotEqualTo: return(fieldValue != compareValue); } } else if (_var.type == VariableType.Integer || _var.type == VariableType.PopUp) { int fieldValue = _var.IntegerValue; int compareValue = intValue; if (_compareVar != null) { compareValue = _compareVar.IntegerValue; } switch (intCondition) { case IntCondition.EqualTo: return(fieldValue == compareValue); case IntCondition.NotEqualTo: return(fieldValue != compareValue); case IntCondition.LessThan: return(fieldValue < compareValue); case IntCondition.MoreThan: return(fieldValue > compareValue); } } else if (_var.type == VariableType.Float) { float fieldValue = _var.FloatValue; float compareValue = floatValue; if (_compareVar != null) { compareValue = _compareVar.FloatValue; } switch (intCondition) { case IntCondition.EqualTo: return(Mathf.Approximately(fieldValue, compareValue)); case IntCondition.NotEqualTo: return(!Mathf.Approximately(fieldValue, compareValue)); case IntCondition.LessThan: return(fieldValue < compareValue); case IntCondition.MoreThan: return(fieldValue > compareValue); } } else if (_var.type == VariableType.String) { string fieldValue = _var.TextValue; string compareValue = AdvGame.ConvertTokens(stringValue); if (_compareVar != null) { compareValue = _compareVar.TextValue; } if (!checkCase) { fieldValue = fieldValue.ToLower(); compareValue = compareValue.ToLower(); } switch (boolCondition) { case BoolCondition.EqualTo: return(fieldValue == compareValue); case BoolCondition.NotEqualTo: return(fieldValue != compareValue); } } else if (_var.type == VariableType.Vector3) { switch (vectorCondition) { case VectorCondition.EqualTo: return(_var.Vector3Value == vector3Value); case VectorCondition.MagnitudeGreaterThan: return(_var.Vector3Value.magnitude > floatValue); } } return(false); }
/** * <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); } }
public override void AssignValues(List <ActionParameter> parameters) { convertedText = AdvGame.ConvertTokens(commentText, 0, null, parameters); }
public override bool CheckCondition() { int actualSceneNumber = 0; if (KickStarter.settingsManager == null || KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow) { runtimePlayerID = -1; } if (runtimePlayerID >= 0) { PlayerData playerData = KickStarter.saveSystem.GetPlayerData(runtimePlayerID); if (playerData != null) { if (sceneToCheck == SceneToCheck.Previous) { actualSceneNumber = playerData.previousScene; } else { actualSceneNumber = playerData.currentScene; } ChooseSceneByPlayerSwitching csbps = (ChooseSceneByPlayerSwitching)chooseSceneByPlayerSwitching; if (csbps == ChooseSceneByPlayerSwitching.CurrentMain) { return(actualSceneNumber == SceneChanger.CurrentSceneIndex); } chooseSceneBy = (ChooseSceneBy)chooseSceneByPlayerSwitching; } else { LogWarning("Could not find scene data for Player ID = " + playerID); } } else { if (sceneToCheck == SceneToCheck.Previous) { actualSceneNumber = KickStarter.sceneChanger.PreviousSceneIndex; } else { actualSceneNumber = SceneChanger.CurrentSceneIndex; } } if (actualSceneNumber == -1 && sceneToCheck == SceneToCheck.Previous) { LogWarning("The " + sceneToCheck + " scene's Build Index is currently " + actualSceneNumber + " - is this the game's first scene?"); return(false); } string actualSceneName = KickStarter.sceneChanger.IndexToName(actualSceneNumber); if (intCondition == IntCondition.EqualTo) { if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName == AdvGame.ConvertTokens(sceneName)) { return(true); } if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber == sceneNumber) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (chooseSceneBy == ChooseSceneBy.Name && actualSceneName != AdvGame.ConvertTokens(sceneName)) { return(true); } if (chooseSceneBy == ChooseSceneBy.Number && actualSceneNumber != sceneNumber) { return(true); } } return(false); }
public Speech(Char _speaker, string _message, int lineID, string _language, bool _isBackground, bool _noAnimation) { log.Clear(); isBackground = _isBackground; if (_speaker) { speaker = _speaker; speaker.isTalking = !_noAnimation; log.speakerName = _speaker.name; if (_speaker.GetComponent <Player>()) { if (KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow || !KickStarter.speechManager.usePlayerRealName) { log.speakerName = "Player"; } } if (_speaker.GetComponent <Hotspot>()) { if (_speaker.GetComponent <Hotspot>().hotspotName != "") { log.speakerName = _speaker.GetComponent <Hotspot>().hotspotName; } } if (_speaker.portraitIcon != null) { _speaker.portraitIcon.Reset(); } if (!_noAnimation) { if (KickStarter.speechManager.lipSyncMode == LipSyncMode.Off) { speaker.isLipSyncing = false; } else if (KickStarter.speechManager.lipSyncMode == LipSyncMode.Salsa2D || KickStarter.speechManager.lipSyncMode == LipSyncMode.FromSpeechText || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadPamelaFile || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadSapiFile || KickStarter.speechManager.lipSyncMode == LipSyncMode.ReadPapagayoFile) { speaker.StartLipSync(KickStarter.dialog.GenerateLipSyncShapes(KickStarter.speechManager.lipSyncMode, lineID, log.speakerName, _language, _message)); } } } else { if (speaker) { speaker.isTalking = false; } speaker = null; log.speakerName = "Narrator"; } _message = AdvGame.ConvertTokens(_message); if (lineID > -1) { log.lineID = lineID; } // Play sound and time displayDuration to it if (lineID > -1 && log.speakerName != "" && KickStarter.speechManager.searchAudioFiles) { string fullFilename = "Speech/"; string filename = KickStarter.speechManager.GetLineFilename(lineID); if (_language != "" && KickStarter.speechManager.translateAudio) { // Not in original language fullFilename += _language + "/"; } if (KickStarter.speechManager.placeAudioInSubfolders) { fullFilename += filename + "/"; } fullFilename += filename + lineID; AudioClip clipObj = Resources.Load(fullFilename) as AudioClip; if (clipObj) { AudioSource audioSource = null; if (_speaker != null) { if (!_noAnimation) { if (KickStarter.speechManager.lipSyncMode == LipSyncMode.FaceFX) { FaceFXIntegration.Play(speaker, log.speakerName + lineID, clipObj); } } if (_speaker.GetComponent <AudioSource>()) { _speaker.GetComponent <AudioSource>().volume = KickStarter.options.optionsData.speechVolume; audioSource = _speaker.GetComponent <AudioSource>(); } else { Debug.LogWarning(_speaker.name + " has no audio source component!"); } } else if (KickStarter.player && KickStarter.player.GetComponent <AudioSource>()) { KickStarter.player.GetComponent <AudioSource>().volume = KickStarter.options.optionsData.speechVolume; audioSource = KickStarter.player.GetComponent <AudioSource>(); } else { audioSource = KickStarter.dialog.GetDefaultAudioSource(); } if (audioSource != null) { audioSource.clip = clipObj; audioSource.loop = false; audioSource.Play(); hasAudio = true; } displayDuration = clipObj.length; } else { displayDuration = KickStarter.speechManager.screenTimeFactor * (float)_message.Length; if (displayDuration < 0.5f) { displayDuration = 0.5f; } Debug.Log("Cannot find audio file: " + fullFilename); } } else { displayDuration = KickStarter.speechManager.screenTimeFactor * (float)_message.Length; if (displayDuration < 0.5f) { displayDuration = 0.5f; } } _message = DetermineGaps(_message); if (speechGaps.Count > 0) { gapIndex = 0; foreach (SpeechGap gap in speechGaps) { displayDuration += (float)gap.waitTime; } } else { gapIndex = -1; } log.fullText = _message; if (!KickStarter.speechManager.scrollSubtitles) { if (continueIndex > 0) { continueTime = Time.time + (continueIndex / KickStarter.speechManager.textScrollSpeed); } if (speechGaps.Count > 0) { displayText = log.fullText.Substring(0, speechGaps[0].characterIndex); } else { displayText = log.fullText; } } else { displayText = ""; } isAlive = true; isSkippable = true; pauseGap = false; endTime = Time.time + displayDuration; }
public override void PreDisplay(int _slot, int languageNumber, bool isActive) { if (Application.isPlaying) { if (labelType == AC_LabelType.Hotspot) { if (KickStarter.playerMenus.GetHotspotLabel() != "" || updateIfEmpty) { newLabel = KickStarter.playerMenus.GetHotspotLabel(); } } else if (labelType == AC_LabelType.Normal) { newLabel = TranslateLabel(label, languageNumber); } else if (labelType == AC_LabelType.GlobalVariable) { newLabel = RuntimeVariables.GetVariable(variableID).GetValue(); } else { 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(); if (line != "" || updateIfEmpty) { newLabel = line; } } else if (!KickStarter.speechManager.keepTextInBuffer) { newLabel = ""; } } } } else { newLabel = label; } newLabel = AdvGame.ConvertTokens(newLabel); if (uiText != null) { uiText.text = newLabel; UpdateUIElement(uiText); } }
protected void SetVariable(GVar var, VariableLocation location, bool doSkip) { if (var == null) { return; } switch (var.type) { case VariableType.Integer: { int _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { if (setVarMethod == SetVarMethod.Formula) { _value = (int)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula, Options.GetLanguage(), localVariables)); } else { _value = intValue; } } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && !string.IsNullOrEmpty(parameterName)) { _value = animator.GetInteger(parameterName); setVarMethod = SetVarMethod.SetValue; } } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue(); } var.SetValue(_value, setVarMethod); if (doSkip) { var.BackupValue(); } break; } case VariableType.Float: { float _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { if (setVarMethod == SetVarMethod.Formula) { _value = (float)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula, Options.GetLanguage(), localVariables)); } else { _value = floatValue; } } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && !string.IsNullOrEmpty(parameterName)) { _value = animator.GetFloat(parameterName); setVarMethod = SetVarMethod.SetValue; } } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue(); } var.SetFloatValue(_value, setVarMethod); if (doSkip) { var.BackupValue(); } break; } case VariableType.Boolean: { int _value = 0; if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere) { _value = (int)boolValue; } else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter) { if (animator && !string.IsNullOrEmpty(parameterName)) { if (animator.GetBool(parameterName)) { _value = 1; } } } var.SetValue(_value, SetVarMethod.SetValue); break; } case VariableType.Vector3: { Vector3 newValue = vector3Value; if (setVarMethodVector == SetVarMethodVector.IncreaseByValue) { newValue += var.vector3Val; } var.SetVector3Value(newValue); break; } case VariableType.PopUp: { int _value = 0; if (setVarMethod == SetVarMethod.Formula) { _value = (int)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula, Options.GetLanguage(), localVariables)); } else if (setVarMethod == SetVarMethod.SetAsRandom) { _value = var.GetNumPopUpValues(); } else { _value = Mathf.Clamp(intValue, 0, var.GetNumPopUpValues() - 1); } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue(); } var.SetValue(_value, setVarMethod); if (doSkip) { var.BackupValue(); } break; } case VariableType.String: { string _value = string.Empty; if (setVarMethodString == SetVarMethodString.EnteredHere) { _value = AdvGame.ConvertTokens(stringValue, Options.GetLanguage(), localVariables); } else if (setVarMethodString == SetVarMethodString.SetAsMenuElementText) { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null) { if (menuElement is MenuInput) { MenuInput menuInput = (MenuInput)menuElement; _value = menuInput.GetContents(); if (KickStarter.runtimeLanguages.LanguageReadsRightToLeft(Options.GetLanguage()) && _value.Length > 0) { // Invert char[] charArray = _value.ToCharArray(); _value = ""; for (int i = charArray.Length - 1; i >= 0; i--) { _value += charArray[i]; } } } else { PlayerMenus.GetMenuWithName(menuName).Recalculate(); menuElement.PreDisplay(slotNumber, Options.GetLanguage(), false); _value = menuElement.GetLabel(slotNumber, Options.GetLanguage()); } } else { LogWarning("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'"); } } var.SetStringValue(_value, lineID); break; } default: break; } var.Upload(location, runtimeVariables); KickStarter.actionListManager.VariableChanged(); }
private bool CheckCondition(InvItem _compareItem, GVar _compareVar) { if (_parameter == null) { ACDebug.LogWarning("Cannot check state of variable since it cannot be found!"); return(false); } if (_parameter.parameterType == ParameterType.Boolean) { int fieldValue = _parameter.intValue; int compareValue = (int)boolValue; if (_compareVar != null) { compareValue = _compareVar.val; } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } else if (_parameter.parameterType == ParameterType.Integer) { int fieldValue = _parameter.intValue; int compareValue = intValue; if (_compareVar != null) { compareValue = _compareVar.val; } if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (_parameter.parameterType == ParameterType.Float) { float fieldValue = _parameter.floatValue; float compareValue = floatValue; if (_compareVar != null) { compareValue = _compareVar.floatVal; } if (intCondition == IntCondition.EqualTo) { if (Mathf.Approximately(fieldValue, compareValue)) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (!Mathf.Approximately(fieldValue, compareValue)) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (_parameter.parameterType == ParameterType.Vector3) { if (vectorCondition == VectorCondition.EqualTo) { return(_parameter.vector3Value == vector3Value); } else if (vectorCondition == VectorCondition.MagnitudeGreaterThan) { return(_parameter.vector3Value.magnitude > floatValue); } } else if (_parameter.parameterType == ParameterType.String) { string fieldValue = _parameter.stringValue; string compareValue = AdvGame.ConvertTokens(stringValue); if (_compareVar != null) { compareValue = _compareVar.textVal; } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } else if (_parameter.parameterType == ParameterType.GameObject) { if ((compareObject != null && _parameter.gameObject == compareObject) || (compareObjectConstantID != 0 && _parameter.intValue == compareObjectConstantID)) { return(true); } if (compareObject == null && _parameter.gameObject == null) { return(true); } } else if (_parameter.parameterType == ParameterType.UnityObject) { if (compareUnityObject != null && _parameter.objectValue == (Object)compareUnityObject) { return(true); } if (compareUnityObject == null && _parameter.objectValue == null) { return(true); } } else if (_parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.LocalVariable) { if (_compareVar != null && _parameter.intValue == _compareVar.id) { return(true); } } else if (_parameter.parameterType == ParameterType.InventoryItem) { if (_compareItem != null && _parameter.intValue == _compareItem.id) { return(true); } } return(false); }
private bool CheckCondition(GVar _var, GVar _compareVar) { if (_var == null) { ACDebug.LogWarning("Cannot check state of variable since it cannot be found!"); return(false); } if (_compareVar != null && _var != null && _compareVar.type != _var.type) { ACDebug.LogWarning("Cannot compare " + _var.label + " and " + _compareVar.label + " as they are not the same type!"); return(false); } if (_var.type == VariableType.Boolean) { int fieldValue = _var.val; int compareValue = (int)boolValue; if (_compareVar != null) { compareValue = _compareVar.val; } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } else if (_var.type == VariableType.Integer || _var.type == VariableType.PopUp) { int fieldValue = _var.val; int compareValue = intValue; if (_compareVar != null) { compareValue = _compareVar.val; } if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (_var.type == VariableType.Float) { float fieldValue = _var.floatVal; float compareValue = floatValue; if (_compareVar != null) { compareValue = _compareVar.floatVal; } if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (_var.type == VariableType.String) { string fieldValue = _var.textVal; string compareValue = AdvGame.ConvertTokens(stringValue); if (_compareVar != null) { compareValue = _compareVar.textVal; } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } return(false); }
private bool CheckCondition(InvVar attribute) { if (attribute == null) { ACDebug.LogWarning("Cannot check state of attribute since it cannot be found!"); return(false); } if (attribute.type == VariableType.Boolean) { int fieldValue = attribute.val; int compareValue = (int)boolValue; if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } else if (attribute.type == VariableType.Integer || attribute.type == VariableType.PopUp) { int fieldValue = attribute.val; int compareValue = intValue; if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (attribute.type == VariableType.Float) { float fieldValue = attribute.floatVal; float compareValue = floatValue; if (intCondition == IntCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else if (intCondition == IntCondition.NotEqualTo) { if (fieldValue != compareValue) { return(true); } } else if (intCondition == IntCondition.LessThan) { if (fieldValue < compareValue) { return(true); } } else if (intCondition == IntCondition.MoreThan) { if (fieldValue > compareValue) { return(true); } } } else if (attribute.type == VariableType.String) { string fieldValue = attribute.textVal; string compareValue = AdvGame.ConvertTokens(stringValue); if (!checkCase) { fieldValue = fieldValue.ToLower(); compareValue = compareValue.ToLower(); } if (boolCondition == BoolCondition.EqualTo) { if (fieldValue == compareValue) { return(true); } } else { if (fieldValue != compareValue) { return(true); } } } return(false); }