//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, September 11, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using TableConfig;
|
namespace Snxxz.UI
|
{
|
//功能预告面板
|
public class FeatureNoticeWin : Window
|
{
|
[SerializeField] Text m_TextAdvanceName;//功能名
|
[SerializeField] Image m_FeaturesImage;//功能图标
|
[SerializeField] Text m_Text_ShowA;//显示内容1
|
[SerializeField] Text m_TextShowB;//显示内容2
|
[SerializeField] Text m_TextShowC;//显示内容3
|
[SerializeField] Text m_TextShowD;//显示内容4
|
[SerializeField] ScrollerController m_ScrollerController;
|
[SerializeField] Button m_CloseButton;
|
List<FunctionForecastConfig> FunctionList = new List<FunctionForecastConfig>();
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_CloseButton.AddListener(()=> { Close(); });
|
}
|
|
protected override void OnPreOpen()
|
{
|
AddList();
|
m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
|
OnCreateGridLineCell(m_ScrollerController);
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
|
}
|
|
void OnCreateGridLineCell(ScrollerController gridCtrl)
|
{
|
gridCtrl.Refresh();
|
for (int i = 0; i < FunctionList.Count; i++)
|
{
|
if (i == 0)
|
{
|
gridCtrl.AddCell(ScrollerDataType.Header, FunctionList[i].FuncId);
|
}
|
else
|
{
|
gridCtrl.AddCell(ScrollerDataType.Normal, FunctionList[i].FuncId);
|
}
|
}
|
gridCtrl.Restart();
|
}
|
private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
{
|
int funcId = cell.index;
|
if (type == ScrollerDataType.Header)
|
{
|
FeaturesType1 featuresType1 = cell.GetComponent<FeaturesType1>();
|
featuresType1.GetTheFeatureID(funcId);
|
}
|
else if (type == ScrollerDataType.Normal)
|
{
|
FeaturesType2 featuresType2 = cell.GetComponent<FeaturesType2>();
|
featuresType2.GetTheFeatureID(funcId);
|
}
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
private void AddList()
|
{
|
if (FunctionList.Count <= 0)
|
{
|
var configs = Config.Instance.GetAllKeys<FunctionForecastConfig>();
|
foreach (var key in configs)
|
{
|
var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(key);
|
if (functionForecastConfig != null && functionForecastConfig.Display == 1)
|
{
|
FunctionList.Add(functionForecastConfig);
|
}
|
|
}
|
}
|
}
|
}
|
|
}
|