ET框架---MatcherComponent学习笔记

MatcherComponent

请大家关注我的微博:@NormanLin_BadPixel坏像素


这是管理匹配对象的组件。

private readonly Dictionary<long, Matcher> matchers = new Dictionary<long, Matcher>();

获取匹配对象数量就是简单的返回字典的长度。

我们在看添加匹配对象的方法时,可以知道,mathers字典的键是Matcher.UserID,值是Matcher对象。

public void Add(Matcher matcher)
{
    this.matchers.Add(matcher.UserID, matcher);
}

当然还提供了根据ID来获取匹配对象的方法。

移除的方法当然也不会少,不过这里移除对象的方法不只是单纯的把指定id的对象移除就了事了,它还会把这个对象返回。就像Queen.Dequeue一样。

猜你喜欢

转载自blog.csdn.net/norman_lin/article/details/79966458