Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 31c2deb

Browse files
committed
fix typo mistake in previous version
1 parent d919497 commit 31c2deb

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/Core/Config/ExplorerConfig.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ internal Vector4 GetWindowAnchorsVector()
135135
ret.y = float.Parse(split[1], _enCulture);
136136
ret.z = float.Parse(split[2], _enCulture);
137137
ret.w = float.Parse(split[3], _enCulture);
138-
139138
return ret;
140139
}
141140
catch
142141
{
143-
Window_Anchors = DEFAULT_WINDOW_ANCHORS;
144-
return new Vector4(0.25f, 0.1f, 0.78f, 0.95f);
142+
return DefaultWindowAnchors();
145143
}
146144
}
147145

@@ -153,7 +151,7 @@ internal static string GetWindowAnchorsString()
153151
return string.Format(_enCulture, "{0},{1},{2},{3}", new object[]
154152
{
155153
rect.anchorMin.x,
156-
rect.anchorMax.y,
154+
rect.anchorMin.y,
157155
rect.anchorMax.x,
158156
rect.anchorMax.y
159157
});
@@ -163,5 +161,11 @@ internal static string GetWindowAnchorsString()
163161
return DEFAULT_WINDOW_ANCHORS;
164162
}
165163
}
164+
165+
internal static Vector4 DefaultWindowAnchors()
166+
{
167+
Instance.Window_Anchors = DEFAULT_WINDOW_ANCHORS;
168+
return new Vector4(0.25f, 0.1f, 0.78f, 0.95f);
169+
}
166170
}
167171
}

src/UI/Main/MainMenu.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,14 @@ private void ConstructMenu()
151151
MainPanel = UIFactory.CreatePanel(UIManager.CanvasRoot, "MainMenu", out GameObject content);
152152

153153
RectTransform panelRect = MainPanel.GetComponent<RectTransform>();
154-
//panelRect.anchorMin = new Vector2(0.25f, 0.1f);
155-
//panelRect.anchorMax = new Vector2(0.78f, 0.95f);
156154
var anchors = ExplorerConfig.Instance.GetWindowAnchorsVector();
157-
panelRect.anchorMin = new Vector2(anchors.x, anchors.y);
158-
panelRect.anchorMax = new Vector2(anchors.z, anchors.w);
155+
SetPanelAnchors(panelRect, anchors);
156+
157+
if (panelRect.rect.width < 400 || panelRect.rect.height < 400)
158+
{
159+
anchors = ExplorerConfig.DefaultWindowAnchors();
160+
SetPanelAnchors(panelRect, anchors);
161+
}
159162

160163
MainPanel.AddComponent<Mask>();
161164

@@ -168,6 +171,12 @@ private void ConstructMenu()
168171
new DebugConsole(content);
169172
}
170173

174+
private void SetPanelAnchors(RectTransform panelRect, Vector4 anchors)
175+
{
176+
panelRect.anchorMin = new Vector2(anchors.x, anchors.y);
177+
panelRect.anchorMax = new Vector2(anchors.z, anchors.w);
178+
}
179+
171180
private void ConstructTitleBar(GameObject content)
172181
{
173182
// Core title bar holder

0 commit comments

Comments
 (0)