private void CreateNewVariable(List <GVar> _vars) { if (_vars == null) { return; } GVar newVariable = new GVar(GetIDArray(_vars)); newVariable.label = variableName; newVariable.type = variableType; newVariable.val = 0; newVariable.textVal = string.Empty; newVariable.floatVal = 0f; newVariable.vector3Val = Vector3.zero; _vars.Add(newVariable); ACDebug.Log("Created new " + location.ToString() + " variable '" + variableName + "'"); if (actionFor != null) { if (actionFor is ActionVarSequence) { ActionVarSequence actionVarSequence = (ActionVarSequence)actionFor; actionVarSequence.variableID = newVariable.id; } } }
private void SideMenu() { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Auto-create " + location.ToString() + " variable"), false, Callback, "AutoCreate"); menu.ShowAsContext(); }
private void CreateNewVariable(List <GVar> _vars) { if (_vars == null) { return; } GVar newVariable = new GVar(GetIDArray(_vars)); newVariable.label = variableName; newVariable.type = variableType; _vars.Add(newVariable); //AdvGame.GetReferences ().variablesManager.ShowVariable (newVariable.id, location); ACDebug.Log("Created new " + location.ToString() + " variable '" + variableName + "'"); if (actionFor != null) { if (actionFor is ActionVarSequence) { ActionVarSequence actionVarSequence = (ActionVarSequence)actionFor; actionVarSequence.variableID = newVariable.id; } } }
override public float Run() { InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ? KickStarter.runtimeInventory.LastSelectedItem : KickStarter.inventoryManager.GetItem(invID); if (invItem != null && runtimeVariable != null) { InvVar invVar = invItem.GetProperty(propertyID); if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item " + invItem.GetLabel(0)); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { if (invVar.type == VariableType.Float) { runtimeVariable.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { runtimeVariable.Vector3Value = invVar.Vector3Value; } else { runtimeVariable.IntegerValue = invVar.IntegerValue; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } } return(0); }
override public float Run() { GVar myVar = (varLocation == VariableLocation.Global) ? GlobalVariables.GetVariable(variableID) : LocalVariables.GetVariable(variableID, localVariables); InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ? KickStarter.runtimeInventory.LastSelectedItem : KickStarter.inventoryManager.GetItem(invID); if (invItem != null && myVar != null) { InvVar invVar = invItem.GetProperty(propertyID); if (myVar.type == VariableType.String) { myVar.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (myVar.type == invVar.type) { if (invVar.type == VariableType.Float) { myVar.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { myVar.Vector3Value = invVar.Vector3Value; } else { myVar.IntegerValue = invVar.IntegerValue; } } else { ACDebug.LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + myVar.label + "'s value from '" + invVar.label + "' property because their types do not match."); } } return(0); }
private string GetVariableName(VariableLocation location) { if (location.IsLocal && location.Index < locals.Count) { string name = locals[location.Index].Name; if (name != null) { return(name); } } return(location.ToString()); }
private void SideMenu() { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Auto-create " + location.ToString() + " variable"), false, Callback, "AutoCreate"); if (variableID >= 0) { // menu.AddItem (new GUIContent ("Show in Variables Manager"), false, Callback, "Show"); } menu.ShowAsContext(); }
public string GetCellText(GVar variable, VariableLocation location, bool replaceForwardSlashes, string sceneName = "") { string cellText = " "; switch (columnType) { case ColumnType.Location: cellText = location.ToString(); break; case ColumnType.SceneName: if (location == VariableLocation.Local || location == VariableLocation.Component) { cellText = sceneName; } break; case ColumnType.Label: cellText = variable.label; if (replaceForwardSlashes) { cellText = cellText.Replace("/", "."); } break; case ColumnType.Type: cellText = variable.type.ToString(); break; case ColumnType.Description: cellText = variable.description; break; case ColumnType.InitialValue: cellText = variable.GetValue(); break; } if (string.IsNullOrEmpty(cellText)) { cellText = " "; } return(RemoveLineBreaks(cellText)); }
public string GetCellText(GVar variable, VariableLocation location, string sceneName = "") { string cellText = " "; switch (columnType) { case ColumnType.Location: cellText = location.ToString(); break; case ColumnType.SceneName: if (location == VariableLocation.Local) { cellText = sceneName; } break; case ColumnType.Label: cellText = variable.label; break; case ColumnType.Type: cellText = variable.type.ToString(); break; case ColumnType.Description: cellText = variable.description; break; case ColumnType.InitialValue: cellText = variable.GetValue(); break; } if (cellText == "") { cellText = " "; } return(RemoveLineBreaks(cellText)); }
public override float Run() { int runtimeInvID = -1; if (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) { if (InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance)) { runtimeInvID = KickStarter.runtimeInventory.SelectedInstance.ItemID; } } else { runtimeInvID = invID; } InvVar invVar = null; if (runtimeInvID >= 0) { InvInstance invInstance = (useLiveValues) ? KickStarter.runtimeInventory.GetInstance(runtimeInvID) : new InvInstance(KickStarter.inventoryManager.GetItem(runtimeInvID)); if (!InvInstance.IsValid(invInstance)) { if (useLiveValues) { LogWarning("Cannot find Inventory item with ID " + runtimeInvID + " in the Player's inventory"); } else { LogWarning("Cannot find Inventory item with ID " + runtimeInvID); } return(0f); } invVar = invInstance.GetProperty(propertyID); } if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item ID " + runtimeInvID); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.TextValue = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { int itemCount = (useLiveValues && multiplyByItemCount) ? KickStarter.runtimeInventory.GetCount(runtimeInvID) : 1; switch (invVar.type) { case VariableType.Float: runtimeVariable.FloatValue = invVar.FloatValue * (float)itemCount; break; case VariableType.Integer: runtimeVariable.IntegerValue = invVar.IntegerValue * itemCount; break; case VariableType.Vector3: runtimeVariable.Vector3Value = invVar.Vector3Value; break; default: runtimeVariable.IntegerValue = invVar.IntegerValue; break; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } return(0); }
public override float Run() { int runtimeInvID = -1; if (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) { if (KickStarter.runtimeInventory.SelectedItem != null) { runtimeInvID = KickStarter.runtimeInventory.SelectedItem.id; } } else { runtimeInvID = invID; } InvVar invVar = null; if (runtimeInvID >= 0) { if (multiplyByItemCount) { invVar = KickStarter.runtimeInventory.GetPropertyTotals(propertyID, runtimeInvID); } else { InvItem invItem = KickStarter.inventoryManager.GetItem(runtimeInvID); if (invItem != null) { invVar = invItem.GetProperty(propertyID); } } } if (invVar == null) { LogWarning("Cannot find property with ID " + propertyID + " on Inventory item ID " + runtimeInvID); return(0f); } if (runtimeVariable.type == VariableType.String) { runtimeVariable.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (runtimeVariable.type == invVar.type) { if (invVar.type == VariableType.Float) { runtimeVariable.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { runtimeVariable.Vector3Value = invVar.Vector3Value; } else { runtimeVariable.IntegerValue = invVar.IntegerValue; } } else { LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match."); } return(0); }
public override ActionEnd End(List <Action> actions) { if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable || getVarMethod == GetVarMethod.ComponentVariable) { if (runtimeCompareVariable == null) { LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the " + getVarMethod.ToString() + " to compare with."); return(GenerateStopActionEnd()); } } if (runtimeVariable != null) { return(ProcessResult(CheckCondition(runtimeVariable, runtimeCompareVariable), actions)); } LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the " + location.ToString() + " Variable with an ID of " + variableID); return(GenerateStopActionEnd()); }