摘要:
public class BankAccount { private int balance; private int overdraft = -500; /// <summary> /// 存款 /// </summary> /// <param name="amount"></param> pu 阅读全文
摘要:
延续责任链模式: https://www.cnblogs.com/Zingu/p/16309483.html 以上例子是增加永久防御和攻击,假设增加增益属性只在一个回合内或者一段时间内有效该如何处理? 增加一个游戏管理者:用来查询各项属性。 public class Game { public ev 阅读全文
摘要:
责任链模式(Chain of Responsibility Pattern) 情景:假设一个卡牌类游戏,怪物卡和属性卡 可以给怪物增加攻击属性,防御属性 /// <summary> /// 生物基础 /// </summary> public class Creature { public stri 阅读全文
摘要:
Compositite_Proxy_Array_Backed_Properties 情景: 有四个点选框 主项是All 子项是Pillars, Walls, Floors; 若子项全选中则主项选中,子项有一项未选中,则主项也未选中。 图例如下(红色为选中): 实现1: public class Ma 阅读全文
摘要:
Compositite Proxy_SoA_AoS 情景1: 一个游戏 有100个对象的X坐标需要全部移动; class Creature { public byte Age; public int X, Y; } class Program { static void Main(string[] 阅读全文