private void DrawObjectProperties(Dictionary <string, PuzzleObject.Property> propertiesObject, PuzzleLayout layout) { var propertyPosition = Camera.current.WorldToScreenPoint(_propertyDialogPosition.ToV3()); Handles.BeginGUI(); GUI.enabled = true; GUILayout.BeginArea(new Rect(propertyPosition.x - 100, Screen.height - propertyPosition.y - 100, 220, 200)); GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(200)); if (propertiesObject.Count == 0) { EditorGUILayout.LabelField("No properties"); } else { foreach (var property in propertiesObject.Values.ToList()) { if (property.Type == typeof(bool)) { var currentValue = (bool)property.Value; var possiblyChangedValue = EditorGUILayout.Toggle(property.Key, currentValue); if (currentValue != possiblyChangedValue) { layout.SetProperty(_propertyDialogPosition, property.Key, possiblyChangedValue); } } else if (property.Type == typeof(int)) { var value = (int)property.Value; var possiblyChangedValue = EditorGUILayout.IntField(property.Key, value); if (value != possiblyChangedValue) { layout.SetProperty(_propertyDialogPosition, property.Key, possiblyChangedValue); } } else if (property.Type == typeof(int)) { var currentValue = (int)property.Value; var possiblyChangedValue = EditorGUILayout.IntSlider(property.Key, currentValue, 1, 5); if (currentValue != possiblyChangedValue) { layout.SetProperty(_propertyDialogPosition, property.Key, possiblyChangedValue); } } } } GUILayout.EndVertical(); GUILayout.EndArea(); Handles.EndGUI(); }
public void Execute() { try { _currentValue = _sut.GetProperty(_position, _key); } catch (Exception) { _currentValue = null; } _sut.SetProperty(_position, _key, _value); }
public void LayoutLinkSet() { _layout = _layoutLink.PuzzleLayout; if (!_layout.HasProperty(_layoutLink.Position, "Health")) { _layout.SetProperty(_layoutLink.Position, "Health", 3); } _layout.PropertySet += PropertyChanged; _health = (int)_layout.GetObjectAt(_layoutLink.Position).Properties["Health"].Value; }
public void LayoutLinkSet() { _layout = _layoutLink.PuzzleLayout; if (!_layout.HasProperty(_layoutLink.Position, "IsLoaded")) { _layout.SetProperty(_layoutLink.Position, "IsLoaded", false); } _layout.PropertySet += PropertyChanged; var isNowLoaded = (bool)_layout.GetObjectAt(_layoutLink.Position).Properties["IsLoaded"].Value; UpdateLoadedState(isNowLoaded); }