public void Awake() { NGUITools.SetActiveSelf(m_saveGameController.gameObject, false); m_saveGameController.OnClose += HandleOnClose; m_saveGameController.OnLoadSaveGame += HandleOnLoadSaveGame; m_modMenu.OnClose += OnCloseModMenu; m_modMenu.OnLoadMod += HandleOnLoadMod; m_unlockContentManager.OnClose += OnUnlockContentClose; LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.MOD_LOADED, new EventHandler(OnModLoaded)); m_version.text = LocaManager.GetText("VERSION_NUMBER", "1.5-16336"); if (LegacyLogic.Instance.ModController.InModMode) { ModController.ModInfo currentMod = LegacyLogic.Instance.ModController.CurrentMod; if (currentMod != null) { m_version.text = currentMod.Name + " " + LocaManager.GetText("VERSION_NUMBER", currentMod.Version); } } InputManager.RegisterHotkeyEvent(EHotkeyType.OPEN_CLOSE_MENU, new EventHandler <HotkeyEventArgs>(OnCloseKeyPressed)); m_tooltipManager.Init(); m_options.CloseEvent += OnCloseOptionsMenu; if (PopupRequest.Instance != null) { PopupRequest.Instance.Destroy(); } m_popUpRequest.Init(); }
private void OnModLoaded(Object sender, EventArgs e) { ModController.ModInfo currentMod = LegacyLogic.Instance.ModController.CurrentMod; m_Mod.LoadDatabase(Path.Combine(currentMod.AssetFolder, "assets.db")); m_Mod.AssetBundleLoader.BaseAddress = currentMod.AssetFolder; Debug.Log("Mod loaded assetpath: " + currentMod.AssetFolder); }
private void OnFinishLoadScene(Object sender, EventArgs e) { Grid grid = LegacyLogic.Instance.MapLoader.Grid; Texture2D texture2D = null; String minimapName = grid.MinimapName; if (LegacyLogic.Instance.ModController.InModMode && !String.IsNullOrEmpty(minimapName)) { ModController.ModInfo currentMod = LegacyLogic.Instance.ModController.CurrentMod; String path = Path.Combine(currentMod.AssetFolder, minimapName + ".png"); if (File.Exists(path)) { if (m_ModMinimapTexture == null) { m_ModMinimapTexture = new Texture2D(1, 1, TextureFormat.RGBA32, false); m_ModMinimapTexture.hideFlags = HideFlags.DontSave; } Byte[] data = File.ReadAllBytes(path); if (m_ModMinimapTexture.LoadImage(data)) { texture2D = m_ModMinimapTexture; } } } if (texture2D == null) { Texture mainTexture = m_MapLayer.mainTexture; texture2D = Helper.ResourcesLoad <Texture2D>(minimapName, false); if (texture2D != mainTexture) { m_MapLayer.mainTexture = null; if (mainTexture != m_ModMinimapTexture) { mainTexture.UnloadAsset(); } } } m_MapLayer.mainTexture = texture2D; m_MapLayer.MakePixelPerfect(); Vector3 localPosition = m_MapLayer.transform.localPosition; localPosition.x = -12f + grid.MinimapOffsetX; localPosition.y = -12f + grid.MinimapOffsetY; m_MapLayer.transform.localPosition = localPosition; localPosition = m_GridLayer.transform.localPosition; localPosition.x = -12f; localPosition.y = -12f; m_GridLayer.transform.localPosition = localPosition; m_GridLayer.localScale = new Vector3(grid.Width * 24, grid.Height * 24, 1f); m_GridLayer.GetComponent <UITexture>().uvRect = new Rect(0f, 0f, grid.Width, grid.Height); Camera cachedCamera = m_MapCamera.cachedCamera; Color backgroundColor = (!(texture2D == null)) ? Color.black : Color.magenta; m_AreaCamera.camera.backgroundColor = backgroundColor; cachedCamera.backgroundColor = backgroundColor; OnSpiritBeaconUpdate(null, null); }
public void ClickedEntry(ModEntry p_modEntry) { if (m_selectedEntry != null) { m_selectedEntry.Unselect(); } m_selectedEntry = p_modEntry; if (m_selectedEntry != null) { m_selectedEntry.Select(); ModController.ModInfo modInfo = m_selectedEntry.ModInfo; m_modName.text = modInfo.Name; m_authorLabel.text = modInfo.Creators; m_versionLabel.text = modInfo.Version; m_descriptionLabel.SetInternalText(modInfo.Description); m_descriptionLabel.Show(); Texture texture = m_defaultTexture; if (!String.IsNullOrEmpty(modInfo.TitleImage)) { String path = Path.Combine(modInfo.ImageFolder, modInfo.TitleImage); if (File.Exists(path)) { if (m_createdModPreview == null) { m_createdModPreview = new Texture2D(1, 1, TextureFormat.RGBA32, false); m_createdModPreview.hideFlags = HideFlags.DontSave; } Byte[] data = File.ReadAllBytes(path); if (m_createdModPreview.LoadImage(data)) { texture = m_createdModPreview; } } } if (m_modTitleScreen.mainTexture != texture) { Texture mainTexture = m_modTitleScreen.mainTexture; m_modTitleScreen.mainTexture = texture; if (mainTexture != null && mainTexture != m_defaultTexture) { mainTexture.UnloadAsset(); } } } else { m_modName.text = "-"; m_authorLabel.text = "-"; m_versionLabel.text = "-"; m_descriptionLabel.SetInternalText(" "); m_descriptionLabel.Show(); } }
private void HandleOnLoadMod(Object sender, EventArgs e) { ModController.ModInfo currentMod = LegacyLogic.Instance.ModController.CurrentMod; if (currentMod != null) { m_version.text = currentMod.Name + " " + LocaManager.GetText("VERSION_NUMBER", currentMod.Version); } else { m_version.text = LocaManager.GetText("VERSION_NUMBER", "1.5-16336"); } OnResolutionChange(); }
private void SetupList() { ClearEntries(); List <ModController.ModInfo> modList = LegacyLogic.Instance.ModController.GetModList(); m_maxPage = (Int32)(modList.Count / (Single)m_entriesPerPage + 1f); if (modList.Count % m_entriesPerPage == 0) { m_maxPage--; } m_page = Math.Min(m_page, m_maxPage); if (modList.Count == 0) { NGUITools.SetActive(m_loadButton, false); m_pageLabel.text = String.Empty; } else { m_pageLabel.text = m_page + 1 + "/" + m_maxPage; NGUITools.SetActive(m_loadButton, true); } NGUITools.SetActive(m_nextPageButton, m_page < m_maxPage - 1); NGUITools.SetActive(m_previousPageButton, m_page > 0); Int32 num = 0; for (Int32 i = 0; i < modList.Count; i++) { ModController.ModInfo p_modInfo = modList[i]; if (num >= m_page * m_entriesPerPage) { GameObject gameObject = NGUITools.AddChild(m_modEntryList, m_modEntryPrefab); ModEntry component = gameObject.GetComponent <ModEntry>(); component.Init(this, p_modInfo); gameObject.transform.localPosition = new Vector3(0f, m_entries.Count * -42, -10f); m_entries.Add(component); } num++; if (num >= m_page * m_entriesPerPage + m_entriesPerPage) { break; } } if (m_entries.Count > 0) { ClickedEntry(m_entries[0]); } else { ClickedEntry(null); } }
private void OnResolutionChange() { EAspectRatio easpectRatio = GraphicsConfigManager.GetAspectRatio(); if (easpectRatio == EAspectRatio.None) { easpectRatio = EAspectRatio._4_3; } Texture mainTexture = (easpectRatio != EAspectRatio._4_3) ? m_backgroundTexture169 : m_backgroundTexture43; if (LegacyLogic.Instance.ModController.InModMode) { ModController.ModInfo currentMod = LegacyLogic.Instance.ModController.CurrentMod; if (!String.IsNullOrEmpty(currentMod.TitleImage)) { String path = Path.Combine(currentMod.ImageFolder, currentMod.TitleImage); if (File.Exists(path)) { if (m_createdBackground == null) { m_createdBackground = new Texture2D(1, 1, TextureFormat.ARGB32, false); m_createdBackground.hideFlags = HideFlags.DontSave; } Byte[] data = File.ReadAllBytes(path); if (m_createdBackground.LoadImage(data)) { mainTexture = m_createdBackground; } } } } m_background.mainTexture = mainTexture; if (easpectRatio == EAspectRatio._4_3) { m_background.transform.localScale = new Vector3(2048f, 1536f, 1f); } else { m_background.transform.localScale = new Vector3(2732f, 1536f, 1f); } }
public void Init(ModMenu p_controller, ModController.ModInfo p_modInfo) { m_controller = p_controller; m_modInfo = p_modInfo; m_label.text = p_modInfo.Name; }