diff --git a/Assembly-CSharp/Assembly-CSharp.csproj b/Assembly-CSharp/Assembly-CSharp.csproj index f81afb4ed..03ba1e83f 100644 --- a/Assembly-CSharp/Assembly-CSharp.csproj +++ b/Assembly-CSharp/Assembly-CSharp.csproj @@ -227,7 +227,6 @@ - @@ -355,6 +354,8 @@ + + diff --git a/Assembly-CSharp/Global/AbilityUI.cs b/Assembly-CSharp/Global/AbilityUI.cs index 635b5c85c..eb242e532 100644 --- a/Assembly-CSharp/Global/AbilityUI.cs +++ b/Assembly-CSharp/Global/AbilityUI.cs @@ -7,6 +7,7 @@ using System.Linq; using Memoria; using Memoria.Assets; +using Memoria.Scenes; using Memoria.Data; using Memoria.Database; using Memoria.Field; @@ -75,6 +76,8 @@ public class AbilityUI : UIScene private Boolean canMultiTarget; private Dictionary equipmentPartInAbilityDict; private Dictionary equipmentIdInAbilityDict; + private GOScrollablePanel _abilityPanel; + private GOScrollablePanel _supportPanel; public static Color[] BoostedAbilityColor = new Color[] { @@ -88,7 +91,7 @@ public class AbilityUI : UIScene public Int32 CurrentPartyIndex { - set { this.currentPartyIndex = value; } + set => this.currentPartyIndex = value; } static AbilityUI() @@ -113,7 +116,7 @@ public AbilityUI() public override void Show(SceneVoidDelegate afterFinished = null) { - SceneVoidDelegate action = () => + SceneVoidDelegate afterShowAction = () => { PersistenSingleton.Instance.MainMenuScene.SubMenuPanel.SetActive(false); ButtonGroupState.SetScrollButtonToGroup(this.activeAbilityScrollList.ScrollButton, ActionAbilityGroupButton); @@ -129,7 +132,8 @@ public override void Show(SceneVoidDelegate afterFinished = null) }; SceneDirector.FadeEventSetColor(FadeMode.Sub, Color.black); - base.Show(action); + base.Show(afterShowAction); + this.UpdateUserInterface(); this.SwitchCharacter(true); this.DisplayHelp(); this.DisplaySubMenuArrow(true); @@ -138,9 +142,41 @@ public override void Show(SceneVoidDelegate afterFinished = null) this.supportAbilityScrollList.ScrollButton.DisplayScrollButton(false, false); } + public void UpdateUserInterface() + { + if (!Configuration.Interface.IsEnabled) + return; + const Int32 originalLineCount = 6; + const Single buttonOriginalHeight = 92f; + const Single panelOriginalWidth = 1488f; + const Single panelOriginalHeight = originalLineCount * buttonOriginalHeight; + Int32 linePerPage = Configuration.Interface.MenuAbilityRowCount; + Int32 lineHeight = (Int32)Math.Round(panelOriginalHeight / linePerPage); + Single scaleFactor = lineHeight / buttonOriginalHeight; + _abilityPanel.SubPanel.ChangeDims(2, linePerPage, panelOriginalWidth / 2f, lineHeight); + _abilityPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _abilityPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.152f, relTop: 0.848f, relLeft: 0.091f, relRight: 0.795f); + _abilityPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _abilityPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.152f, relTop: 0.848f, relLeft: 0.8f, relRight: 0.92f); + _abilityPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _abilityPanel.SubPanel.ButtonPrefab.NumberLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _abilityPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + _supportPanel.SubPanel.ChangeDims(2, linePerPage, panelOriginalWidth / 2f, lineHeight); + _supportPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _supportPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.152f, relTop: 0.848f, relLeft: 0.09f, relRight: 0.176f); + _supportPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _supportPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.152f, relTop: 0.848f, relLeft: 0.24f, relRight: 0.795f); + _supportPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _supportPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.152f, relTop: 0.848f, relLeft: 0.8f, relRight: 0.92f); + _supportPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _supportPanel.SubPanel.ButtonPrefab.NumberLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _supportPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + } + public override void Hide(SceneVoidDelegate afterFinished = null) { - base.Hide(afterFinished); + UIScene.SceneVoidDelegate afterHideAction = delegate + { + MainMenuUI.UIControlPanel?.ExitMenu(); + }; + if (afterFinished != null) + afterHideAction += afterFinished; + base.Hide(afterHideAction); if (this.fastSwitch) return; PersistenSingleton.Instance.MainMenuScene.StartSubmenuTweenIn(); @@ -949,6 +985,7 @@ private void DisplaySADetail(Transform item, ListDataTypeBase data, Int32 index, ButtonGroupState.SetButtonAnimation(detailWithIconHud.Self, true); detailWithIconHud.NameLabel.text = FF9TextTool.SupportAbilityName(supportId); detailWithIconHud.NumberLabel.text = saData.GemsCount.ToString(); + detailWithIconHud.IconSprite.preventPixelPerfect = Configuration.Interface.IsEnabled; detailWithIconHud.IconSprite.color = Color.white; if (abilityListData.Type == AbilityType.CantSpell) { @@ -1290,10 +1327,8 @@ public SubMenu GetSubMenuFromGameObject(GameObject go) private void Awake() { this.FadingComponent = this.ScreenFadeGameObject.GetComponent(); - UIEventListener uiEventListener1 = UIEventListener.Get(this.UseSubMenu); - uiEventListener1.Click += this.onClick; - UIEventListener uiEventListener2 = UIEventListener.Get(this.EquipSubMenu); - uiEventListener2.Click += this.onClick; + UIEventListener.Get(this.UseSubMenu).Click += this.onClick; + UIEventListener.Get(this.EquipSubMenu).Click += this.onClick; this.abilityInfoHud = new AbilityInfoHUD(this.AbilityDetailPanel); this.abilityInfoHud.ClearEquipmentIcon(); this.characterHud = new CharacterDetailHUD(this.CharacterDetailPanel, false); @@ -1301,8 +1336,7 @@ private void Awake() foreach (Component component in this.TargetListPanel.transform.GetChild(0).transform) { GameObject obj = component.gameObject; - UIEventListener uiEventListener3 = UIEventListener.Get(obj); - uiEventListener3.Click += this.onClick; + UIEventListener.Get(obj).Click += this.onClick; this.targetHudList.Add(new CharacterDetailHUD(obj, true)); if (FF9StateSystem.MobilePlatform) gameObject.GetComponent().Help.TextKey = "TargetHelpMobile"; @@ -1314,8 +1348,7 @@ private void Awake() this.allTargetButtonCollider = this.allTargetButton.GetComponent(); this.allTargetButtonLabel = this.allTargetButton.GetChild(1).GetComponent(); this.allTargetHitArea = this.TargetListPanel.GetChild(2); - UIEventListener uiEventListener4 = UIEventListener.Get(this.allTargetButton); - uiEventListener4.Click += OnAllTargetClick; + UIEventListener.Get(this.allTargetButton).Click += OnAllTargetClick; this.useSubMenuLabel = this.UseSubMenu.GetChild(1).GetComponent(); this.equipSubMenuLabel = this.EquipSubMenu.GetChild(1).GetComponent(); this.submenuArrowGameObject = this.SubMenuPanel.GetChild(0); @@ -1323,6 +1356,8 @@ private void Awake() this.supportAbilityScrollList = this.SupportAbilityListPanel.GetChild(1).GetComponent(); this.targetTransition = this.TransitionGroup.GetChild(0).GetComponent(); this.avatarTransition = this.CharacterDetailPanel.GetChild(0).GetChild(6).GetChild(0).GetComponent(); + this._abilityPanel = new GOScrollablePanel(this.ActiveAbilityListPanel); + this._supportPanel = new GOScrollablePanel(this.SupportAbilityListPanel); } private Boolean IsSubMenuDisabledByMainMenu(Boolean useMenu) diff --git a/Assembly-CSharp/Global/ChocographUI.cs b/Assembly-CSharp/Global/ChocographUI.cs index 31ed23473..f48f0aef7 100644 --- a/Assembly-CSharp/Global/ChocographUI.cs +++ b/Assembly-CSharp/Global/ChocographUI.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using Assets.Scripts.Common; using Assets.Sources.Scripts.UI.Common; +using Memoria; +using Memoria.Scenes; using UnityEngine; using Object = System.Object; @@ -9,7 +11,7 @@ public class ChocographUI : UIScene { public override void Show(UIScene.SceneVoidDelegate afterFinished = null) { - UIScene.SceneVoidDelegate sceneVoidDelegate = delegate + UIScene.SceneVoidDelegate afterShowAction = delegate { ButtonGroupState.SetPointerDepthToGroup(4, ChocographUI.ItemGroupButton); ButtonGroupState.SetPointerOffsetToGroup(new Vector2(30f, 0f), ChocographUI.ItemGroupButton); @@ -19,24 +21,16 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) ButtonGroupState.ActiveGroup = ChocographUI.SubMenuGroupButton; }; if (afterFinished != null) - { - sceneVoidDelegate = (UIScene.SceneVoidDelegate)Delegate.Combine(sceneVoidDelegate, afterFinished); - } + afterShowAction += afterFinished; SceneDirector.FadeEventSetColor(FadeMode.Sub, Color.black); - base.Show(sceneVoidDelegate); + base.Show(afterShowAction); + this.UpdateUserInterface(); this.ClearLatestUI(); this.GetEventData(); this.DisplayChocoboAbilityInfo(); this.DisplayInventoryInfo(); this.DisplayChocographList(); - if (FF9StateSystem.PCPlatform) - { - this.HelpDespLabelGameObject.SetActive(true); - } - else - { - this.HelpDespLabelGameObject.SetActive(false); - } + this.HelpDespLabelGameObject.SetActive(FF9StateSystem.PCPlatform); if (ChocographUI.CurrentSelectedChocograph != -1) { ButtonGroupState.SetCursorStartSelect(this.chocographItemList[ChocographUI.CurrentSelectedChocograph].Self, ChocographUI.ItemGroupButton); @@ -53,17 +47,36 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) this.chocoboScrollButton.DisplayScrollButton(false, false); } + public void UpdateUserInterface() + { + if (!Configuration.Interface.IsEnabled) + return; + const Int32 originalLineCount = 5; + const Single buttonOriginalHeight = 86f; + const Single panelOriginalWidth = 658f; + const Single panelOriginalHeight = originalLineCount * buttonOriginalHeight; + Int32 linePerPage = Configuration.Interface.MenuChocographRowCount; + Int32 lineHeight = (Int32)Math.Round(panelOriginalHeight / linePerPage); + Single scaleFactor = lineHeight / buttonOriginalHeight; + _chocographPanel.SubPanel.ChangeDims(1, linePerPage, panelOriginalWidth, lineHeight); + foreach (GOButtonPrefab button in _chocographPanel.SubPanel.Table.Entries) + { + button.IconSprite.SetAnchor(target: button.Transform, relBottom: 0.5f, relTop: 0.5f, bottom: -36f * scaleFactor, top: 36f * scaleFactor, relLeft: 0.064f, relRight: 0.064f, right: 72f * scaleFactor); + button.NameLabel.SetAnchor(target: button.Transform, relBottom: 0.081f, relTop: 0.919f, relLeft: 0.064f, left: 90f * scaleFactor, relRight: 1f); + button.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + } + } + public override void Hide(UIScene.SceneVoidDelegate afterFinished = null) { - UIScene.SceneVoidDelegate sceneVoidDelegate = delegate + UIScene.SceneVoidDelegate afterHideAction = delegate { + MainMenuUI.UIControlPanel?.ExitMenu(); PersistenSingleton.Instance.ChangeUIState(PersistenSingleton.Instance.HUDState); }; if (afterFinished != null) - { - sceneVoidDelegate = (UIScene.SceneVoidDelegate)Delegate.Combine(sceneVoidDelegate, afterFinished); - } - base.Hide(sceneVoidDelegate); + afterHideAction += afterFinished; + base.Hide(afterHideAction); this.RemoveCursorMemorize(); } @@ -218,15 +231,14 @@ private Int32 GetIconType(Int32 id) public static void UpdateEquipedHintMap() { - if (FF9StateSystem.Common.FF9.hintmap_id > 24) + if (FF9StateSystem.Common.FF9.hintmap_id > ChocographUI.HintMapMax) { FF9StateSystem.Common.FF9.hintmap_id = 0; ChocographUI.CurrentSelectedChocograph = -1; } else { - ChocographUI.CurrentSelectedChocograph = FF9StateSystem.Common.FF9.hintmap_id - 1; - ChocographUI.CurrentSelectedChocograph = (Int32)((ChocographUI.CurrentSelectedChocograph >= 0) ? ChocographUI.CurrentSelectedChocograph : -1); + ChocographUI.CurrentSelectedChocograph = Math.Max(FF9StateSystem.Common.FF9.hintmap_id, 0) - 1; } } @@ -235,28 +247,24 @@ private void GetEventData() this.hasMap.Clear(); this.hasGem.Clear(); ChocographUI.UpdateEquipedHintMap(); - Int32 num = 0; - Int32 num2 = 0; - this.ability = (Int32)FF9StateSystem.EventState.gEventGlobal[191]; + Int32 chocographFound = 0; + Int32 chocographOpened = 0; + this.ability = FF9StateSystem.EventState.gEventGlobal[191]; this.mapCount = 0; this.gemCount = 0; for (Int32 i = 0; i < 3; i++) { - num |= (Int32)FF9StateSystem.EventState.gEventGlobal[187 + i] << i * 8; - num2 |= (Int32)FF9StateSystem.EventState.gEventGlobal[184 + i] << i * 8; + chocographFound |= (Int32)FF9StateSystem.EventState.gEventGlobal[187 + i] << i * 8; + chocographOpened |= (Int32)FF9StateSystem.EventState.gEventGlobal[184 + i] << i * 8; } - for (Int32 j = 0; j < 24; j++) + for (Int32 i = 0; i < ChocographUI.HintMapMax; i++) { - this.hasMap.Add((num & 1 << j) != 0); - if (this.hasMap[j]) - { + this.hasMap.Add((chocographFound & 1 << i) != 0); + if (this.hasMap[i]) this.mapCount++; - } - this.hasGem.Add((num2 & 1 << j) != 0); - if (this.hasGem[j]) - { + this.hasGem.Add((chocographOpened & 1 << i) != 0); + if (this.hasGem[i]) this.gemCount++; - } } } @@ -413,19 +421,16 @@ private void DisplaySelected(Int32 currentSelectedItemIndex) private void Awake() { base.FadingComponent = this.ScreenFadeGameObject.GetComponent(); - UIEventListener uieventListener = UIEventListener.Get(this.SelectSubMenu); - uieventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uieventListener.onClick, new UIEventListener.VoidDelegate(this.onClick)); - UIEventListener uieventListener2 = UIEventListener.Get(this.CancelSubMenu); - uieventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new UIEventListener.VoidDelegate(this.onClick)); - foreach (Object obj in this.ChocographListPanel.GetChild(1).GetChild(0).transform) + UIEventListener.Get(this.SelectSubMenu).onClick += this.onClick; + UIEventListener.Get(this.CancelSubMenu).onClick += this.onClick; + foreach (Transform t in this.ChocographListPanel.GetChild(1).GetChild(0).transform) { - Transform transform = (Transform)obj; - this.chocographItemList.Add(new ChocographUI.ChocographItem(transform.gameObject)); - UIEventListener uieventListener3 = UIEventListener.Get(transform.gameObject); - uieventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uieventListener3.onClick, new UIEventListener.VoidDelegate(this.onClick)); + this.chocographItemList.Add(new ChocographUI.ChocographItem(t.gameObject)); + UIEventListener.Get(t.gameObject).onClick += this.onClick; } this.chocoboScrollButton = this.ChocographListPanel.GetChild(0).GetComponent(); this.chocographScrollList = this.ChocographListPanel.GetChild(1).GetComponent(); + this._chocographPanel = new GOScrollablePanel(this.ChocographListPanel); this.ChocoboAbilityInfo = new ChocographUI.ChocoboAbility(this.ChocoboAbilityInfoPanel); this.ChocoboAbilityInfo.ClearAbility(); this.HintAbilityRequired = new ChocographUI.ChocoboAbility(this.HintAbilityRequiredPanel); @@ -437,35 +442,24 @@ private void Awake() public static Int32 CurrentSelectedChocograph = -1; public GameObject ScreenFadeGameObject; - public GameObject HelpDespLabelGameObject; - public GameObject ChocographListPanel; - public GameObject SelectedContentPanel; - public GameObject HintContentPanel; - public GameObject ChocoboAbilityInfoPanel; public UILabel InventoryNumber; - public UILabel LocationFoundNumber; public UISprite SelectedMap; - public UILabel SelectedItemLabel; - public UISprite SelectedItemIcon; public UISprite HintMap; - public UILabel HintText; - public GameObject HintAbilityRequiredPanel; public GameObject SelectSubMenu; - public GameObject CancelSubMenu; private ChocographUI.SubMenu currentMenu; @@ -473,17 +467,15 @@ private void Awake() private Int32 currentSelectItemIndex; private static String SubMenuGroupButton = "Chocograph.SubMenu"; - private static String ItemGroupButton = "Chocograph.Item"; private ChocographUI.ChocoboAbility ChocoboAbilityInfo; - private ChocographUI.ChocoboAbility HintAbilityRequired; private List chocographItemList = new List(); + private GOScrollablePanel _chocographPanel; private SnapDragScrollView chocographScrollList; - private ScrollButton chocoboScrollButton; private Boolean hasSelectedItem; @@ -491,11 +483,9 @@ private void Awake() private Int32 ability = 1; private List hasMap = new List(); - private List hasGem = new List(); private Int32 mapCount; - private Int32 gemCount; public class ChocoboAbility @@ -514,12 +504,8 @@ public ChocoboAbility(GameObject go) public void ClearAbility() { - UISprite[] abilitySpriteList = this.AbilitySpriteList; - for (Int32 i = 0; i < (Int32)abilitySpriteList.Length; i++) - { - UISprite uisprite = abilitySpriteList[i]; - uisprite.spriteName = String.Empty; - } + foreach (UISprite sprite in this.AbilitySpriteList) + sprite.spriteName = String.Empty; } public UISprite[] AbilitySpriteList; @@ -537,13 +523,9 @@ public ChocographItem(GameObject go) } public GameObject Self; - public GameObject Content; - public ButtonGroupState Button; - public UISprite IconSprite; - public UILabel ItemName; } diff --git a/Assembly-CSharp/Global/Config/ConfigUI.cs b/Assembly-CSharp/Global/Config/ConfigUI.cs index 8dfa6e190..e51bb2021 100644 --- a/Assembly-CSharp/Global/Config/ConfigUI.cs +++ b/Assembly-CSharp/Global/Config/ConfigUI.cs @@ -79,21 +79,15 @@ public enum ATBMode } public GameObject KeyboardButton; - public GameObject JoystickButton; - public GameObject CustomControllerKeyboardPanel; - public GameObject CustomControllerJoystickPanel; - public GameObject CustomControllerMobilePanel; private HonoTweenPosition controllerKeyboardTransition; - private HonoTweenPosition controllerJoystickTransition; private List ControllerKeyboardList = new List(); - private List ControllerJoystickList = new List(); private Boolean[] inputBool = @@ -121,9 +115,7 @@ public enum ATBMode }; private Int32 customControllerCount = 8; - private Int32 currentControllerIndex; - private ControllerType currentControllerType; private String[] PCJoystickNormalButtons = @@ -149,37 +141,24 @@ public enum ATBMode }; private ConfigUI.TriggerState leftTrigger; - private ConfigUI.TriggerState rightTrigger; private float leftTriggerTime; - private float rightTriggerTime; - private float triggerDelay = 0.1f; public GameObject ConfigList; - public GameObject HelpDespLabelGameObject; - public GameObject ScreenFadeGameObject; - public GameObject WarningDialog; - public GameObject WarningDialogHitPoint; - public GameObject BoosterPanel; - public GameObject TransitionGroup; - public GameObject ControlPanelGroup; private static String ConfigGroupButton = "Config.Config"; - private static String WarningMenuGroupButton = "Config.Warning"; - private static String CustomControllerGroupButton = "Config.Controller"; - private static String ControllerTypeGroupButton = "Config.ControllerType"; private static List ConfigSliderIdList = new List(new[] @@ -196,31 +175,23 @@ public enum ATBMode private List ConfigFieldList; private SnapDragScrollView configScrollView; - private ScrollButton configScrollButton; private OnScreenButton hitpointScreenButton; private GameObject toTitleGameObject; - private GameObject masterSkillButtonGameObject; - private GameObject lvMaxButtonGameObject; - private GameObject gilMaxButtonGameObject; - private GameObject backButtonGameObject; private UILabel masterSkillLabel; - private UILabel lvMaxLabel; - private UILabel gilMaxLabel; private HonoTweenClipping warningTransition; private Single fieldMessageSliderStep = 6f; - private Single battleSpeedSliderStep = 2f; private Boolean fastSwitch; @@ -228,11 +199,14 @@ public enum ATBMode private Boolean cursorInList = true; private Boolean is_vibe; - private Int32 vibe_tick; private Boolean helpEnable; + [NonSerialized] + private Int32 fieldMessageConfigIndex = (Int32)Configurator.FieldMessage; + public GameObject SliderMenuTemplate => ConfigList.GetChild(1).GetChild(0).GetChild(fieldMessageConfigIndex); + [DebuggerHidden] private IEnumerator ShowButtonGroupDalay() { @@ -1547,6 +1521,8 @@ private GameObject CreateSlider(GameObject template, Configurator id, int siblin go.transform.SetSiblingIndex(siblingIndex); go.name = $"{id} Panel - Slider"; go.GetComponent().ID = (int)id; + if (siblingIndex <= fieldMessageConfigIndex) + fieldMessageConfigIndex++; return go; } catch (Exception ex) @@ -1589,7 +1565,6 @@ private void CreateATBModeSlider(GameObject template, Configurator id, int sibli var slider = go.GetComponentInChildren(); slider.numberOfSteps = 4; slider.value = 0f; - } private void Awake() @@ -1598,8 +1573,7 @@ private void Awake() ConfigFieldList = new List(); // Adding the volume sliders - UITable table = ConfigList.GetChild(1).GetChild(0).GetComponent(); - GameObject template = table.gameObject.GetChild((int)Configurator.FieldMessage); + GameObject template = SliderMenuTemplate; CreateVolumeSlider(template, Configurator.SoundVolume, 0); CreateVolumeSlider(template, Configurator.MusicVolume, 1); CreateVolumeSlider(template, Configurator.MovieVolume, 2); @@ -1619,6 +1593,8 @@ private void Awake() || id == Configurator.Sound || id == Configurator.SoundEffect) { + if (configTopObj.transform.GetSiblingIndex() < fieldMessageConfigIndex) + fieldMessageConfigIndex--; configTopObj.SetActive(false); Destroy(configTopObj); continue; diff --git a/Assembly-CSharp/Global/EquipUI.cs b/Assembly-CSharp/Global/EquipUI.cs index f0f6b7313..125b6cfc7 100644 --- a/Assembly-CSharp/Global/EquipUI.cs +++ b/Assembly-CSharp/Global/EquipUI.cs @@ -15,7 +15,7 @@ public class EquipUI : UIScene { public Int32 CurrentPartyIndex { - set { this.currentPartyIndex = value; } + set => this.currentPartyIndex = value; } public void Update() @@ -49,7 +49,7 @@ private void ChangeBestItemsButtonBehaviour(Boolean equipForAbilityLearning) public override void Show(UIScene.SceneVoidDelegate afterFinished = null) { - UIScene.SceneVoidDelegate sceneVoidDelegate = delegate + UIScene.SceneVoidDelegate afterShowAction = delegate { PersistenSingleton.Instance.MainMenuScene.SubMenuPanel.SetActive(false); ButtonGroupState.SetPointerOffsetToGroup(new Vector2(10f, 0f), EquipUI.InventoryGroupButton); @@ -58,10 +58,11 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) ButtonGroupState.ActiveGroup = EquipUI.SubMenuGroupButton; }; if (afterFinished != null) - sceneVoidDelegate += afterFinished; + afterShowAction += afterFinished; SceneDirector.FadeEventSetColor(FadeMode.Sub, Color.black); - base.Show(sceneVoidDelegate); + base.Show(afterShowAction); + this.UpdateUserInterface(); this.SwitchCharacter(true); this.DisplaySubMenuArrow(true); this.HelpDespLabelGameObject.SetActive(FF9StateSystem.PCPlatform); @@ -69,9 +70,35 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) this.equipSelectScrollList.ScrollButton.DisplayScrollButton(false, false); } + public void UpdateUserInterface() + { + if (!Configuration.Interface.IsEnabled) + return; + const Int32 originalLineCount = 5; + const Single buttonOriginalHeight = 90f; + const Single panelOriginalWidth = 752f; + const Single panelOriginalHeight = originalLineCount * buttonOriginalHeight; + Int32 linePerPage = Configuration.Interface.MenuEquipRowCount; + Int32 lineHeight = (Int32)Math.Round(panelOriginalHeight / linePerPage); + Single scaleFactor = lineHeight / buttonOriginalHeight; + _equipSelectPanel.SubPanel.ChangeDims(1, linePerPage, panelOriginalWidth, lineHeight); + _equipSelectPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _equipSelectPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.144f, relTop: 0.856f, relLeft: 0.044f, relRight: 0.13f); + _equipSelectPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _equipSelectPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.144f, relTop: 0.856f, relLeft: 0.154f, relRight: 0.795f); + _equipSelectPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _equipSelectPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.144f, relTop: 0.856f, relLeft: 0.8f, relRight: 0.92f); + _equipSelectPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _equipSelectPanel.SubPanel.ButtonPrefab.NumberLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _equipSelectPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + } + public override void Hide(UIScene.SceneVoidDelegate afterFinished = null) { - base.Hide(afterFinished); + UIScene.SceneVoidDelegate afterHideAction = delegate + { + MainMenuUI.UIControlPanel?.ExitMenu(); + }; + if (afterFinished != null) + afterHideAction += afterFinished; + base.Hide(afterHideAction); if (!this.fastSwitch) { PersistenSingleton.Instance.MainMenuScene.StartSubmenuTweenIn(); @@ -830,9 +857,7 @@ private void DisplayInventory() if (CanEquip(item, itemData, character, characterMask, equipSlotMask)) { - this.tempItemList[resultIndex].id = item.id; - this.tempItemList[resultIndex].count = item.count; - equipList.Add(this.tempItemList[resultIndex]); + equipList.Add(item); resultIndex++; } } @@ -1315,12 +1340,9 @@ public SubMenu GetSubMenuFromGameObject(GameObject go) private void Awake() { base.FadingComponent = this.ScreenFadeGameObject.GetComponent(); - UIEventListener uieventListener = UIEventListener.Get(this.EquipSubMenu); - uieventListener.onClick = (UIEventListener.VoidDelegate) Delegate.Combine(uieventListener.onClick, new UIEventListener.VoidDelegate(this.onClick)); - UIEventListener uieventListener2 = UIEventListener.Get(this.OptimizeSubMenu); - uieventListener2.onClick = (UIEventListener.VoidDelegate) Delegate.Combine(uieventListener2.onClick, new UIEventListener.VoidDelegate(this.onClick)); - UIEventListener uieventListener3 = UIEventListener.Get(this.OffSubMenu); - uieventListener3.onClick = (UIEventListener.VoidDelegate) Delegate.Combine(uieventListener3.onClick, new UIEventListener.VoidDelegate(this.onClick)); + UIEventListener.Get(this.EquipSubMenu).onClick += this.onClick; + UIEventListener.Get(this.OptimizeSubMenu).onClick += this.onClick; + UIEventListener.Get(this.OffSubMenu).onClick += this.onClick; this.characterHud = new CharacterDetailHUD(this.CharacterDetailPanel, false); this.parameterHud = new ParameterDetailCompareHUD(this.CharacterParameterPanel); this.equipmentHud = new EquipmentDetailHud(this.EquipmentPartListPanel.GetChild(0)); @@ -1332,15 +1354,12 @@ private void Awake() this.equipmentAbilitySelectHudList[2] = new AbilityItemHUD(this.EquipmentAbilityPanel.GetChild(1).GetChild(2)); this.equipmentPartCaption = this.EquipmentPartListPanel.GetChild(1).GetChild(2); this.equipmentListCaption = this.EquipmentInventoryListPanel.GetChild(2).GetChild(4).GetChild(0).GetComponent(); - foreach (Object obj in this.EquipmentPartListPanel.GetChild(0).transform) - { - Transform tr = (Transform) obj; - UIEventListener uieventListener4 = UIEventListener.Get(tr.gameObject); - uieventListener4.onClick = (UIEventListener.VoidDelegate) Delegate.Combine(uieventListener4.onClick, new UIEventListener.VoidDelegate(this.onClick)); - } + foreach (Transform t in this.EquipmentPartListPanel.GetChild(0).transform) + UIEventListener.Get(t.gameObject).onClick += this.onClick; this.submenuArrowGameObject = this.SubMenuPanel.GetChild(0); this.equipSelectScrollList = this.EquipmentInventoryListPanel.GetChild(1).GetComponent(); + this._equipSelectPanel = new GOScrollablePanel(this.EquipmentInventoryListPanel); this.equipmentSelectionTransition = this.TransitionGroup.GetChild(0).GetComponent(); this.avatarTransition = this.CharacterDetailPanel.GetChild(0).GetChild(6).GetChild(0).GetComponent(); this.itemIdList.Add(new List()); @@ -1348,9 +1367,6 @@ private void Awake() this.itemIdList.Add(new List()); this.itemIdList.Add(new List()); this.itemIdList.Add(new List()); - this.tempItemList = new FF9ITEM[45]; - for (int i = 0; i < this.tempItemList.Length; i++) - this.tempItemList[i] = new FF9ITEM(RegularItem.NoItem, 0); this.selectedCaption = this.EquipmentInventoryListPanel.GetChild(2).GetChild(4).GetChild(0).GetComponent(); @@ -1397,13 +1413,13 @@ private void ChangeEquipButtonWidth() private HonoAvatarTweenPosition avatarTransition; private GameObject submenuArrowGameObject; private RecycleListPopulator equipSelectScrollList; + private GOScrollablePanel _equipSelectPanel; private static String SubMenuGroupButton = "Equip.SubMenu"; private static String EquipmentGroupButton = "Equip.Equipment"; private static String InventoryGroupButton = "Equip.Inventory"; private List> itemIdList = new List>(); - private FF9ITEM[] tempItemList; private Int32 currentPartyIndex; private SubMenu currentMenu = SubMenu.None; private Int32 currentEquipPart = -1; diff --git a/Assembly-CSharp/Global/ItemUI.cs b/Assembly-CSharp/Global/ItemUI.cs index 8e7af4b42..fc8e92548 100644 --- a/Assembly-CSharp/Global/ItemUI.cs +++ b/Assembly-CSharp/Global/ItemUI.cs @@ -73,6 +73,8 @@ public class ItemUI : UIScene private Int32 _currentItemIndex; private Dialog _chocoboDialog; private Int32 _defaultSkinLabelSpacingY; + private GOScrollablePanel _itemPanel; + private GOScrollablePanel _keyItemPanel; static ItemUI() { @@ -101,7 +103,7 @@ public ItemUI() public override void Show(SceneVoidDelegate afterFinished = null) { - SceneVoidDelegate action = () => + SceneVoidDelegate afterShowAction = () => { PersistenSingleton.Instance.MainMenuScene.SubMenuPanel.SetActive(false); ButtonGroupState.SetPointerDepthToGroup(4, ItemGroupButton); @@ -117,12 +119,13 @@ public override void Show(SceneVoidDelegate afterFinished = null) ButtonGroupState.SetPointerLimitRectToGroup(ItemListPanel.GetComponent(), _itemScrollList.cellHeight, ItemArrangeGroupButton); ButtonGroupState.SetPointerLimitRectToGroup(KeyItemListPanel.GetComponent(), _keyItemScrollList.cellHeight, KeyItemGroupButton); ButtonGroupState.ActiveGroup = SubMenuGroupButton; - StartCoroutine(Show_dalay()); + StartCoroutine(Show_delay()); afterFinished?.Invoke(); }; SceneDirector.FadeEventSetColor(FadeMode.Sub, Color.black); - base.Show(action); + base.Show(afterShowAction); + UpdateUserInterface(); ItemListPanel.SetActive(true); KeyItemListPanel.SetActive(false); DisplayItem(); @@ -131,8 +134,35 @@ public override void Show(SceneVoidDelegate afterFinished = null) _keyItemScrollList.ScrollButton.DisplayScrollButton(false, false); } + public void UpdateUserInterface() + { + if (!Configuration.Interface.IsEnabled) + return; + const Int32 originalLineCount = 8; + const Single buttonOriginalHeight = 98f; + const Single panelOriginalWidth = 1490f; + const Single panelOriginalHeight = originalLineCount * buttonOriginalHeight; + Int32 linePerPage = Configuration.Interface.MenuItemRowCount; + Int32 lineHeight = (Int32)Math.Round(panelOriginalHeight / linePerPage); + Single scaleFactor = lineHeight / buttonOriginalHeight; + KeyItemDetailHUD keyItemPrefab = new KeyItemDetailHUD(_keyItemPanel.SubPanel.ButtonPrefab.GameObject); + _itemPanel.SubPanel.ChangeDims(2, linePerPage, panelOriginalWidth / 2f, lineHeight); + _itemPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _itemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.105f, relRight: 0.191f); + _itemPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _itemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.215f, relRight: 0.795f); + _itemPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _itemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.8f, relRight: 0.9f); + _itemPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _itemPanel.SubPanel.ButtonPrefab.NumberLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _itemPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + _keyItemPanel.SubPanel.ChangeDims(2, linePerPage, panelOriginalWidth / 2f, lineHeight); + keyItemPrefab.NewIcon.SetDimensions((Int32)Math.Round(117f * scaleFactor), (Int32)Math.Round(64f * scaleFactor)); + keyItemPrefab.NewIconSprite.SetDimensions((Int32)Math.Round(44f * scaleFactor), (Int32)Math.Round(58f * scaleFactor)); + keyItemPrefab.NewIconLabelSprite.SetDimensions((Int32)Math.Round(90f * scaleFactor), (Int32)Math.Round(58f * scaleFactor)); + keyItemPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _keyItemPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + } + [DebuggerHidden] - private IEnumerator Show_dalay() + private IEnumerator Show_delay() { yield return new WaitForEndOfFrame(); @@ -146,7 +176,13 @@ private IEnumerator Show_dalay() public override void Hide(SceneVoidDelegate afterFinished = null) { - base.Hide(afterFinished); + UIScene.SceneVoidDelegate afterHideAction = delegate + { + MainMenuUI.UIControlPanel?.ExitMenu(); + }; + if (afterFinished != null) + afterHideAction += afterFinished; + base.Hide(afterHideAction); if (_fastSwitch) return; PersistenSingleton.Instance.MainMenuScene.StartSubmenuTweenIn(); @@ -889,6 +925,8 @@ private void Awake() _defaultSkinLabelSpacingY = _keyItemDetailDescription.spacingY; _itemScrollList = ItemListPanel.GetChild(1).GetComponent(); _keyItemScrollList = KeyItemListPanel.GetChild(1).GetComponent(); + _itemPanel = new GOScrollablePanel(ItemListPanel); + _keyItemPanel = new GOScrollablePanel(KeyItemListPanel); RemoveLeftAnchorFromItemNumberLabels(); @@ -922,17 +960,19 @@ private void RemoveLeftAnchorFromItemNumberLabels() private struct KeyItemDetailHUD { - //public GameObject Self; + public GameObject Self; public ButtonGroupState Button; public UILabel NameLabel; + public UIWidget NewIcon; public UISprite NewIconSprite; public UISprite NewIconLabelSprite; public KeyItemDetailHUD(GameObject go) { - //Self = go; + Self = go; Button = go.GetComponent(); NameLabel = go.GetChild(0).GetComponent(); + NewIcon = go.GetChild(1).GetComponent(); NewIconSprite = go.GetChild(1).GetChild(0).GetComponent(); NewIconLabelSprite = go.GetChild(1).GetChild(1).GetComponent(); } diff --git a/Assembly-CSharp/Global/MainMenuUI.cs b/Assembly-CSharp/Global/MainMenuUI.cs index 62ab59626..966dbd643 100644 --- a/Assembly-CSharp/Global/MainMenuUI.cs +++ b/Assembly-CSharp/Global/MainMenuUI.cs @@ -5,20 +5,17 @@ using Assets.Sources.Scripts.UI.Common; using Memoria.Data; using Memoria.Assets; +using Memoria.Scenes; using UnityEngine; using Object = System.Object; public class MainMenuUI : UIScene { - public Vector3 FrontRowPosition - { - get => new Vector3(-418f, 0f, 0f); - } + public static MenuUIControlPanel UIControlPanel { get; set; } - public Vector3 BackRowPosition - { - get => new Vector3(-392f, 0f, 0f); - } + public Vector3 FrontRowPosition => new Vector3(-418f, 0f, 0f); + + public Vector3 BackRowPosition => new Vector3(-392f, 0f, 0f); public MainMenuUI.SubMenu CurrentSubMenu { @@ -87,6 +84,7 @@ public override void Hide(UIScene.SceneVoidDelegate afterFinished = null) { UIScene.SceneVoidDelegate afterHideAction = delegate { + MainMenuUI.UIControlPanel?.ExitMenu(); if (this.isNeedHideSubMenu) { SceneDirector.FF9Wipe_FadeInEx(12); diff --git a/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs b/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs index 7473acfc2..0f336087c 100644 --- a/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs +++ b/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs @@ -239,7 +239,7 @@ private void InitTableViewImp(List inDataList, Int32 inActiveI afterVisibleIndex++; } } - base.Invoke("RepositionList", 0.02f); + base.Invoke("RepositionList", 0f); } private void UpdateTableViewImp(Boolean refreshSelection = true) @@ -248,7 +248,15 @@ private void UpdateTableViewImp(Boolean refreshSelection = true) { Transform poolObj = this.itemsPool[kvp.Value]; if (refreshSelection && poolObj.GetComponent()) + { poolObj.GetComponent().startsSelected = this.activeNumber == kvp.Key; + if (ButtonGroupState.ActiveGroup == ItemUI.ItemArrangeGroupButton) + { + UIKeyNavigation subGroupNavig = poolObj.GetChild(1)?.GetComponent(); + if (subGroupNavig != null) + subGroupNavig.startsSelected = this.activeNumber == kvp.Key; + } + } this.PopulateListItemWithData(poolObj, this.dataList[kvp.Key], kvp.Key, false); } } @@ -257,13 +265,18 @@ private void RepositionList() { this.table.Reposition(); this.draggablePanel.SetDragAmount(0f, 0f, false); + // The "pivotOffset" pick is a bit hacky there... not sure on what it should be based instead + Vector2 pivotOffset = PersistenSingleton.Instance.State == UIManager.UIState.BattleHUD ? new Vector2(0f, 0.5f) : new Vector2(0.5f, 0.5f); foreach (KeyValuePair kvp in this.dataTracker) { Int32 lineNo = kvp.Key / this.Column; + Int32 columnNo = kvp.Key % this.Column; Transform poolObj = this.itemsPool[kvp.Value]; if (this.startNumber > 0) lineNo -= this.startNumber / this.Column; - poolObj.localPosition = new Vector3(poolObj.localPosition.x, -(this.cellHeight / 2f + lineNo * this.cellHeight), poolObj.localPosition.z); + Single posX = this.table.padding.x + pivotOffset.x * poolObj.GetComponent().width + columnNo * (2 * this.table.padding.x + poolObj.GetComponent().width); + Single posY = this.table.padding.y + pivotOffset.y * this.cellHeight + lineNo * (2 * this.table.padding.y + this.cellHeight); + poolObj.localPosition = new Vector3(posX, -posY, poolObj.localPosition.z); } this.draggablePanel.SetDragAmount(0f, 0f, true); if (this.ScrollButton) diff --git a/Assembly-CSharp/Global/ShopUI.cs b/Assembly-CSharp/Global/ShopUI.cs index b4b5fa491..e350dca76 100644 --- a/Assembly-CSharp/Global/ShopUI.cs +++ b/Assembly-CSharp/Global/ShopUI.cs @@ -8,6 +8,7 @@ using Memoria; using Memoria.Data; using Memoria.Assets; +using Memoria.Scenes; using UnityEngine; public class ShopUI : UIScene @@ -26,7 +27,7 @@ public ShopUI.ShopType Type public override void Show(UIScene.SceneVoidDelegate afterFinished = null) { - UIScene.SceneVoidDelegate sceneVoidDelegate = delegate + UIScene.SceneVoidDelegate afterShowAction = delegate { ButtonGroupState.SetPointerOffsetToGroup(new Vector2(50f, 0f), ShopUI.ItemGroupButton); ButtonGroupState.SetPointerOffsetToGroup(new Vector2(50f, 0f), ShopUI.WeaponGroupButton); @@ -44,9 +45,10 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) ButtonGroupState.ActiveGroup = ShopUI.SubMenuGroupButton; }; if (afterFinished != null) - sceneVoidDelegate += afterFinished; + afterShowAction += afterFinished; SceneDirector.FadeEventSetColor(FadeMode.Sub, Color.black); - base.Show(sceneVoidDelegate); + base.Show(afterShowAction); + this.UpdateUserInterface(); this.InitializeData(); if (this.type != ShopUI.ShopType.Synthesis) { @@ -64,15 +66,53 @@ public override void Show(UIScene.SceneVoidDelegate afterFinished = null) this.shopSellItemScrollList.ScrollButton.DisplayScrollButton(false, false); } + public void UpdateUserInterface() + { + if (!Configuration.Interface.IsEnabled) + return; + const Int32 originalLineCount = 8; + const Int32 reducedOriginalLineCount = 5; + const Single buttonOriginalHeight = 98f; + const Single buyPanelOriginalWidth = 916f; + const Single panelOriginalHeight = originalLineCount * buttonOriginalHeight; + const Single panelReducedOriginalHeight = reducedOriginalLineCount * buttonOriginalHeight; + Int32 linePerPage = Configuration.Interface.MenuItemRowCount; + Int32 lineHeight = (Int32)Math.Round(panelOriginalHeight / linePerPage); + Int32 reducedLinePerPage = (Int32)Math.Round(linePerPage * 0.65f); + Int32 reducedLineHeight = (Int32)Math.Round(panelReducedOriginalHeight / reducedLinePerPage); + Single scaleFactor = lineHeight / buttonOriginalHeight; + _shopItemPanel.SubPanel.ChangeDims(1, linePerPage, buyPanelOriginalWidth, lineHeight); + _shopItemPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _shopItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.085f, relRight: 0.155f); + _shopItemPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _shopItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.175f, relRight: 0.65f); + _shopItemPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _shopItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.65f, relRight: 0.92f); + _shopItemPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _shopItemPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + _shopWeaponPanel.SubPanel.ChangeDims(1, reducedLinePerPage, buyPanelOriginalWidth, reducedLineHeight); + _shopWeaponPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _shopWeaponPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.085f, relRight: 0.155f); + _shopWeaponPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _shopWeaponPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.175f, relRight: 0.65f); + _shopWeaponPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _shopWeaponPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.65f, relRight: 0.92f); + _shopWeaponPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _shopWeaponPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + const Single sellPanelOriginalWidth = 1490f; + _shopSellItemPanel.SubPanel.ChangeDims(2, linePerPage, sellPanelOriginalWidth / 2f, lineHeight); + _shopSellItemPanel.SubPanel.ButtonPrefab.IconSprite.SetAnchor(target: _shopSellItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.105f, relRight: 0.191f); + _shopSellItemPanel.SubPanel.ButtonPrefab.NameLabel.SetAnchor(target: _shopSellItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.215f, relRight: 0.795f); + _shopSellItemPanel.SubPanel.ButtonPrefab.NumberLabel.SetAnchor(target: _shopSellItemPanel.SubPanel.ButtonPrefab.Transform, relBottom: 0.184f, relTop: 0.816f, relLeft: 0.8f, relRight: 0.9f); + _shopSellItemPanel.SubPanel.ButtonPrefab.NameLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _shopSellItemPanel.SubPanel.ButtonPrefab.NumberLabel.fontSize = (Int32)Math.Round(36f * scaleFactor); + _shopSellItemPanel.SubPanel.RecycleListPopulator.RefreshTableView(); + } + public override void Hide(UIScene.SceneVoidDelegate afterFinished = null) { - UIScene.SceneVoidDelegate sceneVoidDelegate = delegate + UIScene.SceneVoidDelegate afterHideAction = delegate { + MainMenuUI.UIControlPanel?.ExitMenu(); PersistenSingleton.Instance.SetEventEnable(true); }; if (afterFinished != null) - sceneVoidDelegate += afterFinished; - base.Hide(sceneVoidDelegate); + afterHideAction += afterFinished; + base.Hide(afterHideAction); this.RemoveCursorMemorize(); this.soldItemIdDict.Clear(); } @@ -1136,6 +1176,9 @@ private void Awake() this.shopItemScrollList = this.ItemListPanel.GetChild(1).GetComponent(); this.shopWeaponScrollList = this.WeaponListPanel.GetChild(1).GetComponent(); this.shopSellItemScrollList = this.SellItemListPanel.GetChild(1).GetComponent(); + this._shopItemPanel = new GOScrollablePanel(this.ItemListPanel); + this._shopWeaponPanel = new GOScrollablePanel(this.WeaponListPanel); + this._shopSellItemPanel = new GOScrollablePanel(this.SellItemListPanel); UIEventListener.Get(this.BuySubMenu).onClick += this.onClick; UIEventListener.Get(this.SellSubMenu).onClick += this.onClick; UIEventListener.Get(this.InputQuantityDialog.GetChild(2)).onNavigate += this.OnKeyQuantity; @@ -1218,127 +1261,80 @@ private void UpdateWeaponOrSynthType(Boolean exitSelection = false) } private const Single TRIGGER_DURATION = 0.115f; - private const Single CHANGE_QUANTITY_DURATION = 1f; private static String SubMenuGroupButton = "Shop.SubMenu"; - private static String ItemGroupButton = "Shop.Item"; - private static String WeaponGroupButton = "Shop.Weapon"; - private static String SellItemGroupButton = "Shop.Sell"; - private static String QuantityGroupButton = "Shop.Quantity"; public GameObject BuySubMenu; - public GameObject SellSubMenu; - public GameObject ShopTitleLabel; - public GameObject HelpLabel; - public GameObject ItemShopPanel; - public GameObject WeaponAndSynthShopPanel; - public GameObject SellShopPanel; - public GameObject SynthesisPartInfoPanel; - public GameObject NonSynthesisControlPanel; - public GameObject NonSynthesisHelpDespLabelGo; - public GameObject SynthesisControlPanel; - public GameObject SynthesisHelpDespLabelGo; - public GameObject InputQuantityDialog; - public GameObject InfoDialog; - public GameObject ConfirmDialogHitPoint; - public GameObject ItemInfoPanel; - public GameObject WeaponInfoPanel; - public GameObject ItemListPanel; - public GameObject WeaponListPanel; - public GameObject SellItemListPanel; - public GameObject CharacterParamInfoPanel; - public GameObject RequiredItemPanel; - public GameObject ScreenFadeGameObject; private UILabel itemFundLabel; - private UILabel itemCountLabel; - private UILabel weaponFundLabel; - private UILabel weaponCountLabel; - private UILabel weaponEquipTextLabel; - private UILabel weaponEquipLabel; private ItemListDetailWithIconHUD requiredItem1Hud; - private ItemListDetailWithIconHUD requiredItem2Hud; - private ItemListDetailWithIconHUD confirmItemHud; private UILabel confirmQuantityLabel; - private UILabel confirmPriceLabel; - private UILabel confirmFundLabel; - private UILabel confirmCountLabel; - private UILabel confirmEquipLabel; - private UILabel confirmEquipTextLabel; - private UILabel characterParamCaptionLabel; private RecycleListPopulator shopItemScrollList; - private RecycleListPopulator shopWeaponScrollList; - private RecycleListPopulator shopSellItemScrollList; + private GOScrollablePanel _shopItemPanel; + private GOScrollablePanel _shopWeaponPanel; + private GOScrollablePanel _shopSellItemPanel; private List charInfoHud = new List(); private Int32 id; private List itemIdList = new List(); - private List isItemEnableList = new List(); - private List mixItemList = new List(); - private List mixPartyList = new List(); - private List sellItemIdList = new List(); - private Dictionary soldItemIdDict = new Dictionary(); - private List availableCharaList = new List(); private ShopUI.ShopType type; - private ShopUI.SubMenu currentMenu; private Int32 currentItemIndex = -1; - private Int32 mixStartIndex = 0; private Boolean isGrocery; @@ -1346,17 +1342,12 @@ private void UpdateWeaponOrSynthType(Boolean exitSelection = false) private Int32 availableCharaStart; private Int32 minCount; - private Int32 maxCount; - private Int32 count; private Single triggerCounter; - private Boolean isPlusQuantity; - private Boolean isMinusQuantity; - private Single keepPressingTime; private class CharacterWeaponInfoHUD @@ -1371,13 +1362,9 @@ public CharacterWeaponInfoHUD(GameObject go) } public GameObject Self; - public UILabel ParamValueLabel; - public UISprite AvatarSprite; - public UISprite ChangeArrowSprite; - public UISprite EquipmentTypeSprite; } @@ -1400,16 +1387,13 @@ public enum ShopType public class ShopItemListData : ListDataTypeBase { public RegularItem Id; - public Boolean Enable; - public UInt32 Price; } public class ShopSellItemListData : ListDataTypeBase { public RegularItem Id; - public Int32 Count; } } diff --git a/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs b/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs index 4f33c71c0..78f508bbd 100644 --- a/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs +++ b/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs @@ -339,12 +339,24 @@ private void OnUIConfigDetected(UIScene scene) break; if (battleHUD.UIControlPanel == null) battleHUD.UIControlPanel = new BattleUIControlPanel(battleHUD); - else if (battleHUD.UIControlPanel.Show) - Configuration.Interface.SaveValues(); battleHUD.UIControlPanel.Show = !battleHUD.UIControlPanel.Show; FF9Sfx.FF9SFX_Play(103); return; } + case UIManager.UIState.MainMenu: + case UIManager.UIState.Item: + case UIManager.UIState.Ability: + case UIManager.UIState.Equip: + case UIManager.UIState.Shop: + case UIManager.UIState.Chocograph: + { + if (MainMenuUI.UIControlPanel == null) + MainMenuUI.UIControlPanel = new MenuUIControlPanel(); + MainMenuUI.UIControlPanel.Scene = scene; + MainMenuUI.UIControlPanel.Show = !MainMenuUI.UIControlPanel.Show; + FF9Sfx.FF9SFX_Play(103); + return; + } } FF9Sfx.FF9SFX_Play(102); } diff --git a/Assembly-CSharp/Global/UI/UIPanel.cs b/Assembly-CSharp/Global/UI/UIPanel.cs index de0da1208..a84122c1f 100644 --- a/Assembly-CSharp/Global/UI/UIPanel.cs +++ b/Assembly-CSharp/Global/UI/UIPanel.cs @@ -1444,40 +1444,38 @@ public virtual Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max) public Boolean ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, Boolean immediate) { - Vector3 vector = targetBounds.min; - Vector3 vector2 = targetBounds.max; - Single num = 1f; + if (targetBounds.size.sqrMagnitude == 0f) + return false; + Vector3 minBounds = targetBounds.min; + Vector3 maxBounds = targetBounds.max; + Single pixelFactor = 1f; if (this.mClipping == UIDrawCall.Clipping.None) { UIRoot root = base.root; - if (root != (UnityEngine.Object)null) - { - num = root.pixelSizeAdjustment; - } + if (root != null) + pixelFactor = root.pixelSizeAdjustment; } - if (num != 1f) + if (pixelFactor != 1f) { - vector /= num; - vector2 /= num; + minBounds /= pixelFactor; + maxBounds /= pixelFactor; } - Vector3 b = this.CalculateConstrainOffset(vector, vector2) * num; - if (b.sqrMagnitude > 0f) + Vector3 constrainOffset = this.CalculateConstrainOffset(minBounds, maxBounds) * pixelFactor; + if (constrainOffset.sqrMagnitude > 0f) { if (immediate) { - target.localPosition += b; - targetBounds.center += b; - SpringPosition component = target.GetComponent(); - if (component != (UnityEngine.Object)null) - { - component.enabled = false; - } + target.localPosition += constrainOffset; + targetBounds.center += constrainOffset; + SpringPosition spring = target.GetComponent(); + if (spring != null) + spring.enabled = false; } else { - SpringPosition springPosition = SpringPosition.Begin(target.gameObject, target.localPosition + b, 13f); - springPosition.ignoreTimeScale = true; - springPosition.worldSpace = false; + SpringPosition spring = SpringPosition.Begin(target.gameObject, target.localPosition + constrainOffset, 13f); + spring.ignoreTimeScale = true; + spring.worldSpace = false; } return true; } diff --git a/Assembly-CSharp/Global/UI/UISprite/UISprite.cs b/Assembly-CSharp/Global/UI/UISprite/UISprite.cs index 6e511d867..8ad7e2b4a 100644 --- a/Assembly-CSharp/Global/UI/UISprite/UISprite.cs +++ b/Assembly-CSharp/Global/UI/UISprite/UISprite.cs @@ -288,38 +288,26 @@ protected void SetAtlasSprite(UISpriteData sp) public override void MakePixelPerfect() { if (!this.isValid) - { return; - } base.MakePixelPerfect(); - if (this.mType == UIBasicSprite.Type.Tiled) - { + if (this.preventPixelPerfect || this.mType == UIBasicSprite.Type.Tiled) return; - } UISpriteData atlasSprite = this.GetAtlasSprite(); if (atlasSprite == null) - { return; - } Texture mainTexture = this.mainTexture; - if (mainTexture == (UnityEngine.Object)null) - { + if (mainTexture == null) return; - } - if ((this.mType == UIBasicSprite.Type.Simple || this.mType == UIBasicSprite.Type.Filled || !atlasSprite.hasBorder) && mainTexture != (UnityEngine.Object)null) + if (this.mType == UIBasicSprite.Type.Simple || this.mType == UIBasicSprite.Type.Filled || !atlasSprite.hasBorder) { - Int32 num = Mathf.RoundToInt(this.pixelSize * (Single)(atlasSprite.width + atlasSprite.paddingLeft + atlasSprite.paddingRight)); - Int32 num2 = Mathf.RoundToInt(this.pixelSize * (Single)(atlasSprite.height + atlasSprite.paddingTop + atlasSprite.paddingBottom)); - if ((num & 1) == 1) - { - num++; - } - if ((num2 & 1) == 1) - { - num2++; - } - base.width = num; - base.height = num2; + Int32 w = Mathf.RoundToInt(this.pixelSize * (Single)(atlasSprite.width + atlasSprite.paddingLeft + atlasSprite.paddingRight)); + Int32 h = Mathf.RoundToInt(this.pixelSize * (Single)(atlasSprite.height + atlasSprite.paddingTop + atlasSprite.paddingBottom)); + if ((w & 1) == 1) + w++; + if ((h & 1) == 1) + h++; + base.width = w; + base.height = h; } } @@ -388,4 +376,7 @@ public override void OnFill(BetterList verts, BetterList uvs, [NonSerialized] private Boolean mSpriteSet; + + [NonSerialized] + public Boolean preventPixelPerfect = false; } diff --git a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Scene.cs b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Scene.cs index 3aad33280..d59e2e852 100644 --- a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Scene.cs +++ b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Scene.cs @@ -51,10 +51,7 @@ public override void Hide(SceneVoidDelegate afterFinished = null) PauseButtonGameObject.SetActive(false); HelpButtonGameObject.SetActive(false); if ((!_isFromPause || _usingMainMenu) && UIControlPanel != null && UIControlPanel.Show) - { - Configuration.Interface.SaveValues(); UIControlPanel.Show = false; - } if (!_isFromPause) RemoveCursorMemorize(); diff --git a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.AllMenuPanel.cs b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.AllMenuPanel.cs index 326bba4a5..f18201202 100644 --- a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.AllMenuPanel.cs +++ b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.AllMenuPanel.cs @@ -14,8 +14,8 @@ internal sealed class AllMenuPanel : GOBase public readonly ContainerStatus StatusContainer; public readonly PanelCommand CommandPanel; public readonly PanelTarget TargetPanel; - public readonly ScrollablePanel AbilityPanel; - public readonly ScrollablePanel ItemPanel; + public readonly GOScrollablePanel AbilityPanel; + public readonly GOScrollablePanel ItemPanel; public readonly PanelParty PartyPanel; public readonly HUDAutoAttack AutoAttackHUD; @@ -33,8 +33,8 @@ public AllMenuPanel(BattleHUD scene, GameObject obj) StatusContainer = new ContainerStatus(_scene, obj.GetChild(4)); CommandPanel = new PanelCommand(scene, obj.GetChild(5)); TargetPanel = new PanelTarget(scene, obj.GetChild(6)); - AbilityPanel = new ScrollablePanel(obj.GetChild(7)); - ItemPanel = new ScrollablePanel(obj.GetChild(8)); + AbilityPanel = new GOScrollablePanel(obj.GetChild(7)); + ItemPanel = new GOScrollablePanel(obj.GetChild(8)); PartyPanel = new PanelParty(scene, obj.GetChild(9)); AutoAttackHUD = new HUDAutoAttack(obj.GetChild(10)); } diff --git a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.ScrollablePanel.cs b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.ScrollablePanel.cs deleted file mode 100644 index 16858a215..000000000 --- a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.UI.ScrollablePanel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Assets.Sources.Scripts.UI.Common; -using System; -using System.Collections.Generic; -using Memoria.Scenes; -using UnityEngine; - -public partial class BattleHUD : UIScene -{ - private partial class UI - { - internal sealed class ScrollablePanel : GOWidget - { - public readonly GOScrollButton ScrollButton; - public readonly GOSubPanel SubPanel; - public readonly CaptionBackground Background; - - public ScrollablePanel(GameObject obj) - : base(obj) - { - ScrollButton = new GOScrollButton(obj.GetChild(0)); - SubPanel = new GOSubPanel(obj.GetChild(1)); - Background = new CaptionBackground(obj.GetChild(2)); - } - - internal sealed class CaptionBackground : GOWidget - { - public readonly GOSprite Body; - public readonly GOSprite TopBorder; - public readonly GOSprite Border; - public readonly CaptionPanel Panel; - - public CaptionBackground(GameObject obj) - : base(obj) - { - TopBorder = new GOSprite(obj.GetChild(0)); - Border = new GOSprite(obj.GetChild(1)); - Body = new GOSprite(obj.GetChild(2)); - Panel = new CaptionPanel(obj.GetChild(3)); - } - } - - internal sealed class CaptionPanel : GOPanel - { - public readonly GOLocalizableLabel Name; - public readonly GOLocalizableLabel Info; - - public CaptionPanel(GameObject obj) - : base(obj) - { - Name = new GOLocalizableLabel(obj.GetChild(0)); - Info = new GOLocalizableLabel(obj.GetChild(1)); - } - } - } - } -} \ No newline at end of file diff --git a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Unity.cs b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Unity.cs index 7030a0ba4..de9fd211c 100644 --- a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Unity.cs +++ b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.Unity.cs @@ -78,8 +78,8 @@ private void Awake() _allTargetToggle.validator = OnAllTargetToggleValidate; _commandPanel = new UI.PanelCommand(this, CommandPanel); _targetPanel = new UI.PanelTarget(this, TargetPanel); - _abilityPanel = new UI.ScrollablePanel(AbilityPanel); - _itemPanel = new UI.ScrollablePanel(ItemPanel); + _abilityPanel = new GOScrollablePanel(AbilityPanel); + _itemPanel = new GOScrollablePanel(ItemPanel); _abilityScrollList = _abilityPanel.SubPanel.RecycleListPopulator; _itemScrollList = _itemPanel.SubPanel.RecycleListPopulator; diff --git a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.cs b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.cs index b9886327c..5ec7151d4 100644 --- a/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.cs +++ b/Assembly-CSharp/Global/battle/BattleHUD/BattleHUD.cs @@ -39,8 +39,8 @@ public partial class BattleHUD : UIScene private Byte _currentMessagePriority; private Single _battleMessageCounter; private UI.PanelCommand _commandPanel; - private UI.ScrollablePanel _abilityPanel; - private UI.ScrollablePanel _itemPanel; + private GOScrollablePanel _abilityPanel; + private GOScrollablePanel _itemPanel; private Int32 _enemyCount; private Int32 _playerCount; private Int32 _playerDetailCount; diff --git a/Assembly-CSharp/Memoria/Configuration/Access/Interface.cs b/Assembly-CSharp/Memoria/Configuration/Access/Interface.cs index b53979242..2b42675df 100644 --- a/Assembly-CSharp/Memoria/Configuration/Access/Interface.cs +++ b/Assembly-CSharp/Memoria/Configuration/Access/Interface.cs @@ -4,94 +4,124 @@ namespace Memoria { - public sealed partial class Configuration - { - public static class Interface - { - public static Boolean IsEnabled - { - get => Instance._interface.Enabled; - set => Instance._interface.Enabled.Value = value; - } - public static Boolean PSXBattleMenu - { - get => Instance._interface.PSXBattleMenu; - set => Instance._interface.PSXBattleMenu.Value = value; - } - public static Boolean ScanDisplay - { - get => Instance._interface.ScanDisplay; - set => Instance._interface.ScanDisplay.Value = value; - } - public static Int32 BattleRowCount - { - get => Math.Max(1, Instance._interface.BattleRowCount); - set => Instance._interface.BattleRowCount.Value = value; - } - public static Int32 BattleColumnCount - { - get => Math.Max(1, Instance._interface.BattleColumnCount); - set => Instance._interface.BattleColumnCount.Value = value; - } - public static Vector2 BattleMenuPos - { - get => new Vector2(Instance._interface.BattleMenuPosX, Instance._interface.BattleMenuPosY); - set + public sealed partial class Configuration + { + public static class Interface + { + public static Boolean IsEnabled + { + get => Instance._interface.Enabled; + set => Instance._interface.Enabled.Value = value; + } + public static Boolean PSXBattleMenu + { + get => Instance._interface.PSXBattleMenu; + set => Instance._interface.PSXBattleMenu.Value = value; + } + public static Boolean ScanDisplay + { + get => Instance._interface.ScanDisplay; + set => Instance._interface.ScanDisplay.Value = value; + } + public static Int32 BattleRowCount + { + get => Math.Max(1, Instance._interface.BattleRowCount); + set => Instance._interface.BattleRowCount.Value = value; + } + public static Int32 BattleColumnCount + { + get => Math.Max(1, Instance._interface.BattleColumnCount); + set => Instance._interface.BattleColumnCount.Value = value; + } + public static Vector2 BattleMenuPos + { + get => new Vector2(Instance._interface.BattleMenuPosX, Instance._interface.BattleMenuPosY); + set { - Instance._interface.BattleMenuPosX.Value = (Int32)value.x; - Instance._interface.BattleMenuPosY.Value = (Int32)value.y; - } - } - public static Vector2 BattleMenuSize - { - get => new Vector2(Instance._interface.BattleMenuWidth, Instance._interface.BattleMenuHeight); - set - { - Instance._interface.BattleMenuWidth.Value = (Int32)value.x; - Instance._interface.BattleMenuHeight.Value = (Int32)value.y; - } - } - public static Vector2 BattleDetailPos - { - get => new Vector2(Instance._interface.BattleDetailPosX, Instance._interface.BattleDetailPosY); - set - { - Instance._interface.BattleDetailPosX.Value = (Int32)value.x; - Instance._interface.BattleDetailPosY.Value = (Int32)value.y; - } - } - public static Vector2 BattleDetailSize - { - get => new Vector2(Instance._interface.BattleDetailWidth, Instance._interface.BattleDetailHeight); - set - { - Instance._interface.BattleDetailWidth.Value = (Int32)value.x; - Instance._interface.BattleDetailHeight.Value = (Int32)value.y; - } - } + Instance._interface.BattleMenuPosX.Value = (Int32)value.x; + Instance._interface.BattleMenuPosY.Value = (Int32)value.y; + } + } + public static Vector2 BattleMenuSize + { + get => new Vector2(Instance._interface.BattleMenuWidth, Instance._interface.BattleMenuHeight); + set + { + Instance._interface.BattleMenuWidth.Value = (Int32)value.x; + Instance._interface.BattleMenuHeight.Value = (Int32)value.y; + } + } + public static Vector2 BattleDetailPos + { + get => new Vector2(Instance._interface.BattleDetailPosX, Instance._interface.BattleDetailPosY); + set + { + Instance._interface.BattleDetailPosX.Value = (Int32)value.x; + Instance._interface.BattleDetailPosY.Value = (Int32)value.y; + } + } + public static Vector2 BattleDetailSize + { + get => new Vector2(Instance._interface.BattleDetailWidth, Instance._interface.BattleDetailHeight); + set + { + Instance._interface.BattleDetailWidth.Value = (Int32)value.x; + Instance._interface.BattleDetailHeight.Value = (Int32)value.y; + } + } + + public static String BattleDamageTextFormat => Instance._interface.BattleDamageTextFormat; + public static String BattleRestoreTextFormat => Instance._interface.BattleRestoreTextFormat; + public static String BattleMPDamageTextFormat => Instance._interface.BattleMPDamageTextFormat; + public static String BattleMPRestoreTextFormat => Instance._interface.BattleMPRestoreTextFormat; + public static String BattleCommandTitleFormat => Instance._interface.BattleCommandTitleFormat; + + public static Int32 MenuItemRowCount + { + get => Math.Max(1, Instance._interface.MenuItemRowCount); + set => Instance._interface.MenuItemRowCount.Value = value; + } + public static Int32 MenuAbilityRowCount + { + get => Math.Max(1, Instance._interface.MenuAbilityRowCount); + set => Instance._interface.MenuAbilityRowCount.Value = value; + } + public static Int32 MenuEquipRowCount + { + get => Math.Max(1, Instance._interface.MenuEquipRowCount); + set => Instance._interface.MenuEquipRowCount.Value = value; + } + public static Int32 MenuChocographRowCount + { + get => Math.Max(1, Instance._interface.MenuChocographRowCount); + set => Instance._interface.MenuChocographRowCount.Value = value; + } - public static String BattleDamageTextFormat => Instance._interface.BattleDamageTextFormat; - public static String BattleRestoreTextFormat => Instance._interface.BattleRestoreTextFormat; - public static String BattleMPDamageTextFormat => Instance._interface.BattleMPDamageTextFormat; - public static String BattleMPRestoreTextFormat => Instance._interface.BattleMPRestoreTextFormat; - public static String BattleCommandTitleFormat => Instance._interface.BattleCommandTitleFormat; + public static void SaveBattleValues() + { + //SaveValue(Instance._interface.Name, Instance._interface.Enabled); + SaveValue(Instance._interface.Name, Instance._interface.PSXBattleMenu); + SaveValue(Instance._interface.Name, Instance._interface.ScanDisplay); + SaveValue(Instance._interface.Name, Instance._interface.BattleRowCount); + SaveValue(Instance._interface.Name, Instance._interface.BattleColumnCount); + SaveValue(Instance._interface.Name, Instance._interface.BattleMenuPosX); + SaveValue(Instance._interface.Name, Instance._interface.BattleMenuPosY); + SaveValue(Instance._interface.Name, Instance._interface.BattleMenuWidth); + SaveValue(Instance._interface.Name, Instance._interface.BattleMenuHeight); + SaveValue(Instance._interface.Name, Instance._interface.BattleDetailPosX); + SaveValue(Instance._interface.Name, Instance._interface.BattleDetailPosY); + SaveValue(Instance._interface.Name, Instance._interface.BattleDetailWidth); + SaveValue(Instance._interface.Name, Instance._interface.BattleDetailHeight); + } - public static void SaveValues() - { - SaveValue(Instance._interface.Name, Instance._interface.Enabled); - SaveValue(Instance._interface.Name, Instance._interface.PSXBattleMenu); - SaveValue(Instance._interface.Name, Instance._interface.ScanDisplay); - SaveValue(Instance._interface.Name, Instance._interface.BattleRowCount); - SaveValue(Instance._interface.Name, Instance._interface.BattleColumnCount); - SaveValue(Instance._interface.Name, Instance._interface.BattleMenuPosX); - SaveValue(Instance._interface.Name, Instance._interface.BattleMenuPosY); - SaveValue(Instance._interface.Name, Instance._interface.BattleMenuWidth); - SaveValue(Instance._interface.Name, Instance._interface.BattleMenuHeight); - SaveValue(Instance._interface.Name, Instance._interface.BattleDetailPosX); - SaveValue(Instance._interface.Name, Instance._interface.BattleDetailPosY); - SaveValue(Instance._interface.Name, Instance._interface.BattleDetailWidth); - SaveValue(Instance._interface.Name, Instance._interface.BattleDetailHeight); - } - } - } + public static void SaveMenuValues() + { + //SaveValue(Instance._interface.Name, Instance._interface.Enabled); + SaveValue(Instance._interface.Name, Instance._interface.MenuItemRowCount); + SaveValue(Instance._interface.Name, Instance._interface.MenuAbilityRowCount); + SaveValue(Instance._interface.Name, Instance._interface.MenuEquipRowCount); + SaveValue(Instance._interface.Name, Instance._interface.MenuChocographRowCount); + } + } + } } \ No newline at end of file diff --git a/Assembly-CSharp/Memoria/Configuration/Configuration.Loading.cs b/Assembly-CSharp/Memoria/Configuration/Configuration.Loading.cs index 6300e269d..e80c07ac6 100644 --- a/Assembly-CSharp/Memoria/Configuration/Configuration.Loading.cs +++ b/Assembly-CSharp/Memoria/Configuration/Configuration.Loading.cs @@ -18,11 +18,11 @@ public sealed partial class Configuration : Ini static Configuration() { Instance = new Configuration(); - Watcher = CreareWatcher(); + Watcher = CreateWatcher(); LoadSafe(); } - private static FileSystemWatcher CreareWatcher() + private static FileSystemWatcher CreateWatcher() { FileSystemWatcher watcher = new FileSystemWatcher(); GameLoopManager.Quit += watcher.Dispose; @@ -36,31 +36,45 @@ private static FileSystemWatcher CreareWatcher() public static void SaveValue(String sectionName, IniValue value) { - sectionName = $"[{sectionName}]"; - - String[] lines = File.ReadAllLines(ConfigurationFileName); - Int32 startSection = Array.IndexOf(lines, sectionName); - if (startSection < 0) - { - AppendSection(sectionName, value, lines); + if (!Monitor.TryEnter(Watcher)) return; - } - - Int32 index; - for (index = startSection + 1; index < lines.Length; index++) + + try { - var line = lines[index]; - if (line == String.Empty || line[0] == '[') - break; + sectionName = $"[{sectionName}]"; - if (line.StartsWith(value.Name)) + String[] lines = File.ReadAllLines(ConfigurationFileName); + Int32 startSection = Array.IndexOf(lines, sectionName); + if (startSection < 0) { - ChangeValue(value, index, lines); + AppendSection(sectionName, value, lines); return; } + + Int32 index; + for (index = startSection + 1; index < lines.Length; index++) + { + var line = lines[index]; + if (line == String.Empty || line[0] == '[') + break; + + if (line.StartsWith(value.Name)) + { + ChangeValue(value, index, lines); + return; + } + } + + AppendValue(value, index, lines); + } + catch (Exception err) + { + Log.Error(err, $"Failed to update a configuration value {sectionName} {value.Name}."); + } + finally + { + Monitor.Exit(Watcher); } - - AppendValue(value, index, lines); } private static void AppendSection(String sectionName, IniValue value, String[] lines) diff --git a/Assembly-CSharp/Memoria/Configuration/Memoria.ini b/Assembly-CSharp/Memoria/Configuration/Memoria.ini index f71dbc5ea..d23b806da 100644 --- a/Assembly-CSharp/Memoria/Configuration/Memoria.ini +++ b/Assembly-CSharp/Memoria/Configuration/Memoria.ini @@ -31,6 +31,7 @@ PriorityToOGG = 0 ; SkipIntros (default 0) 0 = Don't skip / 1 = Skip logos / 2 = Skip logos and movie / 3 = Don't loop at the title ; GarnetHair (default 0) 0 = Default / 1 = Long / 2 = Short ; TileSize (default 32) Vanilla 32 / Moguri Mod 64 + ; AntiAliasing (default 0) Must be either 0, 2, 4 or 8: enable Unity's anti-aliasing algorithm to improve the render of 3D model edges Enabled = 0 BattleFPS = 30 BattleTPS = 15 @@ -45,6 +46,7 @@ WidescreenSupport = 1 SkipIntros = 0 GarnetHair = 0 TileSize = 32 +AntiAliasing = 0 [Control] ; DisableMouse (default 0) 0 = Can use the mouse to navigate in menus and move on the fields / 7 = Disable the mouse completly / 1 = Disable mouse for field menus and dialogs / 2 = Disable mouse for field movements / 4 = Disable mouse for battle menus @@ -212,7 +214,7 @@ DiscardKeepSameArrow = 0 DiscardExclusions = 56, 75, 76, 77, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 98, 99, 100 [Interface] - ; Setup UI coordinates by pressing Alt+F1 in-game + ; Setup UI parameters by pressing Alt+F1 in-game ; PSXBattleMenu (default 0) 0 = Command menu is disposed as a 2x3 table / 1 = Command menu is disposed in a column with Change/Defend accessible with left/right keys ; ScanDisplay (default 1) 0 = Informations given by Scan are displayed as successive messages / 1 = Scan opens an information panel ; BattleCommandTitleFormat (default empty) Custom format string for displaying the ability names on cast; use eg. CommandTitle + ' ([FFCC00]' + CasterName + '[FFFFFF])' to append the caster's name in yellow @@ -237,6 +239,10 @@ BattleDamageTextFormat = BattleRestoreTextFormat = BattleMPDamageTextFormat = BattleMPRestoreTextFormat = +MenuItemRowCount = 8 +MenuAbilityRowCount = 6 +MenuEquipRowCount = 5 +MenuChocographRowCount = 5 [Fixes] Enabled = 1 diff --git a/Assembly-CSharp/Memoria/Configuration/Structure/InterfaceSection.cs b/Assembly-CSharp/Memoria/Configuration/Structure/InterfaceSection.cs index cc3f460f5..d192d170d 100644 --- a/Assembly-CSharp/Memoria/Configuration/Structure/InterfaceSection.cs +++ b/Assembly-CSharp/Memoria/Configuration/Structure/InterfaceSection.cs @@ -4,48 +4,61 @@ namespace Memoria { - public sealed partial class Configuration - { - private sealed class InterfaceSection : IniSection - { - public readonly IniValue PSXBattleMenu; - public readonly IniValue ScanDisplay; - public readonly IniValue BattleRowCount; - public readonly IniValue BattleColumnCount; - public readonly IniValue BattleMenuPosX; - public readonly IniValue BattleMenuPosY; - public readonly IniValue BattleMenuWidth; - public readonly IniValue BattleMenuHeight; - public readonly IniValue BattleDetailPosX; - public readonly IniValue BattleDetailPosY; - public readonly IniValue BattleDetailWidth; - public readonly IniValue BattleDetailHeight; - public readonly IniValue BattleDamageTextFormat; - public readonly IniValue BattleRestoreTextFormat; - public readonly IniValue BattleMPDamageTextFormat; - public readonly IniValue BattleMPRestoreTextFormat; - public readonly IniValue BattleCommandTitleFormat; + public sealed partial class Configuration + { + private sealed class InterfaceSection : IniSection + { + public readonly IniValue PSXBattleMenu; + public readonly IniValue ScanDisplay; + public readonly IniValue BattleRowCount; + public readonly IniValue BattleColumnCount; + public readonly IniValue BattleMenuPosX; + public readonly IniValue BattleMenuPosY; + public readonly IniValue BattleMenuWidth; + public readonly IniValue BattleMenuHeight; + public readonly IniValue BattleDetailPosX; + public readonly IniValue BattleDetailPosY; + public readonly IniValue BattleDetailWidth; + public readonly IniValue BattleDetailHeight; + public readonly IniValue BattleDamageTextFormat; + public readonly IniValue BattleRestoreTextFormat; + public readonly IniValue BattleMPDamageTextFormat; + public readonly IniValue BattleMPRestoreTextFormat; + public readonly IniValue BattleCommandTitleFormat; - public InterfaceSection() : base(nameof(InterfaceSection), true) - { - PSXBattleMenu = BindBoolean(nameof(PSXBattleMenu), false); - ScanDisplay = BindBoolean(nameof(ScanDisplay), true); - BattleRowCount = BindInt32(nameof(BattleRowCount), 5); - BattleColumnCount = BindInt32(nameof(BattleColumnCount), 1); - BattleMenuPosX = BindInt32(nameof(BattleMenuPosX), -400); - BattleMenuPosY = BindInt32(nameof(BattleMenuPosY), -362); - BattleMenuWidth = BindInt32(nameof(BattleMenuWidth), 630); - BattleMenuHeight = BindInt32(nameof(BattleMenuHeight), 236); - BattleDetailPosX = BindInt32(nameof(BattleDetailPosX), 345); - BattleDetailPosY = BindInt32(nameof(BattleDetailPosY), -380); - BattleDetailWidth = BindInt32(nameof(BattleDetailWidth), 796); - BattleDetailHeight = BindInt32(nameof(BattleDetailHeight), 230); - BattleDamageTextFormat = BindString(nameof(BattleDamageTextFormat), String.Empty); - BattleRestoreTextFormat = BindString(nameof(BattleRestoreTextFormat), String.Empty); - BattleMPDamageTextFormat = BindString(nameof(BattleMPDamageTextFormat), String.Empty); - BattleMPRestoreTextFormat = BindString(nameof(BattleMPRestoreTextFormat), String.Empty); - BattleCommandTitleFormat = BindString(nameof(BattleCommandTitleFormat), String.Empty); - } - } - } + public readonly IniValue MenuItemRowCount; + public readonly IniValue MenuAbilityRowCount; + public readonly IniValue MenuEquipRowCount; + public readonly IniValue MenuChocographRowCount; + + public InterfaceSection() : base(nameof(InterfaceSection), true) + { + PSXBattleMenu = BindBoolean(nameof(PSXBattleMenu), false); + ScanDisplay = BindBoolean(nameof(ScanDisplay), true); + BattleRowCount = BindInt32(nameof(BattleRowCount), 5); + BattleColumnCount = BindInt32(nameof(BattleColumnCount), 1); + BattleMenuPosX = BindInt32(nameof(BattleMenuPosX), -400); + BattleMenuPosY = BindInt32(nameof(BattleMenuPosY), -362); + BattleMenuWidth = BindInt32(nameof(BattleMenuWidth), 630); + BattleMenuHeight = BindInt32(nameof(BattleMenuHeight), 236); + BattleDetailPosX = BindInt32(nameof(BattleDetailPosX), 345); + BattleDetailPosY = BindInt32(nameof(BattleDetailPosY), -380); + BattleDetailWidth = BindInt32(nameof(BattleDetailWidth), 796); + BattleDetailHeight = BindInt32(nameof(BattleDetailHeight), 230); + BattleDamageTextFormat = BindString(nameof(BattleDamageTextFormat), String.Empty); + BattleRestoreTextFormat = BindString(nameof(BattleRestoreTextFormat), String.Empty); + BattleMPDamageTextFormat = BindString(nameof(BattleMPDamageTextFormat), String.Empty); + BattleMPRestoreTextFormat = BindString(nameof(BattleMPRestoreTextFormat), String.Empty); + BattleCommandTitleFormat = BindString(nameof(BattleCommandTitleFormat), String.Empty); + + MenuItemRowCount = BindInt32(nameof(MenuItemRowCount), 8); // Default PC: 8, PSX: 11 + MenuAbilityRowCount = BindInt32(nameof(MenuAbilityRowCount), 6); // Default PC: 6, PSX: 8 + MenuEquipRowCount = BindInt32(nameof(MenuEquipRowCount), 5); // Default PC: 5, PSX: 6 + MenuChocographRowCount = BindInt32(nameof(MenuChocographRowCount), 5); // Default PC: 5, PSX: 7 + // Shop menu -- Default PC: 5/8, PSX: 7/11 (with/without portraits) + // Status menu -- Default PC: 8, PSX: 8 + // Config menu -- Default PC: 6/8, PSX: 9 + } + } + } } \ No newline at end of file diff --git a/Assembly-CSharp/Memoria/Scenes/BattleHUD/BattleUIControlPanel.cs b/Assembly-CSharp/Memoria/Scenes/BattleHUD/BattleUIControlPanel.cs index ef9b3adc6..b2544f108 100644 --- a/Assembly-CSharp/Memoria/Scenes/BattleHUD/BattleUIControlPanel.cs +++ b/Assembly-CSharp/Memoria/Scenes/BattleHUD/BattleUIControlPanel.cs @@ -54,6 +54,7 @@ public BattleUIControlPanel(BattleHUD hud) EndInitialization(UIWidget.Pivot.Bottom); SetEnabled(true); + onHide = Configuration.Interface.SaveBattleValues; } private void SetEnabled(Boolean enabled) diff --git a/Assembly-CSharp/Memoria/Scenes/ControlPanel/ControlPanel.cs b/Assembly-CSharp/Memoria/Scenes/ControlPanel/ControlPanel.cs index fe7575fa7..00ce9690c 100644 --- a/Assembly-CSharp/Memoria/Scenes/ControlPanel/ControlPanel.cs +++ b/Assembly-CSharp/Memoria/Scenes/ControlPanel/ControlPanel.cs @@ -12,6 +12,8 @@ public class ControlPanel public Int32 rowHeight = 50; public Int32 rowSeparatorHeight = 10; public Int32 elementSeparatorWidth = 10; + public Action onShow = null; + public Action onHide = null; public UIWidget BasePanel => basePanel; public List AllPanels => allPanels; @@ -19,7 +21,14 @@ public class ControlPanel public Boolean Show { get => allPanels[activePanelIndex].gameObject.activeSelf; - set => allPanels[activePanelIndex].gameObject.SetActive(value); + set + { + allPanels[activePanelIndex].gameObject.SetActive(value); + if (value && onShow != null) + onShow(); + else if (!value && onHide != null) + onHide(); + } } public ControlPanel(Transform parent, String name) @@ -288,7 +297,7 @@ public T InstantiateUIElement(out GameObject go, out Int32 defaultWidth, out } else if (typeof(T) == typeof(UISlider)) { - go = UnityEngine.Object.Instantiate(PersistenSingleton.Instance.ConfigScene.ConfigList.GetChild(1).GetChild(0).GetChild(8).GetChild(1).GetChild(1).gameObject); + go = UnityEngine.Object.Instantiate(PersistenSingleton.Instance.ConfigScene.SliderMenuTemplate.GetChild(1).GetChild(1).gameObject); UISlider slider = go.GetComponent(); slider.numberOfSteps = 0; defaultWidth = 350; @@ -408,7 +417,7 @@ private UIWidget GetParentPanel(UIWidget panel) private Dictionary panelParentLink = new Dictionary(); private Int32 activePanelIndex = 0; - private static void DebugLogComponents(GameObject startGo, Boolean recursive, Boolean recChild, Func logger) + public static void DebugLogComponents(GameObject startGo, Boolean recursive, Boolean recChild, Func logger) { foreach (Component comp in startGo.GetComponents()) { diff --git a/Assembly-CSharp/Memoria/Scenes/GOButtonPrefab.cs b/Assembly-CSharp/Memoria/Scenes/GOButtonPrefab.cs index 67ac6e4bc..eabd4e531 100644 --- a/Assembly-CSharp/Memoria/Scenes/GOButtonPrefab.cs +++ b/Assembly-CSharp/Memoria/Scenes/GOButtonPrefab.cs @@ -11,9 +11,9 @@ internal class GOButtonPrefab : GOWidget public readonly ButtonGroupState ButtonGroup; public readonly ScrollItemKeyNavigation ScrollKeyNavigation; public readonly UIDragScrollView DragScrollView; - public readonly RecycleListItem ListItem; // These can be null + public readonly RecycleListItem ListItem; public readonly UILabel NameLabel; public readonly UILabel NumberLabel; public readonly UISprite IconSprite; @@ -30,8 +30,9 @@ public GOButtonPrefab(GameObject obj) ButtonGroup = obj.GetExactComponent(); ScrollKeyNavigation = obj.GetExactComponent(); DragScrollView = obj.GetExactComponent(); - ListItem = obj.GetExactComponent(); BoxCollider = obj.GetExactComponent(); + if (obj.GetComponent() != null) + ListItem = obj.GetExactComponent(); GameObject content = obj; if (obj.GetChild(0).transform.childCount > 0) diff --git a/Assembly-CSharp/Memoria/Scenes/GOScrollablePanel.cs b/Assembly-CSharp/Memoria/Scenes/GOScrollablePanel.cs new file mode 100644 index 000000000..f161bfafb --- /dev/null +++ b/Assembly-CSharp/Memoria/Scenes/GOScrollablePanel.cs @@ -0,0 +1,68 @@ +using System; +using UnityEngine; + +namespace Memoria.Scenes +{ + internal sealed class GOScrollablePanel : GOWidget + { + public readonly GOScrollButton ScrollButton; + public readonly GOSubPanel SubPanel; + public readonly CaptionBackground Background; + + public GOScrollablePanel(GameObject obj) + : base(obj) + { + ScrollButton = new GOScrollButton(obj.GetChild(0)); + SubPanel = new GOSubPanel(obj.GetChild(1)); + Background = new CaptionBackground(obj.GetChild(2)); + } + + internal sealed class CaptionBackground : GOWidget + { + public readonly GOSprite Body; + public readonly GOSprite TopBorder; + public readonly GOSprite Border; + public readonly GOSprite Shadow = null; + public readonly CaptionPanel Panel; + + public CaptionBackground(GameObject obj) + : base(obj) + { + TopBorder = new GOSprite(obj.GetChild(0)); + Border = new GOSprite(obj.GetChild(1)); + Body = new GOSprite(obj.GetChild(2)); + if (obj.GetChild(3).GetComponent() != null) + { + Shadow = new GOSprite(obj.GetChild(2)); + Panel = new CaptionPanel(obj.GetChild(4)); + } + else + { + Shadow = null; + Panel = new CaptionPanel(obj.GetChild(3)); + } + } + } + + internal sealed class CaptionPanel : GOPanel + { + public readonly GOLocalizableLabel Name; + public readonly GOLocalizableLabel Info = null; + public readonly GOLocalizableLabel Name2 = null; + public readonly GOLocalizableLabel Info2 = null; + + public CaptionPanel(GameObject obj) + : base(obj) + { + Name = new GOLocalizableLabel(obj.GetChild(0)); + if (obj.transform.childCount == 1) + return; + Info = new GOLocalizableLabel(obj.GetChild(1)); + if (obj.transform.childCount != 4) + return; + Name2 = new GOLocalizableLabel(obj.GetChild(2)); + Info2 = new GOLocalizableLabel(obj.GetChild(3)); + } + } + } +} diff --git a/Assembly-CSharp/Memoria/Scenes/GOSubPanel.cs b/Assembly-CSharp/Memoria/Scenes/GOSubPanel.cs index 90ad4193e..d542c93e7 100644 --- a/Assembly-CSharp/Memoria/Scenes/GOSubPanel.cs +++ b/Assembly-CSharp/Memoria/Scenes/GOSubPanel.cs @@ -1,42 +1,89 @@ using System; +using System.Collections; +using System.Threading; using UnityEngine; namespace Memoria.Scenes { - internal sealed class GOSubPanel : GOBase - { - public readonly UIPanel Panel; - public readonly UIScrollView ScrollView; - public readonly Rigidbody Rigidbody; - public readonly SnapDragScrollView SnapDragScrollView; - public readonly RecycleListPopulator RecycleListPopulator; + internal sealed class GOSubPanel : GOBase + { + public readonly UIPanel Panel; + public readonly UIScrollView ScrollView; + public readonly Rigidbody Rigidbody; + public readonly SnapDragScrollView SnapDragScrollView; - public readonly GOButtonPrefab ButtonPrefab; - public readonly GOTable Table; + public readonly GOTable Table; - public GOSubPanel(GameObject obj) - : base(obj) - { - Panel = obj.GetExactComponent(); - ScrollView = obj.GetExactComponent(); - Rigidbody = obj.GetExactComponent(); - SnapDragScrollView = obj.GetExactComponent(); - RecycleListPopulator = obj.GetExactComponent(); + public Boolean HasListPopulator => RecycleListPopulator != null; + public readonly RecycleListPopulator RecycleListPopulator = null; + public readonly GOButtonPrefab ButtonPrefab = null; - ButtonPrefab = new GOButtonPrefab(RecycleListPopulator.itemPrefab.gameObject); - Table = new GOTable(obj.GetChild(0)); - } + public GOSubPanel(GameObject obj) + : base(obj) + { + Panel = obj.GetExactComponent(); + ScrollView = obj.GetExactComponent(); + Rigidbody = obj.GetExactComponent(); + SnapDragScrollView = obj.GetExactComponent(); + Table = new GOTable(obj.GetChild(0)); - public void ChangeDims(Int32 colCount, Int32 rowCount, Single colWidth, Single rowHeight) - { - SnapDragScrollView.ItemHeight = (Int32)rowHeight; - RecycleListPopulator.cellHeight = rowHeight; - Table.Table.columns = colCount; - ButtonPrefab.Widget.SetRawRect(0f, 0f, colWidth, rowHeight); - ButtonPrefab.ScrollKeyNavigation.ItemHeight = rowHeight; - Panel.baseClipRegion = new Vector4(Panel.baseClipRegion.x, Panel.baseClipRegion.y, colCount * colWidth, rowCount * rowHeight); - if (GameObject.activeInHierarchy) - RecycleListPopulator.RefreshTableView(); - } - } + if (obj.GetComponent() != null) + { + RecycleListPopulator = obj.GetExactComponent(); + ButtonPrefab = new GOButtonPrefab(RecycleListPopulator.itemPrefab.gameObject); + } + else + { + RecycleListPopulator = null; + ButtonPrefab = null; + } + } + + public void ChangeDims(Int32 colCount, Int32 rowCount, Single colWidth, Single rowHeight) + { + colCount = Math.Max(colCount, 1); + rowCount = Math.Max(rowCount, 1); + SnapDragScrollView.ItemHeight = (Int32)rowHeight; + SnapDragScrollView.VisibleItem = colCount * rowCount; + Table.Table.columns = colCount; + Panel.SetAnchor(target: null); + Panel.baseClipRegion = new Vector4(Panel.baseClipRegion.x, Panel.baseClipRegion.y, colCount * colWidth, rowCount * rowHeight); + if (HasListPopulator) + { + RecycleListPopulator.cellHeight = rowHeight; + ButtonPrefab.Widget.SetRawRect(0f, 0f, colWidth, rowHeight); + ButtonPrefab.ScrollKeyNavigation.ItemHeight = rowHeight; + if (GameObject.activeInHierarchy) + RecycleListPopulator.RefreshTableView(); + } + else + { + for (Int32 i = 0; i < Table.Count; i++) + { + GOButtonPrefab button = Table.Entries[i]; + button.Widget.SetDimensions((Int32)colWidth, (Int32)rowHeight); + } + if (GameObject.activeInHierarchy) + Table.Table.StartCoroutine(RepositionStaticList(colCount, rowCount, colWidth, rowHeight)); + } + } + + private IEnumerator RepositionStaticList(Int32 colCount, Int32 rowCount, Single colWidth, Single rowHeight) + { + yield return new WaitForEndOfFrame(); + // The "pivotOffset" pick is hacky there; it applies to the list of Chocographs, which is currently the only GOSubPanel without list populator + Vector2 pivotOffset = new Vector2(0f, 0.5f); + for (Int32 i = 0; i < Table.Count; i++) + { + GOButtonPrefab button = Table.Entries[i]; + Int32 lineNo = i / colCount; + Int32 columnNo = i % colCount; + Single posX = Table.Table.padding.x + pivotOffset.x * button.Widget.width + columnNo * (2 * Table.Table.padding.x + button.Widget.width); + Single posY = Table.Table.padding.y + pivotOffset.y * rowHeight + lineNo * (2 * Table.Table.padding.y + rowHeight); + button.Widget.SetAnchor(target: null); + button.Widget.SetRawRect(posX, -posY, (Int32)colWidth, (Int32)rowHeight); + button.ScrollKeyNavigation.ItemHeight = rowHeight; + } + } + } } \ No newline at end of file diff --git a/Assembly-CSharp/Memoria/Scenes/MenuHUD/MenuUIControlPanel.cs b/Assembly-CSharp/Memoria/Scenes/MenuHUD/MenuUIControlPanel.cs new file mode 100644 index 000000000..56531ceec --- /dev/null +++ b/Assembly-CSharp/Memoria/Scenes/MenuHUD/MenuUIControlPanel.cs @@ -0,0 +1,97 @@ +using Assets.Sources.Scripts.UI.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using FF9; +using Memoria; +using Memoria.Data; +using Memoria.Prime; +using Memoria.Assets; + +namespace Memoria.Scenes +{ + public class MenuUIControlPanel : ControlPanel + { + public const Int32 ITEM_ROW_MIN = 6; + public const Int32 ITEM_ROW_MAX = 12; + public const Int32 ABILITY_ROW_MIN = 4; + public const Int32 ABILITY_ROW_MAX = 10; + public const Int32 EQUIP_ROW_MIN = 4; + public const Int32 EQUIP_ROW_MAX = 8; + public const Int32 CHOCOGRAPH_ROW_MIN = 4; + public const Int32 CHOCOGRAPH_ROW_MAX = 8; + + public UIScene Scene; + + public MenuUIControlPanel() + : base(PersistenSingleton.Instance.MainMenuScene.transform, Localization.Get("ConfigCaption")) + { + Scene = null; + + AddSimpleLabel(Localization.Get("Item"), NGUIText.Alignment.Left, 1); + controlItemRowCount = AddRollOption(ControlRoll.GetNonEmptyIndexList(ITEM_ROW_MAX - ITEM_ROW_MIN + 1), sel => $"{sel + ITEM_ROW_MIN} rows", SetItemRowCount); + controlItemRowCount.Selection = Configuration.Interface.MenuItemRowCount - ITEM_ROW_MIN; + PanelAddRow(); + AddSimpleLabel(Localization.Get("Ability"), NGUIText.Alignment.Left, 1); + controlAbilityRowCount = AddRollOption(ControlRoll.GetNonEmptyIndexList(ABILITY_ROW_MAX - ABILITY_ROW_MIN + 1), sel => $"{sel + ABILITY_ROW_MIN} rows", SetAbilityRowCount); + controlAbilityRowCount.Selection = Configuration.Interface.MenuAbilityRowCount - ABILITY_ROW_MIN; + PanelAddRow(); + AddSimpleLabel(Localization.Get("Equip"), NGUIText.Alignment.Left, 1); + controlShopItemRowCount = AddRollOption(ControlRoll.GetNonEmptyIndexList(EQUIP_ROW_MAX - EQUIP_ROW_MIN + 1), sel => $"{sel + EQUIP_ROW_MIN} rows", SetEquipRowCount); + controlShopItemRowCount.Selection = Configuration.Interface.MenuEquipRowCount - EQUIP_ROW_MIN; + PanelAddRow(); + AddSimpleLabel(Localization.Get("Chocograph"), NGUIText.Alignment.Left, 1); + controlShopItemRowCount = AddRollOption(ControlRoll.GetNonEmptyIndexList(CHOCOGRAPH_ROW_MAX - CHOCOGRAPH_ROW_MIN + 1), sel => $"{sel + CHOCOGRAPH_ROW_MIN} rows", SetChocographRowCount); + controlShopItemRowCount.Selection = Configuration.Interface.MenuChocographRowCount - CHOCOGRAPH_ROW_MIN; + + EndInitialization(UIWidget.Pivot.Right); + onHide = () => + { + Configuration.Interface.SaveMenuValues(); + (Scene as AbilityUI)?.UpdateUserInterface(); + (Scene as ChocographUI)?.UpdateUserInterface(); + (Scene as EquipUI)?.UpdateUserInterface(); + (Scene as ItemUI)?.UpdateUserInterface(); + (Scene as ShopUI)?.UpdateUserInterface(); + Scene?.gameObject.SetActive(true); + }; + onShow = () => Scene?.gameObject.SetActive(false); + } + + public void ExitMenu() + { + if (Show) + { + Scene = null; + Show = false; + } + } + + private void SetItemRowCount(Int32 count) + { + Configuration.Interface.MenuItemRowCount = count + ITEM_ROW_MIN; + } + + private void SetAbilityRowCount(Int32 count) + { + Configuration.Interface.MenuAbilityRowCount = count + ABILITY_ROW_MIN; + } + + private void SetEquipRowCount(Int32 count) + { + Configuration.Interface.MenuEquipRowCount = count + EQUIP_ROW_MIN; + } + + private void SetChocographRowCount(Int32 count) + { + Configuration.Interface.MenuChocographRowCount = count + CHOCOGRAPH_ROW_MIN; + } + + private ControlRoll controlItemRowCount; + private ControlRoll controlKeyItemRowCount; + private ControlRoll controlShopItemRowCount; + private ControlRoll controlAbilityRowCount; + private ControlRoll controlSupportRowCount; + } +} diff --git a/Memoria.Launcher/App.cs b/Memoria.Launcher/App.cs index 85ec12e95..3e08b550c 100644 --- a/Memoria.Launcher/App.cs +++ b/Memoria.Launcher/App.cs @@ -5,7 +5,6 @@ using System.Windows; using System.Windows.Interop; using System.Windows.Media; -using Memoria.Launcher; namespace Memoria.Launcher { diff --git a/Memoria.Launcher/Ini/Memoria.ini b/Memoria.Launcher/Ini/Memoria.ini index f71dbc5ea..d23b806da 100644 --- a/Memoria.Launcher/Ini/Memoria.ini +++ b/Memoria.Launcher/Ini/Memoria.ini @@ -31,6 +31,7 @@ PriorityToOGG = 0 ; SkipIntros (default 0) 0 = Don't skip / 1 = Skip logos / 2 = Skip logos and movie / 3 = Don't loop at the title ; GarnetHair (default 0) 0 = Default / 1 = Long / 2 = Short ; TileSize (default 32) Vanilla 32 / Moguri Mod 64 + ; AntiAliasing (default 0) Must be either 0, 2, 4 or 8: enable Unity's anti-aliasing algorithm to improve the render of 3D model edges Enabled = 0 BattleFPS = 30 BattleTPS = 15 @@ -45,6 +46,7 @@ WidescreenSupport = 1 SkipIntros = 0 GarnetHair = 0 TileSize = 32 +AntiAliasing = 0 [Control] ; DisableMouse (default 0) 0 = Can use the mouse to navigate in menus and move on the fields / 7 = Disable the mouse completly / 1 = Disable mouse for field menus and dialogs / 2 = Disable mouse for field movements / 4 = Disable mouse for battle menus @@ -212,7 +214,7 @@ DiscardKeepSameArrow = 0 DiscardExclusions = 56, 75, 76, 77, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 98, 99, 100 [Interface] - ; Setup UI coordinates by pressing Alt+F1 in-game + ; Setup UI parameters by pressing Alt+F1 in-game ; PSXBattleMenu (default 0) 0 = Command menu is disposed as a 2x3 table / 1 = Command menu is disposed in a column with Change/Defend accessible with left/right keys ; ScanDisplay (default 1) 0 = Informations given by Scan are displayed as successive messages / 1 = Scan opens an information panel ; BattleCommandTitleFormat (default empty) Custom format string for displaying the ability names on cast; use eg. CommandTitle + ' ([FFCC00]' + CasterName + '[FFFFFF])' to append the caster's name in yellow @@ -237,6 +239,10 @@ BattleDamageTextFormat = BattleRestoreTextFormat = BattleMPDamageTextFormat = BattleMPRestoreTextFormat = +MenuItemRowCount = 8 +MenuAbilityRowCount = 6 +MenuEquipRowCount = 5 +MenuChocographRowCount = 5 [Fixes] Enabled = 1 diff --git a/Memoria.Launcher/Memoria.Launcher.csproj b/Memoria.Launcher/Memoria.Launcher.csproj index e4278168a..373bc8026 100644 --- a/Memoria.Launcher/Memoria.Launcher.csproj +++ b/Memoria.Launcher/Memoria.Launcher.csproj @@ -128,7 +128,10 @@ - + + PreserveNewest + Memoria.ini +