有没有一个这样的经理设计模式? [英] Is there such a thing as a manager design pattern?
问题描述
有没有像管理者设计模式这样的东西来控制不同的实体如何交互?
Is there such a thing as a manager design pattern that controls how different entities interact?
这是一个项目,环境, EnvironmentListener
和实体类已由我们的教授预定义。
This is for a project for which the Environment, EnvironmentListener
, and Entity classes have been predefined by our professor.
静态类环境
有一个 EnvironmentListener
接口,它有一个 nextAction()
方法,它只是连续地调用一个像游戏中的主循环,因为它是一个设计模式类,我不能简单更改代码。
The static class, Environment
, has a single EnvironmentListener
interface that has a nextAction()
method it just continuously calls kind of like a main loop in a game and because it is for a design patterns class, i can't simply change the code.
我需要允许实体被拖放,删除,动画等,并认为我会使用不同的控制器。
I need to allow entities to be dragged, dropped, animated, etc. and thought i would do that using different controllers.
我一直在想,如果做一个控制器管理器是一个好主意,它将实现 EnvironmentListener
,如果像这样的模式存在。
I've been wondering if it was a good idea to make a controller manager which would implement EnvironmentListener
and if a pattern like that existed.
控制器管理器将简单地遍历控制器列表并使用其调用函数。
The controller manager would simply iterate through a list of controllers and use their call function.
推荐答案
听起来就像你在调解员模式之后 - 这可以被认为作为处理对象的经理。
Sounds like you're after the mediator pattern - which can be thought of as a 'manager' of the objects that it deals with.
这篇关于有没有一个这样的经理设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!