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.
42 lines
1.1 KiB
42 lines
1.1 KiB
using System; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class CommonToggle : BaseToggle |
|
{ |
|
//字体颜色 |
|
private Color32 SelectedColor = new Color32(255, 255, 255, 255); |
|
private Color32 NormalColor = new Color32(140, 166, 255, 255); |
|
public bool UsedColor = true; |
|
public Text NameLable { get { return GetComponentInChildren<Text>(); } } |
|
public Toggle ToggleButton { get { return GetComponent<Toggle>(); } } |
|
public Action<CommonToggle, bool> OnClicked; |
|
public override void RespondFun(bool value) |
|
{ |
|
if (UsedColor) |
|
{ |
|
if (value) |
|
{ |
|
NameLable.color = SelectedColor; |
|
} |
|
else |
|
{ |
|
NameLable.color = NormalColor; |
|
} |
|
} |
|
if (OnClicked != null) |
|
{ |
|
OnClicked(this, value); |
|
} |
|
} |
|
public string LableText |
|
{ |
|
get { return NameLable.text; } |
|
set { NameLable.text = value; } |
|
} |
|
public bool IsOn |
|
{ |
|
get { return ToggleButton.isOn; } |
|
set { ToggleButton.isOn = value; } |
|
} |
|
}
|
|
|