15 public SkinManager skins
29 return this.layers.Count > 0 || this.contextMenu.isActive;
35 public bool AllowInventoryInteractions
39 return !this.contextMenu.isActive && (this.layers.Count == 0 || base.TopLayer.option.allowInventoryInteraction);
45 public bool BlockActions
49 return (this.wasActive && (!base.TopLayer || !base.TopLayer.option.passive)) || EInput.isInputFieldActive;
55 public bool BlockMouseOverUpdate
59 return this.wasActive;
65 public bool BlockInput
69 return this.IsDragging || base.IsBlockWidgetClick() || LayerAbility.hotElement !=
null || EInput.isInputFieldActive || this.contextMenu.isActive;
75 public bool IsPauseGame
79 return this.layers.Count > 0 && base.TopLayer.option.pauseGame;
85 public bool IsInventoryOpen
95 public bool IsAbilityOpen
105 public override bool blockWidgetClick
115 public override RectTransform rectLayers
119 return this._rectLayers;
125 public bool IsDragging
129 return this.currentDrag !=
null;
134 protected override void Awake()
137 base.InvokeRepeating(
"CheckWindowOrder", 1f, 0.5f);
141 public void OnCoreStart()
143 this.mouseInfo.SetActive(
false);
147 public void OnActivateZone()
149 this.widgets.OnActivateZone();
151 if (this.hud.hangCorner &&
this.hud.hangCorner.isActiveAndEnabled)
153 this.hud.hangCorner.Refresh();
158 public void ShowFloats()
160 this.layerFloat.SetActive(
true);
164 public void HideFloats()
166 this.layerFloat.SetActive(
false);
170 public void OnKillGame()
172 this.widgets.OnKillGame();
173 this.ShowBalloon(
true);
174 this.layerFloat.RemoveLayers(
true);
175 this.currentDrag =
null;
179 public void OnClickAction(
string _mode)
181 base.RemoveLayers(
false);
182 ((
ActionMode)typeof(
ActionMode).GetField(_mode, BindingFlags.Static | BindingFlags.Public).GetValue(
null)).Activate(
true,
false);
186 public void RefreshActiveState()
188 this.isPointerOverUI =
false;
189 foreach (GameObject gameObject
in InputModuleEX.GetPointerEventData(-1).hovered)
191 if (gameObject && gameObject.layer == 5)
193 this.isPointerOverUI =
true;
197 this.wasActive = this.IsActive;
200 CursorSystem.SetCursor(
null, 0);
205 public override void OnChangeLayer()
207 this.RefreshActiveState();
208 CursorSystem.SetCursor(
null, 0);
209 this.hud.HideMouseInfo();
210 if (
ELayer.core.IsGameStarted)
212 ELayer.scene.actionMode.OnUpdateCursor();
214 CursorSystem.Instance.Draw();
215 Layer topLayer = base.TopLayer;
216 if (topLayer !=
null && topLayer.option.dontShowHint)
220 if (this.layers.Count == 0)
222 this.hud.hint.Refresh();
225 if (base.TopLayer.option.hideFloatUI)
229 if (base.TopLayer.option.hideWidgets)
238 elayer.TryShowHint(
null);
242 public void FlashCover(
float durationOut = 1f,
float duration = 1f,
float durationIn = 1f, Action onFadeOut =
null, Action onComplete =
null, Color color =
default(Color))
244 this.ShowCover(durationOut, 1f,
null, color);
245 TweenUtil.Tween(durationOut + duration,
null, delegate()
247 if (onFadeOut !=
null)
251 this.HideCover(durationIn, onComplete);
256 public void ShowCover(
float duration = 0f,
float dest = 1f, Action onComplete =
null, Color color =
default(Color))
258 TweenUtil.KillTween(ref this.tweenCover,
false);
259 float a = this.hud.imageCover.color.a;
260 this.hud.imageCover.color = ((color ==
default(Color)) ? Color.black : color).SetAlpha(a);
261 this.hud.imageCover.SetActive(
true);
262 this.hidingCover =
false;
263 this.tweenCover = this.hud.imageCover.DOFade(dest, duration).OnComplete(delegate
265 Action onComplete2 = onComplete;
266 if (onComplete2 ==
null)
275 public void HideCover(
float duration = 0f, Action onComplete =
null)
277 if (this.hidingCover)
281 this.hidingCover =
true;
282 TweenUtil.KillTween(ref this.tweenCover,
false);
283 this.tweenCover = this.hud.imageCover.DOFade(0f, duration).OnComplete(delegate
285 this.hud.imageCover.SetActive(
false);
286 Action onComplete2 = onComplete;
287 if (onComplete2 !=
null)
291 this.hidingCover =
false;
296 public bool IsCovered()
298 return !this.hidingCover;
302 public void ShowBalloon(
bool enable)
304 ELayer.ui.rectDynamic.SetActive(enable);
309 public void Show(
float duration = 1f)
311 ELayer.scene.elomapActor.selector.srHighlight.SetActive(
true);
312 this.cg.DOKill(
false);
318 this.cg.DOFade(1f, duration);
322 public void Hide(
float duration = 1f)
324 ELayer.scene.elomapActor.selector.srHighlight.SetActive(
false);
330 this.cg.DOFade(0f, duration);
334 public void OnUpdate()
336 if (this.hud.imageDrag.gameObject.activeSelf)
338 this.hud.imageDrag.transform.position = EInput.mpos + (ELayer.game.UseGrid ? this.hud.imageDragFix2 : this.hud.imageDragFix2);
339 Util.ClampToScreen(this.hud.imageDrag.Rect(),
this.hud.marginImageDrag);
341 if (
ELayer.config.ui.blur &&
this.layers.Count > 0 && base.IsUseBlur())
343 UI.blurSize += Time.unscaledDeltaTime * this.blurSpeed;
344 if (UI.blurSize >
ELayer.config.ui.blurSize)
346 UI.blurSize =
ELayer.config.ui.blurSize;
348 if (!this.blur.activeSelf)
350 this.blur.SetActive(
true);
352 int siblingIndex = this.blur.transform.GetSiblingIndex();
354 for (
int i = this.layers.Count - 1; i >= 0; i--)
356 if (this.layers[i].IsUseBlur())
358 num = this.layers[i].transform.GetSiblingIndex() - 1;
362 if (siblingIndex != num)
364 this.blur.transform.SetSiblingIndex(num);
369 UI.blurSize -= Time.unscaledDeltaTime * this.blurSpeed;
370 if (UI.blurSize < 0f)
374 if (this.blur.activeSelf && UI.blurSize == 0f)
376 this.blur.SetActive(
false);
379 this.matBlur.SetFloat(
"_Size", UI.blurSize);
380 if (!EInput.isShiftDown)
382 LayerInventory.highlightInv =
null;
384 this.ShowMouseHint();
388 public void ShowMouseHint()
390 if (this.durationHideMouseHint > 0f)
392 this.durationHideMouseHint -= Core.delta;
393 this.hud.textMouseHintLeft.SetActive(
false);
394 this.hud.textMouseHintRight.SetActive(
false);
398 bool flag = mouseHint !=
null && !this.IsDragging && this.isPointerOverUI && UIButton.currentHighlight && InputModuleEX.IsPointerOver(UIButton.currentHighlight) && LayerAbility.hotElement ==
null;
402 if (mouseHint.ShowMouseHintLeft())
404 this.hud.textMouseHintLeft.text = mouseHint.GetTextMouseHintLeft();
405 if (this.hud.textMouseHintLeft.text ==
"")
417 if (mouseHint.ShowMouseHintRight())
419 this.hud.textMouseHintRight.text = mouseHint.GetTextMouseHintRight();
420 if (this.hud.textMouseHintRight.text ==
"")
430 this.hud.textMouseHintLeft.SetActive(flag2);
431 this.hud.textMouseHintRight.SetActive(flag);
434 this.hud.textMouseHintLeft.transform.position = UIButton.currentHighlight.transform.position + this.hud.textMouseHintFixLeft;
435 this.hud.textMouseHintRight.transform.position = UIButton.currentHighlight.transform.position + this.hud.textMouseHintFix;
436 Util.ClampToScreen(this.hud.textMouseHintRight.Rect(), 10);
441 public void HideMouseHint(
float duration = 0.2f)
443 this.durationHideMouseHint = duration;
444 this.hud.textMouseHintLeft.SetActive(
false);
445 this.hud.textMouseHintRight.SetActive(
false);
449 public void CheckWindowOrder()
451 if (this.layers.Count > 0)
455 foreach (GameObject gameObject
in InputModuleEX.GetPointerEventData(-1).hovered)
460 if (component && !component.AlwaysBottom &&
this.widgets.transform.GetChild(
this.widgets.transform.childCount - 1) != gameObject.transform)
462 gameObject.transform.SetAsLastSibling();
469 WidgetFeed.Instance.transform.SetAsLastSibling();
474 public void ShowSceneSelector()
476 this.canvasScaler.scaleFactor = 1f;
477 Shader.SetGlobalFloat(
"_UIBrightness", 1f);
478 Shader.SetGlobalFloat(
"_UIContrast", 1f);
479 this.layoutLang.SetActive(
true);
481 Button t = this.layoutLang.CreateMold(
null);
484 Button button = Util.Instantiate<Button>(t, this.layoutLang);
485 CoreDebug.StartScene _l = l;
486 button.GetComponentInChildren<Text>().text = l.ToString();
487 button.onClick.AddListener(delegate()
489 this.layoutLang.SetActive(
false);
490 ELayer.debug.startScene = _l;
494 this.layoutLang.RebuildLayout(
false);
498 public void ShowLang()
500 this.canvasScaler.scaleFactor = 1f;
501 Shader.SetGlobalFloat(
"_UIBrightness", 1f);
502 Shader.SetGlobalFloat(
"_UIContrast", 1f);
503 this.layoutLang.SetActive(
true);
504 Button t = this.layoutLang.CreateMold(
null);
505 foreach (LangSetting langSetting
in MOD.langs.Values)
507 Button button = Util.Instantiate<Button>(t, this.layoutLang);
508 LangSetting _l = langSetting;
509 button.GetComponentInChildren<Text>().text = langSetting.name +
" (" + langSetting.name_en +
")";
510 button.onClick.AddListener(delegate()
512 this.layoutLang.SetActive(
false);
513 ELayer.core.langCode = _l.id;
514 if (
ELayer.debug.showSceneSelector || (Input.GetKey(KeyCode.LeftShift) &&
ELayer.debug.enable))
516 this.ShowSceneSelector();
522 this.layoutLang.RebuildLayout(
false);
526 public void SetLight(
bool enable)
531 public UIContextMenu CreateContextMenu(
string cid =
"ContextMenu")
533 return this.contextMenu.Create(cid,
true);
537 public UIContextMenu CreateContextMenuInteraction()
539 return this.contextMenu.Create(
"ContextInteraction",
true);
543 public void Say(
string text, Sprite sprite =
null)
545 this.popSystem.PopText(text.lang(), sprite,
"PopAchievement",
default(Color),
default(Vector3), 0f);
550 public void FreezeScreen(
float duration)
554 UnityEngine.Object.Destroy(this.texFreeze);
556 this.texFreeze = ScreenCapture.CaptureScreenshotAsTexture();
557 this.imageFreeze.SetActive(
true);
558 this.imageFreeze.texture = this.texFreeze;
561 TweenUtil.Tween(duration,
null, delegate()
563 this.UnfreezeScreen();
569 public void UnfreezeScreen()
573 UnityEngine.Object.DestroyImmediate(this.texFreeze);
575 this.imageFreeze.SetActive(
false);
579 public void ToggleAbility(
bool delay =
false)
581 if (!
ELayer.game.altAbility)
588 layerAbility.windows[0].SetRect(
ELayer.core.refs.rects.center,
false);
589 layerAbility.Delay(0.05f);
597 ELayer.player.pref.layerAbility =
false;
598 SE.Play(
"pop_ability_deactivate");
602 ELayer.player.pref.layerAbility =
true;
606 public void ToggleInventory(
bool delay =
false)
608 if (!this.IsInventoryOpen)
610 this.OpenFloatInv(
false);
618 List<Card> list =
new List<Card>();
621 if (layerInventory.IsPlayerContainer(
false))
623 list.Add(layerInventory.invs[0].owner.Container);
628 if (l.IsPlayerContainer(
true))
630 ELayer.ui.layerFloat.RemoveLayer(l);
633 ELayer.ui.widgets.DeactivateWidget(
"Equip");
634 foreach (
Card card
in list)
636 card.c_windowSaveData.open =
true;
638 SE.Play(
"pop_inventory_deactivate");
642 public void OpenFloatInv(
bool ignoreSound =
false)
646 SoundManager.ignoreSounds =
true;
649 SoundManager.ignoreSounds =
true;
650 ELayer.ui.widgets.Activate(
"Equip");
651 foreach (
Thing thing
in ELayer.pc.things.List((
Thing a) => a.trait.IsContainer,
false))
653 Window.SaveData c_windowSaveData = thing.c_windowSaveData;
654 if (!(thing.trait is
TraitToolBelt) && c_windowSaveData !=
null && c_windowSaveData.open)
659 SoundManager.ignoreSounds =
false;
663 public void ToggleFeedback()
676 public void StartDrag(
DragItem item)
678 this.dragDuration = 0f;
679 if (this.currentDrag !=
null)
682 if (this.currentDrag !=
null)
687 this.currentDrag = item;
690 ELayer.core.actionsNextFrame.Add(delegate
692 TooltipManager.Instance.HideTooltips(
true);
699 this.dragDuration += Core.delta;
700 this.currentDrag.OnDrag(
false,
false);
704 public void EndDrag(
bool canceled =
false)
706 if (this.currentDrag ==
null)
710 bool flag = this.currentDrag.OnDrag(
true, canceled);
711 EInput.Consume(
false, 1);
712 EInput.dragHack = 0f;
716 this.currentDrag.OnEndDrag();
717 this.currentDrag =
null;
718 if (this.nextDrag !=
null)
720 this.StartDrag(this.nextDrag);
721 this.nextDrag =
null;
725 this.hud.SetDragImage(
null,
null,
null);
727 UIButton.TryShowTip(
null,
true,
true);
734 private static float blurSize;
737 public Canvas canvas;
746 public InputModuleEX inputModule;
749 public UIContextMenuManager contextMenu;
755 public UIMouseInfo mouseInfo;
758 public RectTransform rectDynamic;
761 public RectTransform rectDynamicEssential;
764 public RectTransform _rectLayers;
767 public ReflexConsole console;
770 public GameObject blur;
773 public Material matBlur;
776 public LayoutGroup layoutLang;
779 public CanvasScaler canvasScaler;
785 public CanvasGroup cg;
791 public Layer layerFloat;
797 public PopManager popGame;
800 public PopManager popSystem;
803 public float blurSpeed;
806 public Texture2D texFreeze;
809 public RawImage imageFreeze;
818 private bool hidingCover;
822 public float lightContrast;
826 public float dragDuration;
829 private Tween tweenCover;
833 public bool wasActive;
837 public bool isPointerOverUI;
840 private float durationHideMouseHint;