zoukankan      html  css  js  c++  java
  • [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)
    {

    }

  • 相关阅读:
    PPP协议 PAP认证
    交换机广播风暴,STP生成树协议,端口聚合
    传统远程注入线程,加载DLL
    EXE和DLL调用关系,DLL制作,钩子
    window bat批处理 实用脚本
    python利用scapy嗅探流量
    关于AWD线下攻防的经验
    APP 仿微信登录
    价值1500左右的毕业设计都开源啦
    EOS2.0环境搭建-centos7
  • 原文地址:https://www.cnblogs.com/cocotang/p/5785168.html
Copyright © 2011-2022 走看看