Beispiel #1
0
        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);
        }
Beispiel #2
0
        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!");
            }
        }