private void DoSetFsmVariable() { setValue.UpdateValue(); if (setValue.IsNone || string.IsNullOrEmpty(variableName.Value)) { return; } var go = Fsm.GetOwnerDefaultTarget(eventTarget.gameObject); if (!go) { return; } if (enable.Value) { go.SetActive(true); if (eventTarget.fsmComponent != null) { eventTarget.fsmComponent.enabled = true; } } string fsmName = eventTarget.fsmName.Value; if (go != cachedGameObject || fsmName != cachedFsmName) { targetFsm = ActionHelpers.GetGameObjectFsm(go, fsmName); if (targetFsm == null) { return; } cachedGameObject = go; cachedFsmName = fsmName; } if (variableName.Value != cachedVariableName) { setValue.UpdateValue(); targetVariable = targetFsm.FsmVariables.FindVariable(setValue.Type, variableName.Value); cachedVariableName = variableName.Value; } if (targetVariable == null) { LogWarning("Missing Variable: " + variableName.Value); return; } setValue.UpdateValue(); setValue.ApplyValueTo(targetVariable); }
private void DoMethodCall() { if (behaviour.Value == null) { Finish(); return; } if (NeedToUpdateCache() && !DoCache()) { Debug.LogError(errorString); Finish(); return; } object value; if (cachedParameterInfo.Length == 0) { value = cachedMethodInfo.Invoke(cachedBehaviour.Value, null); } else { for (int i = 0; i < parameters.Length; i++) { FsmVar fsmVar = parameters[i]; fsmVar.UpdateValue(); if (fsmVar.Type == VariableType.Array) { fsmVar.UpdateValue(); object[] array = fsmVar.GetValue() as object[]; Type elementType = cachedParameterInfo[i].ParameterType.GetElementType(); Array array2 = Array.CreateInstance(elementType, array.Length); for (int j = 0; j < array.Length; j++) { array2.SetValue(array[j], j); } parametersArray[i] = array2; } else { fsmVar.UpdateValue(); parametersArray[i] = fsmVar.GetValue(); } } value = cachedMethodInfo.Invoke(cachedBehaviour.Value, parametersArray); } if (storeResult != null && !storeResult.IsNone && storeResult.Type != VariableType.Unknown) { storeResult.SetValue(value); } }
private void DoMethodCall() { if (this.behaviour.Value == null) { base.Finish(); return; } if (this.cachedBehaviour != this.behaviour.Value) { this.errorString = string.Empty; if (!this.DoCache()) { Debug.LogError(this.errorString); base.Finish(); return; } } object value; if (this.cachedParameterInfo.Length == 0) { value = this.cachedMethodInfo.Invoke(this.cachedBehaviour, null); } else { for (int i = 0; i < this.parameters.Length; i++) { FsmVar fsmVar = this.parameters[i]; fsmVar.UpdateValue(); this.parametersArray[i] = fsmVar.GetValue(); } value = this.cachedMethodInfo.Invoke(this.cachedBehaviour, this.parametersArray); } this.storeResult.SetValue(value); }
private void DoMethodCall() { if (className == null || string.IsNullOrEmpty(className.Value)) { Finish(); return; } if (cachedClassName != className.Value || cachedMethodName != methodName.Value) { errorString = string.Empty; if (!DoCache()) { Debug.LogError(errorString); Finish(); return; } } object obj = null; if (cachedParameterInfo.Length == 0) { obj = cachedMethodInfo.Invoke(null, null); } else { for (int i = 0; i < parameters.Length; i++) { FsmVar fsmVar = parameters[i]; fsmVar.UpdateValue(); parametersArray[i] = fsmVar.GetValue(); } obj = cachedMethodInfo.Invoke(null, parametersArray); } storeResult.SetValue(obj); }
private void ggop() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (!UpdateCache(go, fsmName.Value)) { return; } var fsmArray = fsm.FsmVariables.GetFsmArray(variableName.Value); int count = fsmArray.Length; fsmArray.Reset(); fsmArray.Resize(count); if (!resetValue.IsNone) { resetValue.UpdateValue(); object _val = resetValue.GetValue(); for (int i = 0; i < count; i++) { fsmArray.Set(i, _val); } } Finish(); }
private void DoCheckContainsValue() { value.UpdateValue(); int _id = -1; if (value.GetValue() == null || value.GetValue().Equals(null)) { _id = Array.FindIndex(array.Values, x => x == null || x.Equals(null)); } else { _id = Array.IndexOf(array.Values, value.GetValue()); } var _iscontained = _id != -1; isContained.Value = _iscontained; index.Value = _id; if (_iscontained) { Fsm.Event(isContainedEvent); } else { Fsm.Event(isNotContainedEvent); } }
void ggop() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (!UpdateCache(go, fsmName.Value)) { return; } var fsmArray = fsm.FsmVariables.GetFsmArray(variableName.Value); value.UpdateValue(); List <object> _new = new List <object>(); int i = 0; foreach (object _obj in fsmArray.Values) { if (!_obj.Equals(value.GetValue())) { _new.Add(_obj); } i++; } fsmArray.Values = _new.ToArray(); }
private void DoAddValue() { //incorporate the check for empty or not empty if the value is of type string if (value.Type == VariableType.String) { if (ifEmpty.Value) { if (!string.IsNullOrEmpty(value.stringValue)) { return; } } else { if (string.IsNullOrEmpty(value.stringValue)) { return; } } } array.Resize(array.Length + 1); value.UpdateValue(); array.Set(array.Length - 1, value.GetValue()); }
private void DoSetFsmArray() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (!UpdateCache(go, fsmName.Value)) { return; } var fsmArray = fsm.FsmVariables.GetFsmArray(variableName.Value); if (fsmArray != null) { if (index.Value < 0 || index.Value >= fsmArray.Length) { Fsm.Event(indexOutOfRange); Finish(); return; } if (fsmArray.ElementType == value.NamedVar.VariableType) { value.UpdateValue(); fsmArray.Set(index.Value, value.GetValue()); } else { LogWarning("Incompatible variable type: " + variableName.Value); } } else { DoVariableNotFound(variableName.Value); } }
public override void OnGUI() { _guiStyle.fontSize = fontSize.Value; variable.UpdateValue(); GUI.Label(new Rect(labelPosition.Value.x, labelPosition.Value.y, labelSize.Value.x, labelSize.Value.y), variable.DebugString(), _guiStyle); }
public override void Enter() { defaultValue.UpdateValue(); if (defaultValue.GetValue() != null && !defaultValue.IsNone) { value.SetValue(es3File.Load <object>(key.Value, defaultValue.GetValue())); } else { value.SetValue(es3File.Load <object>(key.Value)); } }
public override void Enter() { value.UpdateValue(); if (value.IsNone || value.GetValue() == null) { HandleError("The 'Load Into' action requires an object to load the data into, but none was specified in the 'Value' field."); } else { ES3.LoadInto <object>(key.Value, value.GetValue(), GetSettings()); } }
public override void Enter() { defaultValue.UpdateValue(); if (defaultValue.GetValue() != null && !defaultValue.IsNone) { value.SetValue(ES3.Load <object>(key.Value, defaultValue.GetValue(), GetSettings())); } else { value.SetValue(ES3.Load <object>(key.Value, GetSettings())); } }
public override void OnEnter() { if (!FsmString.IsNullOrEmpty(key)) { // Save variable as json string variable.UpdateValue(); var json = JsonUtility.ToJson(variable); PlayerPrefs.SetString(key.Value, json); PlayerPrefs.Save(); } Finish(); }
private void ggop() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (!UpdateCache(go, fsmName.Value)) { return; } var fsmArray = fsm.FsmVariables.GetFsmArray(variableName.Value); fsmArray.Resize(fsmArray.Length + 1); value.UpdateValue(); fsmArray.Set(fsmArray.Length - 1, value.GetValue()); }
private void DoGetValue() { if (!array.IsNone) { if (index.Value >= 0 && index.Value < array.Length) { value.UpdateValue(); array.Set(index.Value, value.GetValue()); } else { base.Fsm.Event(indexOutOfRange); } } }
public void DoesArrayListContains() { if (!isProxyValid()) { return; } int i = 0; foreach (var item in proxy.arrayList) { string itemName = item.ToString(); //remove any object type inside the item name if (itemName.Contains(" (")) { itemName = itemName.Substring(0, itemName.IndexOf(" (")); } bool containsName = !contains.Value ? itemName == variableName.Value : itemName.Contains(variableName.Value); if (containsName) { if (!storeFoundResult.IsNone) { storeFoundResult.UpdateValue(); if (storeFoundResult.ObjectType != item.GetType()) { LogError("Found ArrayList item isn't of type " + storeFoundResult.Type + "! Please change the Object type of '" + storeFoundResult.variableName + "' in the Variables tab to " + item.GetType() + "."); } storeFoundResult.SetValue(item); } if (!indexOf.IsNone) { indexOf.Value = i; } Fsm.Event(itemFoundEvent); } i++; } Fsm.Event(itemNotFoundEvent); }
public override void OnEnter() { result.Reset(); List <string> tmpValues = GDEHelpers.ListAllBy(GDEDataType.Item, searchInSchema.Value); List <string> matchingValues = new List <string>(); foreach (var tmp in tmpValues) { if (string.IsNullOrEmpty(itemNameContains.Value) && !itemNameContains.IsNone && !tmp.Contains(itemNameContains.Value)) { continue; } List <string> fieldNames = string.IsNullOrEmpty(searchInField.Value) || searchInField.IsNone ? null : new List <string> { searchInField.Value }; List <object> fieldValues = GDEHelpers.GetFieldValues(tmp, fieldNames); foreach (var fieldValue in fieldValues) { value.UpdateValue(); if (fieldValue.GetType() != value.GetType()) { UnityEngine.Debug.LogError("Given value type doesn't match result type!"); } if (fieldValue != value.GetValue()) { continue; } matchingValues.Add(tmp); break; } } if (matchingValues.Count == 0) { Fsm.Event(noneFoundEvent); } else { result.SetArrayContents(matchingValues); } Finish(); }
private void DoCheckContainsValue() { value.UpdateValue(); int num = Array.IndexOf(array.Values, value.GetValue()); bool flag = num != -1; isContained.Value = flag; index.Value = num; if (flag) { base.Fsm.Event(isContainedEvent); } else { base.Fsm.Event(isNotContainedEvent); } }
public override void OnEnter() { int length = array.Length; array.Reset(); array.Resize(length); if (!resetValue.IsNone) { resetValue.UpdateValue(); object value = resetValue.GetValue(); for (int i = 0; i < length; i++) { array.Set(i, value); } } Finish(); }
private void DoGetValue() { if (array.IsNone) { return; } if (index.Value >= 0 && index.Value < array.Length) { value.UpdateValue(); array.Set(index.Value, value.GetValue()); } else { //LogError("Index out of Range: " + index.Value); Fsm.Event(indexOutOfRange); } }
public override void OnEnter() { int count = array.Length; array.Reset(); array.Resize(count); if (!resetValue.IsNone) { resetValue.UpdateValue(); object _val = resetValue.GetValue(); for (int i = 0; i < count; i++) { array.Set(i, _val); } } Finish(); }
private void DoRemoveValue() { value.UpdateValue(); var list = new List <object>(array.Values); if (allMatches.Value) { list.RemoveAll(x => x == value.GetValue()); } else { list.Remove(value.GetValue()); } array.Values = list.ToArray(); array.SaveChanges(); }
private void DoCheckContainsValue() { value.UpdateValue(); var _id = Array.IndexOf(array.Values, value.GetValue()); var _iscontained = _id != -1; isContained.Value = _iscontained; index.Value = _id; if (_iscontained) { Fsm.Event(isContainedEvent); } else { Fsm.Event(isNotContainedEvent); } }
private void DoSetFsmVariable() { if (setValue.IsNone || string.IsNullOrEmpty(variableName.Value)) { return; } var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } if (go != cachedGameObject || fsmName.Value != cachedFsmName) { targetFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value); if (targetFsm == null) { return; } cachedGameObject = go; cachedFsmName = fsmName.Value; cachedVariableName = string.Empty; // invalidates variable cache } if (variableName.Value != cachedVariableName) { targetVariable = targetFsm.FsmVariables.FindVariable(setValue.Type, variableName.Value); cachedVariableName = variableName.Value; } if (targetVariable == null) { LogWarning("Missing Variable: " + variableName.Value); return; } setValue.UpdateValue(); setValue.ApplyValueTo(targetVariable); }
private void DoRemoveValue() { value.UpdateValue(); List <object> _new = new List <object>(); int i = 0; foreach (object _obj in array.Values) { if (!_obj.Equals(value.GetValue())) { _new.Add(_obj); } i++; } array.Values = _new.ToArray(); array.SaveChanges(); }
private void DoSetStaticValue() { if (className == null || string.IsNullOrEmpty(className.Value)) { Finish(); return; } if (cachedClassName != className.Value || cachedPropertyName != propertyName.Value) { errorString = string.Empty; if (!DoCache()) { Debug.LogError(errorString); Finish(); return; } } propertyValue.UpdateValue(); cachedFieldInfo.SetValue(null, propertyValue.GetValue()); }
public override void Enter() { value.UpdateValue(); es3File.Save <object>(key.Value, value.GetValue()); }
public override void Enter() { value.UpdateValue(); es3Spreadsheet.SetCell <object>(col.Value, row.Value, value.GetValue()); }
public override void Enter() { value.UpdateValue(); ES3.Save <object>(key.Value, value.GetValue(), GetSettings()); }