コード例 #1
0
        ////////////////

        private void UpdateWidget_If()
        {
            CompletionStatHUD widget = this.ObjectivesProgressHUD;

            if (!widget.IsEnabled())
            {
                return;
            }

            //

            if (widget.IsMouseHovering)
            {
                widget.TitleColor = ObjectiveManager.GetTextColor(true);
            }
            else
            {
                widget.TitleColor = ObjectiveManager.GetTextColor(false);
            }
        }
コード例 #2
0
        ////////////////

        private void LoadWidget()
        {
            var dim = new Vector2(176f, 52f);
            var pos = new Vector2(
                ((float)Main.screenWidth - dim.X) * 0.5f,
                (float)Main.screenHeight - dim.Y - 32f
                );

            //

            this.ObjectivesProgressHUD = new CompletionStatHUD(
                pos: pos,
                dim: dim,
                title: "Objectives",
                stat: () => {
                var mngr = ModContent.GetInstance <ObjectiveManager>();
                ICollection <Objective> objs = mngr.CurrentObjectives.Values;
                int complete = objs.Count(o => o.IsComplete == true);

                return(complete, objs.Count - complete);
            },
                enabler: () => Main.playerInventory
                );

            //

            this.ObjectivesProgressHUD.TitleColor = ObjectiveManager.GetTextColor(false);

            this.ObjectivesProgressHUD.OnClick += (_, __) => {
                UtilityPanelsTabs.OpenTab(ObjectivesMod.UtilityPanelsName);
            };

            //

            HUDElementsLibAPI.AddWidget(this.ObjectivesProgressHUD);
        }