You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.5 KiB
82 lines
2.5 KiB
using AX.InputSystem; |
|
using AX.MessageSystem; |
|
using System; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class WaterFlowAttribute : ResourceLoadPanel<WaterFlowAttribute> |
|
{ |
|
public Toggle WaterStraightToggle; |
|
public Toggle WaterFlowerToggle; |
|
public Toggle WaterFogToggle; |
|
public Button ConfirmButton; |
|
ParticleTypeCmdArgs ParticleTypeCmdArgs; |
|
void Awake() |
|
{ |
|
WaterStraightToggle.onValueChanged.AddListener(WaterStraight); |
|
WaterFlowerToggle.onValueChanged.AddListener(WaterFlower); |
|
WaterFogToggle.onValueChanged.AddListener(WaterFog); |
|
ConfirmButton.onClick.AddListener(Confirm); |
|
MessageDispatcher.AddListener("SelectChange", RadioSelect); |
|
} |
|
|
|
private void RadioSelect(IMessage obj) |
|
{ |
|
if (gameObject.activeSelf) |
|
gameObject.SetActive(false); |
|
} |
|
|
|
private void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SelectChange", RadioSelect); |
|
} |
|
private void Confirm() |
|
{ |
|
MessageDispatcher.SendMessage("CHANGE_PARTICLE_TYPE_COMMAND", ParticleTypeCmdArgs); |
|
gameObject.SetActive(false); |
|
} |
|
public void Show(ParticleEnum ParticleType) |
|
{ |
|
switch (ParticleType) |
|
{ |
|
case ParticleEnum.None: |
|
WaterStraightToggle.isOn = true; |
|
break; |
|
case ParticleEnum.WaterStraight: |
|
WaterStraightToggle.isOn = true; |
|
break; |
|
case ParticleEnum.WaterFlower: |
|
WaterFlowerToggle.isOn = true; |
|
break; |
|
case ParticleEnum.WaterFog: |
|
WaterFogToggle.isOn = true; |
|
break; |
|
case ParticleEnum.Froth: |
|
WaterStraightToggle.isOn = true; |
|
break; |
|
case ParticleEnum.DryPowder: |
|
WaterStraightToggle.isOn = true; |
|
break; |
|
default: |
|
WaterStraightToggle.isOn = true; |
|
break; |
|
} |
|
} |
|
private void WaterFog(bool arg0) |
|
{ |
|
if (arg0) |
|
ParticleTypeCmdArgs = new ParticleTypeCmdArgs() { ParticleType = ParticleEnum.WaterFog }; |
|
} |
|
|
|
private void WaterFlower(bool arg0) |
|
{ |
|
if (arg0) |
|
ParticleTypeCmdArgs = new ParticleTypeCmdArgs() { ParticleType = ParticleEnum.WaterFlower }; |
|
} |
|
|
|
private void WaterStraight(bool arg0) |
|
{ |
|
if (arg0) |
|
ParticleTypeCmdArgs = new ParticleTypeCmdArgs() { ParticleType = ParticleEnum.WaterStraight }; |
|
} |
|
}
|
|
|