46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SliderControlWindow : ParameterWindow<IReadOnlyList<uint>>
|
|
{
|
|
public event Action<uint> OnButtonClick;
|
|
|
|
private SliderControl _control;
|
|
|
|
public override bool NeedShowBackground => false;
|
|
public override int ZOrder => 4;
|
|
|
|
private void Awake()
|
|
{
|
|
_control = transform.Find("View/SliderControl").gameObject.GetComponent<SliderControl>();
|
|
}
|
|
|
|
protected override void OnShow(IReadOnlyList<uint> argument)
|
|
{
|
|
OnButtonClick = null;
|
|
|
|
_control.SetControlStates(argument);
|
|
_control.OnSelectedState += OnSelectedStateHandler;
|
|
|
|
// G.Instance.Level.Agent.OnChangeState += SyncControlView;
|
|
}
|
|
|
|
protected override void OnHidden()
|
|
{
|
|
_control.OnSelectedState -= OnSelectedStateHandler;
|
|
// G.Instance.Level.Agent.OnChangeState -= SyncControlView;
|
|
}
|
|
|
|
private void SyncControlView()
|
|
{
|
|
// _control.SetActiveItemForState(G.Instance.Level.Agent.CurrentBehaviour);
|
|
}
|
|
|
|
private void OnSelectedStateHandler(uint state)
|
|
{
|
|
OnButtonClick?.Invoke(state);
|
|
}
|
|
}
|