private static void HandleExternVar(FoundryObject foundryObject, List <string> importLines, ref int currentIndex) { var externVar = new ExternalVariable(); var text = importLines[currentIndex]; var endText = text.Replace(Constants.Component.ExternalVar.Title, Constants.Component.ExternalVar.End); //go until it finds the end for (; currentIndex < importLines.Count - 1; currentIndex++) { var currentText = importLines[currentIndex]; if (currentText.Equals(endText)) { currentIndex++; return; } //it's either going to be ExternVar Type or Specific Value. if it isn't then oops I didn't handle it and it will be ignored if (currentText.Contains(Constants.Component.ExternalVar.Title)) { var name = currentText.Trim().Replace(Constants.Component.ExternalVar.Title, ""); externVar.Name = name; } else if (currentText.Contains(Constants.Component.ExternalVar.Type)) { var type = currentText.Trim().Replace(Constants.Component.ExternalVar.Type, ""); externVar.Type = type; } else if (currentText.Contains(Constants.Component.ExternalVar.SpecificValue.Title)) { HandleSpecificValue(externVar, importLines, ref currentIndex); } } foundryObject.ExternalVariables.Add(externVar.Name, externVar); }
public static string Get(ExternalVariable property) { var attr = EnvironmentVariableAttribute.Get(property); var valueFromEnv = Environment.GetEnvironmentVariable(attr.Name); if (valueFromEnv == null) { throw new Exception($"Environment Variable `{attr.Name}` could not be found. The value can be found in the password store under `{attr.LastPassName}`"); } return(valueFromEnv); }
private static void HandleSpecificValue(ExternalVariable externVar, List <string> importLines, ref int currentIndex) { var specificValue = new SpecificValue(); var text = importLines[currentIndex]; var endText = text.Replace(Constants.Component.ExternalVar.SpecificValue.Title, Constants.Component.ExternalVar.SpecificValue.End); //go until it finds the end for (; currentIndex < importLines.Count - 1; currentIndex++) { var currentText = importLines[currentIndex]; if (currentText.Equals(endText)) { currentIndex++; return; } //it's either going to be Type SpecificValue (ignored) StringVal or FloatVal if (currentText.Contains(Constants.Component.ExternalVar.SpecificValue.Type)) { var type = currentText.Trim().Replace(Constants.Component.ExternalVar.SpecificValue.Title, ""); specificValue.Type = type; } else if (currentText.Contains(Constants.Component.ExternalVar.SpecificValue.FloatVal)) { var floatVal = currentText.Trim().Replace(Constants.Component.ExternalVar.SpecificValue.FloatVal, ""); specificValue.FloatVal = floatVal; } else if (currentText.Contains(Constants.Component.ExternalVar.SpecificValue.StringVal)) { var stringVal = currentText.Trim().Replace(Constants.Component.ExternalVar.SpecificValue.StringVal, ""); specificValue.StringVal = stringVal; } } externVar.SpecificValue = specificValue; }
void OnNoodleCameraSpawn(ExternalVariable <Transform> sender, Transform oldValue, Transform newValue) { _camera.Follow = _camera.LookAt = newValue; }
public ValExtVar(ExternalVariable var) { Var = var; }
void OnStateChanged(ExternalVariable <StateScriptableObject> sender, StateScriptableObject oldState, StateScriptableObject newState) { _onStateChange.Invoke(oldState, newState); }