public void OnShow(string name, IRadioGroup manager)
    {
        mName = name;

        gameObject.name = name;

        mManager = manager;

        /*transform.SetParent(manager.gridTransform);
         * transform.localScale = Vector3.one;*/

        ContentImage.sprite = Resources.Load <Sprite>("ItemSprites/U_icon_" + name);

        IsSelected = false;
        UpdateState();
    }
Exemple #2
0
        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;
        }