5public class UINote : MonoBehaviour
19 public RectTransform
cur;
32 layout = GetComponent<LayoutGroup>();
39 layout = GetComponent<LayoutGroup>();
41 layout.DestroyChildren(destroyInactive:
true);
53 this.RebuildLayoutTo<Layer>();
55 this.RebuildLayout(recursive:
true);
56 this.RebuildLayoutTo<Layer>();
57 this.RebuildLayoutTo<UIContent>();
58 this.RebuildLayoutTo<UIContent>();
62 public void Space(
int sizeY = 0,
int sizeX = 1)
64 RectTransform rectTransform = Load<Transform>(
"UI/Element/Deco/Space").Rect();
65 rectTransform.sizeDelta = ((sizeY == 0) ?
prof.
sizeSpace :
new Vector2(sizeX, sizeY));
68 rectTransform.GetComponent<LayoutElement>().preferredWidth = sizeX;
74 UINote componentInChildren = Load<Transform>(
"UI/Element/Note/" +
id).gameObject.GetComponentInChildren<
UINote>();
76 return componentInChildren;
81 return AddHeader(
"HeaderNote", text, sprite);
86 return AddHeader(
"HeaderCard", text, sprite);
91 return AddHeader(
"HeaderTopic", text, sprite);
96 UIItem uIItem =
Load(
"UI/Element/Header/" +
id);
97 uIItem.text1.text = text.lang();
102 uIItem.image1.sprite = sprite;
103 uIItem.
image1.SetNativeSize();
107 uIItem.
image1.SetActive(enable:
false);
115 return AddText(
null, text, color);
141 return Load(
"UI/Element/Item/" +
id);
146 UIItem uIItem =
Load(
"UI/Element/Text/" +
id);
149 uIItem.
text2.SetActive(!value.IsEmpty());
155 return AddTopic(
"TopicDefault", text, value);
160 Image image =
Load(
"UI/Element/Deco/ImageNote").
image1;
161 image.sprite = sprite;
162 image.SetNativeSize();
163 image.transform.parent.Rect().sizeDelta = image.Rect().sizeDelta;
166 image.transform.parent.SetActive(enable:
false);
172 Image image =
Load(
"UI/Element/Deco/ImageNote").
image1;
173 Sprite sprite = (image.sprite = Resources.Load<Sprite>(
"Media/Graphics/Image/" + idFile));
174 image.SetNativeSize();
175 image.transform.parent.Rect().sizeDelta = image.Rect().sizeDelta;
178 image.transform.parent.SetActive(enable:
false);
184 UIButton uIButton = Load<UIButton>(
"UI/Element/Button/ButtonNote");
185 uIButton.mainText.text = text;
186 uIButton.onClick.AddListener(delegate
195 UIButton button = Load<UIItem>(
"UI/Element/Item/ItemNoteLink").button1;
196 button.mainText.text = text;
197 button.onClick.AddListener(delegate
200 Application.OpenURL(url);
207 UIItem uIItem =
Load(
"UI/Element/Item/ItemDropdown");
209 return uIItem.GetComponentInChildren<
UIDropdown>();
212 public Slider
AddSlider(
float value, Func<float, string> action,
float min = 0f,
float max = 1f,
bool isInt =
false)
214 Slider componentInChildren = Load<Transform>(
"UI/Element/Input/Slider").GetComponentInChildren<Slider>();
215 UIText t = componentInChildren.GetComponentInChildren<
UIText>(includeInactive:
true);
217 componentInChildren.minValue = min;
218 componentInChildren.maxValue = max;
219 componentInChildren.wholeNumbers = isInt;
220 componentInChildren.SetValueWithoutNotify(value);
221 componentInChildren.onValueChanged.AddListener(delegate(
float a)
225 t.text = action(componentInChildren.value);
226 return componentInChildren;
231 UIButton uIButton = Load<UIButton>(
"UI/Element/Button/ButtonToggle");
233 uIButton.mainText.text = idLang.lang().ToTitleCase();
239 return Util.Instantiate(path,
this);
244 return Util.Instantiate<T>(
"UI/Element/Note/Extra/" + path,
this);
249 return Load<UIItem>(path);
252 private T
Load<T>(
string path) where T : Component
static SkinRootStatic CurrentSkin
static SkinRootStatic tempSkin
SkinRootStatic GetSkin(SkinType type)
UIButton AddButtonLink(string text, string url)
void AddImage(string idFile)
UIItem AddHeaderCard(string text, Sprite sprite=null)
UIItem AddHeaderTopic(string text, Sprite sprite=null)
UIDropdown AddDropdown(string text)
UINote AddNote(string id)
Transform AddPrefab(string path)
void AddImage(Sprite sprite)
UIItem AddHeader(string id, string text, Sprite sprite=null)
T AddExtra< T >(string path)
Slider AddSlider(float value, Func< float, string > action, float min=0f, float max=1f, bool isInt=false)
UIItem AddText(string id, string text, Color color)
UIItem AddItem(string id)
UIItem AddText(string id, string text, FontColor color=FontColor.DontChange)
UIItem AddHeader(string text, Sprite sprite=null)
UIItem AddTopic(string text, string value=null)
SkinRootStatic oldTempSkin
UIButton AddButton(string text, Action onClick)
UIItem AddTopic(string id, string text, string value=null)
UIButton AddToggle(string idLang="", bool isOn=false, Action< bool > action=null)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
void Space(int sizeY=0, int sizeX=1)