- 博客(2)
- 资源 (15)
- 收藏
- 关注
原创 游戏开发中常用的的设计模式
单例模式游戏客户端就是一个单例。 各类单例器,如UI管理器,事件管理器等。下面是Python实现的一个单例。class Singleton(object): @classmethod def Instance(cls): if not getattr(cls, "_instance", None): cls.__instance_num__
2017-01-17 18:07:05 1743
原创 Python 装饰器
Python 装饰器python的装饰器实际上是一种装饰器模式,可以在不改变原有方法的情况下,给它添加功能。 一 属性装饰器class Monster(object): def __init__(self): self._hp = 0 @property def hp(self): return max(0, self._hp) @hp.
2017-01-17 15:37:19 510
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人