| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections.Generic;
- using Base;
- namespace Model
- {
- [ObjectEvent]
- public class RealmGateAddressComponentEvent : ObjectEvent<RealmGateAddressComponent>, IAwake
- {
- public void Awake()
- {
- this.GetValue().Awake();
- }
- }
- public class RealmGateAddressComponent : Component
- {
- private readonly List<StartConfig> GateAddress = new List<StartConfig>();
- public void Awake()
- {
- StartConfig[] startConfigs = this.GetComponent<StartConfigComponent>().GetAll();
- foreach (StartConfig config in startConfigs)
- {
- if (!config.AppType.Is(AppType.Gate))
- {
- continue;
- }
- this.GateAddress.Add(config);
- }
- }
- public Entity GetAddress()
- {
- int n = RandomHelper.RandomNumber(0, this.GateAddress.Count);
- return this.GateAddress[n];
- }
- }
- }
|