Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIAutoTurn.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
4public class UIAutoTurn : EMono
5{
6 public Image icon;
7
8 public Sprite[] iconSprites;
9
10 public Gauge gauge;
11
12 public string hint;
13
14 private int count;
15
16 private void Awake()
17 {
18 InvokeRepeating("_Update", 0f, 0.05f);
19 }
20
21 private void _Update()
22 {
23 float now = 0f;
24 float num = 0f;
25 hint = null;
27 {
29 {
30 num = 1f;
31 for (int num2 = EMono.pc.conditions.Count - 1; num2 >= 0; num2--)
32 {
33 if (EMono.pc.conditions[num2].ConsumeTurn)
34 {
35 hint = EMono.pc.conditions[num2].GetText().ToTitleCase();
36 }
37 }
38 }
39 else if (!EMono.pc.HasNoGoal)
40 {
41 AIProgress progress = EMono.pc.ai.GetProgress();
42 if (EMono.pc.ai.IsAutoTurn || progress != null)
43 {
44 if (progress != null)
45 {
46 hint = progress.TextHint;
47 num = (progress.ShowProgress ? progress.MaxProgress : 0);
48 now = (progress.ShowProgress ? progress.progress : 0);
49 }
50 else
51 {
52 num = EMono.pc.ai.MaxProgress;
53 now = (EMono.pc.ai.ShowProgress ? EMono.pc.ai.CurrentProgress : 0);
54 }
55 }
56 }
57 }
58 if (!gauge.gameObject.activeSelf && num != 0f)
59 {
60 gauge.bar.rectTransform.sizeDelta = new Vector2(0f, gauge.bar.rectTransform.sizeDelta.y);
61 }
62 gauge.SetActive(num != 0f);
63 if (num != 0f)
64 {
65 gauge.textNow.SetActive(hint != null);
66 count++;
67 gauge.UpdateValue(now, num);
68 if (hint != null)
69 {
71 }
72 icon.sprite = iconSprites[count / 5 % 2];
73 }
74 }
75}
virtual bool IsAutoTurn
Definition: AIAct.cs:76
AIProgress GetProgress()
Definition: AIAct.cs:148
virtual int MaxProgress
Definition: AIAct.cs:84
virtual string TextHint
Definition: AIProgress.cs:17
AIAct ai
Definition: Chara.cs:187
List< Condition > conditions
Definition: Chara.cs:196
bool HasNoGoal
Definition: Chara.cs:821
bool WillConsumeTurn()
Definition: Chara.cs:3343
bool IsGameStarted
Definition: Core.cs:84
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static Chara pc
Definition: EMono.cs:13
Definition: Gauge.cs:7
void UpdateValue(float now, float _max)
Definition: Gauge.cs:68
RawImage bar
Definition: Gauge.cs:14
UIText textNow
Definition: Gauge.cs:8
Sprite[] iconSprites
Definition: UIAutoTurn.cs:8
void Awake()
Definition: UIAutoTurn.cs:16
void _Update()
Definition: UIAutoTurn.cs:21
Image icon
Definition: UIAutoTurn.cs:6
string hint
Definition: UIAutoTurn.cs:12
Gauge gauge
Definition: UIAutoTurn.cs:10
void SetText(string s)
Definition: UIText.cs:159