13 public void Activate(
Religion r, Action<Religion> _onWorship)
15 this.onWorship = _onWorship;
20 if (!religion.IsMinorGod)
22 this.AddReligion(religion);
25 this.isBranchFaith =
true;
31 TweenUtil.Tween(this.startDelay,
new Action(this.RefreshSlots),
null);
38 if (EInput.wheel != 0)
40 this.Move((EInput.wheel > 0) ? 1 : -1);
45 public void Move(
int a)
48 if (this.index >= this.items.Count)
52 else if (this.index < 0)
54 this.index = this.items.Count - 1;
61 public void RefreshSlots()
65 for (
int i = 0; i < this.items.Count; i++)
67 if (num >= this.items.Count)
71 this.orders.Add(this.items[num]);
74 for (
int j = 0; j < this.items.Count; j++)
76 LayerFaith.Slot slot = (j >= this.slots.Count) ? this.slotVoid : this.slots[j];
77 UIItem item = this.orders[j];
79 if (this.items.Count == 1)
84 item.button1.icon.raycastTarget = !flag;
87 item.button1.SetOnClick(delegate
94 item.button1.SetOnClick(delegate
99 item.button2.SetOnClick(delegate
102 if (religion.IsAvailable || !
this.isBranchFaith)
105 this.onWorship(religion);
110 item.button3.SetOnClick(delegate
114 item.button2.GetComponent<CanvasGroup>().DOFade(flag ? 1f : 0f, this.time).SetEase(slot.ease);
115 item.button3.GetComponent<CanvasGroup>().DOFade(flag ? 1f : 0f, this.time).SetEase(slot.ease);
116 item.text1.DOFade(flag ? 1f : 0f, this.time).SetEase(slot.ease);
117 item.text3.DOFade(flag ? 1f : 0f, this.time).SetEase(slot.ease);
118 item.image2.DOFade(flag ? this.bgAlpha : 0f, this.time).SetEase(slot.ease);
119 item.Rect().DOAnchorPos(slot.position,
this.time,
false).SetEase(slot.ease);
120 item.Rect().DOScale(slot.scale,
this.time).SetEase(slot.ease);
121 item.GetComponent<CanvasGroup>().DOFade(slot.alpha,
this.time).SetEase(slot.ease);
128 UIItem uiitem = Util.Instantiate<UIItem>(this.moldItem, this.layout);
129 uiitem.text1.SetText(r.source.GetDetail());
130 uiitem.text2.SetText(r.Name);
131 uiitem.button1.icon.sprite = Resources.Load<Sprite>(
"Media/Graphics/Image/Faction/" + r.source.id);
132 if (this.isBranchFaith && !r.IsAvailable)
134 uiitem.button2.mainText.SetText(
"faithUnavailable".lang());
137 this.items.Add(uiitem);
138 uiitem.Rect().anchoredPosition = this.startPos;
142 public Vector2 startPos;
148 public float bgAlpha;
151 public float startDelay;
160 public UIItem moldItem;
163 public LayoutGroup layout;
166 public Action<Religion> onWorship;
170 public bool isBranchFaith;
178 public List<UIItem> items =
new List<UIItem>();
182 public List<UIItem> orders =
new List<UIItem>();
195 public Vector2 position;