[TWLFramework] BaseUI

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

}

}

时间: 2024-10-13 19:14:14

[TWLFramework] BaseUI的相关文章

[TWLFramework] UIManager

using UnityEngine;using System.Collections;using System.Collections.Generic; public class UIManager : Singleton<UIManager>{ //UI gameobjects public Dictionary<E_UIType, GameObject> _dictUIs = new Dictionary<E_UIType, GameObject>(); //UI

DEV控件的使用(二次封装BaseUI)

一:DEV的安装 直接点击exe文件安装,安装完成之后,将控件添加到工具栏,如下图添加即可 二:注意事项 项目使用的是二次封装的BaseUI,有些属性和事件在BaseUI的控件中由于太多不能全部显示,有些属性和事件需要到DEV中找

[MetaHook] BaseUI hook

Hook IBaseUI function. 1 #include <metahook.h> 2 3 #include <IBaseUI.h> 4 5 IBaseUI *g_pBaseUI = 0; 6 7 void (__fastcall *g_pfnCBaseUI_Initialize)(void *pthis, int edx, CreateInterfaceFn *factories, int count) = 0; 8 void (__fastcall *g_pfnCBa

[TWLFramework] Singleton

using UnityEngine;using System.Collections; //单例模式 public class Singleton<T> where T : class, new(){ protected static T _instance = null; public static T Instance { get { if (_instance == null) { _instance = new T(); } return _instance; } } protecte

[TWLFramework] Message

using UnityEngine;using System.Collections;using System.Collections.Generic;using System;/* 消息体 直接遍历 key访问 message[key] send() remove() add() 构造函数参数=>sender type(name) content*/ public class Message : IEnumerable<KeyValuePair<string, object>&g

[TWLFramework] MessageCenter

using UnityEngine;using System.Collections;using System.Collections.Generic; public class MessageCenter : Singleton<MessageCenter>{ private Dictionary<string, List<MessageEvent>> _dictMessageEvent = null; public override void Init() { _d

[TWLFramework] BasePanel

using UnityEngine;using System.Collections; public abstract class BasePanel : MonoBehaviour{ //panel State protected E_PanelState _panelState; public E_PanelState PanelState { get { return _panelState; } set { E_PanelState old = this._panelState; thi

[TWLFramework] 全局委托 全局枚举

using UnityEngine;using System.Collections; #region 全局委托 public delegate void MessageEvent(Message message); #endregion #region 全局枚举//panel Typepublic enum E_UIType{ None, FaceUI_Login, FaceUI_SelectRole,}//UI Typepublic enum E_PanelType{ None, E_Mia

用egret制作一款跑酷类游戏(一)

游戏源地址:http://static.egret-labs.org/h5game/62/v20/index.html 本demo素材全是引用该地址的素材. 游戏使用egret引擎制作 关于egret  http://www.egret-labs.org/ 动画是基于starlingswf制作的,关于starlingswf http://xyliu.sinaapp.com/?p=1 一.滑动的背景. 创建一个GameMainView.ts文件,游戏的主场景是建立在该类下的. class Game