unity制作app(5)--发送数据给数据库

这个之前做过,先不做照片的。下一节再做带照片的。

第一步 收集数据

1.先做一个AppModel结构体,这个结构体需要单做的。

cs 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Assets.Model;
public class AppModel
{
    public string id { get; set; }//只要做就都不是事
    public string name { get; set; }
    public string sex { get; set; }
    public string year { get; set; }
    public string month { get; set; }
    public string mobile { get; set; }
    public string address { get; set; }
    public string degree { get; set; }
    public string business{ get; set; }
    public string height { get; set; }
    public string weight { get; set; }
    public string introduce { get; set; }
    public string photo { get; set; }

    public AppModel()
    {

    }

    public AppModel(AppModel model)//
    {
        this.id = model.id;
        this.name = model.name;
        this.sex = model.sex;
        this.year = model.year;
        this.month = model.month;
        this.mobile = model.mobile;
        this.address = model.address;
        this.degree = model.degree;
        this.business = model.business;
        this.height = model.height;
        this.weight = model.weight;
        this.introduce = model.introduce;
        this.photo = model.photo;
    }
}

2.在JoinSubmit中收集信息findwithTag,这东西不难。

3.app发送数据(账号+密码)给服务器

点击登录按钮,客户端发送sendMessage(0,0,0,message),000+账号密码

4.服务器接收数据(处理000),返回001+结果

5.客户端查看结果,登陆成功的话,收到的值是账号的id,同时向服务器发送200+null

6.服务器处理200,返回当前账号中的信息!(在app中强制规定一个账号下只有一个角色)

(后期还需要修改账号所对应的内容!数据上改的东西还是比较多的)

返回201+这个账号下所有的角色信息

7.客户端接受201,赋值全局变量,结束本次消息发送 。(到此为止是起到了一个查询单个账号信息的作用)

继续计划完成的是注册角色信息(AppModel)的功能(本来是应该从这里开始的,但一次工作一个样)

8.当要注册时,首先是由客户端发送202,包的内容原本是角色名称和职业,现在要改成好多个。

直接修改。老方法移植后是可以直接修改文件对应内容的。

服务器成功收到新结构体的数据

相关推荐
风酥糖6 小时前
Godot游戏练习01-第24节-多人游戏暂停菜单,游戏优化
游戏·游戏引擎·godot
Allen747412 小时前
ComfyUI 自动化生产 3D资产 工作流笔记
图像处理·opencv·unity·自然语言处理·3d模型生成·confyui
nnsix15 小时前
Unity Windows11 打字中文显示不出来输入法的候选框
unity
SCLchuck1 天前
Godot 4 2D 物理引擎位置初始化踩坑:add_child() 和 position 到底谁先? (错误位置触发物理事件)
游戏引擎·godot·游戏开发·物理引擎
adogai1 天前
unity mcp接入 实现一句话生成游戏!
游戏·unity·游戏引擎
mxwin1 天前
Unity Shader 逐像素光照 vs 逐顶点光照性能与画质的权衡策略
unity·游戏引擎·shader·着色器
CDN3601 天前
游戏盾导致 Unity/UE 引擎崩溃的主要原因排查?
游戏·unity·游戏引擎
mxwin1 天前
Unity URP 全局光照 (GI) 完全指南 Lightmap 采样与实时 GI(光照探针、反射探针)的 Shader 集成
unity·游戏引擎·shader·着色器
mxwin1 天前
Unity URP 溶解效果基于噪声纹理与 clip 函数实现物体渐隐渐显
unity·游戏引擎·shader
CheerWWW1 天前
GameFramework——Download篇
笔记·学习·unity·c#