public void DisplayIndicator() { wasDisplayed = true; if (!EngineConfig.DisplayingMinimap) { return; } hudOverlay = OverlayManager.Singleton.GetByName("Wof/HUD"); // HUD hud = sceneMgr.CreateEntity("HUD", "HUD.mesh"); hud.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY; hudNode = new SceneNode(sceneMgr); hudNode.SetScale(UnitConverter.xscale(viewport) * 0.01505f, 0.0155f, 0.01f); hudNode.AttachObject(hud); hudNode.Position = new Vector3(-0.01f, -0.408f, -1f); hudNode.GetMaterial().SetDepthCheckEnabled(false); // ARROW fuelArrow = sceneMgr.CreateEntity("FuelArrow", "Arrow.mesh"); fuelArrow.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY; fuelArrowNode = new SceneNode(sceneMgr); fuelArrowNode.SetScale(0.16f, 0.16f, 0.16f); fuelArrowNode.AttachObject(fuelArrow); fuelArrowNode.Position = new Vector3(UnitConverter.xscale(viewport) * -0.214f, -0.255f, -0.7f); fuelArrowNode.GetMaterial().SetDepthCheckEnabled(false); // ARROW oilArrow = sceneMgr.CreateEntity("OilArrow", "Arrow.mesh"); oilArrow.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY; oilArrowNode = new SceneNode(sceneMgr); oilArrowNode.SetScale(0.16f, 0.16f, 0.16f); oilArrowNode.AttachObject(oilArrow); oilArrowNode.Position = new Vector3(UnitConverter.xscale(viewport) * 0.214f, -0.255f, -0.7f); oilArrowNode.GetMaterial().SetDepthCheckEnabled(false); hudOverlay.Add3D(fuelArrowNode); hudOverlay.Add3D(oilArrowNode); hudOverlay.Add3D(hudNode); hudOverlay.ZOrder = 1; hudOverlay.Show(); CreateAmmoContainer(); CreateAmmoTypeContainer(); CreateLivesContainer(); CreateScoreContainer(); CreateHighscoreContainer(); CreateInfoContainer(); UpdateWheelState(gameScreen.CurrentLevel.UserPlane.WheelsState); }
/// <summary> /// This method add an heart to the 3D overlay /// </summary> /// <param name="n"> A numeric tag</param> private void AddHeart(int n) { SceneNode livesNode = CreateHeart(n); lives.Add(livesNode); overlay3D.Add3D(livesNode); }
public override void Run() { meshLayer = OverlayManager.Singleton.Create("CharacterPreview"); meshLayer.ZOrder = 999; SceneManager scm = ScreenManager.Instance.Camera.SceneManager; ent = scm.CreateEntity(Guid.NewGuid().ToString(), meshName); sceneNode = scm.CreateSceneNode(); sceneNode.Translate(new Mogre.Vector3(0, 0, 0)); sceneNode.Rotate(Quaternion.IDENTITY); float lenght = ent.BoundingBox.Size.Length * 2; sceneNode.Translate(new Mogre.Vector3(-7f, 5f, -1.0f * lenght)); ent.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_MAX; ent.Skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE; baseAnim = ent.GetAnimationState(animNames[1]); topAnim = ent.GetAnimationState(animNames[0]); baseAnim.Enabled = true; topAnim.Enabled = true; baseAnim.Loop = true; topAnim.Loop = true; sceneNode.AttachObject(ent); meshLayer.Add3D(sceneNode); meshLayer.Show(); equipmentPanel = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterEquipment", "BorderPanel", "inventoryPanelLeftArea") as OverlayContainer; previewPanel = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterPreview", "BorderPanel", "inventoryPanelMiddleArea") as OverlayContainer; backpackPanel = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterBackpack", "BorderPanel", "inventoryPanelRightArea") as OverlayContainer; row = (int)System.Math.Round((backpackPanel.Height - 0.04) / INV_WIDTH); col = (int)System.Math.Round((backpackPanel.Width - 0.04) / INV_WIDTH); int row_counter = 1; int col_counter = 1; float topValue = 0.0f; float leftValue = 0.0f; for (int i = 0; i < 35; i++) { if (i == 0) { topValue = 0.02f; leftValue = 0.02f; } else if (col_counter <= col) { leftValue += INV_WIDTH; } else { topValue += INV_WIDTH; col_counter = 1; row_counter++; leftValue = 0.02f; } OverlayElement invSlotElement = OverlayManager.Singleton.CreateOverlayElementFromTemplate("InventorySlot", "BorderPanel", "INV_NO_" + i.ToString()); invSlotElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE; invSlotElement.Left = leftValue; invSlotElement.Top = topValue; invSlotElement.Width = INV_WIDTH; invSlotElement.Height = INV_WIDTH; if (row_counter <= row) { backpackPanel.AddChild(invSlotElement); } else { invSlotElement.Hide(); backpackPanel.AddChild(invSlotElement); } elements.Add(invSlotElement); col_counter++; } GameManager.Instance.trayMgr.getTraysLayer().Add2D(equipmentPanel); GameManager.Instance.trayMgr.getTraysLayer().Add2D(previewPanel); GameManager.Instance.trayMgr.getTraysLayer().Add2D(backpackPanel); }
public override void Run() { var moddata = ScreenManager.Instance.ModData; chaData = moddata.CharacterInfos.Where(o => o.ID == chaID).FirstOrDefault(); if (chaData == null) { throw new Exception("Character Data can't be null!"); } var skinData = moddata.SkinInfos.Where(o => o.ID == chaData.Skin).FirstOrDefault(); if (skinData == null) { throw new Exception("Character Skin Data can't be null!"); } var idleSkinAnim = skinData[ChaAnimType.CAT_IDLE]; if (idleSkinAnim == null) { throw new Exception("Idle Skin Anim Data can't be null!"); } var idleAnim = moddata.AnimationInfos.Where(o => o.ID == idleSkinAnim.AnimID).FirstOrDefault(); if (idleAnim == null) { throw new Exception("Idle Anim Data can't be null!"); } discordPanel = UIManager.Instance.CreatePanel("discordPanel", 0.3f, 1); discordPanel.Padding.PaddingLeft = 0.01f; discordPanel.Padding.PaddingRight = 0.01f; discordPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f); discordPanel.AddRow(UI.ValueType.Percent); var txtDiscord = UIManager.Instance.CreateStaticText("txtDiscord", "Discord"); txtDiscord.MetricMode = GuiMetricsMode.GMM_RELATIVE; discordInventoryPanel = UIManager.Instance.CreatePanel("discordInventoryPanel", 0.3f, 1, 0, 0, 9, 3); discordPanel.AddWidget(1, 1, txtDiscord, AlignMode.Center); discordPanel.AddWidget(2, 1, discordInventoryPanel, AlignMode.Center, AlignMode.Center, DockMode.Fill); int currRow = 1; int currCol = 1; for (int i = 0; i < 9; i++) { var invSlot = new PanelTemplateWidget("DiscordInvSlot_" + (i + 1).ToString(), "InventorySlot"); discordInventoryPanel.AddWidget(currRow, currCol, invSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); if ((i + 1) % 3 == 0) { currRow++; currCol = 1; } else { currCol++; } } playerPanel = UIManager.Instance.CreatePanel("playerPanel", 0.4f, 1, 0.3f); playerPanel.ChangeRow(UI.ValueType.Abosulte, 0.6f); playerPanel.AddRow(UI.ValueType.Abosulte, 0.4f); playerEquipPanel = UIManager.Instance.CreatePanel("playerEquipPanel", 1, 1); playerEquipPanel.Padding.PaddingLeft = 0.01f; playerEquipPanel.Padding.PaddingRight = 0.01f; playerPreviewPanel = UIManager.Instance.CreatePanel("playerPreviewPanel", 1, 1); playerPreviewPanel.Padding.PaddingLeft = 0.01f; playerPreviewPanel.Padding.PaddingRight = 0.01f; playerPreviewPanel.ChangeCol(UI.ValueType.Abosulte, 0.6f); playerPreviewPanel.AddCol(UI.ValueType.Abosulte, 0.4f); playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f); playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f); playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f); playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f); playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.1f); playerEquipPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f); playerEquipPanel.AddRow(UI.ValueType.Percent); playerEquipPanel.AddRow(UI.ValueType.Percent); playerEquipPanel.AddRow(UI.ValueType.Percent); playerEquipPanel.AddRow(UI.ValueType.Percent); playerEquipPanel.AddCol(UI.ValueType.Percent); playerEquipPanel.AddCol(UI.ValueType.Percent); playerPanel.AddWidget(1, 1, playerEquipPanel, AlignMode.Left, AlignMode.Center, DockMode.Fill); playerPanel.AddWidget(2, 1, playerPreviewPanel, AlignMode.Left, AlignMode.Center, DockMode.Fill); var txtOutfit = UIManager.Instance.CreateStaticText("txtOutfit", "Outfit"); var txtArms = UIManager.Instance.CreateStaticText("txtArms", "Arms"); txtOutfit.MetricMode = GuiMetricsMode.GMM_RELATIVE; txtArms.MetricMode = GuiMetricsMode.GMM_RELATIVE; playerEquipPanel.AddWidget(1, 2, txtOutfit, AlignMode.Center); playerEquipPanel.AddWidget(1, 3, txtArms, AlignMode.Center); for (int i = 0; i < 9; i++) { var equipSlot = new PanelTemplateWidget("EquipSlot_" + (i + 1).ToString(), "InventorySlot"); switch (i) { case 0: playerEquipPanel.AddWidget(2, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 1: playerEquipPanel.AddWidget(3, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 2: playerEquipPanel.AddWidget(4, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 3: playerEquipPanel.AddWidget(5, 1, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 4: playerEquipPanel.AddWidget(2, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 5: playerEquipPanel.AddWidget(3, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 6: playerEquipPanel.AddWidget(4, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 7: playerEquipPanel.AddWidget(3, 1, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; case 8: playerEquipPanel.AddWidget(5, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); break; } } meshLayer = OverlayManager.Singleton.Create("CharacterPreview"); meshLayer.ZOrder = (ushort)(UIManager.Instance.GetCursorContainer().ZOrder - 1); gameObject = new Character(world, chaData, skinData, new Mogre.Vector3(), true); float length = gameObject.Mesh.Entity.BoundingBox.Size.Length * 2; gameObject.Mesh.Entity.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_MAX; gameObject.Mesh.EntityNode.Translate(new Mogre.Vector3(-2f, -6.3f, -1.0f * length)); gameObject.Mesh.EntityNode.Scale(0.7f, 0.8f, 0.8f); meshLayer.Add3D(gameObject.MeshNode); meshLayer.Show(); var txtPreviewHeadArmourTotal = UIManager.Instance.CreateStaticText("txtPreviewHeadArmourTotal", "Head Armour Total: 0"); var txtPreviewBodyArmourTotal = UIManager.Instance.CreateStaticText("txtPreviewBodyArmourTotal", "Body Armour Total: 0"); var txtPreviewLegArmourTotal = UIManager.Instance.CreateStaticText("txtPreviewLegArmourTotal", "Leg Armour Total: 0"); var txtPreviewEncumbrance = UIManager.Instance.CreateStaticText("txtPreviewEncumbrance", "Encumbrance: 0"); txtPreviewHeadArmourTotal.MetricMode = GuiMetricsMode.GMM_RELATIVE; txtPreviewBodyArmourTotal.MetricMode = GuiMetricsMode.GMM_RELATIVE; txtPreviewLegArmourTotal.MetricMode = GuiMetricsMode.GMM_RELATIVE; txtPreviewEncumbrance.MetricMode = GuiMetricsMode.GMM_RELATIVE; var btnReturn = UIManager.Instance.CreateButton("btnInventoryReturn", "Return", 200); btnReturn.MetricMode = GuiMetricsMode.GMM_RELATIVE; btnReturn.OnClick += (sender) => { ScreenManager.Instance.ChangeScreenReturn(); }; playerPreviewPanel.AddWidget(2, 2, txtPreviewHeadArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth); playerPreviewPanel.AddWidget(3, 2, txtPreviewBodyArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth); playerPreviewPanel.AddWidget(4, 2, txtPreviewLegArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth); playerPreviewPanel.AddWidget(5, 2, txtPreviewEncumbrance, AlignMode.Center, AlignMode.Center, DockMode.FillWidth); playerPreviewPanel.AddWidget(6, 2, btnReturn, AlignMode.Center, AlignMode.Center, DockMode.FillWidth); backpackPanel = UIManager.Instance.CreatePanel("backpackPanel", 0.3f, 1, 0.7f, 0); backpackPanel.Padding.PaddingRight = 0.01f; backpackPanel.Padding.PaddingLeft = 0.01f; backpackPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f); backpackPanel.AddRow(UI.ValueType.Percent); backpackPanel.AddRow(UI.ValueType.Abosulte, 0.03f); var txtInvTitle = UIManager.Instance.CreateStaticText("txtInvTitle", "Inventory"); txtInvTitle.MetricMode = GuiMetricsMode.GMM_RELATIVE; backpackInventoryPanel = UIManager.Instance.CreateScrollablePanel("backpackInventoryPanel", 1, 1, 0, 0, 20, 3); backpackPanel.AddWidget(1, 1, txtInvTitle, AlignMode.Center, AlignMode.Center, DockMode.Fill); backpackPanel.AddWidget(2, 1, backpackInventoryPanel, AlignMode.Center, AlignMode.Center, DockMode.Fill); int curRow = 1; int curCol = 1; for (int i = 0; i < 60; i++) { var invSlot = new PanelTemplateWidget("InvSlot_" + (i + 1).ToString(), "InventorySlot"); invSlot.Height = 0.1f; backpackInventoryPanel.ChangeRow(UI.ValueType.Abosulte, invSlot.Height, curRow); backpackInventoryPanel.AddWidget(curRow, curCol, invSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill); if ((i + 1) % 3 == 0) { curRow++; curCol = 1; } else { curCol++; } } }