public void CopyInput (MenuInput _element) { label = _element.label; anchor = _element.anchor; textEffects = _element.textEffects; inputType = _element.inputType; characterLimit = _element.characterLimit; linkedButton = _element.linkedButton; allowSpaces = _element.allowSpaces; base.Copy (_element); }
/** * <summary>Selects a MenuInput element, allowing the player to enter text into it.</summary> * <param name = "input">The input box to select</param> */ public void SelectInputBox(MenuInput input) { selectedInputBox = input; // Mobile keyboard #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR if (input.inputType == AC_InputType.NumbericOnly) { keyboard = TouchScreenKeyboard.Open (input.label, TouchScreenKeyboardType.NumberPad, false, false, false, false, ""); } else { keyboard = TouchScreenKeyboard.Open (input.label, TouchScreenKeyboardType.ASCIICapable, false, false, false, false, ""); } #endif }
private void DeselectInputBox() { if (selectedInputBox) { selectedInputBox.Deselect (); selectedInputBox = null; // Mobile keyboard #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR if (keyboard != null) { keyboard.active = false; keyboard = null; } #endif } }
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, Options.GetLanguage (), localVariables)); } 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, Options.GetLanguage (), localVariables)); } 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.SetFloatValue (_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.Vector3) { Vector3 newValue = vector3Value; if (setVarMethodVector == SetVarMethodVector.IncreaseByValue) { newValue += var.vector3Val; } var.SetVector3Value (newValue); } else if (var.type == VariableType.PopUp) { int _value = 0; if (setVarMethod == SetVarMethod.Formula) { _value = (int) AdvGame.CalculateFormula (AdvGame.ConvertTokens (formula, Options.GetLanguage (), localVariables)); } else if (setVarMethod == SetVarMethod.SetAsRandom) { if (var.popUps != null) { _value = var.popUps.Length; } } else { _value = intValue; } if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip) { var.RestoreBackupValue (); } var.SetValue (_value, setVarMethod); if (doSkip) { var.BackupValue (); } } else if (var.type == VariableType.String) { string _value = ""; 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 { ACDebug.LogWarning ("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'"); } } var.SetStringValue (_value, lineID); } if (location == VariableLocation.Global) { var.Upload (); } KickStarter.actionListManager.VariableChanged (); }