Ejemplo n.º 1
0
        public override void Start()
        {
            base.Start();
            InitControls();
            UpdateLocalTimeVisible();
            btnDayNightSwitch.tooltip = "Left Click: " + Locale.Get("TIMECONTROL") + "\nRight Click: " + Locale.Get("OPTIONS_ENABLE_DAY_NIGHT");
            btnWeatherSwitch.tooltip  = "Left Click: " + Locale.Get("THEME_WORLD_WEATHER") + "\nRight Click: " + Locale.Get("OPTIONS_ENABLE_WEATHER");

            if (MODUtil.IsChinaLanguage())
            {
                btnRadioIconContainer.tooltip = "电台 开/关";
                btnMuteAudioContainer.tooltip = "静音";
            }
            else
            {
                btnRadioIconContainer.tooltip = "Toggle Radio";
                btnMuteAudioContainer.tooltip = "Mute Audio";
            }

            btnRadioIconContainer.opacity = IsRadioToggle() ? 0.5f : 0.1f;


            // 兼容 Rush Hours
            if (CityInfoDatas.RushHourUI != null && ExtendedInfoManager.infopanel != null)
            {
                UIPanel _panelTime = ExtendedInfoManager.infopanel.Find <UIPanel>("PanelTime");
                if (_panelTime != null)
                {
                    RushHourSprite    = _panelTime.Find <UISprite>("NewSprite");
                    RushHourTimeLabel = _panelTime.Find <UILabel>("NewTime");
                }
            }
        }
Ejemplo n.º 2
0
        public static bool IsModActiveById(string WorkshopId)
        {
            var pluginManager = PluginManager.instance;
            var plugins       = MODUtil.GetPrivate <Dictionary <string, PluginManager.PluginInfo> >(pluginManager, "m_Plugins");

            foreach (var item in plugins)
            {
                if (item.Value.name != WorkshopId)
                {
                    continue;
                }

                return(item.Value.isEnabled);
            }

            return(false);
        }
Ejemplo n.º 3
0
        private static string[] loadStringFromFile(string file)
        {
            string[] lines    = null;
            string   filename = Path.Combine(MODUtil.GetAssemblyPath(), file);

            if (File.Exists(filename))
            {
                using (StreamReader sr = File.OpenText(filename))
                {
                    if (sr != null)
                    {
                        lines = sr.ReadToEnd().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
                    }
                }
            }
            return(lines);
        }
Ejemplo n.º 4
0
        void OnLocaleChanged()
        {
            string s = "";

            if (lblUnemployment != null)
            {
                s = Locale.Get("INFO_POPULATION_UNEMPLOYMENT");

                s = s.Substring(0, s.IndexOf("{"));
                lblUnemployment.tooltip = s.Substring(0, s.Length - 2);
            }

            if (MODUtil.IsChinaLanguage())
            {
                lblActivityA.text = "人口实例:";
            }
            else
            {
                lblActivityA.text = "instances:";
            }
        }
Ejemplo n.º 5
0
        void OnLocaleChanged()
        {
            if (btnDayNightSwitch != null)
            {
                btnDayNightSwitch.tooltip = "Left Click: " + Locale.Get("TIMECONTROL") + "\nRight Click: " + Locale.Get("OPTIONS_ENABLE_DAY_NIGHT");
                btnWeatherSwitch.tooltip  = "Left Click: " + Locale.Get("THEME_WORLD_WEATHER") + "\nRight Click: " + Locale.Get("OPTIONS_ENABLE_WEATHER");
            }

            if (btnRadioIconContainer != null)
            {
                if (MODUtil.IsChinaLanguage())
                {
                    btnRadioIconContainer.tooltip = "电台 开/关";
                    btnMuteAudioContainer.tooltip = "静音";
                }
                else
                {
                    btnRadioIconContainer.tooltip = "Toggle Radio";
                    btnMuteAudioContainer.tooltip = "Mute Audio";
                }
            }
        }
Ejemplo n.º 6
0
        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;
        }