public InGameConsoleInterface(Transform menuCanvasTransform, GameObject notificationTab, AssetBundle bundle) { Singleton = this; _menuParentRoot = menuCanvasTransform.gameObject; // Instantiate var menuPrefab = bundle.LoadAsset <GameObject>("MLConsoleViewer"); var menuObject = Object.Instantiate(menuPrefab); // Fix Transforms menuObject.transform.parent = menuCanvasTransform; menuObject.transform.localPosition = Vector3.zero; menuObject.transform.localScale = Vector3.oneVector; menuObject.transform.localRotation = new Quaternion(0, 0, 0, 1); // Find Components _contentTransform = menuObject.transform.Find("Console/TextArea/MLConsole/Viewport/Content"); LogObject.ConsoleTextPrefab = bundle.LoadAsset <GameObject>("TextElement"); LogObject.ConsoleTextPrefab.transform.parent = menuObject.transform; LogObject.ConsoleTextPrefab.active = false; _latestLogObject = new LogObject(_contentTransform); // Unload Unused NotificationTab = new TabBadge(notificationTab); }
public static void PurgeAwaiting(InGameConsoleInterface consoleInterface) { foreach (var waitingLog in AwaitingLogs) { consoleInterface.AppendConsoleText(waitingLog); } AwaitingLogs.Clear(); }
private static void CreateNotificationTab(string name, string text, Color color) { IsInstantiating = true; var bundle = AssetBundle.LoadFromMemory(ExtractAb()); var quickMenu = GameObject.Find("UserInterface/QuickMenu"); // Tab var quickModeTabs = quickMenu.transform.Find("QuickModeTabs").GetComponent <MonoBehaviourPublicObCoGaCoObCoObCoUnique>(); var newTab = Object.Instantiate(quickModeTabs.transform.Find("NotificationsTab"), quickModeTabs.transform); var existingTabs = quickModeTabs.field_Public_ArrayOf_GameObject_0.ToList(); Object.DestroyImmediate(newTab.GetComponent <MonoBehaviourPublicGaTeSiSiUnique>()); newTab.name = name; SetTabIndex(newTab, quickModeTabs.field_Public_ArrayOf_GameObject_0.Count); newTab.Find("Badge").GetComponent <RawImage>().color = color; newTab.Find("Badge/NotificationsText").GetComponent <Text>().text = text; existingTabs.Add(newTab.gameObject); Resources.FindObjectsOfTypeAll <MonoBehaviourPublicObCoGaCoObCoObCoUnique>()[0].field_Public_ArrayOf_GameObject_0 = existingTabs.ToArray(); newTab.Find("Icon").GetComponent <Image>().sprite = LoadQmSprite(bundle); // Menu var quickModeMenus = quickMenu.transform.Find("QuickModeMenus"); var newMenu = new GameObject(name + "Menu", new Il2CppSystem.Type[] { Il2CppType.Of <RectTransform>() }).GetComponent <RectTransform>(); newMenu.SetParent(quickModeMenus, false); newMenu.anchorMin = new Vector2(0, 1); newMenu.anchorMax = new Vector2(0, 1); newMenu.sizeDelta = new Vector2(1680f, 1200f); newMenu.pivot = new Vector2(0.5f, 0.5f); newMenu.anchoredPosition = new Vector2(0, 200f); newMenu.gameObject.SetActive(false); var newConsole = new InGameConsoleInterface(newMenu, newTab.Find("Badge").gameObject, bundle); // Tab interaction var tabButton = newTab.GetComponent <Button>(); tabButton.onClick.RemoveAllListeners(); tabButton.onClick.AddListener((Action)(() => { QuickMenu.prop_QuickMenu_0.field_Private_GameObject_6.SetActive(false); QuickMenu.prop_QuickMenu_0.field_Private_GameObject_6 = newMenu.gameObject; newMenu.gameObject.SetActive(true); newConsole.NotificationTab.OnTabViewed(); })); newTab.transform.FindChild("Badge").gameObject.SetActive(false); IsInstantiating = false; }