public static void CombatHUD_OnCombatGameDestroyed_Postfix() { Mod.Log.Info("Combat game destroyed, cleaning up"); combat = null; messageCenter = null; _activeChatList = null; _views = null; }
public static bool CombatChatModule_OnChatMessage_Prefix(CombatChatModule __instance, MessageCenterMessage message, ActiveChatListView ____activeChatList, PassiveChatListView ____passiveChatList) { ChatMessage chatMessage = (ChatMessage)message; Mod.Log.Debug($"Chat message is: '{chatMessage.Message}'"); try { ____activeChatList.Add(chatMessage); ____activeChatList.ScrollToBottom(); ____activeChatList.Refresh(); } catch (Exception e) { Mod.Log.Error($"Failed to send a message:{e.Message}"); Mod.Log.Error($"{e.StackTrace}"); } return(false); }
static bool Prefix(CombatChatModule __instance, ActiveChatListView ____activeChatList) { //Mod.Log.Info(" -- CCM:Update:pre invoked"); // Invoke base.Update() CombatChatModule_UIModule_Update.Invoke(__instance); // Remove the [T] from the chat button Transform chatBtnT = __instance.gameObject.transform.Find("Representation/chat_panel/uixPrf_chatButton"); if (chatBtnT != null) { LocalizableText chatBtnLT = chatBtnT.GetComponentInChildren <LocalizableText>(); chatBtnLT.SetText(" "); } else { Mod.Log.Info("Could not find chat button"); } return(false); }
public static void CombatChatModule_CombatInit_Postfix(CombatChatModule __instance, MessageCenter ____messageCenter, HBSDOTweenButton ____chatBtn, HBSDOTweenButton ____muteBtn, HBS_InputField ____inputField, GameObject ____activeChatWindow, ActiveChatListView ____activeChatList, PassiveChatListView ____passiveChatList) { ____chatBtn.enabled = true; ____chatBtn.gameObject.SetActive(true); ____muteBtn.enabled = false; ____muteBtn.gameObject.SetActive(false); ____inputField.enabled = false; ____inputField.gameObject.SetActive(false); ____inputField.readOnly = true; // Hide the send button Transform sendButtonT = ____activeChatWindow.gameObject.transform.Find("uixPrf_genericButton"); if (sendButtonT != null) { sendButtonT.gameObject.SetActive(false); } else { Mod.Log.Info("Could not find send button to disable!"); } // Set the scroll spacing to 0 Transform scrollListT = ____activeChatWindow.gameObject.transform.Find("panel_history/uixPrfPanl_listView/ScrollRect/Viewport/List"); if (scrollListT != null) { VerticalLayoutGroup scrollListVLG = scrollListT.gameObject.GetComponent <VerticalLayoutGroup>(); scrollListVLG.spacing = 0; } else { Mod.Log.Info("Could not find scrollList to change spacing!"); } // Resize the image background Transform imageBackgroundT = ____activeChatWindow.gameObject.transform.Find("image_background"); if (imageBackgroundT != null) { RectTransform imageBackgroundRT = imageBackgroundT.gameObject.GetComponent <RectTransform>(); Rect ibRect = imageBackgroundRT.rect; Mod.Log.Info($"Background image size: {ibRect.height}h x {ibRect.width}"); Vector3 newPos = imageBackgroundRT.position; newPos.y += 20f; imageBackgroundRT.position = newPos; imageBackgroundRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, ibRect.height - 20); imageBackgroundRT.ForceUpdateRectTransforms(); } else { Mod.Log.Info("Could not find imageBackground to change size!"); } }
public static void CombatChatModule_Init_Postfix(CombatChatModule __instance, MessageCenter ____messageCenter, HBSDOTweenButton ____chatBtn, HBSDOTweenButton ____muteBtn, ActiveChatListView ____activeChatList) { ____chatBtn.enabled = false; ____chatBtn.gameObject.SetActive(false); ____muteBtn.enabled = false; ____muteBtn.gameObject.SetActive(false); ____messageCenter.AddSubscriber(MessageCenterMessageType.FloatieMessage, OnFloatie); messageCenter = ____messageCenter; }
public static void CombatHUD_Init_Postfix(CombatHUD __instance, CombatGameState Combat) { Mod.Log.Trace("CHUD:I:post - entered."); CombatLog.infoSidePanel = LazySingletonBehavior <UIManager> .Instance.GetOrCreateUIModule <CombatHUDInfoSidePanel>("", true); infoSidePanel.Init(); infoSidePanel.Visible = false; // Combat Chat module CombatLog.combatChatModule = LazySingletonBehavior <UIManager> .Instance.GetOrCreateUIModule <CombatChatModule>("", true); if (CombatLog.combatChatModule == null) { Mod.Log.Error("Error creating combat chat module"); } else { CombatLog.combatChatModule.CombatInit(); CombatLog.infoSidePanel.BumpUp(); clog_count = 1; _activeChatList = (ActiveChatListView)typeof(CombatChatModule).GetField("_activeChatList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(combatChatModule); _views = (IViewDataSource <ChatListViewItem>) typeof(ActiveChatListView).BaseType.GetField("_views", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(_activeChatList); } Mod.Log.Info($"CombatChatModule pos: {CombatLog.combatChatModule.gameObject.transform.position}"); Mod.Log.Info($"RetreatEscMenu pos: {__instance.RetreatEscMenu.gameObject.transform.position}"); Vector3 newPos = CombatLog.combatChatModule.gameObject.transform.position; newPos.x = __instance.RetreatEscMenu.gameObject.transform.position.x * 1.25f; newPos.y = __instance.RetreatEscMenu.gameObject.transform.position.y - 120f; //newPos.z = __instance.WeaponPanel.gameObject.transform.position.z; CombatLog.combatChatModule.gameObject.transform.position = newPos; Mod.Log.Info($"new CombatChatModule pos: {newPos}"); // Move the chat button into the menu Transform chatBtnT = CombatLog.combatChatModule.gameObject.transform.Find("Representation/chat_panel/uixPrf_chatButton"); Mod.Log.Info($"ChatButton base pos: {newPos}"); if (chatBtnT != null) { if (__instance.Combat.BattleTechGame.Simulation == null) { newPos.x -= 620f; // skirmish, no withdraw button } else { newPos.x -= 740f; // simgame, has withdraw button } newPos.y += 80f; chatBtnT.position = newPos; Mod.Log.Info($"ChatButton new pos: {newPos}"); } else { Mod.Log.Info("Could not find chatButton to change position!"); } combat = Combat; }