Example #1
0
 internal MoreModActions()
 {
     actionsScreen = null;
     buttonFirst   = buttonUp = buttonLast = buttonDown = buttonUnsub = null;
     buttonManage  = null;
     callingButton = null;
     callHandler   = null;
 }
Example #2
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;
        }
Example #3
0
 protected override void OnCleanUp()
 {
     HidePopup();
     unsubCaller?.Dispose();
     if (actionsScreen != null)
     {
         Destroy(actionsScreen.gameObject);
     }
     actionsScreen = null;
     base.OnCleanUp();
 }