예제 #1
0
        internal static void LoadLayout(IEModOptions.LayoutOptions newLayout)
        {
            Initialize();
            var buffsChanged = newLayout.BuffsSideLeft;

            foreach (var portrait in GetAllPortraits())
            {
                var statusEffects = portrait.Child("StatusEffects");
                var uiAnchor      = statusEffects.Component <UIAnchor>();
                uiAnchor.side        = buffsChanged ? UIAnchor.Side.TopLeft : UIAnchor.Side.TopRight;
                uiAnchor.pixelOffset = new Vector2(buffsChanged ? -27f : 3f, 0f);                 // default is (3,0)
                statusEffects.Component <UIGrid>().Reposition();
            }
            FormationButtonSet.transform.localPosition = newLayout.FormationPosition;
            PartyPortraitBar.transform.localPosition   = newLayout.PartyBarPosition;
            PartySolidHud.transform.localPosition      = newLayout.PartySolidHudPosition;
            _customizeButton.LocalPosition             = newLayout.CustomizeButtonPosition;
            if (newLayout.BuffsSideLeft != (RadioGroup.Component <UIAnchor>().side == UIAnchor.Side.TopRight))
            {
                var blop = new GameObject();
                SetLogButtonsAlignment(blop);
            }
            ActionBar.Child("trimB").transform.localPosition = newLayout.HudPosition;
            AbilitiesBar.transform.localPosition             = newLayout.AbilitiesBarPosition;
            ConsoleWindow.transform.localPosition            = newLayout.LogPosition;

            SetLogButtonsAlignment(newLayout.LogButtonsLeft);
            ButtonsLeft.transform.localPosition  = newLayout.LeftHudBarPosition;
            ButtonsRight.transform.localPosition = newLayout.RightHudBarPosition;
            TimeWidget.transform.localPosition   = newLayout.ClockPosition;

            var leftUiGrid = ButtonsLeft.Component <UIGrid>();

            leftUiGrid.arrangement = newLayout.HudHorizontal ? UIGrid.Arrangement.Horizontal : UIGrid.Arrangement.Vertical;
            leftUiGrid.Reposition();

            var rightUiGrid = ButtonsRight.Component <UIGrid>();

            rightUiGrid.arrangement = newLayout.HudHorizontal ? UIGrid.Arrangement.Vertical : UIGrid.Arrangement.Horizontal;
            rightUiGrid.Reposition();

            ActionBarTrimB.gameObject.SetActive(!newLayout.HudTextureHidden);

            mod_UIPartyPortrait.IsVertical = newLayout.PartyBarHorizontal;

            if (ButtonsLeft.ChildPath("#0/Background").gameObject.activeSelf != newLayout.ButtonsBackground)
            {
                SetButtonsBackgroundActive();
            }

            ReplaceAtlas(newLayout.UsingCustomTextures);

            SetPortraitHighlight(!newLayout.PortraitHighlightsDisabled);

            SelectedFrame.Value = newLayout.FramePath;
            //not sure why, but the tooltip offset only updates correctly if we do this last.
            TooltipOffset.Value = newLayout.TooltipOffset;
        }
예제 #2
0
        private static void SetButtonsBackgroundActive(bool?isInactive = null)
        {
            var btnsLeftBgs =
                from button in ButtonsLeft.Children().Concat(ButtonsRight.Children())
                where button.HasChild("Background")
                select button.Child("Background");

            foreach (var bg in btnsLeftBgs)
            {
                bg.SetActive(isInactive ?? !bg.activeSelf);
            }
        }
예제 #3
0
        private static void SetHudOrientation(bool horizontal)
        {
            var buttonsLeft_grid = ButtonsLeft.Component <UIGrid>();

            buttonsLeft_grid.arrangement = horizontal ? UIGrid.Arrangement.Horizontal : UIGrid.Arrangement.Vertical;
            buttonsLeft_grid.Reposition();

            //rather amusingly, the right hud already has orientation by default... it just looks horizontal. :)
            var buttonsRight_grid = ButtonsRight.Component <UIGrid>();

            buttonsRight_grid.arrangement = horizontal ? UIGrid.Arrangement.Vertical : UIGrid.Arrangement.Horizontal;
            buttonsRight_grid.Reposition();
        }