CSL_Traffic.RoadCustomizerTool.InitializeUI C# (CSharp) Метод

InitializeUI() публичный статический Метод

public static InitializeUI ( UIButton button ) : bool
button UIButton
Результат bool
		public static bool InitializeUI(UIButton button)
		{
			GameObject container = GameObject.Find("TSContainer");
			if (container == null)
				return false;

			GameObject panel = UITemplateManager.GetAsGameObject("ScrollableSubPanelTemplate");
			if (panel == null)
				return false;

			container.GetComponent<UIComponent>().AttachUIComponent(panel);
			panel.GetComponent<UIPanel>().relativePosition = Vector3.zero;
			panel.GetComponent<UIPanel>().isVisible = false;
			GameObject gtsContainer = panel.transform.GetChild(0).gameObject;
			panel.GetComponent<UIPanel>().AttachUIComponent(gtsContainer);
			GameObject groupToolstrip = panel.transform.GetChild(1).gameObject;
			panel.GetComponent<UIPanel>().AttachUIComponent(groupToolstrip);

			GameObject vehiclePanel = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate");
			if (vehiclePanel == null)
				return false;

			UIComponent comp = gtsContainer.GetComponent<UIComponent>();
			if (comp == null)
				return false;
			comp.AttachUIComponent(vehiclePanel);
			comp.relativePosition = Vector3.zero;
			vehiclePanel.GetComponent<UIPanel>().AttachUIComponent(vehiclePanel.transform.GetChild(0).gameObject);
			vehiclePanel.GetComponent<UIPanel>().relativePosition = Vector3.zero;
			vehiclePanel.GetComponent<UIPanel>().isVisible = true;
			vehiclePanel.GetComponent<UIPanel>().isInteractive = true;
			vehiclePanel.transform.GetChild(0).gameObject.GetComponent<UIComponent>().relativePosition = new Vector3(50f, 0f);

			GameObject speedPanel = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate");
			if (speedPanel == null)
				return false;
			comp.AttachUIComponent(speedPanel);
			speedPanel.GetComponent<UIPanel>().AttachUIComponent(speedPanel.transform.GetChild(0).gameObject);
			speedPanel.GetComponent<UIPanel>().relativePosition = Vector3.zero;
			speedPanel.GetComponent<UIPanel>().isInteractive = true;
			speedPanel.transform.GetChild(0).gameObject.GetComponent<UIComponent>().relativePosition = new Vector3(50f, 0f);

			// add RoadCustomizerGroupPanel to panel
			panel.AddComponent<RoadCustomizerGroupPanel>();

			// add RoadCustomizerPanel to scrollablePanel
			vehiclePanel.AddComponent<RoadCustomizerPanel>();//.SetPanel(RoadCustomizerPanel.Panel.VehicleRestrictions);
			speedPanel.AddComponent<RoadCustomizerPanel>();//.SetPanel(RoadCustomizerPanel.Panel.SpeedRestrictions);

			button.eventClick += delegate(UIComponent component, UIMouseEventParameter eventParam)
			{
				//roadsPanel.isVisible = false;
				panel.SetActive(true);
				panel.GetComponent<UIPanel>().isVisible = true;
				//vehiclePanel.GetComponent<UIPanel>().isVisible = true;
			};

			return true;
		}