// Update is called once per frame
    //void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.P))
    //    {
    //        Screen.fullScreen = !Screen.fullScreen;
    //    }
    //}

    /// <summary>
    /// 获取系统设置
    /// </summary>
    public static void GetSystemSetting()
    {
        string path = Application.dataPath + ConfigPath;

        if (!File.Exists(path))
        {
            CreateSystemSettingXml();
        }
        else
        {
            systemSetting = SerializeHelper.DeserializeFromFile <SystemSetting>(path);
        }
        Log.Error("SystemSettingHelper.GetSystemSetting" + systemSetting.IsShowLeftTopo);
        resolutionSetting    = systemSetting.ResolutionSetting;
        cinemachineSetting   = systemSetting.CinemachineSetting;
        communicationSetting = systemSetting.CommunicationSetting;
        versionSetting       = systemSetting.VersionSetting;
        refreshSetting       = systemSetting.RefreshSetting;
        assetLoadSetting     = systemSetting.AssetLoadSetting;
        honeyWellSetting     = systemSetting.HoneyWellSetting;
        deviceSetting        = systemSetting.DeviceSetting;
        historyPathSetting   = systemSetting.HistoryPathSetting;
        alarmSetting         = systemSetting.AlarmSetting;
        ///如果版本号不一致,自动更新
        if (versionSetting.VersionNumber != SystemSettingHelper.instance.versionNum)
        {
            versionSetting.VersionNumber = SystemSettingHelper.instance.versionNum;
            SaveSystemSetting();
        }

        locationSetting = systemSetting.LocationSetting;

        debugSetting = systemSetting.DebugSetting;
    }
Example #2
0
 public SystemSetting()
 {
     ResolutionSetting    = new ResolutionSetting();
     CinemachineSetting   = new CinemachineSetting();
     CommunicationSetting = new CommunicationSetting();
     VersionSetting       = new VersionSetting();
     RefreshSetting       = new RefreshSetting();
     AssetLoadSetting     = new AssetLoadSetting();
     HoneyWellSetting     = new HoneyWellSetting();
     DeviceSetting        = new DeviceSetting();
     HistoryPathSetting   = new HistoryPathSetting();
     LocationSetting      = new LocationSetting();
     DebugSetting         = new DebugSetting();
     AlarmSetting         = new AlarmSetting();
 }
Example #3
0
        public override void OnActivate()
        {
            // Load settings
            currentres = new ResolutionSetting(
                Root.Singleton.Settings.ReadInt("Video", "ResX"),
                Root.Singleton.Settings.ReadInt("Video", "ResY")
                );
            currentfs         = Root.Singleton.Settings.ReadInt("Video", "Fullscreen") == 1;
            hotkeys           = Root.Singleton.Settings.ReadInt("Video", "Hotkeys") == 1;
            backgrounds       = Root.Singleton.Settings.ReadInt("Video", "Backgrounds") == 1;
            achievementPopups = Root.Singleton.Settings.ReadInt("Video", "AchievementPopups") == 1;
            autoPause         = Root.Singleton.Settings.ReadInt("Video", "AutoPause") == 1;

            BackgroundImage = Root.Singleton.Material("img/box_text1.png");
            base.OnActivate();

            var lblTitle = new Label();

            lblTitle.Colour = Color.White;
            lblTitle.Text   = "Options:  (ESCAPE when done)";
            lblTitle.Font   = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.Scale  = 0.475f;
            lblTitle.X      = 22;
            lblTitle.Y      = 35;
            lblTitle.Parent = Window;
            lblTitle.Init();

            btnResolution          = AddButton(70);
            btnResolution.OnClick += (sender) =>
            {
                int i = resolutions.IndexOf(currentres);
                i++;
                if (i >= resolutions.Count)
                {
                    i = 0;
                }
                currentres = resolutions[i];
                updateButtons();
                windowresetneeded = true;
            };

            btnFullscreen          = AddButton(96);
            btnFullscreen.OnClick += (sender) =>
            {
                currentfs = !currentfs;
                updateButtons();
                windowresetneeded = true;
            };

            btnHotkeys          = AddButton(122);
            btnHotkeys.OnClick += (sender) =>
            {
                hotkeys = !hotkeys;
                updateButtons();
            };

            btnDynamicBackgrounds          = AddButton(148);
            btnDynamicBackgrounds.OnClick += (sender) =>
            {
                backgrounds = !backgrounds;
                updateButtons();
            };

            btnAchievePopups          = AddButton(174);
            btnAchievePopups.OnClick += (sender) =>
            {
                achievementPopups = !achievementPopups;
                updateButtons();
            };

            btnWindowFocusPause          = AddButton(200);
            btnWindowFocusPause.OnClick += (sender) =>
            {
                autoPause = !autoPause;
                updateButtons();
            };
            updateButtons();
        }
Example #4
0
        public void OnActivate()
        {
            // Store window
            window             = Root.Singleton.Window;
            rctScreen          = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            windowresetneeded  = false;
            finishnow          = false;
            window.KeyPressed += new EventHandler <KeyEventArgs>(window_KeyPressed);

            // Load settings
            currentres = new ResolutionSetting(
                Root.Singleton.Settings.ReadInt("Video", "ResX"),
                Root.Singleton.Settings.ReadInt("Video", "ResY")
                );
            currentfs         = Root.Singleton.Settings.ReadInt("Video", "Fullscreen") == 1;
            hotkeys           = Root.Singleton.Settings.ReadInt("Video", "Hotkeys") == 1;
            backgrounds       = Root.Singleton.Settings.ReadInt("Video", "Backgrounds") == 1;
            achievementPopups = Root.Singleton.Settings.ReadInt("Video", "AchievementPopups") == 1;
            autoPause         = Root.Singleton.Settings.ReadInt("Video", "AutoPause") == 1;

            // Create UI
            pnObscure        = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow       = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/box_text1.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (616 / 2), (720 / 2) - (384 / 2), 616, 384, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            var lblTitle = new Label();

            lblTitle.Colour = Color.White;
            lblTitle.Text   = "Options:  (ESCAPE when done)";
            lblTitle.Font   = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.Scale  = 0.475f;
            lblTitle.X      = 22;
            lblTitle.Y      = 35;
            lblTitle.Parent = pnWindow;
            lblTitle.Init();

            btnResolution          = AddButton(70);
            btnResolution.OnClick += (sender) =>
            {
                int i = resolutions.IndexOf(currentres);
                i++;
                if (i >= resolutions.Count)
                {
                    i = 0;
                }
                currentres = resolutions[i];
                updateButtons();
                windowresetneeded = true;
            };

            btnFullscreen          = AddButton(96);
            btnFullscreen.OnClick += (sender) =>
            {
                currentfs = !currentfs;
                updateButtons();
                windowresetneeded = true;
            };

            btnHotkeys          = AddButton(122);
            btnHotkeys.OnClick += (sender) =>
            {
                hotkeys = !hotkeys;
                updateButtons();
            };

            btnDynamicBackgrounds          = AddButton(148);
            btnDynamicBackgrounds.OnClick += (sender) =>
            {
                backgrounds = !backgrounds;
                updateButtons();
            };

            btnAchievePopups          = AddButton(174);
            btnAchievePopups.OnClick += (sender) =>
            {
                achievementPopups = !achievementPopups;
                updateButtons();
            };

            btnWindowFocusPause          = AddButton(200);
            btnWindowFocusPause.OnClick += (sender) =>
            {
                autoPause = !autoPause;
                updateButtons();
            };
            updateButtons();

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }
Example #5
0
        private static int[] GetResolution(ResolutionSetting setting)
        {
            int[] screendim = new int[2];
            screendim[0] = 0;
            screendim[1] = 0;
            if (setting == ResolutionSetting.Windows || setting == ResolutionSetting.Xbox360)
            {
                screendim[0] = 720;
                screendim[1] = 1280;
            }

            if (setting == ResolutionSetting.WP7_Landscape)
            {
                screendim[0] = 480;
                screendim[1] = 800;

            } else if (setting == ResolutionSetting.WP7_Portrait)
            {
                screendim[0] = 800;
                screendim[1] = 480;
            }

            return screendim;
        }
Example #6
0
 /// <summary>
 /// We should have two seperate resolutions for seperate devices.
 /// This way you can have one source to preform calculations on world size depending on the device.
 /// </summary>
 public static void SetResolution(GraphicsDeviceManager graphics, ResolutionSetting setting)
 {
     //height is first
     graphics.PreferredBackBufferHeight = GetResolution(setting)[0];
     graphics.PreferredBackBufferWidth = GetResolution(setting)[1];
     _ressetting = setting;
 }
Example #7
0
        public override void OnActivate(params object[] args)
        {
            // Load settings
            currentres = new ResolutionSetting(
                Root.Singleton.Settings.ReadInt("Video", "ResX"),
                Root.Singleton.Settings.ReadInt("Video", "ResY")
            );
            currentfs = Root.Singleton.Settings.ReadInt("Video", "Fullscreen") == 1;
            hotkeys = Root.Singleton.Settings.ReadInt("Video", "Hotkeys") == 1;
            backgrounds = Root.Singleton.Settings.ReadInt("Video", "Backgrounds") == 1;
            achievementPopups = Root.Singleton.Settings.ReadInt("Video", "AchievementPopups") == 1;
            autoPause = Root.Singleton.Settings.ReadInt("Video", "AutoPause") == 1;

            BackgroundImage = Root.Singleton.Material("img/box_text1.png");
            base.OnActivate();

            var lblTitle = new Label();
            lblTitle.Colour = Color.White;
            lblTitle.Text = "Options:  (ESCAPE when done)";
            lblTitle.Font = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.Scale = 0.475f;
            lblTitle.X = 22;
            lblTitle.Y = 35;
            lblTitle.Parent = Window;
            lblTitle.Init();

            btnResolution = AddButton(70);
            btnResolution.OnClick += (sender) =>
            {
                int i = resolutions.IndexOf(currentres);
                i++;
                if (i >= resolutions.Count) i = 0;
                currentres = resolutions[i];
                UpdateButtons();
                windowresetneeded = true;
            };

            btnFullscreen = AddButton(96);
            btnFullscreen.OnClick += (sender) =>
            {
                currentfs = !currentfs;
                UpdateButtons();
                windowresetneeded = true;
            };

            btnHotkeys = AddButton(122);
            btnHotkeys.OnClick += (sender) =>
            {
                hotkeys = !hotkeys;
                UpdateButtons();
            };

            btnDynamicBackgrounds = AddButton(148);
            btnDynamicBackgrounds.OnClick += (sender) =>
            {
                backgrounds = !backgrounds;
                UpdateButtons();
            };

            btnAchievePopups = AddButton(174);
            btnAchievePopups.OnClick += (sender) =>
            {
                achievementPopups = !achievementPopups;
                UpdateButtons();
            };

            btnWindowFocusPause = AddButton(200);
            btnWindowFocusPause.OnClick += (sender) =>
            {
                autoPause = !autoPause;
                UpdateButtons();
            };
            UpdateButtons();
        }
Example #8
0
        public void OnActivate()
        {
            // Store window
            window = Root.Singleton.Window;
            rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            windowresetneeded = false;
            finishnow = false;
            window.KeyPressed += new EventHandler<KeyEventArgs>(window_KeyPressed);

            // Load settings
            currentres = new ResolutionSetting(
                Root.Singleton.Settings.ReadInt("Video", "ResX"),
                Root.Singleton.Settings.ReadInt("Video", "ResY")
            );
            currentfs = Root.Singleton.Settings.ReadInt("Video", "Fullscreen") == 1;
            hotkeys = Root.Singleton.Settings.ReadInt("Video", "Hotkeys") == 1;
            backgrounds = Root.Singleton.Settings.ReadInt("Video", "Backgrounds") == 1;
            achievementPopups = Root.Singleton.Settings.ReadInt("Video", "AchievementPopups") == 1;
            autoPause = Root.Singleton.Settings.ReadInt("Video", "AutoPause") == 1;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/box_text1.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (616 / 2), (720 / 2) - (384 / 2), 616, 384, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            var lblTitle = new Label();
            lblTitle.Colour = Color.White;
            lblTitle.Text = "Options:  (ESCAPE when done)";
            lblTitle.Font = Root.Singleton.Font("fonts/JustinFont12Bold.ttf");
            lblTitle.Scale = 0.475f;
            lblTitle.X = 22;
            lblTitle.Y = 35;
            lblTitle.Parent = pnWindow;
            lblTitle.Init();

            btnResolution = AddButton(70);
            btnResolution.OnClick += (sender) =>
            {
                int i = resolutions.IndexOf(currentres);
                i++;
                if (i >= resolutions.Count) i = 0;
                currentres = resolutions[i];
                updateButtons();
                windowresetneeded = true;
            };

            btnFullscreen = AddButton(96);
            btnFullscreen.OnClick += (sender) =>
            {
                currentfs = !currentfs;
                updateButtons();
                windowresetneeded = true;
            };

            btnHotkeys = AddButton(122);
            btnHotkeys.OnClick += (sender) =>
            {
                hotkeys = !hotkeys;
                updateButtons();
            };

            btnDynamicBackgrounds = AddButton(148);
            btnDynamicBackgrounds.OnClick += (sender) =>
            {
                backgrounds = !backgrounds;
                updateButtons();
            };

            btnAchievePopups = AddButton(174);
            btnAchievePopups.OnClick += (sender) =>
            {
                achievementPopups = !achievementPopups;
                updateButtons();
            };

            btnWindowFocusPause = AddButton(200);
            btnWindowFocusPause.OnClick += (sender) =>
            {
                autoPause = !autoPause;
                updateButtons();
            };
            updateButtons();

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }