Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. using System;
  2. using Assets.Scripts;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class Watermark : MonoBehaviour
  7. {
  8. private Text _text;
  9. private Text2 _text;
  10. private Text3 _text;
  11. private GridLayoutGroup _gridLayoutGroup;
  12. void Awake()
  13. {
  14. _text = GetComponentInChildren<Text>();
  15. _text2 = GetComponentInChildren<Text2>();
  16. _text3 = GetComponentInChildren<Text3>();
  17. _gridLayoutGroup = GetComponentInChildren<GridLayoutGroup>();
  18.  
  19. GameObject logo = _gridLayoutGroup.transform.GetChild(0).gameObject;
  20. for (int x = 0; x < _gridLayoutGroup.constraintCount * _gridLayoutGroup.constraintCount - 1; x++)
  21. Instantiate(logo, _gridLayoutGroup.transform);
  22.  
  23. UpdateText();
  24. InvokeRepeating(nameof(UpdateInfo), 0.0f, 60.0f);
  25. }
  26.  
  27. void Start()
  28. {
  29. #if UNITY_EDITOR
  30. gameObject.SetActive(false);
  31. #else
  32. gameObject.SetActive(GameSettings.DevelopmentEnvironment());
  33. #endif
  34. }
  35.  
  36. public void OnDisable()
  37. {
  38. CancelInvoke(nameof(UpdateInfo));
  39. }
  40.  
  41. public void UpdateInfo()
  42. {
  43. UpdateText();
  44.  
  45. if (User.Groups.Contains(User.Group.IgnoreWatermark) || User.Groups.Contains(User.Group.Developer))//specjalnie dla Trichlora :3
  46. gameObject.SetActive(false);
  47. }
  48.  
  49. private void UpdateText()
  50. {
  51. _text.text = $"{User.Identificator} {User.UniqueId}\nv{GameSettings.Version} \"{GameSettings.CodeName}\" {GameSettings.RunMode}\n{DateTime.Now:yyyy-MM-dd_HH-mm}";
  52. _text2.text = $"{User.Identificator} {User.UniqueId}\nv{GameSettings.Version} \"{GameSettings.CodeName}\" {GameSettings.RunMode}\n{DateTime.Now:yyyy-MM-dd_HH-mm}";
  53. _text3.text = $"{User.Identificator} {User.UniqueId}\nv{GameSettings.Version} \"{GameSettings.CodeName}\" {GameSettings.RunMode}\n{DateTime.Now:yyyy-MM-dd_HH-mm}";
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement