public override void OnScreenSizeChagned() { base.OnScreenSizeChagned(); if (btnPlay != null) { btnPlay.size = new Vector2(11, 12); btnPlay.relativePosition = new Vector3(166, LINE2 + 2); btnSpeed.size = new Vector2(28, 22); btnSpeed.relativePosition = new Vector3(280, LINE2 - 4); } if (lblGameTime != null) { lblGameTime.size = new Vector2(120, LINEW); lblGameTime.relativePosition = new Vector3(170, LINE2 - 3); lblGameTime.fontSize = (int)MUISkin.UIToScreen(11f); lblDayTime.size = new Vector2(40, LINEW); lblDayTime.relativePosition = new Vector3(115, LINE1); lblLocalTimeA.size = new Vector2(7, 7); lblLocalTimeA.relativePosition = new Vector3(4, LINE2 + 5); lblLocalTime.size = new Vector2(45, LINEW); lblLocalTime.relativePosition = new Vector3(14, LINE2 - 2); } if (lblThermometer != null) { lblThermometer.size = new Vector2(40, LINEW); lblThermometer.relativePosition = new Vector3(115, LINE2); lblThermometerA.size = new Vector2(16, 16); lblThermometerA.relativePosition = new Vector3(105, LINE2 + 2); } }
public override void OnScreenSizeChagned() { base.OnScreenSizeChagned(); if (lblIcon != null) { lblIcon.size = new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); } if (lblCashAmount != null) { lblCashAmount.fontSize = (int)MUISkin.UIToScreen(14f); lblCashAmount.size = new Vector2(115, LINEW); lblCashAmount.relativePosition = new Vector3(32, LINE1); } if (lblCashDelta != null) { lblCashDelta.fontSize = (int)MUISkin.UIToScreen(12f); lblCashDelta.size = new Vector2(105, LINEW); lblCashDelta.relativePosition = new Vector3(42, LINE2); } if (lblImportTotal != null) { lblImportTotal.fontSize = (int)MUISkin.UIToScreen(10f); lblImportTotal.size = new Vector2(50, LINEW); lblImportTotal.relativePosition = new Vector3(155, LINE1 - 3); } if (lblExportTotal != null) { lblExportTotal.fontSize = (int)MUISkin.UIToScreen(10f); lblExportTotal.size = new Vector2(50, LINEW); lblExportTotal.relativePosition = new Vector3(203, LINE1 - 3); } }
public override void OnDrawPanel() { base.OnDrawPanel(); if (CanOnGUIDraw()) { float W = MUISkin.UIToScreen(160); float T = 4f; float H = MUISkin.UIToScreen(PANEL_HEIGHT) - T * 2; GUI.DrawTexture(new Rect(W, T, 1, H), lineTexture); } }
public override void OnScreenSizeChagned() { base.OnScreenSizeChagned(); if (lblIcon != null) { //lblIcon.size = new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); lblIcon.relativePosition = new Vector3(4, 4); } if (lblCityName != null) { lblCityName.fontSize = (int)MUISkin.UIToScreen(14f); lblCityName.size = new Vector2(159, LINEW); lblCityName.relativePosition = new Vector3(6, LINE1); lblLandValue.size = new Vector2(79, LINEW); lblLandValue.relativePosition = new Vector3(86, LINE2); lblMaptheme.fontSize = (int)MUISkin.UIToScreen(10f); lblMaptheme.size = new Vector2(80, LINEW); lblMaptheme.relativePosition = new Vector3(36, LINE2); } if (lblDistricts != null) { lblDistricts.size = new Vector2(45, LINEW); lblDistricts.relativePosition = new Vector3(180, LINE1); lblDistrictsA.size = new Vector2(16, 16); lblDistrictsA.relativePosition = new Vector3(175, LINE1 + 2); } if (lblBuildings != null) { lblBuildings.size = new Vector2(45, LINEW); lblBuildings.relativePosition = new Vector3(180, LINE2); lblBuildings.fontSize = (int)MUISkin.UIToScreen(11f); lblBuildingsA.size = new Vector2(16, 16); lblBuildingsA.relativePosition = new Vector3(175, LINE2 + 2); } if (lblTrees != null) { lblTrees.size = new Vector2(60, LINEW); lblTrees.relativePosition = new Vector3(230, LINE2); lblTrees.fontSize = (int)MUISkin.UIToScreen(11f); lblTreesA.size = new Vector2(16, 14); lblTreesA.relativePosition = new Vector3(235, LINE2 + 4); } if (lblPark != null) { lblPark.size = new Vector2(16, 12); lblPark.relativePosition = new Vector3(235, LINE1 + 4); lblTouristsAverage.size = new Vector2(60, LINEW); lblTouristsAverage.relativePosition = new Vector3(230, LINE1 - 2); } }
private void Deinitialize() { if (ChirpPanel.instance != null) { ChirperVisible = ChirpPanel.instance.gameObject.activeSelf; } if (CityInfoDatas.TimeWarpMod_sunManager == null) { UnHookZoomButtonControls(); } UpdatePanelsVisitable(false); Singleton <CityInfoDatas> .instance.enabled = false; MUISkin.Done(); }
void InitControls() { LocaleManager.eventLocaleChanged += OnLocaleChanged; // 昼夜转换 btnDayNightSwitch = this.AddUIComponent <UIButton>(); btnDayNightSwitch.size = new Vector2(18, 9); btnDayNightSwitch.relativePosition = new Vector3(4, 6); btnDayNightSwitch.normalBgSprite = "IconSunMoon"; btnDayNightSwitch.playAudioEvents = true; //btnDayNightSwitch.tooltipLocaleID = "TIMECONTROL"; btnDayNightSwitch.eventClick += OnDayNightSwitchClicked; btnDayNightSwitch.eventMouseUp += OnDayNightSwitchMouseUp; btnDayNightSwitch.opacity = 0.5f; btnDayNightSwitch.isTooltipLocalized = true; btnDayNightSwitch.spritePadding = new RectOffset(); // 天气转换 btnWeatherSwitch = this.AddUIComponent <UIButton>(); btnWeatherSwitch.size = new Vector2(13, 13); btnWeatherSwitch.relativePosition = new Vector3(25, 4); btnWeatherSwitch.normalBgSprite = "IconPolicyOnlyElectricity"; btnWeatherSwitch.playAudioEvents = true; //btnWeatherSwitch.tooltipLocaleID = "THEME_WORLD_WEATHER"; btnWeatherSwitch.eventClick += OnWeatherSwitchClicked; btnWeatherSwitch.eventMouseUp += OnWeatherSwitchMouseUp; btnWeatherSwitch.opacity = 0.5f; btnWeatherSwitch.isTooltipLocalized = true; btnWeatherSwitch.spritePadding = new RectOffset(); // 啾啾显示 btnChirperContainer = this.AddUIComponent <UIButton>(); btnChirperContainer.size = new Vector2(13, 13); btnChirperContainer.relativePosition = new Vector3(42, 2); btnChirperContainer.normalBgSprite = "ChirperIcon"; btnChirperContainer.playAudioEvents = true; btnChirperContainer.isTooltipLocalized = true; btnChirperContainer.spritePadding = new RectOffset(); btnChirperContainer.eventClick += OnChirperTogglerClicked; btnChirperContainer.tooltipLocaleID = "CHIRPER_NAME"; if (ChirpPanel.instance != null) { btnChirperContainer.isVisible = true; btnChirperContainer.opacity = ChirpPanel.instance.gameObject.activeSelf ? 0.5f : 0.1f; } else { btnChirperContainer.isVisible = false; } // 电台显示 btnRadioIconContainer = this.AddUIComponent <UIButton>(); btnRadioIconContainer.size = new Vector2(13, 13); btnRadioIconContainer.relativePosition = new Vector3(58, 2); btnRadioIconContainer.normalFgSprite = "ADIcon"; btnRadioIconContainer.playAudioEvents = true; btnRadioIconContainer.isTooltipLocalized = true; btnRadioIconContainer.spritePadding = new RectOffset(); btnRadioIconContainer.eventClick += OnRadioTogglerClicked; // 静音 btnMuteAudioContainer = this.AddUIComponent <UIButton>(); btnMuteAudioContainer.size = new Vector2(13, 13); btnMuteAudioContainer.relativePosition = new Vector3(74, 2); btnMuteAudioContainer.normalFgSprite = "IconPolicyNoLoudNoisesHovered"; btnMuteAudioContainer.playAudioEvents = true; btnMuteAudioContainer.isTooltipLocalized = true; btnMuteAudioContainer.spritePadding = new RectOffset(); btnMuteAudioContainer.eventClick += (UIComponent comp, UIMouseEventParameter p) => { ExtendedInfoManager.AudioMuteAll = !ExtendedInfoManager.AudioMuteAll; Singleton <AudioManager> .instance.MuteAll = ExtendedInfoManager.AudioMuteAll; btnMuteAudioContainer.opacity = Singleton <AudioManager> .instance.MuteAll ? 0.1f : 0.5f; }; btnMuteAudioContainer.opacity = Singleton <AudioManager> .instance.MuteAll ? 0.1f : 0.5f; // 暂停按钮 btnPlay = this.AddUIComponent <UIMultiStateButton>(); btnPlay.size = new Vector2(11, 12); btnPlay.relativePosition = new Vector3(206, LINE2 + 2); btnPlay.isTooltipLocalized = true; btnPlay.tooltipLocaleID = "MAIN_PLAYPAUSE"; btnPlay.eventClick += OnPlayClicked; btnPlay.playAudioEvents = true; btnPlay.spritePadding = new RectOffset(); UIMultiStateButton.SpriteSet btnPlaySpriteSet0 = btnPlay.foregroundSprites[0]; btnPlaySpriteSet0.normal = "ButtonPause"; btnPlaySpriteSet0.hovered = "ButtonPauseHovered"; btnPlaySpriteSet0.pressed = "ButtonPausePressed"; btnPlaySpriteSet0.focused = "ButtonPauseFocused"; btnPlay.backgroundSprites.AddState(); btnPlay.foregroundSprites.AddState(); UIMultiStateButton.SpriteSet btnPlaySpriteSet1 = btnPlay.foregroundSprites[1]; btnPlaySpriteSet1.normal = "ButtonPlay"; btnPlaySpriteSet1.hovered = "ButtonPlayHovered"; btnPlaySpriteSet1.pressed = "ButtonPlayPressed"; btnPlaySpriteSet1.focused = "ButtonPlayFocused"; // 速度按钮 btnSpeed = this.AddUIComponent <UIMultiStateButton>(); btnSpeed.size = new Vector2(28, 22); btnSpeed.relativePosition = new Vector3(280, LINE2 - 4); btnSpeed.isTooltipLocalized = true; btnSpeed.tooltipLocaleID = "MAIN_SPEED"; btnSpeed.eventClick += OnSpeedClicked; btnSpeed.playAudioEvents = true; btnSpeed.spritePadding = new RectOffset(); UIMultiStateButton.SpriteSet btnSpeedSpriteSet0 = btnSpeed.foregroundSprites[0]; btnSpeedSpriteSet0.normal = "IconSpeed1Normal"; btnSpeedSpriteSet0.hovered = "IconSpeed1Hover"; btnSpeedSpriteSet0.pressed = "IconSpeed2Normal"; btnSpeed.backgroundSprites.AddState(); btnSpeed.foregroundSprites.AddState(); UIMultiStateButton.SpriteSet btnSpeedSpriteSet1 = btnSpeed.foregroundSprites[1]; btnSpeedSpriteSet1.normal = "IconSpeed2Normal"; btnSpeedSpriteSet1.hovered = "IconSpeed2Hover"; btnSpeedSpriteSet1.pressed = "IconSpeed3Normal"; btnSpeed.backgroundSprites.AddState(); btnSpeed.foregroundSprites.AddState(); UIMultiStateButton.SpriteSet btnSpeedSpriteSet2 = btnSpeed.foregroundSprites[2]; btnSpeedSpriteSet2.normal = "IconSpeed3Normal"; btnSpeedSpriteSet2.hovered = "IconSpeed3Hover"; btnSpeedSpriteSet2.pressed = "IconSpeed1Normal"; // 时间条 if (gameTimeSprite != null) { barTime = this.AddUIComponent <UISprite>(); barTime.name = "NewSprite"; barTime.size = new Vector2(140, 12); barTime.relativePosition = new Vector3(166, 4); barTime.atlas = gameTimeSprite.atlas; barTime.spriteName = gameTimeSprite.spriteName; barTime.fillAmount = 0.5f; barTime.fillDirection = UIFillDirection.Horizontal; barTime.color = gameTimeSprite.color; barTime.fillAmount = gameTimeSprite.fillAmount; } // 游戏日期标签 lblGameTime = this.AddUIComponent <MUILabel>(); lblGameTime.size = new Vector2(120, LINEW); lblGameTime.relativePosition = new Vector3(170, LINE2 - 3); lblGameTime.textColor = ExtendedPanel.COLOR_DARK_TEXT; lblGameTime.textAlignment = UIHorizontalAlignment.Center; //lblGameTime.fontStyle = FontStyle.Bold; lblGameTime.fontSize = (int)MUISkin.UIToScreen(11f); // 游戏时间标签 lblDayTimeA = this.AddUIComponent <UISprite>(); lblDayTimeA.size = new Vector2(14, 14); lblDayTimeA.relativePosition = new Vector3(107, 5); lblDayTimeA.spriteName = "InfoIconEntertainmentFocused"; lblDayTimeA.opacity = 0.3f; lblDayTimeA.playAudioEvents = (CityInfoDatas.TimeWarpMod_sunManager == null); lblDayTimeA.eventClick += OnDayTimeClicked; lblDayTime = this.AddUIComponent <MUILabel>(); lblDayTime.size = new Vector2(40, LINEW); lblDayTime.relativePosition = new Vector3(115, LINE1); lblDayTime.textColor = ExtendedPanel.COLOR_TEXT; lblDayTime.textAlignment = UIHorizontalAlignment.Right; lblDayTime.fontStyle = FontStyle.Bold; lblDayTime.fontSize = (int)MUISkin.UIToScreen(11f); lblDayTime.playAudioEvents = (CityInfoDatas.TimeWarpMod_sunManager == null); lblDayTime.eventClick += OnDayTimeClicked; // 本地时间 lblLocalTimeA = this.AddUIComponent <UISprite>(); lblLocalTimeA.size = new Vector2(7, 7); lblLocalTimeA.relativePosition = new Vector3(4, LINE2 + 5); lblLocalTimeA.spriteName = "OptionBaseFocused"; lblLocalTimeA.opacity = 0.3f; lblLocalTime = this.AddUIComponent <MUILabel>(); lblLocalTime.size = new Vector2(45, LINEW); lblLocalTime.relativePosition = new Vector3(14, LINE2 - 2); lblLocalTime.textColor = ExtendedPanel.COLOR_DARK_YELLOW; lblLocalTime.textAlignment = UIHorizontalAlignment.Left; lblLocalTime.fontStyle = FontStyle.Bold; lblLocalTime.fontSize = (int)MUISkin.UIToScreen(11f); lblLocalTime.eventClick += OnLocalTimeClick; lblLocalTime.playAudioEvents = true; // 温度 lblThermometerA = this.AddUIComponent <UISprite>(); lblThermometerA.size = new Vector2(16, 16); lblThermometerA.relativePosition = new Vector3(105, LINE2); lblThermometerA.spriteName = "ThermometerIcon"; lblThermometerA.opacity = 0.3f; lblThermometer = this.AddUIComponent <MUILabel>(); lblThermometer.size = new Vector2(40, LINEW); lblThermometer.relativePosition = new Vector3(115, LINE2); lblThermometer.textColor = ExtendedPanel.COLOR_DARK_TEXT; lblThermometer.textAlignment = UIHorizontalAlignment.Right; //lblThermometer.fontStyle = FontStyle.Bold; lblThermometer.fontSize = (int)MUISkin.UIToScreen(11f); lblThermometer.tooltipLocaleID = "MAIN_TEMPERATURE"; setGameState(); }
void InitControls() { LocaleManager.eventLocaleChanged += OnLocaleChanged; // 图标 lblIcon = this.AddUIComponent <MUILabel>(); lblIcon.size = new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); lblIcon.relativePosition = new Vector3(0, 0); lblIcon.backgroundSprite = "InfoIconPopulationFocused"; // 总人口 lblPopulation = this.AddUIComponent <MUILabel>(); lblPopulation.size = new Vector2(83, LINEW); lblPopulation.relativePosition = new Vector3(32, LINE1); lblPopulation.textColor = ExtendedPanel.COLOR_TEXT; lblPopulation.textAlignment = UIHorizontalAlignment.Right; lblPopulation.fontStyle = FontStyle.Bold; lblPopulation.fontSize = (int)MUISkin.UIToScreen(14f); lblPopulation.tooltipLocaleID = "MAIN_POPULATION"; // 人口变化 lblChange = this.AddUIComponent <MUILabel>(); lblChange.size = new Vector2(73, LINEW); lblChange.relativePosition = new Vector3(42, LINE2); lblChange.textColor = COLOR_DARK_GREEN; lblChange.fontSize = (int)MUISkin.UIToScreen(12f); lblChange.textAlignment = UIHorizontalAlignment.Right; lblChange.fontStyle = FontStyle.Bold; lblChange.tooltipLocaleID = "MAIN_POPULATIONDELTA"; // 失业率 lblUnemploymentA = this.AddUIComponent <MUILabel>(); lblUnemploymentA.size = new Vector2(16, 16); lblUnemploymentA.relativePosition = new Vector3(125, LINE1 + 2); lblUnemploymentA.backgroundSprite = "IconPolicyWeAreTheNormPressed"; lblUnemploymentA.opacity = 0.1f; lblUnemployment = this.AddUIComponent <MUILabel>(); lblUnemployment.size = new Vector2(40, LINEW); lblUnemployment.relativePosition = new Vector3(130, LINE2); lblUnemployment.textColor = COLOR_DARK_PURPLE; lblUnemployment.textAlignment = UIHorizontalAlignment.Right; // 健康 lblHealthA = this.AddUIComponent <MUILabel>(); lblHealthA.size = new Vector2(16, 16); lblHealthA.relativePosition = new Vector3(183, LINE1 + 2); lblHealthA.backgroundSprite = "InfoIconHealthPressed"; lblHealthA.opacity = 0.3f; lblHealth = this.AddUIComponent <MUILabel>(); lblHealth.size = new Vector2(50, LINEW); lblHealth.relativePosition = new Vector3(175, LINE1); lblHealth.textAlignment = UIHorizontalAlignment.Right; lblHealth.textColor = COLOR_DARK_GREEN; lblHealth.tooltipLocaleID = "INFO_HEALTH_TITLE"; // 教育 lblEducationA = this.AddUIComponent <MUILabel>(); lblEducationA.size = new Vector2(16, 16); lblEducationA.relativePosition = new Vector3(235, LINE2 + 2); lblEducationA.backgroundSprite = "ToolbarIconEducationPressed"; lblEducationA.opacity = 0.3f; lblEducation1 = this.AddUIComponent <MUILabel>(); lblEducation1.size = new Vector2(20, LINEW); lblEducation1.relativePosition = new Vector3(255, LINE2); lblEducation1.textColor = COLOR_DARK_TEXT; lblEducation1.textAlignment = UIHorizontalAlignment.Right; lblEducation1.tooltipLocaleID = "ZONEDBUILDING_EDUCATED"; lblEducation2 = this.AddUIComponent <MUILabel>(); lblEducation2.size = new Vector2(20, LINEW); lblEducation2.relativePosition = new Vector3(285, LINE2); lblEducation2.textAlignment = UIHorizontalAlignment.Center; lblEducation2.textColor = COLOR_DARK_TEXT; lblEducation2.tooltipLocaleID = "ZONEDBUILDING_WELLEDUCATED"; lblEducation3 = this.AddUIComponent <MUILabel>(); lblEducation3.size = new Vector2(20, LINEW); lblEducation3.relativePosition = new Vector3(315, LINE2); lblEducation3.textAlignment = UIHorizontalAlignment.Right; lblEducation3.textColor = COLOR_DARK_YELLOW; lblEducation3.tooltipLocaleID = "ZONEDBUILDING_HIGHLYEDUCATED"; lblEducation1.fontSize = (int)MUISkin.UIToScreen(10f); lblEducation2.fontSize = lblEducation1.fontSize; lblEducation3.fontSize = lblEducation1.fontSize; // 幸福度 lblHappinessA = this.AddUIComponent <MUILabel>(); lblHappinessA.size = new Vector2(14, 14); lblHappinessA.relativePosition = new Vector3(235, LINE1 + 2); string happinessString = GetHappinessString(Citizen.GetHappinessLevel(Singleton <DistrictManager> .instance.m_districts.m_buffer[0].m_finalHappiness)); lblHappinessA.backgroundSprite = happinessString; // "InfoIconHappiness"; lblHappinessA.opacity = 0.3f; lblHappiness = this.AddUIComponent <MUILabel>(); lblHappiness.size = new Vector2(50, LINEW); lblHappiness.relativePosition = new Vector3(235, LINE1); lblHappiness.textColor = COLOR_DARK_TEXT; lblHappiness.textAlignment = UIHorizontalAlignment.Right; lblHappiness.tooltipLocaleID = "MAIN_HAPPINESS"; // 老年人 lblSeniorA = this.AddUIComponent <MUILabel>(); lblSeniorA.size = new Vector2(16, 16); lblSeniorA.relativePosition = new Vector3(295, LINE1 + 2); lblSeniorA.backgroundSprite = "InfoIconAgePressed"; lblSeniorA.opacity = 0.3f; //lblSeniorA.textColor = COLOR_CAPTION; //lblSeniorA.text = Locale.Get("INFO_AGE_SENIOR") + ":"; //lblSeniorA.fontSize = (int)MUISkin.UIToScreen(9f); lblSenior = this.AddUIComponent <MUILabel>(); lblSenior.size = new Vector2(45, LINEW); lblSenior.relativePosition = new Vector3(290, LINE1); lblSenior.textAlignment = UIHorizontalAlignment.Right; lblSenior.textColor = COLOR_DARK_PURPLE; // MUIUtil.DarkenColor(Color.yellow, 0.50f); lblSenior.tooltipLocaleID = "CITY_SENIORAMOUNT"; // 活动人口 lblActivityA = this.AddUIComponent <MUILabel>(); lblActivityA.size = new Vector2(70, LINEW); lblActivityA.relativePosition = new Vector3(125, LINE2); lblActivityA.textColor = COLOR_CAPTION; if (MODUtil.IsChinaLanguage()) { lblActivityA.text = "人口实例:"; } else { lblActivityA.text = "instances:"; } lblActivityA.fontSize = (int)MUISkin.UIToScreen(10f); lblActivity = this.AddUIComponent <MUILabel>(); lblActivity.size = new Vector2(95, LINEW); lblActivity.relativePosition = new Vector3(130, LINE2); lblActivity.textAlignment = UIHorizontalAlignment.Right; lblActivity.textColor = MUIUtil.DarkenColor(Color.yellow, 0.70f); lblIcon.eventClick += OnSetInfoModeClick; lblPopulation.eventClick += OnSetInfoModeClick; lblChange.eventClick += OnSetInfoModeClick; lblSenior.eventClick += OnSetInfoModeClick; lblUnemployment.eventClick += OnSetInfoModeClick; lblHealth.eventClick += OnSetInfoModeClick; lblEducation1.eventClick += OnSetInfoModeClick; lblEducation2.eventClick += OnSetInfoModeClick; lblEducation3.eventClick += OnSetInfoModeClick; lblHappiness.eventClick += OnSetInfoModeClick; lblIcon.playAudioEvents = true; lblPopulation.playAudioEvents = true; lblChange.playAudioEvents = true; lblSenior.playAudioEvents = true; lblUnemployment.playAudioEvents = true; lblHealth.playAudioEvents = true; lblEducation1.playAudioEvents = true; lblEducation2.playAudioEvents = true; lblEducation3.playAudioEvents = true; lblHappiness.playAudioEvents = true; lblHappinessA.playAudioEvents = true; }
public override void OnScreenSizeChagned() { base.OnScreenSizeChagned(); if (lblIcon != null) { lblIcon.size = new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); } if (lblPopulation != null) { lblPopulation.fontSize = (int)MUISkin.UIToScreen(14f); lblPopulation.size = new Vector2(83, LINEW); lblPopulation.relativePosition = new Vector3(32, LINE1); } if (lblChange != null) { lblChange.fontSize = (int)MUISkin.UIToScreen(12f); lblChange.size = new Vector2(73, LINEW); lblChange.relativePosition = new Vector3(42, LINE2); } if (lblUnemployment != null) { lblUnemploymentA.relativePosition = new Vector3(125, LINE1 + 2); lblUnemployment.size = new Vector2(40, LINEW); lblUnemployment.relativePosition = new Vector3(130, LINE1); } if (lblHealth != null) { lblHealthA.relativePosition = new Vector3(183, LINE1 + 2); lblHealth.size = new Vector2(50, LINEW); lblHealth.relativePosition = new Vector3(175, LINE1); } if (lblSenior != null) { //lblSeniorA.fontSize = (int)MUISkin.UIToScreen(9f); //lblSeniorA.size = new Vector2(70, LINEW); lblSeniorA.relativePosition = new Vector3(295, LINE1 + 2); lblSenior.size = new Vector2(45, LINEW); lblSenior.relativePosition = new Vector3(290, LINE1); lblHappiness.fontSize = (int)MUISkin.UIToScreen(12f); lblHappinessA.relativePosition = new Vector3(235, LINE1 + 2); lblHappiness.size = new Vector2(50, LINEW); lblHappiness.relativePosition = new Vector3(235, LINE1); } if (lblEducationA != null) { lblEducationA.relativePosition = new Vector3(235, LINE2 + 2); lblEducation1.fontSize = (int)MUISkin.UIToScreen(10f); lblEducation2.fontSize = lblEducation1.fontSize; lblEducation3.fontSize = lblEducation1.fontSize; lblEducation1.size = new Vector2(20, LINEW); lblEducation1.relativePosition = new Vector3(255, LINE2); lblEducation2.size = new Vector2(20, LINEW); lblEducation2.relativePosition = new Vector3(285, LINE2); lblEducation3.size = new Vector2(20, LINEW); lblEducation3.relativePosition = new Vector3(315, LINE2); } if (lblActivity != null) { lblActivityA.size = new Vector2(70, LINEW); lblActivityA.relativePosition = new Vector3(125, LINE2); lblActivityA.fontSize = (int)MUISkin.UIToScreen(10f); lblActivity.size = new Vector2(95, LINEW); lblActivity.relativePosition = new Vector3(130, LINE2); } }
void InitControls() { LocaleManager.eventLocaleChanged += OnLocaleChanged; // 图标 lblIcon = this.AddUIComponent <MUILabel>(); lblIcon.size = new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); lblIcon.relativePosition = new Vector3(2, 2); lblIcon.backgroundSprite = "InfoPanelIconCurrency"; lblIcon.eventClick += OnCashAmountClick; lblIcon.playAudioEvents = true; // 金额 lblCashAmount = this.AddUIComponent <MUILabel>(); lblCashAmount.size = new Vector2(115, LINEW); lblCashAmount.relativePosition = new Vector3(32, LINE1); lblCashAmount.textColor = ExtendedPanel.COLOR_TEXT; lblCashAmount.textAlignment = UIHorizontalAlignment.Right; lblCashAmount.fontStyle = FontStyle.Bold; lblCashAmount.fontSize = (int)MUISkin.UIToScreen(14f); lblCashAmount.tooltipLocaleID = "MAIN_MONEYINFO"; lblCashAmount.eventClick += OnCashAmountClick; // 每周收入 lblCashDelta = this.AddUIComponent <MUILabel>(); lblCashDelta.size = new Vector2(105, LINEW); lblCashDelta.relativePosition = new Vector3(42, LINE2); lblCashDelta.fontSize = (int)MUISkin.UIToScreen(12f); lblCashDelta.textColor = COLOR_DARK_GREEN; lblCashDelta.fontStyle = FontStyle.Bold; lblCashDelta.textAlignment = UIHorizontalAlignment.Right; lblCashDelta.tooltipLocaleID = "MAIN_MONEYDELTA"; lblCashDelta.eventClick += OnCashAmountClick; int LOF = 155; //left offset // 进口 lblImportTotal = this.AddUIComponent <MUILabel>(); lblImportTotal.fontSize = (int)MUISkin.UIToScreen(10f); lblImportTotal.size = new Vector2(50, LINEW); lblImportTotal.relativePosition = new Vector3(155, LINE1 - 3); lblImportTotal.textColor = COLOR_DARK_TEXT; lblImportTotal.textAlignment = UIHorizontalAlignment.Right; lblImportTotal.tooltipLocaleID = "INFO_CONNECTIONS_IMPORT"; impOilColor = createColorSprite(LOF, m_resourceColors[0], "INFO_CONNECTIONS_OIL"); impOreColor = createColorSprite(LOF + CSW, m_resourceColors[1], "INFO_CONNECTIONS_ORE"); impGoodsColor = createColorSprite(LOF + CSW * 2, m_resourceColors[2], "INFO_CONNECTIONS_GOODS"); impForestryColor = createColorSprite(LOF + CSW * 3, m_resourceColors[3], "INFO_CONNECTIONS_FORESTRY"); impAgricultureColor = createColorSprite(LOF + CSW * 4, m_resourceColors[4], "INFO_CONNECTIONS_AGRICULTURE"); LOF = 210; // 出口 lblExportTotal = this.AddUIComponent <MUILabel>(); lblExportTotal.fontSize = (int)MUISkin.UIToScreen(10f); lblExportTotal.size = new Vector2(50, LINEW); lblExportTotal.relativePosition = new Vector3(203, LINE1 - 3); lblExportTotal.textColor = COLOR_DARK_TEXT; lblExportTotal.textAlignment = UIHorizontalAlignment.Right; lblExportTotal.tooltipLocaleID = "INFO_CONNECTIONS_EXPORT"; expOilColor = createColorSprite(LOF, m_resourceColors[0], "INFO_CONNECTIONS_OIL"); expOreColor = createColorSprite(LOF + CSW, m_resourceColors[1], "INFO_CONNECTIONS_ORE"); expGoodsColor = createColorSprite(LOF + CSW * 2, m_resourceColors[2], "INFO_CONNECTIONS_GOODS"); expForestryColor = createColorSprite(LOF + CSW * 3, m_resourceColors[3], "INFO_CONNECTIONS_FORESTRY"); expAgricultureColor = createColorSprite(LOF + CSW * 4, m_resourceColors[4], "INFO_CONNECTIONS_AGRICULTURE"); impOilColor.eventClick += OnSetInfoModeClick; impOreColor.eventClick += OnSetInfoModeClick; impGoodsColor.eventClick += OnSetInfoModeClick; impForestryColor.eventClick += OnSetInfoModeClick; impAgricultureColor.eventClick += OnSetInfoModeClick; lblImportTotal.eventClick += OnSetInfoModeClick; impOilColor.playAudioEvents = true; impOreColor.playAudioEvents = true; impGoodsColor.playAudioEvents = true; impForestryColor.playAudioEvents = true; impAgricultureColor.playAudioEvents = true; lblImportTotal.playAudioEvents = true; expOilColor.eventClick += OnSetInfoModeClick; expOreColor.eventClick += OnSetInfoModeClick; expGoodsColor.eventClick += OnSetInfoModeClick; expForestryColor.eventClick += OnSetInfoModeClick; expAgricultureColor.eventClick += OnSetInfoModeClick; lblExportTotal.eventClick += OnSetInfoModeClick; expOilColor.playAudioEvents = true; expOreColor.playAudioEvents = true; expGoodsColor.playAudioEvents = true; expForestryColor.playAudioEvents = true; expAgricultureColor.playAudioEvents = true; lblExportTotal.playAudioEvents = true; }
void InitControls() { LocaleManager.eventLocaleChanged += OnLocaleChanged; // 图标 lblIcon = this.AddUIComponent <UIButton>(); lblIcon.size = CityInfoButton.size; //new Vector2(PANEL_HEIGHT - 2, PANEL_HEIGHT - 2); lblIcon.relativePosition = new Vector3(4, 4); lblIcon.normalBgSprite = "CityInfo"; lblIcon.hoveredBgSprite = "CityInfoHovered"; lblIcon.pressedBgSprite = "CityInfoPressed"; lblIcon.isTooltipLocalized = true; lblIcon.tooltipLocaleID = "MAIN_CITYINFO"; lblIcon.eventClick += OnCityInfoClicked; lblIcon.playAudioEvents = true; //lblIcon.backgroundSprite = "InfoIconTrafficCongestionFocused"; // 城市名称 lblCityName = this.AddUIComponent <MUILabel>(); lblCityName.size = new Vector2(159, LINEW); lblCityName.relativePosition = new Vector3(6, LINE1); lblCityName.textColor = ExtendedPanel.COLOR_TEXT; lblCityName.textAlignment = UIHorizontalAlignment.Right; lblCityName.fontStyle = FontStyle.Bold; lblCityName.fontSize = (int)MUISkin.UIToScreen(14f); //lblCityName.text = Singleton<SimulationManager>.instance.m_metaData.m_CityName; // 地图主题 lblMaptheme = this.AddUIComponent <MUILabel>(); lblMaptheme.size = new Vector2(80, LINEW); lblMaptheme.relativePosition = new Vector3(36, LINE2); lblMaptheme.textColor = ExtendedPanel.COLOR_DARK_TEXT; lblMaptheme.textAlignment = UIHorizontalAlignment.Left; lblMaptheme.fontSize = (int)MUISkin.UIToScreen(10f); lblMaptheme.text = CityInfoDatas.Maptheme.text; lblMaptheme.tooltipLocaleID = "LOADPANEL_MAPTHEME"; // 地价 lblLandValue = this.AddUIComponent <MUILabel>(); lblLandValue.size = new Vector2(79, LINEW); lblLandValue.relativePosition = new Vector3(86, LINE2); lblLandValue.textColor = ExtendedPanel.COLOR_DARK_GREEN; lblLandValue.textAlignment = UIHorizontalAlignment.Right; lblLandValue.fontStyle = FontStyle.Bold; lblLandValue.tooltipLocaleID = "INFO_LANDVALUE_TITLE"; lblIcon.BringToFront(); // 分区 lblDistrictsA = this.AddUIComponent <MUILabel>(); lblDistrictsA.size = new Vector2(16, 16); lblDistrictsA.relativePosition = new Vector3(175, LINE1 + 2); lblDistrictsA.backgroundSprite = "InfoIconDistricts"; lblDistricts = this.AddUIComponent <MUILabel>(); lblDistricts.size = new Vector2(45, LINEW); lblDistricts.relativePosition = new Vector3(180, LINE1); lblDistricts.textColor = COLOR_DARK_YELLOW; lblDistricts.textAlignment = UIHorizontalAlignment.Right; lblDistricts.tooltipLocaleID = "MAIN_AREAS"; // 建筑 lblBuildingsA = this.AddUIComponent <MUILabel>(); lblBuildingsA.size = new Vector2(16, 16); lblBuildingsA.relativePosition = new Vector3(175, LINE2 + 2); lblBuildingsA.backgroundSprite = "ToolbarIconMonuments"; // "UnlockingBackground"; lblBuildingsA.opacity = 0.4f; lblBuildings = this.AddUIComponent <MUILabel>(); lblBuildings.size = new Vector2(45, LINEW); lblBuildings.relativePosition = new Vector3(180, LINE2); lblBuildings.textColor = COLOR_DARK_TEXT; lblBuildings.textAlignment = UIHorizontalAlignment.Right; lblBuildings.tooltipLocaleID = "ASSETTYPE_BUILDING"; lblBuildings.fontSize = (int)MUISkin.UIToScreen(11f); // 树 lblTreesA = this.AddUIComponent <MUILabel>(); lblTreesA.size = new Vector2(16, 14); lblTreesA.relativePosition = new Vector3(235, LINE2 + 4); lblTreesA.backgroundSprite = "ToolbarIconBeautification"; lblTreesA.opacity = 0.3f; lblTrees = this.AddUIComponent <MUILabel>(); lblTrees.size = new Vector2(60, LINEW); lblTrees.relativePosition = new Vector3(230, LINE2); lblTrees.textColor = COLOR_DARK_TEXT; lblTrees.textAlignment = UIHorizontalAlignment.Right; lblTrees.tooltipLocaleID = "ASSETTYPE_TREE"; lblTrees.fontSize = (int)MUISkin.UIToScreen(11f); // 休闲设置 lblPark = this.AddUIComponent <MUILabel>(); lblPark.size = new Vector2(12, 16); lblPark.relativePosition = new Vector3(235, LINE1 + 2); lblPark.backgroundSprite = "SubBarBeautificationExpansion1"; lblPark.opacity = 0.3f; // 游客 lblTouristsAverage = this.AddUIComponent <MUILabel>(); lblTouristsAverage.size = new Vector2(60, LINEW); lblTouristsAverage.relativePosition = new Vector3(230, LINE1); lblTouristsAverage.textColor = COLOR_TEXT; lblTouristsAverage.textAlignment = UIHorizontalAlignment.Right; lblTouristsAverage.tooltipLocaleID = "INFO_PUBLICTRANSPORT_TOURISTS"; lblTouristsAverage.fontSize = (int)MUISkin.UIToScreen(11f); lblBuildings.eventClick += OnSetInfoModeClick; lblLandValue.eventClick += OnSetInfoModeClick; lblLandValue.eventMouseUp += OnRightSetInfoModeClick; lblDistricts.eventClick += OnSetInfoModeClick; lblTrees.eventClick += OnSetInfoModeClick; lblCityName.eventClick += OnSetInfoModeClick; lblCityName.eventMouseUp += OnRightSetInfoModeClick; lblTouristsAverage.eventMouseUp += OnSetInfoModeClick; lblBuildings.playAudioEvents = true; lblLandValue.playAudioEvents = true; lblDistricts.playAudioEvents = true; lblTrees.playAudioEvents = true; lblCityName.playAudioEvents = true; lblTouristsAverage.playAudioEvents = true; }