[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;
this._panelState = value;
if (this._panelState != old)
{
OnStateChange(old, this._panelState);
}
}
}
//panel Type
protected E_PanelType _panelType;
public E_PanelType PanelType
{
get; private set;
}

public abstract void SetPanelState();
public abstract void SetPanelType();
public virtual void OnStateChange(E_PanelState oldS, E_PanelState newS)
{

}

void Start()
{
OnStart();
}
public virtual void OnStart()
{
SetPanelType();
UIManager.Instance.SavePanel(this._panelType, this.gameObject);
}
void Awake()
{
OnAwake();
}
public virtual void OnAwake()
{

}

void Update()
{
OnUpdate();
}

public virtual void OnUpdate()
{

}

}

时间: 2024-12-09 03:26:50

[TWLFramework] BasePanel的相关文章

UI(UGUI)框架(二)-------------UIManager单例模式与开发BasePanel面板基类/UIManage统一管理UI面板的实例化/开发字典扩展类

UIManage单实例: 1 /// 单例模式的核心 2 /// 1,定义一个静态的对象 在外界访问 在内部构造 3 /// 2,构造方法私有化 4 5 private static UIManager _instance; 6 7 public static UIManager Instance 8 { 9 get 10 { 11 if (_instance == null) 12 { 13 _instance = new UIManager(); 14 } 15 return _instan

[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

[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] BaseUI

using UnityEngine;using System.Collections; public abstract class BaseUI : MonoBehaviour{ //缓存 gameobject 和 transform private GameObject _cacheGameObject; public GameObject CacheGameObject { get { if (_cacheGameObject == null) { _cacheGameObject = th

[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中通过判断不同的类型来使同一个UI面板上显示不同的效果

点击不同按钮弹出同一个面板上的不同效果,通过传入类型来判断: this.btnRight.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onUpgradeforgift,this); this.btnLeft.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onPayforgift,this); private onUpgradeforgift(evt:egret.TouchEvent){ ma

javax.Swing 使用GridBagLayout的程序栗子

摘自https://zhidao.baidu.com/question/110748776.html javax.Swing 使用GridBagLayout的程序栗子 总共两个文件,第一个是启动文件,第二个是一个基础面板类 1 package com; 2 3 import com.ren.BasePanel; 4 import javax.swing.*; 5 import java.awt.BorderLayout; 6 import java.awt.Toolkit; 7 8 public