| | 1 | | using DCL; |
| | 2 | | using DCL.MyAccount; |
| | 3 | | using ExploreV2Analytics; |
| | 4 | | using System; |
| | 5 | | using System.Collections; |
| | 6 | | using TMPro; |
| | 7 | | using UnityEngine; |
| | 8 | | using UnityEngine.UI; |
| | 9 | | using Environment = DCL.Environment; |
| | 10 | |
|
| | 11 | | public class ProfileHUDViewV2 : BaseComponentView, IProfileHUDView |
| | 12 | | { |
| | 13 | | private const float COPY_TOAST_VISIBLE_TIME = 3; |
| | 14 | | private const int ADDRESS_CHUNK_LENGTH = 6; |
| | 15 | | private const int NAME_POSTFIX_LENGTH = 4; |
| | 16 | | private const string OPEN_PASSPORT_SOURCE = "ProfileHUD"; |
| | 17 | |
|
| | 18 | | [SerializeField] private MyAccountCardComponentView myAccountCardView; |
| | 19 | | [SerializeField] private RectTransform myAccountCardLayout; |
| | 20 | | [SerializeField] private RectTransform mainRootLayout; |
| | 21 | | [SerializeField] internal GameObject loadingSpinner; |
| | 22 | | [SerializeField] internal ShowHideAnimator copyToast; |
| | 23 | | [SerializeField] internal GameObject copyTooltip; |
| | 24 | | [SerializeField] private GameObject expandedObject; |
| | 25 | | [SerializeField] private GameObject profilePicObject; |
| | 26 | | [SerializeField] internal InputAction_Trigger closeAction; |
| | 27 | | [SerializeField] internal Canvas mainCanvas; |
| | 28 | | [SerializeField] internal Button viewPassportButton; |
| | 29 | |
|
| | 30 | | [Header("Hide GOs on claimed name")] |
| | 31 | | [SerializeField] |
| | 32 | | internal GameObject[] hideOnNameClaimed; |
| | 33 | |
|
| | 34 | | [Header("Connected wallet sections")] |
| | 35 | | [SerializeField] |
| | 36 | | internal GameObject connectedWalletSection; |
| | 37 | |
|
| | 38 | | [SerializeField] |
| | 39 | | internal GameObject nonConnectedWalletSection; |
| | 40 | |
|
| | 41 | | [Header("Thumbnail")] |
| | 42 | | [SerializeField] |
| | 43 | | internal RawImage imageAvatarThumbnail; |
| | 44 | |
|
| | 45 | | [SerializeField] |
| | 46 | | protected internal Button buttonToggleMenu; |
| | 47 | |
|
| | 48 | | [Header("Texts")] |
| | 49 | | [SerializeField] internal TextMeshProUGUI textName; |
| | 50 | | [SerializeField] internal TextMeshProUGUI textPostfix; |
| | 51 | | [SerializeField] internal TextMeshProUGUI textAddress; |
| | 52 | |
|
| | 53 | | [Header("Buttons")] |
| | 54 | | [SerializeField] protected internal Button buttonClaimName; |
| | 55 | | [SerializeField] protected internal Button buttonCopyAddress; |
| | 56 | | [SerializeField] protected internal Button buttonLogOut; |
| | 57 | | [SerializeField] protected internal Button buttonSignUp; |
| | 58 | | [SerializeField] protected internal Button_OnPointerDown buttonTermsOfServiceForConnectedWallets; |
| | 59 | | [SerializeField] protected internal Button_OnPointerDown buttonPrivacyPolicyForConnectedWallets; |
| | 60 | | [SerializeField] protected internal Button_OnPointerDown buttonTermsOfServiceForNonConnectedWallets; |
| | 61 | | [SerializeField] protected internal Button_OnPointerDown buttonPrivacyPolicyForNonConnectedWallets; |
| | 62 | |
|
| | 63 | | [Header("Name Edition")] |
| | 64 | | [SerializeField] protected internal Button_OnPointerDown buttonEditName; |
| | 65 | | [SerializeField] protected internal Button_OnPointerDown buttonEditNamePrefix; |
| | 66 | | [SerializeField] internal TMP_InputField inputName; |
| | 67 | | [SerializeField] internal TextMeshProUGUI textCharLimit; |
| | 68 | | [SerializeField] internal ManaCounterView manaCounterView; |
| | 69 | | [SerializeField] internal ManaCounterView polygonManaCounterView; |
| | 70 | |
|
| | 71 | | [Header("Tutorial Config")] |
| | 72 | | [SerializeField] internal RectTransform tutorialTooltipReference; |
| | 73 | |
|
| | 74 | | [Header("Description")] |
| | 75 | | [SerializeField] internal GameObject charLimitDescriptionContainer; |
| | 76 | | [SerializeField] internal GameObject descriptionStartEditingGo; |
| | 77 | | [SerializeField] internal GameObject descriptionIsEditingGo; |
| | 78 | | [SerializeField] internal Button descriptionStartEditingButton; |
| | 79 | | [SerializeField] internal Button descriptionIsEditingButton; |
| | 80 | | [SerializeField] internal TMP_InputField descriptionInputText; |
| | 81 | | [SerializeField] internal TextMeshProUGUI textCharLimitDescription; |
| | 82 | |
|
| | 83 | | [SerializeField] internal GameObject descriptionContainer; |
| | 84 | |
|
| | 85 | | private InputAction_Trigger.Triggered closeActionDelegate; |
| | 86 | |
|
| | 87 | | private Coroutine copyToastRoutine; |
| | 88 | | private UserProfile profile; |
| | 89 | | private string description; |
| | 90 | | private string userId; |
| | 91 | | private BaseVariable<(string playerId, string source)> currentPlayerId; |
| | 92 | |
|
| | 93 | | public event EventHandler ClaimNamePressed; |
| | 94 | | public event EventHandler SignedUpPressed; |
| | 95 | | public event EventHandler LogedOutPressed; |
| | 96 | | public event EventHandler Opened; |
| | 97 | | public event EventHandler Closed; |
| | 98 | | public event EventHandler<string> NameSubmitted; |
| | 99 | | public event EventHandler<string> DescriptionSubmitted; |
| | 100 | | public event EventHandler ManaInfoPressed; |
| | 101 | | public event EventHandler ManaPurchasePressed; |
| | 102 | | public event EventHandler TermsAndServicesPressed; |
| | 103 | | public event EventHandler PrivacyPolicyPressed; |
| | 104 | |
|
| | 105 | | internal bool isStartMenuInitialized = false; |
| | 106 | |
|
| | 107 | | private HUDCanvasCameraModeController hudCanvasCameraModeController; |
| 2 | 108 | | public GameObject GameObject => gameObject; |
| 0 | 109 | | public RectTransform ExpandedMenu => mainRootLayout; |
| 0 | 110 | | public RectTransform MyAccountCardLayout => myAccountCardLayout; |
| 0 | 111 | | public RectTransform MyAccountCardMenu => (RectTransform)myAccountCardView.transform; |
| 1 | 112 | | public MyAccountCardComponentView MyAccountCardView => myAccountCardView; |
| 0 | 113 | | public RectTransform TutorialReference => tutorialTooltipReference; |
| | 114 | |
|
| | 115 | | public override void Awake() |
| | 116 | | { |
| 1 | 117 | | currentPlayerId = DataStore.i.HUDs.currentPlayerId; |
| | 118 | |
|
| 1 | 119 | | buttonLogOut.onClick.AddListener(() => LogedOutPressed?.Invoke(this, EventArgs.Empty)); |
| 1 | 120 | | buttonSignUp.onClick.AddListener(() => SignedUpPressed?.Invoke(this, EventArgs.Empty)); |
| 1 | 121 | | buttonClaimName.onClick.AddListener(() => ClaimNamePressed?.Invoke(this, EventArgs.Empty)); |
| | 122 | |
|
| 1 | 123 | | buttonTermsOfServiceForConnectedWallets.onClick.AddListener(() => TermsAndServicesPressed?.Invoke(this, EventArg |
| 1 | 124 | | buttonTermsOfServiceForNonConnectedWallets.onClick.AddListener(() => TermsAndServicesPressed?.Invoke(this, Event |
| 1 | 125 | | buttonPrivacyPolicyForConnectedWallets.onClick.AddListener(() => PrivacyPolicyPressed?.Invoke(this, EventArgs.Em |
| 1 | 126 | | buttonPrivacyPolicyForNonConnectedWallets.onClick.AddListener(() => PrivacyPolicyPressed?.Invoke(this, EventArgs |
| | 127 | |
|
| 1 | 128 | | manaCounterView.buttonManaInfo.onClick.AddListener(() => ManaInfoPressed?.Invoke(this, EventArgs.Empty)); |
| 1 | 129 | | polygonManaCounterView.buttonManaInfo.onClick.AddListener(() => ManaInfoPressed?.Invoke(this, EventArgs.Empty)); |
| 1 | 130 | | manaCounterView.buttonManaPurchase.onClick.AddListener(() => ManaPurchasePressed?.Invoke(this, EventArgs.Empty)) |
| 1 | 131 | | polygonManaCounterView.buttonManaPurchase.onClick.AddListener(() => ManaPurchasePressed?.Invoke(this, EventArgs. |
| | 132 | |
|
| 1 | 133 | | closeActionDelegate = (x) => Hide(); |
| | 134 | |
|
| 1 | 135 | | buttonToggleMenu.onClick.AddListener(OpenStartMenu); |
| 1 | 136 | | buttonCopyAddress.onClick.AddListener(CopyAddress); |
| 1 | 137 | | buttonEditName.onPointerDown += () => ActivateProfileNameEditionMode(true); |
| 1 | 138 | | buttonEditNamePrefix.onPointerDown += () => ActivateProfileNameEditionMode(true); |
| 1 | 139 | | inputName.onValueChanged.AddListener(UpdateNameCharLimit); |
| 1 | 140 | | inputName.onDeselect.AddListener((newName) => |
| | 141 | | { |
| 0 | 142 | | ActivateProfileNameEditionMode(false); |
| 0 | 143 | | NameSubmitted?.Invoke(this, newName); |
| 0 | 144 | | }); |
| | 145 | |
|
| 1 | 146 | | descriptionStartEditingButton.onClick.AddListener(descriptionInputText.Select); |
| 1 | 147 | | descriptionIsEditingButton.onClick.AddListener(() => descriptionInputText.OnDeselect(null)); |
| 1 | 148 | | descriptionInputText.onTextSelection.AddListener((description, x, y) => |
| | 149 | | { |
| 0 | 150 | | descriptionInputText.text = profile.description; |
| 0 | 151 | | SetDescriptionIsEditing(true); |
| 0 | 152 | | UpdateDescriptionCharLimit(description); |
| 0 | 153 | | }); |
| 1 | 154 | | descriptionInputText.onSelect.AddListener(x => |
| | 155 | | { |
| 0 | 156 | | descriptionInputText.text = profile.description; |
| 0 | 157 | | SetDescriptionIsEditing(true); |
| 0 | 158 | | UpdateDescriptionCharLimit(description); |
| 0 | 159 | | }); |
| 1 | 160 | | descriptionInputText.onValueChanged.AddListener(UpdateDescriptionCharLimit); |
| 1 | 161 | | descriptionInputText.onDeselect.AddListener(description => |
| | 162 | | { |
| 0 | 163 | | this.description = description; |
| 0 | 164 | | DescriptionSubmitted?.Invoke(this, description); |
| | 165 | |
|
| 0 | 166 | | SetDescriptionIsEditing(false); |
| 0 | 167 | | UpdateLinksInformation(description); |
| 0 | 168 | | }); |
| 1 | 169 | | SetDescriptionIsEditing(false); |
| | 170 | |
|
| 1 | 171 | | copyToast.gameObject.SetActive(false); |
| 1 | 172 | | hudCanvasCameraModeController = new HUDCanvasCameraModeController(GetComponent<Canvas>(), DataStore.i.camera.hud |
| | 173 | |
|
| 1 | 174 | | viewPassportButton.onClick.RemoveAllListeners(); |
| 1 | 175 | | viewPassportButton.onClick.AddListener(OpenPassport); |
| 1 | 176 | | Show(false); |
| 1 | 177 | | } |
| | 178 | |
|
| 1 | 179 | | public bool HasManaCounterView() => manaCounterView != null; |
| 0 | 180 | | public bool HasPolygonManaCounterView() => polygonManaCounterView != null; |
| 0 | 181 | | public bool IsDesciptionIsLongerThanMaxCharacters() => descriptionInputText.characterLimit < descriptionInputText.te |
| 0 | 182 | | public void SetManaBalance(string balance) => manaCounterView.SetBalance(balance); |
| 0 | 183 | | public void SetPolygonBalance(double balance) => polygonManaCounterView.SetBalance(balance); |
| 1 | 184 | | public void SetWalletSectionEnabled(bool isEnabled) => connectedWalletSection.SetActive(isEnabled); |
| 1 | 185 | | public void SetNonWalletSectionEnabled(bool isEnabled) => nonConnectedWalletSection.SetActive(isEnabled); |
| 1 | 186 | | public void SetStartMenuButtonActive(bool isActive) => isStartMenuInitialized = isActive; |
| 0 | 187 | | public override void RefreshControl() { } |
| | 188 | |
|
| | 189 | | public void SetProfile(UserProfile userProfile) |
| | 190 | | { |
| 0 | 191 | | UpdateLayoutByProfile(userProfile); |
| 0 | 192 | | if (profile == null) |
| | 193 | | { |
| 0 | 194 | | description = userProfile.description; |
| 0 | 195 | | descriptionInputText.text = description; |
| 0 | 196 | | UpdateLinksInformation(description); |
| | 197 | | } |
| | 198 | |
|
| 0 | 199 | | profile = userProfile; |
| 0 | 200 | | } |
| | 201 | |
|
| | 202 | | public void ShowProfileIcon(bool show) |
| | 203 | | { |
| 0 | 204 | | profilePicObject.SetActive(show); |
| 0 | 205 | | } |
| | 206 | |
|
| | 207 | | public void ShowExpanded(bool show, bool showMyAccountVersion = false) |
| | 208 | | { |
| 0 | 209 | | if (!show) |
| | 210 | | { |
| 0 | 211 | | expandedObject.SetActive(false); |
| 0 | 212 | | myAccountCardView.Hide(); |
| | 213 | | } |
| | 214 | | else |
| | 215 | | { |
| 0 | 216 | | if (!showMyAccountVersion) |
| 0 | 217 | | expandedObject.SetActive(true); |
| | 218 | | else |
| 0 | 219 | | myAccountCardView.Show(); |
| | 220 | | } |
| | 221 | |
|
| 0 | 222 | | if (show && profile && !showMyAccountVersion) |
| 0 | 223 | | UpdateLayoutByProfile(profile); |
| 0 | 224 | | } |
| | 225 | |
|
| | 226 | | public void SetDescriptionIsEditing(bool isEditing) |
| | 227 | | { |
| 2 | 228 | | SetDescriptionCharLimitEnabled(isEditing); |
| 2 | 229 | | descriptionStartEditingGo.SetActive(!isEditing); |
| 2 | 230 | | descriptionIsEditingGo.SetActive(isEditing); |
| 2 | 231 | | } |
| | 232 | |
|
| | 233 | | private void UpdateLayoutByProfile(UserProfile userProfile) |
| | 234 | | { |
| 0 | 235 | | if (userProfile.hasClaimedName) |
| 0 | 236 | | HandleClaimedProfileName(userProfile); |
| | 237 | | else |
| 0 | 238 | | HandleUnverifiedProfileName(userProfile); |
| | 239 | |
|
| 0 | 240 | | SetConnectedWalletSectionActive(userProfile.hasConnectedWeb3); |
| 0 | 241 | | HandleProfileAddress(userProfile); |
| 0 | 242 | | HandleProfileSnapshot(userProfile); |
| 0 | 243 | | SetDescriptionEnabled(userProfile.hasConnectedWeb3); |
| 0 | 244 | | SetUserId(userProfile); |
| | 245 | |
|
| 0 | 246 | | string[] nameSplits = userProfile.userName.Split('#'); |
| 0 | 247 | | if (nameSplits.Length >= 2) |
| | 248 | | { |
| 0 | 249 | | textName.text = nameSplits[0]; |
| 0 | 250 | | textPostfix.text = $"#{nameSplits[1]};"; |
| | 251 | | } |
| | 252 | | else |
| | 253 | | { |
| 0 | 254 | | textName.text = userProfile.userName; |
| 0 | 255 | | textPostfix.text = userProfile.userId; |
| | 256 | | } |
| 0 | 257 | | } |
| | 258 | |
|
| | 259 | | private void SetUserId(UserProfile userProfile) |
| | 260 | | { |
| 0 | 261 | | userId = userProfile.userId; |
| 0 | 262 | | } |
| | 263 | |
|
| | 264 | | private void OpenStartMenu() |
| | 265 | | { |
| 0 | 266 | | if (isStartMenuInitialized) |
| | 267 | | { |
| 0 | 268 | | if (!DataStore.i.exploreV2.isOpen.Get()) |
| | 269 | | { |
| 0 | 270 | | var exploreV2Analytics = new ExploreV2Analytics.ExploreV2Analytics(); |
| 0 | 271 | | exploreV2Analytics.SendStartMenuVisibility( |
| | 272 | | true, |
| | 273 | | ExploreUIVisibilityMethod.FromClick); |
| | 274 | | } |
| 0 | 275 | | DataStore.i.exploreV2.isOpen.Set(true); |
| | 276 | | } |
| 0 | 277 | | } |
| | 278 | |
|
| | 279 | | private void ActivateProfileNameEditionMode(bool activate) |
| | 280 | | { |
| 0 | 281 | | if (profile != null && profile.hasClaimedName) |
| 0 | 282 | | return; |
| | 283 | |
|
| 0 | 284 | | textName.gameObject.SetActive(!activate); |
| 0 | 285 | | inputName.gameObject.SetActive(activate); |
| | 286 | |
|
| 0 | 287 | | if (activate) |
| | 288 | | { |
| 0 | 289 | | inputName.text = textName.text; |
| 0 | 290 | | inputName.Select(); |
| | 291 | | } |
| 0 | 292 | | } |
| | 293 | |
|
| | 294 | | private void SetDescriptionCharLimitEnabled(bool enabled) |
| | 295 | | { |
| 2 | 296 | | charLimitDescriptionContainer.SetActive(enabled); |
| 2 | 297 | | } |
| | 298 | |
|
| | 299 | | private void OpenPassport() |
| | 300 | | { |
| 0 | 301 | | if (string.IsNullOrEmpty(userId)) |
| 0 | 302 | | return; |
| | 303 | |
|
| 0 | 304 | | ShowExpanded(false); |
| 0 | 305 | | currentPlayerId.Set((userId, OPEN_PASSPORT_SOURCE)); |
| 0 | 306 | | } |
| | 307 | |
|
| | 308 | | private void HandleProfileSnapshot(UserProfile userProfile) |
| | 309 | | { |
| 0 | 310 | | loadingSpinner.SetActive(true); |
| 0 | 311 | | userProfile.snapshotObserver.AddListener(SetProfileImage); |
| 0 | 312 | | } |
| | 313 | |
|
| | 314 | | private void HandleClaimedProfileName(UserProfile userProfile) |
| | 315 | | { |
| 0 | 316 | | textName.text = userProfile.userName; |
| 0 | 317 | | SetActiveUnverifiedNameGOs(false); |
| 0 | 318 | | } |
| | 319 | |
|
| | 320 | | private void HandleUnverifiedProfileName(UserProfile userProfile) |
| | 321 | | { |
| 0 | 322 | | textName.text = string.IsNullOrEmpty(userProfile.userName) || userProfile.userName.Length <= NAME_POSTFIX_LENGTH |
| | 323 | | ? userProfile.userName |
| | 324 | | : userProfile.userName[..(userProfile.userName.Length - NAME_POSTFIX_LENGTH - 1)]; |
| | 325 | |
|
| 0 | 326 | | textPostfix.text = $"#{userProfile.userId[^NAME_POSTFIX_LENGTH..]}"; |
| 0 | 327 | | SetActiveUnverifiedNameGOs(true); |
| 0 | 328 | | } |
| | 329 | |
|
| | 330 | | private void SetConnectedWalletSectionActive(bool active) |
| | 331 | | { |
| 0 | 332 | | connectedWalletSection.SetActive(active); |
| 0 | 333 | | nonConnectedWalletSection.SetActive(!active); |
| 0 | 334 | | buttonLogOut.gameObject.SetActive(active); |
| 0 | 335 | | } |
| | 336 | |
|
| | 337 | | private void SetActiveUnverifiedNameGOs(bool active) |
| | 338 | | { |
| 0 | 339 | | for (int i = 0; i < hideOnNameClaimed.Length; i++) |
| 0 | 340 | | hideOnNameClaimed[i].SetActive(active); |
| 0 | 341 | | } |
| | 342 | |
|
| | 343 | | private void HandleProfileAddress(UserProfile userProfile) |
| | 344 | | { |
| 0 | 345 | | string address = userProfile.userId; |
| 0 | 346 | | string start = address.Substring(0, ADDRESS_CHUNK_LENGTH); |
| 0 | 347 | | string end = address.Substring(address.Length - ADDRESS_CHUNK_LENGTH); |
| 0 | 348 | | textAddress.text = $"{start}...{end}"; |
| 0 | 349 | | } |
| | 350 | |
|
| | 351 | | private void SetProfileImage(Texture2D texture) |
| | 352 | | { |
| 0 | 353 | | loadingSpinner.SetActive(false); |
| 0 | 354 | | imageAvatarThumbnail.texture = texture; |
| 0 | 355 | | } |
| | 356 | |
|
| | 357 | | private void OnDestroy() |
| | 358 | | { |
| 1 | 359 | | hudCanvasCameraModeController?.Dispose(); |
| 1 | 360 | | if (profile) |
| 0 | 361 | | profile.snapshotObserver.RemoveListener(SetProfileImage); |
| 1 | 362 | | } |
| | 363 | |
|
| | 364 | | private void CopyAddress() |
| | 365 | | { |
| 0 | 366 | | if (!profile) |
| 0 | 367 | | return; |
| | 368 | |
|
| 0 | 369 | | Environment.i.platform.clipboard.WriteText(profile.userId); |
| | 370 | |
|
| 0 | 371 | | copyTooltip.gameObject.SetActive(false); |
| 0 | 372 | | if (copyToastRoutine != null) |
| 0 | 373 | | StopCoroutine(copyToastRoutine); |
| | 374 | |
|
| 0 | 375 | | copyToastRoutine = StartCoroutine(ShowCopyToast()); |
| 0 | 376 | | } |
| | 377 | |
|
| 2 | 378 | | private void OnEnable() { closeAction.OnTriggered += closeActionDelegate; } |
| | 379 | |
|
| 2 | 380 | | private void OnDisable() { closeAction.OnTriggered -= closeActionDelegate; } |
| | 381 | |
|
| 0 | 382 | | private void UpdateNameCharLimit(string newValue) { textCharLimit.text = $"{newValue.Length}/{inputName.characterLim |
| | 383 | |
|
| | 384 | | private void SetDescriptionEnabled(bool enabled) |
| | 385 | | { |
| 0 | 386 | | descriptionContainer.SetActive(enabled); |
| 0 | 387 | | } |
| | 388 | |
|
| | 389 | | private void UpdateDescriptionCharLimit(string description) => |
| 0 | 390 | | textCharLimitDescription.text = $"{description.Length}/{descriptionInputText.characterLimit}"; |
| | 391 | |
|
| | 392 | | private void UpdateLinksInformation(string description) |
| | 393 | | { |
| 0 | 394 | | string[] words = description.Split(' ', StringSplitOptions.RemoveEmptyEntries); |
| 0 | 395 | | bool[] areLinks = new bool[words.Length]; |
| 0 | 396 | | bool linksFound = false; |
| | 397 | |
|
| 0 | 398 | | for (int i = 0; i < words.Length; i++) |
| | 399 | | { |
| 0 | 400 | | if (words[i].StartsWith("[") && words[i].Contains("]") && words[i].Contains("(") && words[i].EndsWith(")")) |
| | 401 | | { |
| 0 | 402 | | string link = words[i].Split("(")[0].Replace("[", "").Replace("]", ""); |
| 0 | 403 | | string id = words[i].Split("]")[1].Replace("(", "").Replace(")", ""); |
| 0 | 404 | | string[] elements = words[i].Split('.'); |
| 0 | 405 | | if (elements.Length >= 2) |
| | 406 | | { |
| 0 | 407 | | words[i] = $"<color=\"blue\"><link=\"{id}\">{link}</link></color>"; |
| 0 | 408 | | areLinks[i] = true; |
| 0 | 409 | | linksFound = true; |
| | 410 | | } |
| | 411 | | } |
| | 412 | | } |
| | 413 | |
|
| 0 | 414 | | if (linksFound) |
| | 415 | | { |
| 0 | 416 | | bool foundLinksAtTheEnd = false; |
| 0 | 417 | | for (int i = words.Length - 1; i >= 0; i--) |
| | 418 | | { |
| 0 | 419 | | if (string.IsNullOrEmpty(words[i])) |
| | 420 | | continue; |
| | 421 | |
|
| 0 | 422 | | if (!foundLinksAtTheEnd && !areLinks[i]) |
| | 423 | | break; |
| | 424 | |
|
| 0 | 425 | | if (areLinks[i]) |
| | 426 | | { |
| 0 | 427 | | foundLinksAtTheEnd = true; |
| 0 | 428 | | continue; |
| | 429 | | } |
| | 430 | |
|
| 0 | 431 | | words[i] += "\n\n"; |
| 0 | 432 | | break; |
| | 433 | | } |
| 0 | 434 | | descriptionInputText.text = string.Join(" ", words); |
| | 435 | | } |
| 0 | 436 | | } |
| | 437 | |
|
| | 438 | |
|
| | 439 | | private IEnumerator ShowCopyToast() |
| | 440 | | { |
| 0 | 441 | | if (!copyToast.gameObject.activeSelf) |
| 0 | 442 | | copyToast.gameObject.SetActive(true); |
| | 443 | |
|
| 0 | 444 | | copyToast.Show(); |
| 0 | 445 | | yield return new WaitForSeconds(COPY_TOAST_VISIBLE_TIME); |
| 0 | 446 | | copyToast.Hide(); |
| 0 | 447 | | } |
| | 448 | | } |