summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs')
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs35
1 files changed, 25 insertions, 10 deletions
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs
index 3081d97..9d1157c 100644
--- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs
@@ -2,26 +2,41 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
+[ExecuteInEditMode]
[DisallowMultipleComponent]
-public class PanelBase : MonoBehaviour
+public abstract class PanelBase : MonoBehaviour
{
- public virtual void Set(object param)
+ public abstract void Set(object param);
+
+ public virtual void OnEnable()
{
+ InitRectTransform();
}
- void Start()
- {
-
- }
+ public void InitRectTransform()
+ {
+ RectTransform rect = gameObject.GetComponent<RectTransform>();
+ rect.anchorMin = new Vector2(0, 0);
+ rect.anchorMax = new Vector2(1, 1);
+
+ rect.localScale = new Vector3(1, 1, 1);
+
+ rect.anchoredPosition3D = Vector3.zero;
+
+ rect.offsetMin = new Vector2(0, 0);
+ rect.offsetMax = new Vector2(0, 0);
- protected virtual void Update()
- {
- }
+ rect.pivot = new Vector2(0.5f, 0.5f);
+ }
+
+ protected virtual void Update()
+ {
+ }
protected virtual void OnSecondUpdate()
{
}
-}
+} \ No newline at end of file