当前位置:网站首页>当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
2022-07-01 13:48:00 【漫步星河】
个人理解分析出来三个方法,如果大家有什么建议或不足就提出来,谢谢
(具体还是要根据项目和架构来定)
方法1:
可以自己写好类或接口,让负责的同事写具体代码
数据类:我们自己调用的的时候传入参数,或者可以告诉同事怎么安全的调用数据类
方法2:
api:写一个事件接口枚举,把方法注册到事件管理器中。
可以参考Unity官方文档里的Api然后通过api调用来写,或者使用IOC依赖倒置
例如商店: 打开商店显示商店道具 参数(list(id和价格))
例如背包: 打开背包执行的内容 参数 (id和数量)
背包道具:UI显示描述,传入道具的id,从数据类得到道具信息
道具的操作:(移动unity提供了接口)
活动:活动界面打开接口
方法3:
使用框架IOC依赖倒置原则
边栏推荐
- 二传感器尺寸「建议收藏」
- [machine learning] VAE variational self encoder learning notes
- 【剑指 Offer】55 - II. 平衡二叉树
- Leetcode question 1: sum of two numbers (3 languages)
- Applet - applet chart Library (F2 chart Library)
- [anwangbei 2021] Rev WP
- GET请求如何传递数组参数
- Blind box NFT digital collection platform system development (build source code)
- C language course design topic
- [NLP] pre training model - gpt1
猜你喜欢

队列的基本操作(C语言实现)

被裁三个月,面试到处碰壁,心态已经开始崩了

What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!

French Data Protection Agency: using Google Analytics or violating gdpr
![[machine learning] VAE variational self encoder learning notes](/img/38/3eb8d9078b2dcbe780430abb15edcb.png)
[machine learning] VAE variational self encoder learning notes

Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security

【241. 为运算表达式设计优先级】

2022年PMP项目管理考试敏捷知识点(6)

04-Redis源码数据结构之字典

介绍一种对 SAP GUI 里的收藏夹事务码管理工具增强的实现方案
随机推荐
3.4 《数据库系统概论》之数据查询—SELECT(单表查询、连接查询、嵌套查询、集合查询、多表查询)
【IoT毕设.上】STM32+机智云AIoT+实验室安全监控系统
当你真的学会DataBinding后,你会发现“这玩意真香”!
逻辑是个好东西
SAP 智能机器人流程自动化(iRPA)解决方案分享
LeetCode重建二叉树详解[通俗易懂]
C language course design topic
20个实用的 TypeScript 单行代码汇总
小程序- view中多个text换行
7. Icons
2022 · 让我带你Jetpack架构组件从入门到精通 — Lifecycle
Fiori applications are shared through the enhancement of adaptation project
Leetcode question 1: sum of two numbers (3 languages)
二传感器尺寸「建议收藏」
5. Use of ly tab plug-in of header component
使用CMD修复和恢复病毒感染文件
IO的几种模型 阻塞,非阻塞,io多路复用,信号驱动和异步io
Spark source code (V) how does dagscheduler taskscheduler cooperate with submitting tasks, and what is the corresponding relationship between application, job, stage, taskset, and task?
Detailed explanation of leetcode reconstruction binary tree [easy to understand]
8 popular recommended style layout