public ViewModelBase(SWF.IWin32Window hiddenForm, RenderHost renderHost) { this.renderHost = renderHost; colorTextures = new ColorTextures(); textureCache = new TextureCache(colorTextures, renderHost); renderer = new Renderer.Renderer(hiddenForm, renderHost, colorTextures, textureCache); mapLoaded = false; cameraPanScale = 1.0f; cameraScrollScale = 1.0f; }
public static void Init() { // Always reset the UI callbacks on scene change SceneManager.activeSceneChanged += (_, __) => { ColorTextures.Clear(); UICallbacks.Clear(); // Only need these on the client BorderTexture = CreateFillTexture(Color.Lerp(ValheimColor, Color.white, 0.25f)); FrontTexture = CreateFillTexture(Color.Lerp(ValheimColor, Color.black, 0.5f)); BackTexture = CreateFillTexture(Color.Lerp(ValheimColor, Color.black, 0.85f)); BigTextStyle = null; // We are "resetting" this in-case it got invalidated. We can only actually create it in a GUI function NormalTextStyle = null; UI.Add("Debug Mode", () => { if (BetterContinents.AllowDebugActions) { UI.Text("Better Continents Debug Mode Enabled!", 10, 10, Color.red); if (Menu.IsVisible() || Minimap.instance.m_mode == Minimap.MapMode.Large) { DoDebugMenu(); } if (WindowVisible) { DebugUtils.Command.CmdUI.DrawSettingsWindow(); } } }); UI.Add("Active Hint", () => { //if (Game.instance && Game.instance.WaitingForRespawn())//(Hud.instance?.m_loadingScreen.isActiveAndEnabled ?? false) if (Menu.IsVisible() || Game.instance && Game.instance.WaitingForRespawn()) { if (BetterContinents.Settings.EnabledForThisWorld) { UI.DisplayMessage($"<color=gray><size=20><b>{ModInfo.Name} v{ModInfo.Version}</b>: <color=green>ENABLED</color> for this world</size></color>"); } else { UI.DisplayMessage($"<color=gray><size=20><b>{ModInfo.Name} v{ModInfo.Version}</b>: <color=#505050ff>DISABLED</color> for this world</size></color>"); } } }); }; }