Beispiel #1
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            {
                return;
            }
            _mode = mode;

            buildingWindowGameObject = new GameObject("buildingWindowObject");
            this.buildingWindow      = buildingWindowGameObject.AddComponent <BuildingInfoWindow5>();
            UIPanel info = attachWindow(
                this.buildingWindow,
                new PropertyChangedEventHandler <bool>(buildingInfo_eventVisibilityChanged),
                "(Library) ZonedBuildingWorldInfoPanel");

            this.buildingWindow.baseBuildingWindow = info.gameObject.transform.GetComponentInChildren <ZonedBuildingWorldInfoPanel>();

            serviceWindowGameObject = new GameObject("serviceWindowObject");
            this.serviceWindow      = serviceWindowGameObject.AddComponent <ServiceInfoWindow2>();
            info = attachWindow(
                this.serviceWindow,
                new PropertyChangedEventHandler <bool>(serviceBuildingInfo_eventVisibilityChanged),
                "(Library) CityServiceWorldInfoPanel");
            this.serviceWindow.baseBuildingWindow = info.gameObject.transform.GetComponentInChildren <CityServiceWorldInfoPanel>();
        }
Beispiel #2
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            {
                return;
            }
            _mode = mode;

            buildingWindowGameObject = new GameObject("buildingWindowObject");

            var buildingInfo = UIView.Find <UIPanel>("(Library) ZonedBuildingWorldInfoPanel");

            this.buildingWindow = buildingWindowGameObject.AddComponent <BuildingInfoWindow5>();
            this.buildingWindow.transform.parent   = buildingInfo.transform;
            this.buildingWindow.size               = new Vector3(buildingInfo.size.x, buildingInfo.size.y);
            this.buildingWindow.baseBuildingWindow = buildingInfo.gameObject.transform.GetComponentInChildren <ZonedBuildingWorldInfoPanel>();
            this.buildingWindow.position           = new Vector3(0, 12);
            buildingInfo.eventVisibilityChanged   += buildingInfo_eventVisibilityChanged;

            var serviceBuildingInfo = UIView.Find <UIPanel>("(Library) CityServiceWorldInfoPanel");

            serviceWindow = buildingWindowGameObject.AddComponent <ServiceInfoWindow2>();
            serviceWindow.servicePanel = serviceBuildingInfo.gameObject.transform.GetComponentInChildren <CityServiceWorldInfoPanel>();

            serviceBuildingInfo.eventVisibilityChanged += serviceBuildingInfo_eventVisibilityChanged;
        }
 public override void OnLevelLoaded(LoadMode mode)
 {
     if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame &&
         mode != LoadMode.LoadScenario && mode != LoadMode.NewGameFromScenario)
         return;
     
     for (int i = 0; i < UIView.library.m_DynamicPanels.Length; i++)
         switch (UIView.library.m_DynamicPanels[i].instance.GetComponent<BuildingWorldInfoPanel>())
         {
             case ZonedBuildingWorldInfoPanel panel:
                 BuildingInfoWindow5 buildingWindow = panel.component.AddUIComponent<BuildingInfoWindow5>();
                 buildingWindow.size = panel.component.size;
                 buildingWindow.baseBuildingWindow = panel;
                 buildingWindow.position = new Vector3(0, 12);
                 break;
             case CityServiceWorldInfoPanel panel:
                 CityServiceLabel serviceWindow = panel.component.AddUIComponent<CityServiceLabel>();
                 break;
         }
 }
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
                return;
            _mode = mode;

            buildingWindowGameObject = new GameObject("buildingWindowObject");

            var buildingInfo = UIView.Find<UIPanel>("(Library) ZonedBuildingWorldInfoPanel");
            this.buildingWindow = buildingWindowGameObject.AddComponent<BuildingInfoWindow5>();
            this.buildingWindow.transform.parent = buildingInfo.transform;
            this.buildingWindow.size = new Vector3(buildingInfo.size.x, buildingInfo.size.y);
            this.buildingWindow.baseBuildingWindow = buildingInfo.gameObject.transform.GetComponentInChildren<ZonedBuildingWorldInfoPanel>();
            this.buildingWindow.position = new Vector3(0, 12);
            buildingInfo.eventVisibilityChanged += buildingInfo_eventVisibilityChanged;

            var serviceBuildingInfo = UIView.Find<UIPanel>("(Library) CityServiceWorldInfoPanel");
            serviceWindow = buildingWindowGameObject.AddComponent<ServiceInfoWindow2>();
            serviceWindow.servicePanel = serviceBuildingInfo.gameObject.transform.GetComponentInChildren<CityServiceWorldInfoPanel>();

            serviceBuildingInfo.eventVisibilityChanged += serviceBuildingInfo_eventVisibilityChanged;
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            {
                return;
            }

            _mode = mode;

            buildingWindowGameObject = new GameObject("buildingWindowObject");

            var buildingInfo = UIView.Find <UIPanel>("(Library) ZonedBuildingWorldInfoPanel");

            if (buildingInfo == null)
            {
                throw new ExtendedLoadingException("UIPanel not found (update broke the mod!): (Library) ZonedBuildingWorldInfoPanel\nAvailable panels are:\n" +
                                                   string.Join("  \n", GetUIPanelNames()));
                //FindObjectsOfType<UIPanel>().Select(p => p.name).ToArray()));
            }
            this.buildingWindow = buildingWindowGameObject.AddComponent <BuildingInfoWindow5>();
            this.buildingWindow.transform.parent   = buildingInfo.transform;
            this.buildingWindow.size               = new Vector3(buildingInfo.size.x, buildingInfo.size.y);
            this.buildingWindow.baseBuildingWindow = buildingInfo.gameObject.transform.GetComponentInChildren <ZonedBuildingWorldInfoPanel>();
            this.buildingWindow.position           = new Vector3(0, 12);
            buildingInfo.eventVisibilityChanged   += buildingInfo_eventVisibilityChanged;

            var serviceBuildingInfo = GetPanel("(Library) CityServiceWorldInfoPanel");//UIView.Find<UIPanel>("(Library) CityServiceWorldInfoPanel");

            if (serviceBuildingInfo == null)
            {
                throw new ExtendedLoadingException("UIPanel not found (update broke the mod!): (Library) CityServiceWorldInfoPanel\nAvailable panels are:\n" +
                                                   string.Join("  \n", GetUIPanelNames()));
            }
            serviceWindow = buildingWindowGameObject.AddComponent <ServiceInfoWindow2>();
            serviceWindow.servicePanel = serviceBuildingInfo.gameObject.transform.GetComponentInChildren <CityServiceWorldInfoPanel>();

            serviceBuildingInfo.eventVisibilityChanged += serviceBuildingInfo_eventVisibilityChanged;
        }