using System.Collections.Generic; using Base; namespace Model { [ObjectEvent] public class RealmGateAddressComponentEvent : ObjectEvent, IAwake { public void Awake() { this.GetValue().Awake(); } } public class RealmGateAddressComponent : Component { private readonly List GateAddress = new List(); public void Awake() { StartConfig[] startConfigs = this.GetComponent().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]; } } }