没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
4页
当我们需要在Unity客户端做一个限制功能,比如按钮 (最好是发送验证码按钮)要求每天只能点击三次,等到第二天又有三次机会,这个过程不涉及到服务端消息,只涉及到本地存储,以下是我的解决方案: 直接上代码: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UniRx; using System; using System.IO; using System.Text; using System.Globalization; publ
资源详情
资源评论
资源推荐
Unity登录注册时限制发送验证码次数功能的解决方法登录注册时限制发送验证码次数功能的解决方法
当我们需要在Unity客户端做一个限制功能,比如按钮 (最好是发送验证码按钮)要求每天只能点击三次,等到第二天又有三
次机会,这个过程不涉及到服务端消息,只涉及到本地存储,以下是我的解决方案:
直接上代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using System;
using System.IO;
using System.Text;
using System.Globalization;
public class RegisterPanel : MonoBehaviour
{
private LoginUIPanel mLoginUIPanel;
StreamWriter writer;
StreamReader reader;
//本地存储手机号
private string set_phonenum;
//同一个手机号码使用次数
private int useNum=1;
FileInfo file;
private Button btn_GetMsgCode;
/**倒计时 */
private Text txt_CountDownTimer;
}
private void Awake()
{
//获取验证码按钮
btn_GetMsgCode = input_MsgCode.transform.Find("Btn_GetVerficationCode").GetComponent<Button>();
btn_GetMsgCode.onClick.AddListener(OnGetMsgCodeClick);
txt_CountDownTimer = btn_GetMsgCode.transform.Find("Text").GetComponent<Text>();
}
private void OnEnable()
{
ResetGetMsgCode();
}
/**
* 获取验证码
*/
private void OnGetMsgCodeClick()
{
if (!mLoginUIPanel.CheckGetMsgCode(input_Account.text))
{
Debug.Log("没有输入");
return;
}
set_phonenum = input_Account.text.ToString();
if (Limit())
{
Debug.Log("返回true");
return;
}
else
{
int timer = 60;
intervalStream = Observable.Interval(TimeSpan.FromSeconds(1))
.Where(value => { return timer > 1; })
.SubscribeToText(txt_CountDownTimer, value =>
{
weixin_38745891
- 粉丝: 4
- 资源: 1000
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0