void DrawTrashAdminView()
        {
            float metric;
            var   state = MyTrashRemoval.GetTrashState(m_grid, MyTrashRemoval.PreviewSettings);
            var   color = Color.Green;
            var   aabb  = m_grid.PositionComp.WorldAABB;

            if (state != MyTrashRemovalFlags.None)
            {
                color = Color.Red;
                string name = MyTrashRemoval.GetName(state);

                if (state == MyTrashRemovalFlags.WithBlockCount)
                {
                    name = string.Format(name, MyTrashRemoval.PreviewSettings.BlockCountThreshold);
                    if (m_grid.BlocksCount < MyTrashRemoval.PreviewSettings.BlockCountThreshold)
                    {
                        color = Color.Green;
                    }
                }
                else if (state == MyTrashRemovalFlags.DistanceFromPlayer)
                {
                    name = string.Format(name, MyTrashRemoval.PreviewSettings.PlayerDistanceThreshold);
                }

                MyRenderProxy.DebugDrawText3D(aabb.Center, name, color, 0.7f, false, VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }
            MyRenderProxy.DebugDrawAABB(aabb, color, 1, 1, false);
        }
示例#2
0
        static void RemoveTrash_Implementation(MyTrashRemovalSettings settings, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyTrashRemoval.Apply(settings, operation);
        }
示例#3
0
        void RecalcTrash()
        {
            if (Sync.IsServer == false)
            {
                MyMultiplayer.RaiseStaticEvent(x => UploadSettingsToServer, MyTrashRemoval.PreviewSettings);
            }
            int num = MyTrashRemoval.Calculate(MyTrashRemoval.PreviewSettings);

            m_labelNumVisible.TextToDraw.Clear().ConcatFormat(MyTexts.GetString(MyCommonTexts.ScreenDebugAdminMenu_NumberOfLocalTrash), num);
        }
示例#4
0
        static void RemoveEntity_Implementation(long entityId, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyEntity entity;

            if (MyEntities.TryGetEntityById(entityId, out entity))
            {
                MyTrashRemoval.ApplyOperation(entity, operation);
            }
        }
示例#5
0
文件: Fighter.cs 项目: Cheetah97/EEM
        float DangerIndex(Ingame.MyDetectedEntityInfo Enemy)
        {
            if (Enemy.Type == Ingame.MyDetectedEntityType.CharacterHuman)
            {
                return(Distance(Enemy) < 100 ? 100 : 10);
            }
            if (!Enemy.IsGrid())
            {
                return(0);
            }

            float       DangerIndex = 0;
            IMyCubeGrid EnemyGrid   = Enemy.GetGrid();

            if (MyTrashRemoval.IsTrash(EnemyGrid as MyEntity))
            {
                return(0);
            }

            List <IMySlimBlock> EnemySlimBlocks = new List <IMySlimBlock>();

            EnemyGrid.GetBlocks(EnemySlimBlocks, x => x.FatBlock != null && x.FatBlock is IMyTerminalBlock);
            List <IMyTerminalBlock> EnemyBlocks = EnemySlimBlocks.Select(x => x.FatBlock as IMyTerminalBlock).ToList();

            DangerIndex += EnemyBlocks.Count(x => x is IMyLargeMissileTurret) * 300;
            DangerIndex += EnemyBlocks.Count(x => x is IMyLargeGatlingTurret) * 100;
            DangerIndex += EnemyBlocks.Count(x => x is IMySmallMissileLauncher) * 400;
            DangerIndex += EnemyBlocks.Count(x => x is IMySmallGatlingGun) * 250;
            DangerIndex += EnemyBlocks.Count(x => x is IMyLargeInteriorTurret) * 40;

            if (Enemy.Type == Ingame.MyDetectedEntityType.LargeGrid)
            {
                DangerIndex *= 2.5f;
            }
            return(DangerIndex);
        }
示例#6
0
        protected void AddTrashCheckbox(MyTrashRemovalFlags flag, bool enabled, List <MyGuiControlBase> controlGroup = null, Vector4?color = null, Vector2?checkBoxOffset = null)
        {
            string name = string.Format(MyTrashRemoval.GetName(flag), String.Empty);

            AddCheckBox(name, (MyTrashRemoval.PreviewSettings.Flags & flag) == flag, c => OnFlagChanged(flag, c.IsChecked), enabled, controlGroup, color, checkBoxOffset);
        }
示例#7
0
        void RecalcTrash()
        {
            int num = MyTrashRemoval.Calculate(MyTrashRemoval.PreviewSettings);

            m_labelNumVisible.TextToDraw.Clear().ConcatFormat(MyTexts.GetString(MyCommonTexts.ScreenDebugAdminMenu_NumberOfLocalTrash), num);
        }