当前位置:网站首页>当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
2022-07-01 13:48:00 【漫步星河】
个人理解分析出来三个方法,如果大家有什么建议或不足就提出来,谢谢
(具体还是要根据项目和架构来定)
方法1:
可以自己写好类或接口,让负责的同事写具体代码
数据类:我们自己调用的的时候传入参数,或者可以告诉同事怎么安全的调用数据类
方法2:
api:写一个事件接口枚举,把方法注册到事件管理器中。
可以参考Unity官方文档里的Api然后通过api调用来写,或者使用IOC依赖倒置
例如商店: 打开商店显示商店道具 参数(list(id和价格))
例如背包: 打开背包执行的内容 参数 (id和数量)
背包道具:UI显示描述,传入道具的id,从数据类得到道具信息
道具的操作:(移动unity提供了接口)
活动:活动界面打开接口
方法3:
使用框架IOC依赖倒置原则
边栏推荐
- arthas使用
- Arthas use
- 详细讲解面试的 IO多路复用,select,poll,epoll
- Word2vec training Chinese word vector
- The best landing practice of cave state in an Internet ⽹⾦ financial technology enterprise
- 进入前六!博云在中国云管理软件市场销量排行持续上升
- 【Flask】Flask启程与实现一个基于Flask的最小应用程序
- 新手准备多少钱可以玩期货?农产品可以吗?
- A new book by teacher Zhang Yujin of Tsinghua University: 2D vision system and image technology (five copies will be sent at the end of the article)
- 网络中的listen
猜你喜欢

Understand the window query function of tdengine in one article

leetcode622.设计循环队列(C语言)

孔松(信通院)-数字化时代云安全能力建设及趋势

【IoT毕设.下】STM32+机智云AIoT+实验室安全监控系统

使用net core 6 c# 的 NPOI 包,读取excel..xlsx单元格内的图片,并存储到指定服务器

spark源码(五)DAGScheduler TaskScheduler如何配合提交任务,application、job、stage、taskset、task对应关系是什么?

Qtdeisgner, pyuic detailed use tutorial interface and function logic separation (nanny teaching)

Kongsong (Xintong Institute) - cloud security capacity building and trend in the digital era

SAP 智能机器人流程自动化(iRPA)解决方案分享

使用 Lambda 函数URL + CloudFront 实现S3镜像回源
随机推荐
1.8新特性-List
IO的几种模型 阻塞,非阻塞,io多路复用,信号驱动和异步io
Social distance (cow infection)
6年技术迭代,阿里全球化出海&合规的挑战和探索
1. Sum of two numbers: given an integer array num and an integer target value, please find the two integers whose sum is the target value target in the array and return their array subscripts
Sign APK with command line
Summary of 20 practical typescript single line codes
介绍一种对 SAP GUI 里的收藏夹事务码管理工具增强的实现方案
A new book by teacher Zhang Yujin of Tsinghua University: 2D vision system and image technology (five copies will be sent at the end of the article)
arthas使用
el-form-item 正则验证
焱融看 | 混合云时代下,如何制定多云策略
盲盒NFT数字藏品平台系统开发(搭建源码)
Collation and review of knowledge points of Microcomputer Principle and interface technology - pure manual
一文读懂TDengine的窗口查询功能
word2vec训练中文词向量
Simplex, half duplex, full duplex, TDD and FDD
MySQL日志
Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security
04-Redis源码数据结构之字典