private UILabel criaFatiaELegenda(Color c, UIRadialChartExtended chart, UIPanel legendPanel = null, string localeID = "", float offsetY = 0) { chart.AddSlice(c, c); UIPanel legendItemContainer = null; if (legendPanel != null) { KlyteUtils.createUIElement(out legendItemContainer, legendPanel.transform); legendItemContainer.width = legendPanel.width; legendItemContainer.relativePosition = new Vector3(0f, offsetY); legendItemContainer.name = "LegendItem"; legendItemContainer.autoLayout = false; legendItemContainer.useCenter = true; legendItemContainer.wrapLayout = false; legendItemContainer.height = 20; KlyteUtils.createUIElement(out UILabel legendColor, legendItemContainer.transform); legendColor.backgroundSprite = "EmptySprite"; legendColor.width = 10; legendColor.height = 10; legendColor.relativePosition = new Vector3(0, 0); legendColor.color = c; KlyteUtils.createUIElement(out UILabel legendName, legendItemContainer.transform); legendName.textAlignment = UIHorizontalAlignment.Right; legendName.width = legendItemContainer.width - 10; legendName.localeID = localeID; legendName.textScale = 0.6f; legendName.relativePosition = new Vector3(15f, 2f); legendName.verticalAlignment = UIVerticalAlignment.Middle; return(legendName); } return(null); }
private void createLineCharts(Vector3 relativePos) { KlyteUtils.createUIElement(out agesChartPanel, parent); agesChartPanel.relativePosition = relativePos; agesChartPanel.width = 140; agesChartPanel.height = 70; agesChartPanel.name = "WorkersPanel"; agesChartPanel.autoLayout = false; agesChartPanel.useCenter = true; agesChartPanel.wrapLayout = false; agesChartPanel.tooltipLocaleID = "ZONEDBUILDING_WORKERCHART"; KlyteUtils.createUIElement(out UIPanel pieLegendPanel, agesChartPanel.transform); pieLegendPanel.relativePosition = new Vector3(70f, 0f); pieLegendPanel.width = 70; pieLegendPanel.height = 70; pieLegendPanel.name = "WorkersLegendPanel"; pieLegendPanel.wrapLayout = false; pieLegendPanel.autoLayout = false; pieLegendPanel.useCenter = true; KlyteUtils.createUIElement(out workplaceChart, agesChartPanel.transform); workplaceChart.spriteName = "PieChartWhiteBg"; workplaceChart.relativePosition = new Vector3(0, 0); workplaceChart.width = 70; workplaceChart.height = 70; workplaceChart.name = "WorkersChart"; Color32 unskill = new Color32(210, 40, 40, 255); Color32 oneSchool = new Color32(180, 180, 40, 255); Color32 twoSchool = new Color32(40, 180, 40, 255); Color32 threeSchool = new Color32(40, 40, 210, 255); int y = 0; legendL0 = criaFatiaELegenda(unskill, workplaceChart, pieLegendPanel, "ZONEDBUILDING_UNEDUCATED", 14 * y++); legendL1 = criaFatiaELegenda(oneSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_EDUCATED", 14 * y++); legendL2 = criaFatiaELegenda(twoSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_WELLEDUCATED", 14 * y++); legendL3 = criaFatiaELegenda(threeSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_HIGHLYEDUCATED", 14 * y++); KlyteUtils.createUIElement(out workersChart, workplaceChart.transform); workersChart.spriteName = "PieChartWhiteFg"; workersChart.relativePosition = new Vector3(0, 0); workersChart.width = 70; workersChart.height = 70; workersChart.name = "WorkersChart"; criaFatiaELegenda(MultiplyColor(unskill, 0.5f), workersChart); criaFatiaELegenda(MultiplyColor(oneSchool, 0.5f), workersChart); criaFatiaELegenda(MultiplyColor(twoSchool, 0.5f), workersChart); criaFatiaELegenda(MultiplyColor(threeSchool, 0.5f), workersChart); legendFr = criaFatiaELegenda(Color.gray, workersChart, pieLegendPanel, "ZONEDBUILDING_JOBSAVAIL", 14 * y++); }
private void Awake() { controlContainer = GetComponent <UIPanel>(); controlContainer.name = "KCPanel"; KlyteUtils.createUIElement(out UIPanel _mainPanel, controlContainer.transform, "KCListPanel", new Vector4(395, 58, 875, 550)); mainPanel = _mainPanel; KlyteUtils.createUIElement(out m_StripMain, mainPanel.transform, "KCTabstrip", new Vector4(10, -40, mainPanel.width - 20, 40)); KlyteUtils.createUIElement(out UITabContainer tabContainer, mainPanel.transform, "KCTabContainer", new Vector4(0, 0, mainPanel.width, mainPanel.height)); m_StripMain.tabPages = tabContainer; m_StripMain.selectedIndex = 0; m_StripMain.selectedIndex = -1; }
private void Awake() { m_instance = this; m_controlContainer = GetComponent <UIComponent>(); m_controlContainer.name = "SSPanel"; m_controlContainer.isInteractive = false; var lateralListWidth = 180; KlyteUtils.createUIElement(out UIPanel _mainPanel, GetComponent <UIPanel>().transform, "SSListPanel", new Vector4(0, 0, m_controlContainer.width, m_controlContainer.height)); MainPanel = _mainPanel; MainPanel.backgroundSprite = "MenuPanel2"; CreateTitleBar(); KlyteUtils.CreateScrollPanel(_mainPanel, out m_profileList, out UIScrollbar scrollbar, lateralListWidth, m_controlContainer.height - 110, new Vector3(10, 100)); KlyteUtils.createUIElement(out m_tabstripCategories, MainPanel.transform, "SSTabstrip", new Vector4(lateralListWidth + 30, 50, MainPanel.width - 340, 40)); KlyteUtils.createUIElement(out UITabContainer tabContainer, MainPanel.transform, "SSTabContainer", new Vector4(lateralListWidth + 30, 90, MainPanel.width - 350, MainPanel.height - 90)); m_tabstripCategories.tabPages = tabContainer; UIButton tabTrees = CreateTabTemplate(); KlyteUtils.createUIElement(out UIPanel containerTrees, null); containerTrees.area = new Vector4(0, 0, tabContainer.width, tabContainer.height); containerTrees.backgroundSprite = "MainPanelInfo"; containerTrees.color = Color.gray; List <Type> tabs = KlyteUtils.GetSubtypesRecursive(typeof(SSDecorationTab <,>), GetType()); foreach (var tab in tabs) { m_tabstripCategories.AddTab(tab.Name, tabTrees.gameObject, containerTrees.gameObject); var tabController = (SSDecorationTab)containerTrees.gameObject.AddComponent(tab); tabTrees.normalFgSprite = tabController.TabIcon; tabTrees.tooltipLocaleID = tabController.TabDescriptionLocale; tabTrees.isTooltipLocalized = true; } m_tabstripCategories.selectedIndex = -1; }
private void createLineCharts() { KlyteUtils.createUIElement(out agesChartPanel, parent); agesChartPanel.relativePosition = new Vector3(450f, 45f); agesChartPanel.width = 140; agesChartPanel.height = 70; agesChartPanel.name = "AgesChartPanel"; agesChartPanel.autoLayout = false; agesChartPanel.useCenter = true; agesChartPanel.wrapLayout = false; KlyteUtils.createUIElement(out UIPanel pieLegendPanel, agesChartPanel.transform); pieLegendPanel.relativePosition = new Vector3(70f, 0f); pieLegendPanel.width = 70; pieLegendPanel.height = 70; pieLegendPanel.name = "AgesChartLegendPanel"; pieLegendPanel.wrapLayout = false; pieLegendPanel.autoLayout = false; pieLegendPanel.useCenter = true; KlyteUtils.createUIElement(out agesChart, agesChartPanel.transform); agesChart.spriteName = "PieChartWhiteBg"; agesChart.tooltipLocaleID = "ZONEDBUILDING_AGECHART"; agesChart.relativePosition = new Vector3(0, 0); agesChart.width = 70; agesChart.height = 70; agesChart.name = "AgesChart"; Color32 criancaColor = new Color32(254, 218, 155, 255); Color32 adolescenteColor = new Color32(205, 239, 145, 255); Color32 jovemColor = new Color32(189, 206, 235, 255); Color32 adultoColor = new Color32(255, 162, 162, 255); Color32 idosoColor = new Color32(100, 224, 206, 255); int y = 0; criaFatiaELegenda(criancaColor, agesChart, pieLegendPanel, "ZONEDBUILDING_CHILDREN", 14 * y++); criaFatiaELegenda(adolescenteColor, agesChart, pieLegendPanel, "ZONEDBUILDING_TEENS", 14 * y++); criaFatiaELegenda(jovemColor, agesChart, pieLegendPanel, "ZONEDBUILDING_YOUNGS", 14 * y++); criaFatiaELegenda(adultoColor, agesChart, pieLegendPanel, "ZONEDBUILDING_ADULTS", 14 * y++); criaFatiaELegenda(idosoColor, agesChart, pieLegendPanel, "ZONEDBUILDING_SENIORS", 14 * y++); }
/// <summary> /// This method will be hooked at Klyte Commons to create a new tab at the 45's button instead of new button at the game toolbar /// </summary> private void CreateMainPanel() { UITabstrip toolStrip = ToolsModifierControl.mainToolbar.GetComponentInChildren <UITabstrip>(); KlyteUtils.createUIElement(out m_openSSPanelButton, null); m_openSSPanelButton.size = new Vector2(43f, 49f); m_openSSPanelButton.tooltip = GetTooltipText(); m_openSSPanelButton.atlas = SSToolbarTextureAtlas.instance.atlas; m_openSSPanelButton.focusedColor = new Color32(128, 183, 240, 255); m_openSSPanelButton.hoveredColor = new Color32(128, 240, 183, 255); m_openSSPanelButton.disabledColor = new Color32(0, 0, 0, 255); m_openSSPanelButton.normalBgSprite = "SuburbStylerIcon"; m_openSSPanelButton.focusedBgSprite = "SuburbStylerIcon"; m_openSSPanelButton.hoveredBgSprite = "SuburbStylerIcon"; m_openSSPanelButton.pressedBgSprite = "SuburbStylerIcon"; m_openSSPanelButton.disabledBgSprite = "SuburbStylerIcon"; m_openSSPanelButton.focusedFgSprite = "ToolbarIconGroup6Focused"; m_openSSPanelButton.hoveredFgSprite = "ToolbarIconGroup6Hovered"; m_openSSPanelButton.normalFgSprite = ""; m_openSSPanelButton.pressedFgSprite = "ToolbarIconGroup6Pressed"; m_openSSPanelButton.disabledFgSprite = ""; m_openSSPanelButton.playAudioEvents = true; m_openSSPanelButton.tabStrip = true; KlyteUtils.createUIElement(out UIPanel ssPanelContainerRoot, null); toolStrip.AddTab("SuburbStyler", m_openSSPanelButton.gameObject, ssPanelContainerRoot.gameObject); KlyteUtils.createUIElement(out UIPanel ssPanelContainer, ssPanelContainerRoot.transform); ssPanelContainer.absolutePosition = new Vector4(0, 0, 0, 0); ssPanelContainer.clipChildren = false; KlyteUtils.createUIElement(out UIPanel ssInternalPanel, ssPanelContainer.transform); ssInternalPanel.area = new Vector4(400, 200, GetTabWidth(), 550); ssInternalPanel.gameObject.AddComponent(GetDefaultClassForMainPanel()); }