当我们需要在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