码迷,mamicode.com
首页 > 其他好文 > 详细

[TWLFramework] BaseUI

时间:2016-08-18 21:03:19      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

using UnityEngine;
using System.Collections;

public abstract class BaseUI : MonoBehaviour
{
//缓存 gameobject 和 transform
private GameObject _cacheGameObject;
public GameObject CacheGameObject
{
get
{
if (_cacheGameObject == null)
{
_cacheGameObject = this.gameObject;
}
return _cacheGameObject;
}
}
private Transform _cacheTransfrom;
public Transform CacheTransfrom
{
get
{
if (_cacheTransfrom == null)
{
_cacheTransfrom = this.transform;
}
return _cacheTransfrom;
}
}
//UI type
protected E_UIType _uiType;
public E_UIType UIType
{
get
{
return _uiType;
}
protected set
{
_uiType = value;
}
}
//UI State
protected E_UIState _uiState;
public E_UIState UIState
{
get
{
return this._uiState;
}
set
{
E_UIState old = this._uiState;
this._uiState = value;
if (old != this._uiState)
{
OnUIStateChange(this.gameObject, old, this._uiState);
}
}
}


void Awake()
{
OnAwake();
}
public virtual void OnAwake()
{
SetUIType();
}

void Start()
{
OnStart();
}
public virtual void OnStart()
{
this._uiState = E_UIState.None;

//重写UI Type
public abstract void SetUIType();
public virtual E_UIType GetUIType()
{
return UIType;
}
//On UI State Change
public virtual void OnUIStateChange(GameObject go, E_UIState oldS, E_UIState newS)
{

}

//Load Data
public virtual void LoadData(object args)
{

}

[TWLFramework] BaseUI

标签:

原文地址:http://www.cnblogs.com/cocotang/p/5785168.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!