private static bool DrawTilesHomePatch(ItemSpawnerUI __instance) { ItemSpawnerDataObject data = __instance.GetComponent <ItemSpawnerDataObject>(); List <ItemSpawnerCategoryDefinitions.Category> cats = GetVisibleCategories(); int displayIndex = 0; for (int i = data.currHomePage * 10; i < cats.Count && displayIndex < 10; i++) { if (IM.CD.ContainsKey(IM.CDefs.Categories[i].Cat)) { __instance.Tiles_SelectionPage[displayIndex].gameObject.SetActive(true); __instance.Tiles_SelectionPage[displayIndex].Image.sprite = cats[i].Sprite; __instance.Tiles_SelectionPage[displayIndex].Text.text = cats[i].DisplayName; __instance.Tiles_SelectionPage[displayIndex].Category = cats[i].Cat; __instance.Tiles_SelectionPage[displayIndex].LockedCorner.gameObject.SetActive(false); displayIndex += 1; } } for (int i = displayIndex; i < __instance.Tiles_SelectionPage.Length; i++) { __instance.Tiles_SelectionPage[i].gameObject.SetActive(false); } return(false); }
private static bool SetModeCategoryPatch(ItemSpawnerUI __instance) { ItemSpawnerDataObject data = __instance.GetComponent <ItemSpawnerDataObject>(); __instance.m_curMode = ItemSpawnerUI.ItemSpawnerPageMode.Category; __instance.P_Tiles.SetActive(true); __instance.P_Details.SetActive(false); __instance.P_Vault.SetActive(false); __instance.B_Spawn.SetActive(false); __instance.B_Back.SetActive(true); __instance.B_Vault.SetActive(true); __instance.B_Scan.SetActive(false); __instance.T_TopBar.text = "HOME | " + IM.CDefInfo[__instance.m_curCategory].DisplayName; data.maxCategoryPage = GetMaxCategoryPage(IM.CDefInfo[__instance.m_curCategory]); if (data.currCategoryPage > data.maxCategoryPage) { data.currCategoryPage = data.maxCategoryPage; } if (data.maxCategoryPage > 0) { if (data.currCategoryPage == 0) { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(false); } else if (data.currCategoryPage == data.maxCategoryPage) { __instance.B_Next.SetActive(false); __instance.B_Prev.SetActive(true); } else { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(true); } __instance.B_PageIndicator.SetActive(true); } else { __instance.B_Next.SetActive(false); __instance.B_Prev.SetActive(false); __instance.B_PageIndicator.SetActive(false); } __instance.Draw_Tiles_Category(__instance.m_curCategory); __instance.ControlPoster.gameObject.SetActive(false); __instance.UpdatePageIndicator(data.currCategoryPage, data.maxCategoryPage); return(false); }
private static bool ButtonPressPrevPatch(ItemSpawnerUI __instance) { if (__instance.refireTick > 0f) { return(false); } if (__instance.m_curMode == ItemSpawnerUI.ItemSpawnerPageMode.Home) { ItemSpawnerDataObject data = __instance.GetComponent <ItemSpawnerDataObject>(); __instance.ButtonPress(1); data.currHomePage -= 1; if (data.currHomePage == 0) { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(false); } else { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(true); } __instance.UpdatePageIndicator(data.currHomePage, data.maxHomePage); __instance.Draw_Tiles_Home(); return(false); } else if (__instance.m_curMode == ItemSpawnerUI.ItemSpawnerPageMode.Category) { ItemSpawnerDataObject data = __instance.GetComponent <ItemSpawnerDataObject>(); __instance.ButtonPress(1); data.currCategoryPage -= 1; if (data.currCategoryPage == 0) { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(false); } else { __instance.B_Next.SetActive(true); __instance.B_Prev.SetActive(true); } __instance.UpdatePageIndicator(data.currCategoryPage, data.maxCategoryPage); __instance.Draw_Tiles_Category(__instance.m_curCategory); return(false); } return(true); }
private static void ButtonPressDetailPatch(int i, ItemSpawnerUI __instance) { if (__instance.m_IDSelectedForSpawn.Infographic != null) { __instance.ControlPoster.gameObject.SetActive(true); __instance.ControlPoster.material.SetTexture("_MainTex", __instance.m_IDSelectedForSpawn.Infographic.Poster); } }
private static bool StartPatch(ItemSpawnerUI __instance) { //Make sure previous data objects on this spawner are destroyed ItemSpawnerDataObject dupObject = __instance.gameObject.GetComponent <ItemSpawnerDataObject>(); if (dupObject != null) { OtherLogger.Log("Destroying duplicated ItemSpawnerDataObject", OtherLogger.LogType.General); UnityEngine.Object.Destroy(dupObject); } //Somehow, an extra canvas is created when loaded by Atlas, so we must clear all previous canvases as well Transform dupCanvas = __instance.transform.Find("LoadingTextCanvas"); if (dupCanvas != null) { OtherLogger.Log("Destroying duplicated progress canvas", OtherLogger.LogType.General); UnityEngine.Object.Destroy(dupCanvas.gameObject); } __instance.gameObject.AddComponent <ItemSpawnerDataObject>(); return(true); }
private static bool DrawTilesCategoryPatch(ItemSpawnerID.EItemCategory Category, ItemSpawnerUI __instance) { ItemSpawnerDataObject data = __instance.GetComponent <ItemSpawnerDataObject>(); List <ItemSpawnerCategoryDefinitions.SubCategory> subs = GetVisibleSubCategories(IM.CDefInfo[Category]); int displayIndex = 0; for (int i = data.currCategoryPage * 10; i < subs.Count && displayIndex < 10; i++) { if (IM.SCD.ContainsKey(IM.CDefSubs[Category][i].Subcat)) { __instance.Tiles_SelectionPage[displayIndex].gameObject.SetActive(true); __instance.Tiles_SelectionPage[displayIndex].Image.sprite = subs[i].Sprite; __instance.Tiles_SelectionPage[displayIndex].Text.text = subs[i].DisplayName; __instance.Tiles_SelectionPage[displayIndex].SubCategory = subs[i].Subcat; __instance.Tiles_SelectionPage[displayIndex].LockedCorner.gameObject.SetActive(false); displayIndex += 1; } } for (int i = displayIndex; i < __instance.Tiles_SelectionPage.Length; i++) { __instance.Tiles_SelectionPage[i].gameObject.SetActive(false); } return(false); }
// Add 20rnd mag to mp7 page private void ItemSpawnerUI_Draw_Tiles_Detail(On.FistVR.ItemSpawnerUI.orig_Draw_Tiles_Detail orig, ItemSpawnerUI self, ItemSpawnerID item) { if (item.ItemID == "PDW" + MP7_ID && item.Secondaries.Length <= 2) { AddFTWMagToItemSpawnerPage(item); } orig(self, item); }