当前位置:   article > 正文

Unity 登录注册时 限制发送验证码次数功能的解决方案_unityid验证码为什么发不到手机

unityid验证码为什么发不到手机

当我们需要在Unity客户端做一个限制功能,比如按钮 (最好是发送验证码按钮)要求每天只能点击三次,等到第二天又有三次机会,这个过程不涉及到服务端消息,只涉及到本地存储,以下是我的解决方案,

直接上代码:

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UniRx;
  6. using System;
  7. using System.IO;
  8. using System.Text;
  9. using System.Globalization;
  10. public class RegisterPanel : MonoBehaviour
  11. {
  12. private LoginUIPanel mLoginUIPanel;
  13. StreamWriter writer;
  14. StreamReader reader;
  15. //本地存储手机号
  16. private string set_phonenum;
  17. //同一个手机号码使用次数
  18. private int useNum=1;
  19. FileInfo file;
  20. private Button btn_GetMsgCode;
  21. /**倒计时 */
  22. private Text txt_CountDownTimer;
  23. }
  24. private void Awake()
  25. {
  26. //获取验证码按钮
  27. btn_GetMsgCode = input_MsgCode.transform.Find("Btn_GetVerficationCode").GetComponent<Button>();
  28. btn_GetMsgCode.onClick.AddListener(OnGetMsgCodeClick);
  29. txt_CountDownTimer = btn_GetMsgCode.transform.Find("Text").GetComponent<Text>();
  30. }
  31. private void OnEnable()
  32. {
  33. ResetGetMsgCode();
  34. }
  35. /**
  36. * 获取验证码
  37. */
  38. private void OnGetMsgCodeClick()
  39. {
  40. if (!mLoginUIPanel.CheckGetMsgCode(input_Account.text))
  41. {
  42. Debug.Log("没有输入");
  43. return;
  44. }
  45. se
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/233602?site
推荐阅读
相关标签
  

闽ICP备14008679号