Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我为我的游戏制作了背景,每个背景都在各自的图层类中。我还创建了每个不同层的枚举。我想制作一种方法,允许我为场景创建背景层(一般)的实例。这背后的想法是我希望能够拥有背景实例,这样我就可以滚动浏览不同的类型。请帮忙。
你的意思是有一个用于构建图层或场景的工厂类?如果这不是你的意思,试着更好地表达你的问题,因为不是很清楚
SceneFactory 可以有类似的东西
- (CCScene *) sceneOfType:(enum SceneType) type { switch(type){ case type1: return [[Scene1 alloc] init]; case type2: return [[Scene2 alloc] init]; } }