Inheritance: MonoBehaviour
Exemplo n.º 1
0
 /// <summary>
 /// Hides the component given from being rendered.
 /// </summary>
 /// <param name="comp">The component to hide.</param>
 public void HideComponent(HudComponent comp)
 {
     if (!_hiddenComponents.Contains(comp))
     {
         _hiddenComponents.Add(comp);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Unhides the component, and will render it again.
 /// </summary>
 /// <param name="comp">The component to stop hiding.</param>
 public void ShowComponent(HudComponent comp)
 {
     if (_hiddenComponents.Contains(comp))
     {
         _hiddenComponents.Remove(comp);
     }
 }
Exemplo n.º 3
0
        public RheinwerkGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            // Fenstergrösse festlegen.
            graphics.PreferredBackBufferHeight = 2000;
            graphics.PreferredBackBufferWidth  = 3000;

            // Objektinstanzen erzeugen
            Input             = new InputComponent(this);
            Input.UpdateOrder = 0;

            Scene             = new SceneComponent(this);
            Scene.UpdateOrder = 2;
            Scene.DrawOrder   = 0;

            Simulation             = new SimulationComponent(this);
            Simulation.UpdateOrder = 1;

            // Komponenten hinzufügen
            Components.Add(Input);
            Components.Add(Scene);
            Components.Add(Simulation);

            // Update Order bestimmt in welcher Reihenfolge die Komponenten gemalt werden
            Input.UpdateOrder      = 0;
            Simulation.UpdateOrder = 1;
            Scene.UpdateOrder      = 2;

            Hud             = new HudComponent(this);
            Hud.UpdateOrder = 3;
            Hud.DrawOrder   = 1;
            Components.Add(Hud);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Unhides the component, and will render it again.
 /// </summary>
 /// <param name="comp">The component to stop hiding.</param>
 public void ShowComponent(HudComponent comp)
 {
     Screen.Hud.ShowComponentThisFrame(comp);
     if (_hiddenComponents.Contains(comp))
     {
         _hiddenComponents.Remove(comp);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Hides the component given from being rendered.
 /// </summary>
 /// <param name="comp">The component to hide.</param>
 public void HideComponent(HudComponent comp)
 {
     Screen.Hud.HideComponentThisFrame(comp);
     if (!_hiddenComponents.Contains(comp))
     {
         _hiddenComponents.Add(comp);
     }
 }
Exemplo n.º 6
0
        public RheinwerkGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            IsMouseVisible        = true;

            Input             = new InputComponent(this);
            Input.UpdateOrder = 0;
            Components.Add(Input);

            Screen             = new ScreenComponent(this);
            Screen.UpdateOrder = 1;
            Screen.DrawOrder   = 2;
            Components.Add(Screen);

            Local             = new LocalComponent(this);
            Local.UpdateOrder = 2;
            Components.Add(Local);

            var client = new ClientComponent(this);

            Client             = client;
            client.UpdateOrder = 3;
            Components.Add(client);

            var server = new ServerComponent(this);

            Server             = server;
            server.UpdateOrder = 4;
            Components.Add(server);

            Simulation             = new SimulationComponent(this);
            Simulation.UpdateOrder = 5;
            Components.Add(Simulation);

            Scene             = new SceneComponent(this);
            Scene.UpdateOrder = 6;
            Scene.DrawOrder   = 0;
            Components.Add(Scene);

            Hud             = new HudComponent(this);
            Hud.UpdateOrder = 7;
            Hud.DrawOrder   = 1;
            Components.Add(Hud);

            Music             = new MusicComponent(this);
            Music.UpdateOrder = 8;
            Components.Add(Music);

            Sound             = new SoundComponent(this);
            Sound.UpdateOrder = 9;
            Components.Add(Sound);

            // Einstellungen laden
            Settings = Settings.LoadSettings();
        }
Exemplo n.º 7
0
        public void AddHudComponent(HudComponent hudComponent)
        {
            if (hudLayer != -1)
            {
                hudComponent.setLayer(hudLayer);
            }

            hudComponent.hud = this;
            hudComponent.transform.SetParent(transform, false);

            hudComponents.Add(hudComponent);
        }
Exemplo n.º 8
0
        public override void OnStart()
        {
            Unit unit = UnitFactory.CreateUnit(m_Res, m_ID, m_UnitType);

            unit.gameObject.name = "Unit_" + m_Name;
            unit.SetName(m_Name);
            unit.EulerAngles = m_EulerAngles;
            unit.Position    = m_Position;
            unit.SetAttr(AttrType.Hp, m_Hp);
            unit.SetAttr(AttrType.HpMax, m_HpMax);
            HudComponent hudComponent = unit.gameObject.AddComponent <HudComponent>();

            hudComponent.SetOwner(unit);
            Node.Status = ENodeStatus.Succeed;
        }
 public RheinWerkGameWindows()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     Input             = new InputComponent(this);
     Input.UpdateOrder = 0;
     Components.Add(Input);
     Simulation             = new SimulationComponent(this);
     Simulation.UpdateOrder = 1;
     Components.Add(Simulation);
     Scene             = new SceneComponent(this);
     Scene.UpdateOrder = 2;
     Components.Add(Scene);
     Hud             = new HudComponent(this);
     Hud.UpdateOrder = 3;
     Hud.DrawOrder   = 1;
     Components.Add(Hud);
 }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < 4; i++)
        {
            if (i > characters.Count - 1)
            {
                huds [i].SetActive(false);
            }
            else
            {
                huds [i].SetActive(true);

                RLCharacter  c  = characters [i];
                HudComponent hc = huds [i].GetComponent <HudComponent> ();
                hc.portrait.GetComponent <SpriteRenderer> ().sprite = GetSprite(c.name);
                for (int h = 0; h < 4; h++)
                {
                    if (c.health > h)
                    {
                        hc.hearts [h].GetComponent <SpriteRenderer> ().sprite = GetSprite("health");
                    }
                    else
                    {
                        hc.hearts [h].GetComponent <SpriteRenderer> ().sprite = GetSprite("health_empty");
                    }
                }
                for (int h = 0; h < 5; h++)
                {
                    if (c != null && c.GetComponent <ActionCounter>().actionsRemaining > h)
                    {
                        hc.potions [h].GetComponent <SpriteRenderer> ().sprite = GetSprite("action");
                    }
                    else
                    {
                        hc.potions [h].GetComponent <SpriteRenderer> ().sprite = GetSprite("action_empty");
                    }
                }
            }
        }
    }
Exemplo n.º 11
0
 /// <summary>
 /// Draws the specified <see cref="HudComponent"/> this frame.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/></param>
 ///<remarks>This will only draw the <see cref="HudComponent"/> if the <see cref="HudComponent"/> can be drawn</remarks>
 public static void ShowComponentThisFrame(HudComponent component)
 {
     Function.Call(Hash.SHOW_HUD_COMPONENT_THIS_FRAME, component);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Check if a certain component is visible
 /// </summary>
 public bool IsHudComponentVisible(HudComponent component)
 {
     return(MtaClient.IsPlayerHudComponentVisible(component.ToString().ToLower()));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Set the visibility of a Hud component
 /// </summary>
 public bool SetHudComponentVisible(HudComponent component, bool visible)
 {
     return(MtaClient.SetPlayerHudComponentVisible(component.ToString().ToLower(), visible));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Hides the specified <see cref="HudComponent"/> this frame.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to hide.</param>
 public static void HideComponentThisFrame(HudComponent component)
 {
     NativeFunction.Natives.HIDE_HUD_COMPONENT_THIS_FRAME((int)component);
 }
Exemplo n.º 15
0
 public UiElement(HudComponent hud)
 {
     Hud = hud;
 }
Exemplo n.º 16
0
 public static void HideHudComponentThisFrame(HudComponent component) => Function.Call(Hash.HIDE_HUD_COMPONENT_THIS_FRAME, (InputArgument)(Enum)component);
Exemplo n.º 17
0
 public PanelControl(HudComponent hud)
     : base(hud)
 {
     Tiles = true;
 }
Exemplo n.º 18
0
            public MenuItemHudComponent(Client client, Menu owner, string label, HudComponent comp, bool isChecked = false, int priority = -1) : base(client, owner, label, isChecked, priority)
            {
                Component = comp;

                IsChecked = () => !DisabledComponents.Contains(Component);
            }
Exemplo n.º 19
0
 /// <summary>
 /// Set the visibility of a Hud component
 /// </summary>
 public bool SetHudComponentVisible(HudComponent component, bool visible)
 {
     return(MtaServer.SetPlayerHudComponentVisible(element, component.ToString().ToLower(), visible));
 }
Exemplo n.º 20
0
 public Control(HudComponent hud)
 {
     Hud = hud;
     Enabled = true;
     Visible = true;
 }
Exemplo n.º 21
0
 public Screen(HudComponent hud)
     : base(hud)
 {
     RequiresPointer = true;
 }
Exemplo n.º 22
0
 public MiniMap(HudComponent hud)
     : base(hud)
 {
 }
 public static void ShowHudComponentThisFrame(HudComponent component)
 {
     InputArgument[] arguments = new InputArgument[] { component };
     Function.Call(Hash.SHOW_HUD_COMPONENT_THIS_FRAME, arguments);
 }
 public static bool IsHudComponentActive(HudComponent component)
 {
     InputArgument[] arguments = new InputArgument[] { component };
     return(Function.Call <bool>(Hash.IS_HUD_COMPONENT_ACTIVE, arguments));
 }
Exemplo n.º 25
0
    protected override void OnUpdate()
    {
        base.OnUpdate();
        if (!this.m_OrigPosInitialised)
        {
            this.StoreControlsOrigPositions();
            this.UpdateControlsPosition();
            this.m_OrigPosInitialised = true;
        }
        float num           = TimeManager.TimeSinceLevelLoad(true);
        bool  flag          = (this.Last400msUpdate < 1E-05f) || ((num - this.Last400msUpdate) >= 0.4f);
        int   length        = this.m_HudComponents.Length;
        float realDeltaTime = TimeManager.RealDeltaTime;

        for (int i = 0; i < length; i++)
        {
            HudComponent component = this.m_HudComponents[i] as HudComponent;
            if ((component != null) && component.IsEnabled())
            {
                component.HudUpdate(realDeltaTime);
                float num5  = num - this.m_Last100msUpdate[i];
                bool  flag2 = num5 >= 0.1f;
                if (flag2)
                {
                    component.HudUpdate100ms();
                }
                if (flag)
                {
                    component.HudUpdate400ms();
                }
                if (flag2)
                {
                    num5 -= ((float)Mathf.FloorToInt(num5 * 10f)) / 10f;
                    this.m_Last100msUpdate[i] = num - num5;
                }
            }
        }
        if (flag)
        {
            float num6 = (num - this.Last400msUpdate) - 0.4f;
            if ((num6 > 0.4f) || (num6 < 0f))
            {
                this.Last400msUpdate = num;
            }
            else
            {
                this.Last400msUpdate = num - num6;
            }
            if (InputManager.IsGamepadConnected)
            {
                this.hudActions.Enable(HudComponent.EnableLayer.Gamepad, false);
                this.hudMoveControl.Enable(HudComponent.EnableLayer.Gamepad, false);
            }
            else
            {
                this.hudActions.Enable(HudComponent.EnableLayer.Gamepad, true);
                this.hudMoveControl.Enable(HudComponent.EnableLayer.Gamepad, true);
            }
        }
        if (Game.Instance != null)
        {
            if (NvidiaShield.IsShield() || (this.NoTouchForSec(10f) && UnityGpad.IsGamepadConnectedCached()))
            {
                this.EnableActionControls(false);
            }
            else
            {
                this.EnableActionControls(true);
            }
        }
    }
Exemplo n.º 26
0
 /// <summary>
 /// Determines whether a given <see cref="HudComponent"/> is active.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to check</param>
 /// <returns><c>true</c> if the <see cref="HudComponent"/> is active; otherwise, <c>false</c></returns>
 public static bool IsComponentActive(HudComponent component)
 {
     return(Function.Call <bool>(Hash.IS_HUD_COMPONENT_ACTIVE, component));
 }
Exemplo n.º 27
0
 public Toolbar(HudComponent hud)
     : base(hud)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// Draws the specified <see cref="HudComponent"/> this frame.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/></param>
 ///<remarks>This will only draw the <see cref="HudComponent"/> if the <see cref="HudComponent"/> can be drawn</remarks>
 public static void ShowComponentThisFrame(HudComponent component)
 {
     API.ShowHudComponentThisFrame((int)component);
 }
Exemplo n.º 29
0
 /// <summary>
 /// Hides the specified <see cref="HudComponent"/> this frame.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to hide.</param>
 public static void HideComponentThisFrame(HudComponent component)
 {
     Function.Call(Hash.HIDE_HUD_COMPONENT_THIS_FRAME, component);
 }
Exemplo n.º 30
0
 public DebugInfos(HudComponent hud)
     : base(hud)
 {
     framebuffer = new float[buffersize];
 }
Exemplo n.º 31
0
 /// <summary>
 /// Determines whether a given <see cref="HudComponent"/> is Active.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to check</param>
 /// <returns><c>true</c> if the <see cref="HudComponent"/> is Active; otherwise, <c>false</c></returns>
 public static bool IsComponentActive(HudComponent component)
 {
     return(API.IsHudComponentActive((int)component));
 }
Exemplo n.º 32
0
 public InventoryScreen(HudComponent hud)
     : base(hud)
 {
 }
Exemplo n.º 33
0
 /// <summary>
 /// Hides the specified <see cref="HudComponent"/> this frame.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to hide.</param>
 public static void HideComponentThisFrame(HudComponent component)
 {
     API.HideHudComponentThisFrame((int)component);
 }
Exemplo n.º 34
0
 public Compass(HudComponent hud)
     : base(hud)
 {
 }
Exemplo n.º 35
0
 public static bool IsHudComponentActive(HudComponent component) => Function.Call <bool>(Hash.IS_HUD_COMPONENT_ACTIVE, (InputArgument)(Enum)component);
Exemplo n.º 36
0
 /// <summary>
 /// Determines whether a given <see cref="HudComponent"/> is active.
 /// </summary>
 /// <param name="component">The <see cref="HudComponent"/> to check</param>
 /// <returns><c>true</c> if the <see cref="HudComponent"/> is active; otherwise, <c>false</c></returns>
 public static bool IsComponentActive(HudComponent component)
 {
     return(NativeFunction.Natives.IS_HUD_COMPONENT_ACTIVE <bool>((int)component));
 }
Exemplo n.º 37
0
 public static HudComponentVisiblePacket CreateShowHudComponentPacket(HudComponent hudComponent, bool show)
 {
     return(new HudComponentVisiblePacket((byte)hudComponent, show));
 }
Exemplo n.º 38
0
 public Control(HudComponent hud)
     : base(hud)
 {
     Enabled = true;
     Visible = true;
 }