예제 #1
0
        protected override void OnSpawn()
        {
            base.OnSpawn();
            // One long linear row
            var panel = new PPanel("MoreModActions")
            {
                BackColor = PUITuning.Colors.DialogDarkBackground, Spacing = 6,
                BackImage = PUITuning.Images.BoxBorder, ImageMode = Image.Type.Sliced,
                Direction = PanelDirection.Horizontal, Margin = new RectOffset(6, 6, 6, 6)
            }.AddChild(MakeButton("MoveToFirst", UI.TOOLTIPS.DNI_TOP,
                                  SpriteRegistry.GetTopIcon(), OnMoveFirst, (obj) =>
                                  buttonFirst = obj.GetComponent <KButton>()))
            .AddChild(MakeButton("MoveUpTen", UI.TOOLTIPS.DNI_UP,
                                 Assets.GetSprite("icon_priority_up_2"), OnMoveUp, (obj) =>
                                 buttonUp = obj.GetComponent <KButton>()))
            .AddChild(MakeButton("MoveDownTen", UI.TOOLTIPS.DNI_DOWN,
                                 Assets.GetSprite("icon_priority_down_2"), OnMoveDown, (obj) =>
                                 buttonDown = obj.GetComponent <KButton>()))
            .AddChild(MakeButton("MoveToLast", UI.TOOLTIPS.DNI_BOTTOM,
                                 SpriteRegistry.GetBottomIcon(), OnMoveLast, (obj) =>
                                 buttonLast = obj.GetComponent <KButton>()))
            .AddChild(new PButton("ManageMod")
            {
                Text    = UI.MODSSCREEN.BUTTON_SUBSCRIPTION, DynamicSize = false,
                OnClick = OnManage, ToolTip = "Manage Mod", Margin = DebugUtils.BUTTON_MARGIN
            }.SetKleiBlueStyle().AddOnRealize((obj) => buttonManage = obj))
            .AddChild(new PButton("UnsubMod")
            {
                Text    = UI.MODSSCREEN.BUTTON_UNSUB, DynamicSize = false,
                OnClick = OnUnsub, ToolTip = UI.TOOLTIPS.DNI_UNSUB, Margin = DebugUtils.
                                                                             BUTTON_MARGIN
            }.SetKleiBlueStyle().AddOnRealize((obj) => buttonUnsub = obj.
                                                                     GetComponent <KButton>()));

#if DEBUG
            panel.AddChild(new PButton("ModifyMod")
            {
                Text    = UI.MODSSCREEN.BUTTON_MODIFY, DynamicSize = false,
                OnClick = OnModify, ToolTip = UI.TOOLTIPS.DNI_MODIFY, Margin = DebugUtils.
                                                                               BUTTON_MARGIN
            }.SetKleiPinkStyle().AddOnRealize((obj) => buttonModify = obj.
                                                                      GetComponent <KButton>()));
#endif
            var actionsObj = panel.AddTo(gameObject);
#if DEBUG
            PButton.SetButtonEnabled(buttonModify.gameObject, false);
#endif
            actionsObj.SetActive(false);
            // Blacklist from auto layout
            actionsObj.AddOrGet <LayoutElement>().ignoreLayout = true;
            PUIElements.SetAnchors(actionsObj, PUIAnchoring.End, PUIAnchoring.Center);
            unsubCaller = new CallResult <RemoteStorageUnsubscribePublishedFileResult_t>(
                OnUnsubComplete);
            actionsScreen = actionsObj.AddComponent <ModActionsScreen>();
            callingButton = null;
        }
예제 #2
0
        /// <summary>
        /// Adds the sorting buttons to the row prefab to reconstruct them faster.
        /// </summary>
        /// <param name="rowPrefab">The prefab to modify.</param>
        internal static void ConfigureRowPrefab(GameObject rowPrefab)
        {
            // Use the existing references object
            var refs    = rowPrefab.AddOrGet <HierarchyReferences>();
            var newRefs = ListPool <ElementReference, ModDebugRegistry> .Allocate();

            if (refs.references != null)
            {
                newRefs.AddRange(refs.references);
            }
            // Add our new buttons
            newRefs.Add(MakeButton(REF_TOP, SpriteRegistry.GetTopIcon(), rowPrefab));
            newRefs.Add(MakeButton(REF_UP, Assets.GetSprite("icon_priority_up_2"), rowPrefab));
            newRefs.Add(MakeButton(REF_DOWN, Assets.GetSprite("icon_priority_down_2"),
                                   rowPrefab));
            newRefs.Add(MakeButton(REF_BOTTOM, SpriteRegistry.GetBottomIcon(), rowPrefab));
            refs.references = newRefs.ToArray();
            newRefs.Recycle();
        }