一些方案对比 ![[Pasted image 20240305124837.png]] 动作游戏 需求和优点: ![[Pasted image 20240305125350.png]] 游戏开始菜单: UI界面 ![[Pasted image 20240305132231.png]] 对应脚本: ![[Pasted image 20240305132201.png]] 也是统一管理资源的: ![[Pasted image 20240305133613.png]] 运行游戏,鼠标控制视角,wasd或方向键,控制移动 ![[Pasted image 20240305132414.png]] 特性说明: ![[Pasted image 20240305133350.png]] 先整一个新颜色 ![[Pasted image 20240305133808.png]] 存储颜色 重写获取哈希值的方式 ![[Pasted image 20240305134025.png]] 存储为浮点数值,构造函数里面,进行赋值 ![[Pasted image 20240305142511.png]] 字典和方向向量,也是同理,需要序列化 逻辑基本一样 ![[Pasted image 20240305142813.png]] 这个标签指的是,不用序列化 ![[Pasted image 20240305143335.png]] 序列化字典,实际上,是把key和value,分别存到两个list结构 真正序列化的,是这俩list结构 ![[Pasted image 20240305143748.png]] 序列化的逻辑: ![[Pasted image 20240305143935.png]] 反序列化的逻辑: ![[Pasted image 20240305144127.png]] 使用: ![[Pasted image 20240305144350.png]] 颜色序列化相关,调用: ![[Pasted image 20240305144617.png]]