Beispiel #1
0
 public static void CombatHUD_OnCombatGameDestroyed_Postfix()
 {
     Mod.Log.Info("Combat game destroyed, cleaning up");
     combat          = null;
     messageCenter   = null;
     _activeChatList = null;
     _views          = null;
 }
Beispiel #2
0
        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;
        }