protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("CreateCharRaceSelect: Could not load native texture.");
            }

            // Load picker colours
            racePickerBitmap = DaggerfallUI.GetImgBitmap(racePickerImgName);

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Add "Please select your home province..." prompt
            promptLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 16), TextManager.Instance.GetLocalizedText("pleaseSelectYourHomeProvince"), NativePanel);
            promptLabel.HorizontalAlignment = HorizontalAlignment.Center;
            promptLabel.TextColor           = DaggerfallUI.DaggerfallDefaultTextColor;
            promptLabel.ShadowColor         = DaggerfallUI.DaggerfallDefaultShadowColor;
            promptLabel.ShadowPosition      = DaggerfallUI.DaggerfallDefaultShadowPos;

            // Handle clicks
            NativePanel.OnMouseClick += ClickHandler;
        }
Example #2
0
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallTravelMap: Could not load native texture.");
            }

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Populate the offset dict
            PopulateRegionOffsetDict();

            // Don't allow automatic cancel, we will handle this locally
            AllowCancel = false;

            // Load picker colours
            regionPickerBitmap = DaggerfallUI.GetImgBitmap(regionPickerImgName);

            // Add region label
            regionLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 2), string.Empty, NativePanel);
            regionLabel.HorizontalAlignment = HorizontalAlignment.Center;

            // Handle clicks
            NativePanel.OnMouseClick += ClickHandler;

            // Setup buttons for first time
            LoadButtonTextures();
            SetupButtons();
            UpdateSearchButtons();

            // Region overlay panel
            regionTextureOverlayPanel         = DaggerfallUI.AddPanel(regionTextureOverlayPanelRect, NativePanel);
            regionTextureOverlayPanel.Enabled = false;

            // Location cluster panel
            locationClusterPanel = DaggerfallUI.AddPanel(regionTextureOverlayPanelRect, regionTextureOverlayPanel);
            locationClusterPanel.HorizontalAlignment = HorizontalAlignment.Left;
            locationClusterPanel.VerticalAlignment   = VerticalAlignment.Top;

            // Location cluster will be updated when user opens a region
            locationClusterColors             = new Color32[(int)regionTextureOverlayPanelRect.width * (int)regionTextureOverlayPanelRect.height];
            locationClusterTexture            = new Texture2D((int)regionTextureOverlayPanelRect.width, (int)regionTextureOverlayPanelRect.height);
            locationClusterTexture.filterMode = DaggerfallUI.Instance.GlobalFilterMode;

            // Overlay to identify player region
            identifyRegionOverlayTexture = CreatePlayerRegionOverlayTexture();

            // Identify region panel is displayed to show user what region they are in
            identifyRegionPanel                   = new Panel();
            identifyRegionPanel.Position          = new Vector2(0, 0);
            identifyRegionPanel.Size              = NativePanel.Size;
            identifyRegionPanel.BackgroundTexture = identifyRegionOverlayTexture;
            identifyRegionPanel.Enabled           = false;
            NativePanel.Components.Add(identifyRegionPanel);
        }