| | |
| | | State state = State.Closed; |
| | | |
| | | float closeTimer = 0f; |
| | | int openedFunctionCount = 0; |
| | | |
| | | TreasureFindHostModel hostModel { get { return ModelCenter.Instance.GetModel<TreasureFindHostModel>(); } } |
| | | LimitedTimePackageItemClassModel limitedTimePackageItemModel { get { return ModelCenter.Instance.GetModel<LimitedTimePackageItemClassModel>(); } } |
| | |
| | | void Start() |
| | | { |
| | | m_Switch.SetListener(() => { Switch(state == State.Closed); }); |
| | | openedFunctionCount = 0; |
| | | openedFunctionCount += CountOpenedFunction(m_GridGroup1); |
| | | openedFunctionCount += CountOpenedFunction(m_GridGroup2); |
| | | SwitchImmedidately(false); |
| | | } |
| | | |
| | |
| | | var index = 0; |
| | | foreach (var grid in m_GridGroup1) |
| | | { |
| | | if (!grid.alwayShow) |
| | | if (!grid.alwayShow && openedFunctionCount > 5) |
| | | { |
| | | grid.Switch(active, 0, 0f); |
| | | } |
| | |
| | | index = 0; |
| | | foreach (var grid in m_GridGroup2) |
| | | { |
| | | if (!grid.alwayShow) |
| | | if (!grid.alwayShow && openedFunctionCount > 5) |
| | | { |
| | | var offset = (index / 6) + 1; |
| | | grid.Switch(active, offset * (m_GridSize.y + m_Space.y), offset * 0.1f); |
| | |
| | | { |
| | | foreach (var grid in m_GridGroup1) |
| | | { |
| | | if (!grid.alwayShow) |
| | | if (grid.alwayShow || openedFunctionCount <= 5) |
| | | { |
| | | grid.SwitchImmediately(true, 0); |
| | | } |
| | | else |
| | | { |
| | | grid.SwitchImmediately(active, 0); |
| | | } |
| | |
| | | var index = 0; |
| | | foreach (var grid in m_GridGroup2) |
| | | { |
| | | if (!grid.alwayShow) |
| | | if (grid.alwayShow || openedFunctionCount <= 5) |
| | | { |
| | | grid.SwitchImmediately(true, ((index / 6) + 1) * (m_GridSize.y + m_Space.y)); |
| | | } |
| | | else |
| | | { |
| | | grid.SwitchImmediately(active, ((index / 6) + 1) * (m_GridSize.y + m_Space.y)); |
| | | } |
| | |
| | | |
| | | private void RefreshGridsActiveState() |
| | | { |
| | | openedFunctionCount = 0; |
| | | openedFunctionCount += CountOpenedFunction(m_GridGroup1); |
| | | openedFunctionCount += CountOpenedFunction(m_GridGroup2); |
| | | |
| | | ActiveGroup(m_GridGroup1); |
| | | ActiveGroup(m_GridGroup2); |
| | | LayoutGroup(m_GridGroup1, m_GroupContainer1); |
| | |
| | | |
| | | bool IsShowButton() |
| | | { |
| | | if (openedFunctionCount <= 5) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | foreach (var grid in m_GridGroup1) |
| | | { |
| | | if (!grid.alwayShow && grid.gameObject.activeSelf) |
| | |
| | | m_ArrowClose.gameObject.SetActive(state == State.Closed); |
| | | } |
| | | |
| | | int CountOpenedFunction(MainWinTopGrid[] grids) |
| | | { |
| | | var count = 0; |
| | | foreach (var grid in grids) |
| | | { |
| | | var active = grid.IsOpen(); |
| | | count += active ? 1 : 0; |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | |
| | | void ActiveGroup(MainWinTopGrid[] grids) |
| | | { |
| | | foreach (var grid in grids) |
| | |
| | | grid.gameObject.SetActive(true); |
| | | } |
| | | |
| | | if (grid.gameObject.activeSelf && (grid.alwayShow || openedFunctionCount <= 5)) |
| | | { |
| | | grid.SwitchImmediately(true, 0); |
| | | } |
| | | |
| | | if (!active && grid.gameObject.activeSelf) |
| | | { |
| | | grid.gameObject.SetActive(false); |