Prefácio
Existem poucas soluções completas para adicionar, modificar e verificar esse conjunto de tabelas de dados CSV na Internet. Isso requer configuração de ambiente e instalação de plug-ins tediosas ou muito código tedioso. Portanto, só pode ser realizado através de exploração e testes contínuos.
Vídeo de demonstração
Demonstração do Unity sobre como adicionar, modificar e verificar tabelas de dados CSV
Imagem de demonstração
pedaço de código
//本页CSV文件的增、改、查代码为肖老师原创,如需转载,请通知作者:[email protected]。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
//using System.Data.OleDb;
using UnityEngine;
public class MakeDB : MonoBehaviour
{
[SerializeField]
string inputID = "", inputPWD = "", registerID = "", registerPWD = "";//用户登录、注册数据
string loginIndex = "", loginID = "", loginPWD = "";//成功登录后的暂存信息
public string freshScore = "";//记录当前用户最新成绩
string filePath = "";//记录数据表地址
// Start is called before the first frame update
void Start()
{
//filePath = Application.streamingAssetsPath + "\\BariumMealExamData.csv";//新建StreamingAssets文件夹,并将BariumMealExamData.csv保存到此文件夹。CSV文件可以直接用Excel或WPS打开。请勿随意删改csv表中的预留信息,以防出错。
filePath=Application.persistentDataPath+"//"+ "BariumMealExamData.csv";//保存在安卓端的地址,即apk安装后的files文件夹中
}
// Update is called once per frame
void Update()
{
Register(registerID, registerPWD);//新用户注册
Login(inputID, inputPWD);//用户登录
UpdateScore();//更新用户成绩
}
//更新用户成绩
void