コード例 #1
0
        public AddTaskMenu(ITranslationHelper translation) : base(0, 0, 612, 64)
        {
            xPositionOnScreen = (Game1.uiViewport.Width / 2) - (width / 2);
            yPositionOnScreen = (Game1.uiViewport.Height / 2) - (height / 2);

            _translation  = translation;
            _taskParser   = new TaskParser(translation);
            _previousText = "";
            _hoverText    = "";

            optionsButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen - 88, yPositionOnScreen - 6, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(16, 80, 16, 16),
                4f)
            {
                myID            = 100,
                downNeighborID  = SNAP_AUTOMATIC,
                rightNeighborID = SNAP_AUTOMATIC
            };

            closeTipButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + 444, yPositionOnScreen + height + 18, 24, 24),
                Game1.mouseCursors,
                new Rectangle(337, 494, 12, 12),
                2f)
            {
                myID            = 101,
                upNeighborID    = 0,
                downNeighborID  = SNAP_AUTOMATIC,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC,
                visible         = false
            };

            cancelButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + width + 32, yPositionOnScreen - 6, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(0, 80, 16, 16),
                4f)
            {
                myID           = 102,
                downNeighborID = SNAP_AUTOMATIC,
                leftNeighborID = SNAP_AUTOMATIC
            };

            okButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + width - 36, yPositionOnScreen + height + 18, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(32, 80, 16, 16),
                4f)
            {
                myID           = 103,
                upNeighborID   = 0,
                leftNeighborID = SNAP_AUTOMATIC
            };

            smartOkButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + width - 108, okButton.bounds.Y, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(48, 80, 16, 16),
                4f)
            {
                myID            = 104,
                upNeighborID    = 0,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            smartItemIcon = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + 60, okButton.bounds.Y, 56, 56),
                DeluxeJournalMod.UiTexture,
                new Rectangle(14, 110, 14, 14),
                4f)
            {
                myID            = 105,
                upNeighborID    = 0,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC,
                visible         = false
            };

            smartNPCIcon = new ClickableTextureComponent(
                smartItemIcon.bounds,
                DeluxeJournalMod.UiTexture,
                new Rectangle(0, 110, 14, 14),
                4f)
            {
                myID            = 106,
                upNeighborID    = 0,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC,
                visible         = false
            };

            smartNameIcon = new ClickableTextureComponent(
                smartItemIcon.bounds,
                DeluxeJournalMod.UiTexture,
                new Rectangle(28, 110, 14, 14),
                4f)
            {
                myID            = 107,
                upNeighborID    = 0,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC,
                visible         = false
            };

            smartTypeIconCC = new ClickableComponent(new Rectangle(xPositionOnScreen, okButton.bounds.Y, 56, 56), "")
            {
                myID            = 108,
                upNeighborID    = 0,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC,
                visible         = false
            };

            _textBox = new SideScrollingTextBox(null, null, Game1.dialogueFont, Game1.textColor)
            {
                X        = xPositionOnScreen,
                Y        = yPositionOnScreen,
                Width    = width,
                Height   = 192,
                Selected = true
            };

            textBoxCC = new ClickableComponent(new Rectangle(_textBox.X, _textBox.Y, _textBox.Width, 64), "")
            {
                myID            = 0,
                downNeighborID  = SNAP_AUTOMATIC,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            Game1.playSound("shwip");

            exitFunction = OnExit;
        }
コード例 #2
0
        public TaskOptionsMenu(ITranslationHelper translation) : base(0, 0, 864, 576)
        {
            xPositionOnScreen = (Game1.uiViewport.Width / 2) - (width / 2);
            yPositionOnScreen = (Game1.uiViewport.Height / 2) - (height / 2);

            _translation      = translation;
            _textBoxTexture   = Game1.content.Load <Texture2D>("LooseSprites\\textBox");
            _optionHeld       = null;
            _taskFactory      = null;
            _task             = null;
            _selectedTaskID   = TaskTypes.Basic;
            _restoreChildMenu = false;
            _hoverText        = "";

            _fixedContentBounds       = default;
            _fixedContentBounds.X     = xPositionOnScreen + spaceToClearSideBorder + 28;
            _fixedContentBounds.Y     = yPositionOnScreen + spaceToClearTopBorder + 16;
            _fixedContentBounds.Width = width - (_fixedContentBounds.X - xPositionOnScreen) * 2;

            _parameterIcons     = new Dictionary <int, ClickableTextureComponent>();
            _parameterTextBoxes = new Dictionary <int, TaskParameterTextBox>();
            parameterTextBoxCCs = new List <ClickableComponent>();
            typeIcons           = new List <ClickableComponent>();

            _nameTextBox = new SideScrollingTextBox(_textBoxTexture, null, Game1.smallFont, Game1.textColor)
            {
                X     = _fixedContentBounds.X + LabelWidth,
                Y     = _fixedContentBounds.Y,
                Width = _fixedContentBounds.Width - LabelWidth
            };

            _renewPeriodDropDown = CreateTranslatedDropDown("ui.tasks.options.renew", 0, VerticalSpacing, true);
            _weekdaysDropDown    = CreateTranslatedDropDown("weekdays", _renewPeriodDropDown.bounds.Width + 8, VerticalSpacing, false);
            _seasonsDropDown     = CreateTranslatedDropDown("seasons", _renewPeriodDropDown.bounds.Width + 8, VerticalSpacing, false);
            _daysDropDown        = new OptionsNumericDropDown(string.Empty, 1, 28, OptionsNumericDropDown.WrapStyle.Horizontal, 7, _renewPeriodDropDown.bounds.Right + 8, _renewPeriodDropDown.bounds.Y);

            nameTextBoxCC = new ClickableComponent(new Rectangle(_nameTextBox.X, _nameTextBox.Y, _nameTextBox.Width, _nameTextBox.Height), "")
            {
                myID            = 100,
                downNeighborID  = 101,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            renewPeriodDropDownCC = new ClickableComponent(_renewPeriodDropDown.bounds, "")
            {
                myID            = 101,
                upNeighborID    = SNAP_AUTOMATIC,
                downNeighborID  = CUSTOM_SNAP_BEHAVIOR,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            weekdaysDropDownCC = new ClickableComponent(_weekdaysDropDown.bounds, "")
            {
                myID            = 102,
                upNeighborID    = SNAP_AUTOMATIC,
                downNeighborID  = CUSTOM_SNAP_BEHAVIOR,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            daysDropDownCC = new ClickableComponent(_daysDropDown.bounds, "")
            {
                myID            = 103,
                upNeighborID    = SNAP_AUTOMATIC,
                downNeighborID  = CUSTOM_SNAP_BEHAVIOR,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            seasonsDropDownCC = new ClickableComponent(_seasonsDropDown.bounds, "")
            {
                myID            = 104,
                upNeighborID    = SNAP_AUTOMATIC,
                downNeighborID  = CUSTOM_SNAP_BEHAVIOR,
                rightNeighborID = SNAP_AUTOMATIC,
                leftNeighborID  = SNAP_AUTOMATIC
            };

            Rectangle iconBounds = new Rectangle(0, 0, 56, 56);
            int       offset     = 0;
            int       i          = 0;

            foreach (string id in TaskRegistry.Keys)
            {
                iconBounds.X = _fixedContentBounds.X + LabelWidth + 12 + (offset % 512);
                iconBounds.Y = _fixedContentBounds.Y + 20 + VerticalSpacing * (2 + (offset / 512));

                typeIcons.Add(new ClickableComponent(iconBounds, id)
                {
                    myID            = i,
                    upNeighborID    = SNAP_AUTOMATIC,
                    downNeighborID  = SNAP_AUTOMATIC,
                    rightNeighborID = SNAP_AUTOMATIC,
                    leftNeighborID  = SNAP_AUTOMATIC
                });

                offset += 64;
                i++;
            }

            _fixedContentBounds.Height = typeIcons.Last().bounds.Y + VerticalSpacing + 4 - _fixedContentBounds.Y;
            height = _fixedContentBounds.Bottom + BottomGap - xPositionOnScreen;

            backButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen - 64, _fixedContentBounds.Y + 12, 64, 32),
                Game1.mouseCursors,
                new Rectangle(352, 495, 12, 11),
                4f)
            {
                myID            = 105,
                downNeighborID  = 0,
                rightNeighborID = SNAP_AUTOMATIC
            };

            cancelButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + width - 12, _fixedContentBounds.Y, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(0, 80, 16, 16),
                4f)
            {
                myID           = 106,
                leftNeighborID = SNAP_AUTOMATIC
            };

            okButton = new ClickableTextureComponent(
                new Rectangle(xPositionOnScreen + width - 100, yPositionOnScreen + height - 4, 64, 64),
                DeluxeJournalMod.UiTexture,
                new Rectangle(32, 80, 16, 16),
                4f)
            {
                myID            = 107,
                upNeighborID    = CUSTOM_SNAP_BEHAVIOR,
                rightNeighborID = SNAP_AUTOMATIC
            };

            Game1.playSound("shwip");

            exitFunction = OnExit;
        }