ET框架---RealmGateAddressComponent学习笔记

RealmGateAddressComponent

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


这是一个管理AppType.Gate服务启动信息的组件。我们看到,它储存的是StartConfig类型的数据。

提供的获取信息的方法,很好理解。

public StartConfig GetAddress()
{
    int n = RandomHelper.RandomNumber(0, this.GateAddress.Count);
    return this.GateAddress[n];
}

把这些地址又是在哪里获取到的呢?有了之前的教训,这会我每看一个类,都会去看看它有没有其他的扩展方法。

public static class RealmGateAddressComponentEx
{
    public static void Start(this RealmGateAddressComponent component)
    {
        StartConfig[] startConfigs = component.Entity.GetComponent<StartConfigComponent>().GetAll();
        foreach (StartConfig config in startConfigs)
        {
            if (!config.AppType.Is(AppType.Gate))
            {
                continue;
            }

            component.GateAddress.Add(config);
        }
    }
}

由此可见,它保存了启动配置里面所有的AppType.Gate地址。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值