Skip to content

Commit 2ba4d9f

Browse files
committed
Restructure main layout
1 parent 1f83b89 commit 2ba4d9f

7 files changed

Lines changed: 50 additions & 95 deletions

File tree

DressCodeControl.cs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,32 @@
33
namespace COM3D2.DressCode;
44

55
internal class DressCodeControl : MonoBehaviour {
6-
private ScopeSelectTabBar _scopeSelectTabBar;
7-
private MaidSelectPanel _maidSelectPanel;
6+
private const int UiWidth = 1920;
7+
8+
private static readonly Vector3 PanelMargin = new(15, 0);
9+
private static readonly Vector2 SceneListSize = new(184, 925);
10+
private static readonly Vector2 ScopeListSize = new(144, 925);
11+
private static readonly Vector2 MaidListSize = new(502, 925);
12+
813
private SceneList _sceneList;
14+
private ScopeList _scopeList;
15+
private MaidSelectPanel _maidSelectPanel;
916
private ProfilePanel _profilePanel;
1017

1118
private DressCodeManager m_mgr;
1219
private GameObject m_goPanel;
1320

14-
public ProfileScope SelectedScope {
15-
get => _scopeSelectTabBar.SelectedScope;
16-
set => _scopeSelectTabBar.SelectScope(value);
17-
}
1821

1922
public CostumeScene SelectedScene {
2023
get => _sceneList.SelectedValue;
2124
set => _sceneList.SelectValue(value);
2225
}
2326

27+
public ProfileScope SelectedScope {
28+
get => _scopeList.SelectedValue;
29+
set => _scopeList.SelectValue(value);
30+
}
31+
2432
public Maid SelectedMaid {
2533
get => _maidSelectPanel.SelectedMaid;
2634
set => _maidSelectPanel.SelectMaid(value);
@@ -37,14 +45,22 @@ public void Init(DressCodeManager manager, CanvasComponent panel) {
3745
panel.AddComponent<uGUICanvas>();
3846
panel.AddComponent<GraphicRaycaster>();
3947

40-
_scopeSelectTabBar = new ScopeSelectTabBar(panel);
41-
_scopeSelectTabBar.ScopeSelected += (o, e) => UpdateScopeSelection();
48+
_sceneList = new SceneList(panel);
49+
_sceneList.Position = new(-(UiWidth / 2) + SceneListSize.x / 2 + 41, 0);
50+
_sceneList.Size = SceneListSize;
51+
_sceneList.ValueSelected += (o, e) => UpdateProfileSelection();
52+
53+
_scopeList = new ScopeList(panel);
54+
_scopeList.Position = _sceneList.Position + PanelMargin + new Vector3(SceneListSize.x / 2 + ScopeListSize.x / 2, 0);
55+
_scopeList.Size = ScopeListSize;
56+
_scopeList.ValueSelected += (o, e) => UpdateScopeSelection();
4257

4358
_maidSelectPanel = new MaidSelectPanel(panel);
59+
_maidSelectPanel.Position = _scopeList.Position + PanelMargin + new Vector3(ScopeListSize.x / 2 + MaidListSize.x / 2, 0);
60+
_maidSelectPanel.Size = MaidListSize;
4461
_maidSelectPanel.MaidSelected += (o, e) => UpdateMaidSelection();
4562

46-
_sceneList = new SceneList(panel);
47-
_sceneList.ValueSelected += (o, e) => UpdateProfileSelection();
63+
_maidSelectPanel.ScrollChild.Position = new(0, MaidListSize.y / 2 - 112.5f);
4864

4965
_profilePanel = new ProfilePanel(panel, this);
5066
_profilePanel.ProfileSelected += OnProfileChanged;
@@ -76,13 +92,11 @@ public void CreateSelector() {
7692

7793
private void SetSceneMode() {
7894
_maidSelectPanel.SetActive(false);
79-
_sceneList.Position = new(-832, 0);
8095
_profilePanel.SetSceneMode();
8196
}
8297

8398
private void SetMaidMode() {
8499
_maidSelectPanel.SetActive(true);
85-
_sceneList.Position = new(-337, 0);
86100
_profilePanel.SetMaidMode();
87101
}
88102

Panels/MaidSelectPanel.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
namespace COM3D2.DressCode;
22

33
internal class MaidSelectPanel : GridScrollViewPanel {
4-
private static readonly Vector2 PanelSize = new(502, 1080);
5-
64
private readonly CharacterSelectManager _characterSelectManager;
75

86
public MaidSelectPanel(CanvasComponent parent) : base(parent, nameof(MaidSelectPanel)) {
9-
Position = new(-690, 0);
107
ContentPivot = UIWidget.Pivot.Top;
118

12-
Size = PanelSize;
13-
14-
ScrollChild.Position = new(0, PanelSize.y / 2 - 112.5f);
15-
169
Grid.cellHeight = 130;
1710
Grid.pivot = UIWidget.Pivot.Top;
1811
Grid.sorting = UIGrid.Sorting.Custom;
@@ -34,13 +27,9 @@ protected virtual void OnMaidSelected(MaidSelectedEventArgs e) {
3427
MaidSelected?.Invoke(this, e);
3528
}
3629

37-
public void Initialize() {
38-
_characterSelectManager.Create(CharacterSelectManager.Type.Select);
39-
}
30+
public void Initialize() => _characterSelectManager.Create(CharacterSelectManager.Type.Select);
4031

41-
public void SelectMaid(Maid maid) {
42-
_characterSelectManager.SelectMaid(maid);
43-
}
32+
public void SelectMaid(Maid maid) => _characterSelectManager.SelectMaid(maid);
4433

4534
private void GetMaidList(List<Maid> drawMaidList) {
4635
var characterManager = GameMain.Instance.CharacterMgr;

Panels/ProfilePanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ internal class ProfilePanel : CanvasComponent {
44
private const int ThumbnailPanelWidth = 615;
55
private const int ButtonSpacing = 115;
66

7-
private static readonly Vector2 PanelSize = new(956, 830);
7+
private static readonly Vector2 PanelSize = new(890, 830);
88

99
private readonly DressCodeControl _parentControl;
1010
private readonly ThumbnailPanel _thumbnailPanel;

Panels/SceneList.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
namespace COM3D2.DressCode;
22

33
internal class SceneList : ButtonScrollList<CostumeScene> {
4-
private static readonly Vector2 PanelSize = new(174, 848);
5-
6-
private readonly CostumeScene[] _npcScenes = {
4+
private static readonly CostumeScene[] NpcScenes = {
75
CostumeScene.Dance,
86
CostumeScene.PoleDance,
97
};
108

11-
private readonly KeyValuePair<string, CostumeScene>[] _scenes = {
9+
private static readonly KeyValuePair<string, CostumeScene>[] Scenes = {
1210
new("SceneDance", CostumeScene.Dance),
1311
new("ScenePoleDance", CostumeScene.PoleDance),
1412
new("SceneYotogi", CostumeScene.Yotogi),
@@ -17,12 +15,10 @@ internal class SceneList : ButtonScrollList<CostumeScene> {
1715
};
1816

1917
public SceneList(BaseComponent parent) : base(parent, nameof(SceneList)) {
20-
Size = PanelSize;
21-
2218
ScrollValue = 0.5f;
2319

24-
foreach (var scene in _scenes) {
25-
AddButton(scene.Value, scene.Key, 140);
20+
foreach (var scene in Scenes) {
21+
AddButton(scene.Value, scene.Key, 150);
2622
}
2723

2824
UpdateChildren();
@@ -34,7 +30,7 @@ public void SelectFirstAvailable() {
3430
}
3531

3632
public void SetNpcMode(bool isNpcMode) {
37-
foreach (var button in Buttons.Where(e => !_npcScenes.Contains(e.Value))) {
33+
foreach (var button in Buttons.Where(e => !NpcScenes.Contains(e.Value))) {
3834
if (isNpcMode) {
3935
button.SetSelected(false);
4036
}

Panels/ScopeList.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace COM3D2.DressCode;
2+
3+
internal class ScopeList : ButtonScrollList<ProfileScope> {
4+
public ScopeList(BaseComponent parent) : base(parent, nameof(ScopeList)) {
5+
AddButton(ProfileScope.Scene, "SceneSetting", 110);
6+
AddButton(ProfileScope.Maid, "MaidSetting", 110);
7+
8+
UpdateChildren();
9+
}
10+
}

Panels/ScopeSelectTabBar.cs

Lines changed: 0 additions & 57 deletions
This file was deleted.

localization/DressCode.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Localization>
33
<Language Code="en">
44
<Term Key="BackButton" Translation="Back" />
55

6-
<Term Key="SceneSetting" Translation="Scene settings" />
7-
<Term Key="MaidSetting" Translation="Maid settings" />
6+
<Term Key="SceneSetting" Translation="Scene" />
7+
<Term Key="MaidSetting" Translation="Maid" />
88

99
<Term Key="SceneDance" Translation="Dance" />
1010
<Term Key="ScenePoleDance" Translation="Pole dance" />
@@ -24,6 +24,9 @@
2424
<Term Key="EditButton" Translation="Edit" />
2525
</Language>
2626
<Language Code="ja">
27+
<Term Key="SceneSetting" Translation="シーン" />
28+
<Term Key="MaidSetting" Translation="メイド" />
29+
2730
<Term Key="SceneDance" Translation="ダンス" />
2831
<Term Key="ScenePoleDance" Translation="ポールダンス" />
2932
<Term Key="SceneYotogi" Translation="夜伽" />

0 commit comments

Comments
 (0)