summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/UI/Panel/PanelBase.cs
blob: 9d1157c50c13fff0a8ddfd3b2a6c7ad679f2e7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteInEditMode]
[DisallowMultipleComponent]
public abstract class PanelBase : MonoBehaviour
{

	public abstract void Set(object param);

	public  virtual void OnEnable()
	{
		InitRectTransform();
	}

	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);

		rect.pivot = new Vector2(0.5f, 0.5f);
	}

	protected virtual void Update()
	{
	}

	protected virtual void OnSecondUpdate()
	{

	}

}