public AGSCheckBox(string id, Resolver resolver) : base(id, resolver) { _uIEvents = AddComponent<IUIEvents>(); _skinComponent = AddComponent<ISkinComponent>(); _hasRoom = AddComponent<IHasRoom>(); _animationContainer = AddComponent<IAnimationContainer>(); _inObjectTree = AddComponent<IInObjectTree>(); _collider = AddComponent<ICollider>(); _visibleComponent = AddComponent<IVisibleComponent>(); _enabledComponent = AddComponent<IEnabledComponent>(); _customProperties = AddComponent<ICustomPropertiesComponent>(); _drawableInfo = AddComponent<IDrawableInfo>(); _hotspotComponent = AddComponent<IHotspotComponent>(); _shaderComponent = AddComponent<IShaderComponent>(); _translateComponent = AddComponent<ITranslateComponent>(); _imageComponent = AddComponent<IImageComponent>(); _scaleComponent = AddComponent<IScaleComponent>(); _rotateComponent = AddComponent<IRotateComponent>(); _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>(); _textComponent = AddComponent<ITextComponent>(); _checkboxComponent = AddComponent<ICheckboxComponent>(); beforeInitComponents(resolver); InitComponents(); afterInitComponents(resolver); }
public AGSCheckBox(string id, Resolver resolver) : base(id, resolver) { _uIEvents = AddComponent <IUIEvents>(); _skinComponent = AddComponent <ISkinComponent>(); _hasRoom = AddComponent <IHasRoom>(); _animationContainer = AddComponent <IAnimationContainer>(); _inObjectTree = AddComponent <IInObjectTree>(); _collider = AddComponent <ICollider>(); _visibleComponent = AddComponent <IVisibleComponent>(); _enabledComponent = AddComponent <IEnabledComponent>(); _customProperties = AddComponent <ICustomPropertiesComponent>(); _drawableInfo = AddComponent <IDrawableInfo>(); _hotspotComponent = AddComponent <IHotspotComponent>(); _shaderComponent = AddComponent <IShaderComponent>(); _translateComponent = AddComponent <ITranslateComponent>(); _imageComponent = AddComponent <IImageComponent>(); _scaleComponent = AddComponent <IScaleComponent>(); _rotateComponent = AddComponent <IRotateComponent>(); _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>(); _textComponent = AddComponent <ITextComponent>(); _checkboxComponent = AddComponent <ICheckboxComponent>(); _modelMatrixComponent = AddComponent <IModelMatrixComponent>(); beforeInitComponents(resolver); InitComponents(); afterInitComponents(resolver); }
public void AddEditorUI(string id, ITreeNodeView view, InspectorProperty property) { _property = property; var label = view.TreeItem; var checkbox = CreateCheckbox(label, _factory, id); _checkbox = checkbox; checkbox.Checked = bool.Parse(property.Value); checkbox.OnCheckChanged.Subscribe(args => { property.Prop.SetValue(property.Object, args.Checked); }); }
public AGSCheckBox(string id, Resolver resolver) : base(id, resolver) { _uIEvents = AddComponent <IUIEvents>(); Bind <IUIEvents>(c => _uIEvents = c, _ => {}); _skinComponent = AddComponent <ISkinComponent>(); Bind <ISkinComponent>(c => _skinComponent = c, _ => {}); _hasRoomComponent = AddComponent <IHasRoomComponent>(); Bind <IHasRoomComponent>(c => _hasRoomComponent = c, _ => {}); _animationComponent = AddComponent <IAnimationComponent>(); Bind <IAnimationComponent>(c => _animationComponent = c, _ => {}); _inObjectTreeComponent = AddComponent <IInObjectTreeComponent>(); Bind <IInObjectTreeComponent>(c => _inObjectTreeComponent = c, _ => {}); _colliderComponent = AddComponent <IColliderComponent>(); Bind <IColliderComponent>(c => _colliderComponent = c, _ => {}); _visibleComponent = AddComponent <IVisibleComponent>(); Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {}); _enabledComponent = AddComponent <IEnabledComponent>(); Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {}); _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>(); Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {}); _drawableInfoComponent = AddComponent <IDrawableInfoComponent>(); Bind <IDrawableInfoComponent>(c => _drawableInfoComponent = c, _ => {}); _shaderComponent = AddComponent <IShaderComponent>(); Bind <IShaderComponent>(c => _shaderComponent = c, _ => {}); _translateComponent = AddComponent <ITranslateComponent>(); Bind <ITranslateComponent>(c => _translateComponent = c, _ => {}); _imageComponent = AddComponent <IImageComponent>(); Bind <IImageComponent>(c => _imageComponent = c, _ => {}); _borderComponent = AddComponent <IBorderComponent>(); Bind <IBorderComponent>(c => _borderComponent = c, _ => { }); _scaleComponent = AddComponent <IScaleComponent>(); Bind <IScaleComponent>(c => _scaleComponent = c, _ => {}); _rotateComponent = AddComponent <IRotateComponent>(); Bind <IRotateComponent>(c => _rotateComponent = c, _ => {}); _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>(); Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {}); _modelMatrixComponent = AddComponent <IModelMatrixComponent>(); Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {}); _boundingBoxComponent = AddComponent <IBoundingBoxComponent>(); Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {}); _worldPositionComponent = AddComponent <IWorldPositionComponent>(); Bind <IWorldPositionComponent>(c => _worldPositionComponent = c, _ => {}); _checkboxComponent = AddComponent <ICheckboxComponent>(); Bind <ICheckboxComponent>(c => _checkboxComponent = c, _ => {}); beforeInitComponents(resolver); InitComponents(); afterInitComponents(resolver); }
public void AddEditorUI(string id, ITreeNodeView view, IProperty property) { _property = property; var label = view.TreeItem; var checkbox = CreateCheckbox(label, _factory, id); _checkbox = checkbox; checkbox.Checked = bool.Parse(property.ValueString); checkbox.OnCheckChanged.Subscribe(args => { if (_actions.ActionIsExecuting) { return; } _actions.RecordAction(new PropertyAction(property, args.Checked, _model)); }); }
private void addTargetUIForCreate(IPanel panel, Target target) { if (target == Target.Area) { return; } var factory = _editor.Editor.Factory; var buttonsPanel = factory.UI.GetPanel("MethodWizardTargetPanel", 100f, 45f, MethodWizard.MARGIN_HORIZONTAL, 50f, panel); buttonsPanel.Tint = Colors.Transparent; var font = _editor.Editor.Settings.Defaults.TextFont; var labelConfig = new AGSTextConfig(font: factory.Fonts.LoadFont(font.FontFamily, font.SizeInPoints, FontStyle.Underline)); factory.UI.GetLabel("AddToLabel", "Add To:", 50f, 20f, 0f, 0f, buttonsPanel, labelConfig); const float buttonY = -40f; var roomButton = factory.UI.GetCheckBox("AddToRoomRadioButton", (ButtonAnimation)null, null, null, null, 10f, buttonY, buttonsPanel, "Room", width: 20f, height: 25f); var guiButton = factory.UI.GetCheckBox("AddToGUIRadioButton", (ButtonAnimation)null, null, null, null, 130f, buttonY, buttonsPanel, "GUI", width: 20f, height: 25f); _guiButton = guiButton.GetComponent <ICheckboxComponent>(); _targetRadioGroup = new AGSRadioGroup(); roomButton.RadioGroup = _targetRadioGroup; guiButton.RadioGroup = _targetRadioGroup; if (_potentialParent != null) { var parentButton = factory.UI.GetCheckBox("AddToParentRadioButton", (ButtonAnimation)null, null, null, null, 250f, buttonY, buttonsPanel, _potentialParent.GetFriendlyName(), width: 20f, height: 25f); parentButton.RadioGroup = _targetRadioGroup; _parentButton = parentButton.GetComponent <ICheckboxComponent>(); parentButton.MouseClicked.Subscribe(() => { resetNumberEditor(panel, "x"); resetNumberEditor(panel, "y"); }); } _targetRadioGroup.SelectedButton = target == Target.UI ? _guiButton : roomButton; }
public SettingsEntryInterface( ComponentGroup componentGroup, Vector2 position, string name, Type type, object defaultValue, object currentValue, Action <object> applySetting, bool doubleLine = false, bool autoApply = false ) { _type = type; _defaultValue = defaultValue; _applySetting = applySetting; _doubleLine = doubleLine; new TextComponent( componentGroup, position + new Vector2(50, doubleLine ? -20 : 0), new Vector2(TextWidth, doubleLine ? 40 : 30), name, FontManager.UIFontRegular, 18, alignment: TextAnchor.LowerLeft ); if (type == typeof(byte)) { _input = new InputComponent( componentGroup, position - new Vector2(0, 35 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, InputHeight), currentValue.ToString(), "", TextureManager.InputFieldBackground, FontManager.UIFontRegular, 18, InputField.CharacterValidation.Integer ); // TODO: make the constructor parameter "autoApply" work with integer input new TextComponent( componentGroup, position - new Vector2(0, 60 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, 20), "default value: " + defaultValue, FontManager.UIFontRegular, alignment: TextAnchor.MiddleLeft ); } else if (type == typeof(bool)) { if (currentValue is bool currentChecked) { _checkbox = new CheckboxComponent( componentGroup, position - new Vector2(90, 30 + (doubleLine ? 25 : 0)), new Vector2(20, 20), currentChecked, TextureManager.ToggleBackground, TextureManager.Checkmark ); if (autoApply) { _checkbox.SetOnToggle(_ => { ApplySetting(); }); } } new TextComponent( componentGroup, position - new Vector2(-40, 30 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, 20), "default value: " + defaultValue, FontManager.UIFontRegular, alignment: TextAnchor.MiddleLeft ); } else { throw new ArgumentException("Type of object is not supported"); } }
public SettingsUIEntry(GameObject parent, Vector2 position, string name, Type type, object defaultValue, object currentValue, Action <object> applySetting, bool doubleLine = false) { _type = type; _defaultValue = defaultValue; _applySetting = applySetting; _doubleLine = doubleLine; new TextComponent( parent, position + new Vector2(50, doubleLine ? -20 : 0), new Vector2(TextWidth, doubleLine ? 40 : 30), name, FontManager.UIFontRegular, 18, alignment: TextAnchor.LowerLeft ); if (type == typeof(int)) { _input = new InputComponent( parent, position - new Vector2(0, 35 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, InputHeight), currentValue.ToString(), "", TextureManager.InputFieldBackground, FontManager.UIFontRegular, 18, InputField.CharacterValidation.Integer ); new TextComponent( parent, position - new Vector2(0, 60 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, 20), "default value: " + defaultValue, FontManager.UIFontRegular, alignment: TextAnchor.MiddleLeft ); } else if (type == typeof(bool)) { if (currentValue is bool currentChecked) { _checkbox = new CheckboxComponent( parent, position - new Vector2(90, 30 + (doubleLine ? 25 : 0)), new Vector2(20, 20), currentChecked, TextureManager.ToggleBackground, TextureManager.Checkmark ); } new TextComponent( parent, position - new Vector2(-40, 30 + (doubleLine ? 25 : 0)), new Vector2(InputWidth, 20), "default value: " + defaultValue, FontManager.UIFontRegular, alignment: TextAnchor.MiddleLeft ); } }
public SettingsEntryInterface( ComponentGroup componentGroup, Vector2 position, string name, Type type, object defaultValue, object currentValue, Action <object> applySetting, bool autoApply = false ) { _type = type; _defaultValue = defaultValue; _applySetting = applySetting; float height; if (type == typeof(byte)) { height = 38f; } else if (type == typeof(bool)) { height = 32f; } else { throw new ArgumentException("Type of object is not supported"); } _text = new TextComponent( componentGroup, position, new Vector2(EntryWidth, height), name, UiManager.NormalFontSize, alignment: TextAnchor.MiddleLeft ); if (type == typeof(byte)) { _input = new InputComponent( componentGroup, position + new Vector2(EntryWidth / 2f - InputWidth / 2f, 0f), new Vector2(InputWidth, InputHeight), currentValue.ToString(), "", TextureManager.InputFieldBg, FontManager.UIFontRegular, UiManager.NormalFontSize, InputField.CharacterValidation.Integer ); if (autoApply) { _input.SetOnChange(_ => { if (_currentInputWaitApplyRoutine != null) { MonoBehaviourUtil.Instance.StopCoroutine(_currentInputWaitApplyRoutine); } _currentInputWaitApplyRoutine = MonoBehaviourUtil.Instance.StartCoroutine(InputWaitApply()); }); } // TODO: make the constructor parameter "autoApply" work with integer input } else if (type == typeof(bool)) { if (currentValue is bool currentChecked) { _checkbox = new CheckboxComponent( componentGroup, position + new Vector2(EntryWidth / 2f - CheckboxSize / 2f, 0f), new Vector2(CheckboxSize, CheckboxSize), currentChecked, TextureManager.InputFieldBg, TextureManager.CheckBoxToggle ); if (autoApply) { _checkbox.SetOnToggle(_ => { ApplySetting(); }); } } } }