public QuickMenuPage(QuickMenuTab menuTab, Transform menuObject) { MenuObject = new GameObject(menuTab.TabName + " Page"); MenuObject.transform.parent = menuObject; MenuObject.AddComponent <Canvas>(); MenuObject.AddComponent <GraphicRaycaster>(); MenuObject.AddComponent <CanvasGroup>(); }
private static void HandleMenuTabCreation(Transform newMenu) { if (EyeTab != null) { Object.Destroy(EyeTab.TabObject); } if (MouthTab != null) { Object.Destroy(MouthTab.TabObject); } var newTabs = Object.Instantiate(OriginalTabsObject, OriginalTabsObject.transform.parent, true); newTabs.name = "SRanipalTabs"; newTabs.transform.localScale = OriginalTabsObject.transform.localScale; newTabs.transform.localPosition = OriginalTabsObject.transform.localPosition; newTabs.transform.localRotation = OriginalTabsObject.transform.localRotation; //Strip away notification menu scripts and instantiate top buttons for (var i = 0; i < newTabs.transform.GetChildCount(); i++) { var tab = newTabs.transform.GetChild(i).gameObject; switch (tab.gameObject.name) { case "InvitesTab": EyeTab = new QuickMenuTab(tab.gameObject, "Eye Tracking", "View the Eye Tracking Menu", null, () => new Thread(() => SRanipalTrack.Initialize(true, false)).Start()); EyeTab.TabEnabled = SRanipalTrack.EyeEnabled; // Catch up with SRanipal break; case "FriendRequestsTab": MouthTab = new QuickMenuTab(tab.gameObject, "Mouth Tracking", "View the Mouth Tracking Menu", null, () => SRanipalTrack.Initialize(false, true)); MouthTab.TabEnabled = SRanipalTrack.FaceEnabled; // Catch up with SRanipal break; default: Object.Destroy(tab.gameObject); continue; } } newTabs.transform.parent = newMenu; //if (EyeTab.TabEnabled) //HandlePageCreation(EyeTab, newMenu); }
private static void HandlePageCreation(QuickMenuTab menuTab, Transform menuObject) { var newPage = new QuickMenuPage(menuTab, menuObject); newPage.CreateMenuButton("DoAThing", new Vector2(0, 0), () => MelonLogger.Msg("BUTTON PRESS")); }