public static void AppendDangerousTerrainText(MoveStatusPreview __instance, AbstractActor actor, Vector3 worldPos)
 {
     try {
         MapTerrainDataCell cell = Combat.EncounterLayerData.GetCellAt(worldPos).relatedTerrainCell;
         bool isLandingZone      = SplatMapInfo.IsDropshipLandingZone(cell.terrainMask),
              isDangerous        = SplatMapInfo.IsDangerousLocation(cell.terrainMask);
         if (!isLandingZone && !isDangerous)
         {
             return;
         }
         DesignMaskDef mask = Combat.MapMetaData.GetPriorityDesignMask(cell);
         if (mask == null)
         {
             return;
         }
         string title = mask.Description.Name, text = mask.Description.Details;
         CombatUIConstantsDef desc = Combat.Constants.CombatUIConstants;
         if (isDangerous)
         {
             title += " <#FF0000>(" + desc.DangerousLocationDesc.Name + ")";
             text  += " <#FF0000>" + desc.DangerousLocationDesc.Details;
             if (isLandingZone)
             {
                 text += " " + desc.DrophipLocationDesc.Details;
             }
         }
         else
         {
             title += " <#FF0000>(" + desc.DrophipLocationDesc.Name + ")";
             text  += " <#FF0000>" + desc.DrophipLocationDesc.Details;
         }
         CombatHUDInfoSidePanel sidePanel = (CombatHUDInfoSidePanel)SidePanelProp?.GetValue(__instance, null);
         sidePanel?.ForceShowSingleFrame(new Text(title), new Text(text), null, false);
     }                 catch (Exception ex) { Error(ex); }
 }
Exemplo n.º 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();
            }

            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;
        }
Exemplo n.º 3
0
        public static void CombatHUD_Init_Postfix(CombatHUD __instance, CombatGameState Combat)
        {
            Mod.Log.Trace?.Write("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?.Write("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?.Write($"CombatChatModule pos: {CombatLog.combatChatModule.gameObject.transform.position}");
            Mod.Log.Info?.Write($"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?.Write($"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?.Write($"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?.Write($"ChatButton new  pos: {newPos}");
            }
            else
            {
                Mod.Log.Info?.Write("Could not find chatButton to change position!");
            }

            combat = Combat;
        }