Ejemplo n.º 1
0
        protected override void Awake()
        {
            base.Awake();

            name = "EnhancedDistrictServicesTool";

            if (m_button == null)
            {
                m_button = UIView.GetAView().AddUIComponent(typeof(UIEDSButton)) as UIEDSButton;
            }

            if (m_edsCursor == null)
            {
                m_edsCursor = Utils.FindObject <CursorInfo>("SelfSufficient Placement");
            }

            EnhancedDistrictServicesUIPanel.Create();

            BuildingManager.instance.EventBuildingCreated += Constraints.CreateBuilding;
            BuildingManager.instance.EventBuildingCreated += VehicleManagerMod.CreateBuilding;
            BuildingManager.instance.EventBuildingCreated += TaxiMod.RegisterTaxiBuilding;
            BuildingManager.instance.EventBuildingCreated += OutsideConnectionInfo.RegisterCargoBuilding;

            BuildingManager.instance.EventBuildingReleased += Constraints.ReleaseBuilding;
            BuildingManager.instance.EventBuildingReleased += VehicleManagerMod.ReleaseBuilding;
            BuildingManager.instance.EventBuildingReleased += TaxiMod.DeregisterTaxiBuilding;
            BuildingManager.instance.EventBuildingReleased += OutsideConnectionInfo.DeregisterCargoBuilding;
        }
Ejemplo n.º 2
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            UnityEngine.Object.Destroy(m_button);
            m_button = null;

            UnityEngine.Object.Destroy(m_edsCursor);
            m_edsCursor = null;

            EnhancedDistrictServicesUIPanel.Destroy();

            BuildingManager.instance.EventBuildingCreated  -= Constraints.CreateBuilding;
            BuildingManager.instance.EventBuildingCreated  -= VehicleManagerMod.CreateBuilding;
            BuildingManager.instance.EventBuildingCreated  -= TaxiMod.RegisterTaxiBuilding;
            BuildingManager.instance.EventBuildingReleased -= Constraints.ReleaseBuilding;
            BuildingManager.instance.EventBuildingReleased -= VehicleManagerMod.ReleaseBuilding;
            BuildingManager.instance.EventBuildingReleased -= TaxiMod.DeregisterTaxiBuilding;
        }