public MyGuiScreenSecurityControlHUB(MySmallShip useBy, MyPrefabSecurityControlHUB prefabSecurityControlHUB)
            : base(new Vector2(0.505f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.57f, 0.96f), true, MyGuiManager.GetHubBackground())
        {
            AddCaption(MyTextsWrapperEnum.SecurityControlHUB, new Vector2(0, 0.005f));

            m_prefabSecurityControlHUB = prefabSecurityControlHUB;
            m_useBy = useBy;
            m_entitiesGui = new List<MyGuiControlEntityUse>();
            RecreateControls(true);

            /*
            Controls.Add(new MyGuiControlButton(this, new Vector2(0f, 0.45f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Exit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnExitClick,
                MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
             * */

            MyGuiScreenGamePlay.Static.ReleasedControlOfEntity += OnGameReleasedControlOfEntity;
            MyGuiScreenGamePlay.Static.RollLeftPressed += OnSwitchPrevious;
            MyGuiScreenGamePlay.Static.RollRightPressed += OnSwitchNext;
            MySession.PlayerShip.OnDie += OnPlayerShipDie;
            MySession.Static.Player.AliveChanged += Player_AliveChanged;
            m_prefabSecurityControlHUB.OnEntityDisconnected += m_prefabSecurityControlHUB_OnEntityDisconnected;
        }
Exemplo n.º 2
0
        /// <summary>
        /// CreatePrefab
        /// </summary>
        /// <param name="hudLabelText"></param>
        /// <param name="objBuilder"></param>
        /// <returns></returns>
        public MyPrefabBase CreatePrefab(string hudLabelText, MyPrefabContainer prefabContainer, MyMwcObjectBuilder_PrefabBase prefabBuilder)
        {
            Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyPrefabFactory.CreatePrefab");

            MyPrefabConfiguration config = MyPrefabConstants.GetPrefabConfiguration(prefabBuilder.GetObjectBuilderType(), prefabBuilder.GetObjectBuilderId().Value);
            Vector3 relativePosition = MyPrefabContainer.GetRelativePositionInAbsoluteCoords(prefabBuilder.PositionInContainer);
            Matrix prefabLocalOrientation = Matrix.CreateFromYawPitchRoll(prefabBuilder.AnglesInContainer.X, prefabBuilder.AnglesInContainer.Y, prefabBuilder.AnglesInContainer.Z);

            MyPrefabBase prefab = null;
            if (config is MyPrefabConfigurationKinematic)
            {
                prefab = new MyPrefabKinematic(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLight)
            {
                prefab = new MyPrefabLight(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLargeWeapon)
            {
                prefab = new MyPrefabLargeWeapon(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationSound)
            {
                prefab = new MyPrefabSound(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationParticles)
            {
                prefab = new MyPrefabParticles(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLargeShip)
            {
                prefab = new MyPrefabLargeShip(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationHangar)
            {
                prefab = new MyPrefabHangar(prefabContainer);                
            }
            else if(config is MyPrefabConfigurationFoundationFactory)
            {
                prefab = new MyPrefabFoundationFactory(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationSecurityControlHUB) 
            {
                prefab = new MyPrefabSecurityControlHUB(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationBankNode) 
            {
                prefab = new MyPrefabBankNode(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationGenerator) 
            {
                prefab = new MyPrefabGenerator(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationScanner) 
            {
                prefab = new MyPrefabScanner(prefabContainer);
            }
            else if (config is MyPrefabConfigurationCamera)
            {
                prefab = new MyPrefabCamera(prefabContainer);
            }
            else if (config is MyPrefabConfigurationAlarm)
            {
                prefab = new MyPrefabAlarm(prefabContainer);
            }            
            else
            {
                prefab = new MyPrefab(prefabContainer);
                //prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);
            }
            prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);

            Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            return prefab;
        }
 public MyGuiScreenEditorSecurityControlHUB(MyPrefabSecurityControlHUB prefabSecurityControlHUB)
     : base(prefabSecurityControlHUB, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.SecurityControlHUB)
 {
     Init();
 }