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