//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, February 05, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System;
|
using System.Collections.Generic;
|
|
namespace vnxbqy.UI {
|
|
public class RayAccepterNull:MonoBehaviour {
|
[SerializeField] Transform m_LowSettingTipGroup;
|
[SerializeField] Transform m_RayAccepterNull;
|
public float Long=87f;
|
public float Wide=87f;
|
public int Number=4;
|
|
private int ButtonNumbers = 0;
|
private void OnEnable()
|
{
|
SetObjWideAndHight();
|
FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
|
}
|
private void Start()
|
{
|
|
}
|
|
private void OnDisable()
|
{
|
FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
|
}
|
private void SetObjWideAndHight()
|
{
|
ButtonNumbers = 0;
|
for (int i = 0; i < m_LowSettingTipGroup.childCount; i++)
|
{
|
if (m_LowSettingTipGroup.GetChild(i).gameObject.activeSelf)
|
{
|
ButtonNumbers += 1;
|
}
|
|
}
|
|
int line = Mathf.FloorToInt(ButtonNumbers/ Number);
|
(m_RayAccepterNull as RectTransform).sizeDelta = (m_RayAccepterNull as RectTransform).sizeDelta.SetY(Wide * Number);
|
(m_RayAccepterNull as RectTransform).sizeDelta = (m_RayAccepterNull as RectTransform).sizeDelta.SetX(Long * line);
|
}
|
|
private void OnFuncStateChange(int obj)
|
{
|
SetObjWideAndHight();
|
}
|
}
|
|
}
|