public class ViceInfoPanel : BasePanel
{
///
//基类虚函数重写///
///
protected override int panelID
{
return id;
}
protected override ArrayList GetAssets(){ }
protected override void OnFirstShow(){}
protected override void OnShow(){}
protected override void OnHide(){}
protected override void OnDestroy(){}
///
//内部处理函数/
///
#region 创建panel
private void createPanel()
{
}
private createLeftPanel(){}
private createRightPanel(){}
private void upLvBtnHandler(){}
///
//对外接口函数/
public void UpdateData(){ refreshPanel(); }
///
/成员变量//
//数据
public void showPanel()
else
{
}
public void HidePanel()
public void DestroyPanel()
{
///
//基类虚函数重写///
///
protected override int panelID
{
return id;
}
protected override ArrayList GetAssets(){ }
protected override void OnFirstShow(){}
protected override void OnShow(){}
protected override void OnHide(){}
protected override void OnDestroy(){}
///
//内部处理函数/
///
#region 创建panel
private void createPanel()
{
createLeftPanel();
createRightPanel();}
private createLeftPanel(){}
private createRightPanel(){}
#endregion
#region 数据显示与操作
private void refreshPanel(){}private void upLvBtnHandler(){}
#endregion
///
//对外接口函数/
///
public void SetInitData(int gunId){ m_gunId = gunId; }public void UpdateData(){ refreshPanel(); }
///
/成员变量//
///
//资源
private UIAtlas m_plazaAtlas;//组件引用(动态变化)
private UILabel m_nameTxt;//数据
private int m_gunId;
}在Controller类里操作该View实例:
private ViceInfoPanel m_viceInfoPanel;public void showPanel()
{
if(m_viceInfoPanel == null)
{//创建逻辑
}else
{
if(!NGUITools.GetActive(m_viceInfoPanel))
{NGUITools.SetActive(m_viceInfoPanel.gameObject, true);
}
m_viceInfoPanel.UpdateData();
}}
public void HidePanel()
{
if(m_viceInfoPanel != null){ m_viceInfoPanel.Hide(); }
}public void DestroyPanel()
{
if(m_viceInfoPanel != null){ m_viceInfoPanel.Destroy();}
}