public DefaultHUDState() { playerHUD = new HUDContainer(); Root.MouseUp += DefaultHUDState_MouseUp; Root.MouseDown += DefaultHUDState_MouseDown; SetupControls(); SetupGUI(); }
public InventoryHUDState(Inventory inv) { playerHUD = new HUDContainer(); // TODO: remove this reference this.inv = inv; SetupControls(); Game.onTargetInventoryOpen += onTargetInventoryOpen; Game.onTargetInventoryClosed += onTargetInventoryClosed; SetupGUI(); }
public CharHUDState() { playerHUD = new HUDContainer(); view = new CharView(); SetupControls(); var col = new Column() { playerHUD }; //col.RegisterChild(); Root.RegisterChild(col); // Root.RegisterChild(playerHUD); col = new Column() { view }; Root.RegisterChild(col); // Root.RegisterChild(view); SetupGUI(); }
/// <summary> /// Used with the docking mode toggle /// </summary> public void ToggleDockingMode() { if (dockingMode) { openWindowButton.interactable = true; openWindowButton.alpha = 1; dockingMode = false; containerPrefab = Resources.Load<ResizeableAndDraggableWindow>("GUI/Prefabs/PauseMenu/UIBuilder/ResizeContainer"); // Check which windows are empty and which are not List<HUDContainer> activeWindows = new List<HUDContainer>(); foreach (HUDContainer w in hudWindows) { if (w.Content != null) { activeWindows.Add(w); w.Content.transform.SetParent(transform, false); } Destroy(w.gameObject); } // Take the content of the old docking windows and attach them to resizeable windows hudWindows = new List<HUDContainer>(); for (int i = 0; i < activeWindows.Count; i++) { HUDContainer w = activeWindows[i]; ResizeableAndDraggableWindow window = Instantiate<ResizeableAndDraggableWindow>((ResizeableAndDraggableWindow)containerPrefab); window.Initialize(w.Content, this, i, w.RectTransform.anchorMin, w.RectTransform.anchorMax, windowAlpha, HUD); w.Content.transform.SetParent(window.transform, false); hudWindows.Add(window); Destroy(w.gameObject); } } else { dockingMode = true; openWindowButton.interactable = false; openWindowButton.alpha = 0.5f; containerPrefab = Resources.Load<DockingWindowContainer>("GUI/Prefabs/PauseMenu/UIBuilder/DockingContainer"); DockingPosition[] dockingPositions = (DockingPosition[])Enum.GetValues(typeof(DockingPosition)); // Check which windows are at a docking position Dictionary<DockingPosition, HUDContainer> activeWindows = new Dictionary<DockingPosition, HUDContainer>(); foreach (HUDContainer w in hudWindows) { bool added = false; foreach (DockingPosition d in dockingPositions) { float[] anchors = DockingPositionHelper.GetAnchors(d); if (!added && anchors[0] == w.RectTransform.anchorMin.x && anchors[1] == w.RectTransform.anchorMax.x && anchors[2] == w.RectTransform.anchorMin.y && anchors[3] == w.RectTransform.anchorMax.y) { activeWindows.Add(d, w); added = true; } } if (added) { w.Content.transform.SetParent(transform, false); } else { Destroy(w.gameObject); } } hudWindows = new List<HUDContainer>(); // Instanciates the docking windows for (int i = 0; i < dockingPositions.Length; i++) { DockingPosition d = (DockingPosition)i; DockingWindowContainer window = Instantiate<DockingWindowContainer>((DockingWindowContainer)containerPrefab); float[] anchors = DockingPositionHelper.GetAnchors(d); if (activeWindows.ContainsKey(d)) { activeWindows[d].Content.transform.SetParent(window.transform, false); window.Initialize(activeWindows[d].Content, this, i, new Vector2(anchors[0], anchors[2]), new Vector2(anchors[1], anchors[3]), windowAlpha, hud, d, callback); Destroy(activeWindows[d].gameObject); } else { window.Initialize(null, this, i, new Vector2(anchors[0], anchors[2]), new Vector2(anchors[1], anchors[3]), windowAlpha, hud, d, callback); } hudWindows.Add(window); } } }
private void Awake() { hudWindows = new List<HUDContainer>(); containerPrefab = Resources.Load<ResizeableAndDraggableWindow>("GUI/Prefabs/PauseMenu/UIBuilder/ResizeContainer"); string[] s = Enum.GetNames(typeof(PlayerHUD)); string[] names = new string[s.Length + 1]; names[0] = Localization.Instance.Localize("gui.remove"); for (int i = 1; i < names.Length; i++) { names[i] = Localization.Instance.Localize("gui." + hud.ToString().ToLower() + ".windows." + s[i - 1].ToLower()); } callback = new OpenWindowCallback(this, hud, names); Reload(); }
public HumanController() { TargetLabel = Engine.Singleton.Labeler.NewTextLabel3D("Primitive", 0.04f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 0); ColLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.04f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); ColLabel.Caption = "Kolizja"; ColLabel.SetColor(ColourValue.Green, ColourValue.Green); ColLabel.SetPosition(0.4f, 0.1f); TalkBox = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.05f, 0.85f, 0.9f, 0.1f, new ColourValue(1, 1, 1), 1); TalkBox.IsVisible = false; TalkLabels = new List<TextLabel>(); for (int i = 0; i < 8; i++) { TalkLabels.Add(Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.04f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2)); TalkLabels[i].SetPosition(0.07f, 0.63f + i * 0.037f); } ValidReplies = new List<TalkReply>(); HUDInventory = new HUDInventory(); HUDContainer = new HUDContainer(); HUDShop = new HUDShop(); HUD = new HUD(); HUDMenu = new HUDMenu(); Mysz = new MOIS.MouseState_NativePtr(); light.Type = Light.LightTypes.LT_POINT; light.Direction = new Vector3(0, -1, 0).NormalisedCopy; light.DiffuseColour = new ColourValue(0.2f, 0.2f, 0.8f); light.SpecularColour = new ColourValue(0.3f, 0.3f, 0.9f); // light.SetAttenuation(10.0f, 0, 5.0f, 10.0f); light.PowerScale = 1.0f; l1.Type = Light.LightTypes.LT_POINT; l1.DiffuseColour = new ColourValue(1,0,0); l1.SpecularColour = new ColourValue(1,0,0); l1.PowerScale = 1.0f; l1.Visible = false; l2.Type = Light.LightTypes.LT_POINT; l2.DiffuseColour = new ColourValue(0, 1, 0); l2.SpecularColour = new ColourValue(0, 1, 0); l2.PowerScale = 1.0f; l2.Visible = false; l3.Type = Light.LightTypes.LT_POINT; l3.DiffuseColour = new ColourValue(0, 0, 1); l3.SpecularColour = new ColourValue(0, 0, 1); l3.PowerScale = 1.0f; l3.Visible = false; l4.Type = Light.LightTypes.LT_POINT; l4.DiffuseColour = new ColourValue(1, 1, 0); l4.SpecularColour = new ColourValue(1, 1, 0); l4.PowerScale = 1.0f; l4.Visible = false; l5.Type = Light.LightTypes.LT_POINT; l5.DiffuseColour = new ColourValue(1, 1, 1); l5.SpecularColour = new ColourValue(1, 1, 1); l5.PowerScale = 1.0f; l5.Visible = false; l6.Type = Light.LightTypes.LT_POINT; l6.DiffuseColour = new ColourValue(1, 0, 1); l6.SpecularColour = new ColourValue(1, 0, 1); l6.PowerScale = 1.0f; l6.Visible = false; l7.Type = Light.LightTypes.LT_POINT; l7.DiffuseColour = new ColourValue(0, 1, 1); l7.SpecularColour = new ColourValue(0, 1, 1); l7.PowerScale = 1.0f; l7.Visible = false; }
public virtual void OnHUDCreate(HUDContainer hudContainer) { m_HudContainer = hudContainer; }