private void HandleMutableItemSelected(MutableBoxMutableItemBehaviour item) { UndoLord.Instance.Push(new MutableTargetChange(this, (MutableTarget.SchemaSource == SchemaSource.Mutable ? "Local Payload." : "Global Payload.") + MutableTarget.AbsoluteKey, item.UserFacingAbsoluteKey + "." + MutableTarget.LastKey)); IndicateMutableValue(item); // ArraySuffix never leaves this class! var arrayFreeText = item.AbsoluteKey.Replace(ArraySuffix, ""); if (MutableTarget.ValidateKey(SchemaProvider.Schema)) { MutableTarget.IntermediateKeyString = arrayFreeText; } IndicateError = !MutableTarget.KeyValid; ShowItemDropDown = false; }
private Stack <string> GetInitialDisplayString(MutableObject schema, string absoluteKey) { // Null schema implies we're in initialize behaviour var displayKeys = new Stack <string>(MutableTarget.AbsoluteKey.Split('.')); if (schema == null || !MutableTarget.ValidateKey(schema)) { if (schema != null) { IndicateError = true; } return(displayKeys); } displayKeys = GetDisplayString(schema, absoluteKey.Split('.').ToList()); return(displayKeys); }
public void DoUndo(string newKey) { var parts = newKey.Split('.'); SetSelectedMutableText(string.Join(".", parts, 0, parts.Length - 1)); var segmentCount = parts.Length - 1; GetComponent <LayoutElement>().preferredHeight = segmentCount * 16 + PreferredHeight - 16 + 4; // -16 for keypanel, +4 for layout group padding. // ArraySuffix never leaves this class! var arrayFreeText = string.Join(".", parts, 1, parts.Length - 2).Replace(ArraySuffix, ""); SchemaProvider.CacheSchema(); MutableTarget.IntermediateKeyString = arrayFreeText; SchemaProvider.UnCacheSchema(); var textKey = parts[parts.Length - 1]; NewFieldValueInputFieldComponent.text = textKey; var indicError = false; if (textKey.Contains('.')) { indicError = true; } else { SchemaProvider.CacheSchema(); MutableTarget.LastKey = textKey; SchemaProvider.UnCacheSchema(); } SchemaProvider.CacheSchema(); MutableTarget.ValidateKey(SchemaProvider.Schema); SchemaProvider.UnCacheSchema(); IndicateError = indicError | !MutableTarget.KeyValid; }
private void IndicateMutableValue(MutableBoxMutableItemBehaviour item) { SetSelectedMutableText(item.UserFacingAbsoluteKey); var segmentCount = item.UserFacingAbsoluteKey.Count(c => c.Equals('.')) + 1; GetComponent <LayoutElement>().preferredHeight = segmentCount * 16 + PreferredHeight - 16 + 4; // -16 for keypanel, +4 for layout group padding. // ArraySuffix never leaves this class! var arrayFreeText = item.AbsoluteKey.Replace(ArraySuffix, ""); SchemaProvider.CacheSchema(); MutableTarget.IntermediateKeyString = arrayFreeText; SchemaProvider.UnCacheSchema(); SchemaProvider.CacheSchema(); MutableTarget.ValidateKey(SchemaProvider.Schema); SchemaProvider.UnCacheSchema(); IndicateError = !MutableTarget.KeyValid; //ShowItemDropDown = false; }