protected void ShowCurrentMessage() { messageElement.Show(); if (!iconOverlay.IsVisible) { iconOverlay.Show(); } startTime = DateTime.Now; }
public override void Update(FrameEvent evt) { base.Update(evt); Animate(evt); if (lives.Count > characterStats.Lives.Value && characterStats.Lives.Value >= 0) { SceneNode life = lives[lives.Count - 1]; RemoveAndDestroyLife(life); } if (lives.Count < characterStats.Lives.Value) { AddHeart(characterStats.Lives.Value); } healthBar.Width = hRatio * characterStats.Health.Value; shieldBar.Width = sRatio * characterStats.Shield.Value; scoreText.Caption = score + ((PlayerStats)characterStats).Score.Value; if (Tutorial.win == true) { winText.Show(); } else if (clockText == "0:00") { //clockText = "0:00"; gameOverText.Show(); gameOver.Show(); timeText.Hide(); scoreText.Hide(); healthBar.Hide(); } else { clockText = convertTime(clock - time.Milliseconds); timeText.Caption = timer + clockText; } if (characterStats.Lives.Value == 0) { gameOverText.Show(); gameOver.Show(); timeText.Hide(); scoreText.Hide(); healthBar.Hide(); } levelText.Caption = leveltxt; }
/// <summary> /// This method updates the interface /// </summary> /// <param name="evt"></param> public override void Update(FrameEvent evt) { base.Update(evt); Animate(evt); if (lives.Count > characterStats.Lives.Value && characterStats.Lives.Value >= 0) { SceneNode life = lives[lives.Count - 1]; RemoveAndDestroyLife(life); } if (lives.Count < characterStats.Lives.Value) { AddHeart(characterStats.Lives.Value); } if (((PlayerStats)characterStats).Score.Value == 100) { gameWonText.Show(); gameWon = true; } if (((PlayerStats)characterStats).Lives.Value == 0) { gameLostText.Show(); gameLost = true; } healthBar.Width = hRatio * characterStats.Health.Value; shieldBar.Width = (sRatio * characterStats.Shield.Value) / 2; scoreText.Caption = score + ((PlayerStats)characterStats).Score.Value; timeText.Caption = timeDisplay + convertTime(time.MillisecondsCPU); }
public void AddItem(List <string> item) { float left = 0.01f; ListViewItem lvi = new ListViewItem(); if (items.Count == 0) { lvi.Top = top + 0.042f; } else { ListViewItem lastLvi = items.Last(); lvi.Top = lastLvi.Top + 0.048f; } for (int i = 0; i < item.Count; i++) { PanelOverlayElement ListViewCell = OverlayManager.Singleton.CreateOverlayElementFromTemplate("ListView/ListViewCell", "Panel", "item" + Guid.NewGuid()) as PanelOverlayElement; var txtArea = ListViewCell.GetChild(ListViewCell.Name + "/ListViewCellCaption"); txtArea.Caption = item[i]; lvi.Items.Add(ListViewCell); ListViewCell.Top = lvi.Top; ListViewCell.Left = left; ListViewCell.Width = width / item.Count - 0.005f; var line = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/HorizalLine", "Panel", "colhorline" + Guid.NewGuid()) as PanelOverlayElement;; line.Left = 0.0f; line.Top = 0.0f; line.Width = ListViewCell.Width; line.Show(); ListViewCell.AddChild(line); left = left + ListViewCell.Width; if (items.Count >= maxShowItem) { ListViewCell.Hide(); } else { ListViewCell.Show(); } listview.AddChild(ListViewCell); } items.Add(lvi); if (items.Count >= maxShowItem) { drag.Show(); drag.Height = (float)(maxShowItem * 0.045f * Convert.ToDouble(maxShowItem / items.Count)); } else { drag.Hide(); } }
/// <summary> /// This method updates the interface /// </summary> /// <param name="evt"></param> public override void Update(FrameEvent evt) ////////////Update { if (Globals.freezeGame == false) { base.Update(evt); Animate(evt); if (lives.Count > characterStats.Lives.Value && characterStats.Lives.Value >= 0) { SceneNode life = lives[lives.Count - 1]; RemoveAndDestroyLife(life); } if (lives.Count < characterStats.Lives.Value) { AddHeart(characterStats.Lives.Value); } healthBar.Width = hRatio * characterStats.Health.Value; shieldBar.Width = sRatio * characterStats.Shield.Value; scoreText.Caption = score + ((PlayerStats)characterStats).Score.Value; timeText.Caption = timer + DecreaseTime(time.Milliseconds); if (timeText.Caption.Contains("-") || (playerStats.Lives.Value == 0 && playerStats.Health.Value <= 0)) { // // timeText.Caption = "-time's up-"; timeText.Hide(); panel.Hide(); panelGameMessage.Show(); gameOver.Show(); scoreGameOver.Caption = score + ((PlayerStats)characterStats).Score.Value; scoreGameOver.Show(); Globals.freezeGame = true; } } }
public override void AddWidget( int rowNum, int colNum, Widget widget, AlignMode hAlign = AlignMode.Left, AlignMode vAlign = AlignMode.Left, DockMode dock = DockMode.None, int rowSpan = 1, int colSpan = 1, bool isAddWidgetToAnother = true) { if (rowNum > rows.Count) { int sub = rowNum - rows.Count; for (int i = 0; i < sub; i++) { PanelRow row = new PanelRow(this); row.Type = ValueType.Abosulte; row.Height = widget.Height; rows.Add(row); } } if (colNum > cols.Count) { int sub = colNum - cols.Count; for (int i = 0; i < sub; i++) { PanelColumn col = new PanelColumn(this); col.Type = ValueType.Percent; cols.Add(col); } } base.AddWidget(rowNum, colNum, widget, hAlign, vAlign, dock, rowSpan, colSpan); if (widget.Top + widget.Height > Height) { scroll.Show(); drag.Show(); widget.Hide(); } else { visualWidgets.Add(widget); } calculateScrollBar(); }
private void CreateMessageContainer() { // BetaGUI.GUI gui = new GUI(); // Window w = gui.createWindow(); // w.createStaticImage() backgroundElement.Hide(); iconOverlay = OverlayManager.Singleton.GetByName("Wof/MessageBar"); iconElement = OverlayManager.Singleton.GetOverlayElement("Wof/MessageBarIcon"); iconElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE; iconElement.SetDimensions(radioIconWidth, radioIconWidth); iconElement.Show(); iconOverlay.Hide(); // zewnetrzny kontener ukryje wszystko iconDefaultDimesions.x = Mogre.StringConverter.ParseReal(iconElement.GetParameter("width")); iconDefaultDimesions.y = Mogre.StringConverter.ParseReal(iconElement.GetParameter("height")); messageElement = OverlayManager.Singleton.CreateOverlayElement( "TextArea", "messageElement " + DateTime.Now.Ticks); messageContainer = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement( "Panel", "messageContainer " + DateTime.Now.Ticks); messageElement.SetDimensions(mainViewport.ActualWidth, mainViewport.ActualHeight); messageElement.MetricsMode = GuiMetricsMode.GMM_PIXELS; messageElement.SetParameter("font_name", FontManager.CurrentFont); messageElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE; messageElement.SetParameter("char_height", StringConverter.ToString(EngineConfig.CurrentFontSize)); messageElement.SetParameter("colour_top", "0.1 0.1 0.1"); messageElement.SetParameter("colour_bottom", "0.5 0.1 0.1"); messageElement.Caption = ""; messageContainer.MetricsMode = GuiMetricsMode.GMM_RELATIVE; messageContainer.SetDimensions(1.0f, 0.05f); // messageContainer.SetPosition(0.055f, 0.015f); messageContainer.AddChild(messageElement); messageOverlay.Add2D(messageContainer); messageContainer.Show(); }
public GuiCursor(Panel cursor, List <string> subCursorList, int subCursorIndex) : base(cursor) { this.subCursorList = subCursorList; this.subCursorIndex = subCursorIndex; //sychronize cursors at start for (int index = 0; index < subCursorList.Count; index++) { OverlayElement subCursor = ((OverlayElementContainer)element).GetChild(subCursorList[index]); if (subCursorIndex == index) { subCursor.Show(); } else { subCursor.Hide(); } } }
public void changeLevel(int level) { // this.level = level; if (level == 4) { panel.Hide(); panelGameMessage.Show(); gameOver.Show(); gameOver.Caption = "You won!"; scoreGameOver.Caption = score + ((PlayerStats)characterStats).Score.Value; scoreGameOver.Show(); Globals.freezeGame = true; } else { newLevel = OverlayManager.Singleton.GetOverlayElement("NewLevel"); newLevel.Caption = newLevelText; newLevel.Left = mWindow.Width * 0.5f; newLevel.Caption = newLevelText + level; panelGameMessage.Show(); levelCompleted.Show(); newLevel.Show(); } }
public void Show() { element.Show(); }
public void UpdateControl(float timeSinceLastFrame) { if (currentMessage == null) { if (messageQueue.Count != 0) { // Console.WriteLine("Enqueuing"); currentMessage = messageQueue[0]; PrepareMessage(); messageQueue.RemoveAt(0); if (currentMessage.NoBackground && messageElement != null && !messageElement.IsVisible) { ShowCurrentMessage(); } if (instantBackground && messageElement != null && !messageElement.IsVisible) { currentBgOpacity = bgAnimationMaxOpacity; SetBgOpacity(currentBgOpacity); ShowCurrentMessage(); } if (!currentMessage.NoBackground) { backgroundElement.Show(); isIncreasingBgOpacity = true; } } else { } } else { if (!currentMessage.NoBackground) { // BACKGROUND if (isIncreasingBgOpacity) { if (currentBgOpacity < bgAnimationMaxOpacity) { SetBgOpacity(currentBgOpacity); currentBgOpacity += timeSinceLastFrame / bgAnimationLength; return; } else { isIncreasingBgOpacity = false; currentBgOpacity = bgAnimationMaxOpacity; // pokaz ShowCurrentMessage(); backgroundElement.Show(); } } else if (isDecreasingBgOpacity) { if (currentBgOpacity > 0.0f) { SetBgOpacity(currentBgOpacity); currentBgOpacity -= timeSinceLastFrame / bgAnimationLength; return; } else { isDecreasingBgOpacity = false; currentBgOpacity = 0; // ukryj backgroundElement.Hide(); ClearMessage(); return; } } else { UpdateMessage(); } } else { // no background // show // Console.WriteLine("Showing"); if (messageElement != null && !messageElement.IsVisible) { ShowCurrentMessage(); } isDecreasingBgOpacity = false; isIncreasingBgOpacity = false; } TimeSpan diff = DateTime.Now.Subtract(startTime); if (!currentMessage.Permanent && diff.TotalMilliseconds > currentMessage.Time) { // Console.WriteLine("Clearing"); isDecreasingBgOpacity = true; if (messageElement != null) { messageElement.Hide(); } if (iconOverlay != null && iconOverlay.IsVisible) { iconOverlay.Hide(); } if (instantBackground) { backgroundElement.Hide(); ClearMessage(); } if (currentMessage.NoBackground) { ClearMessage(); isDecreasingBgOpacity = false; isIncreasingBgOpacity = false; } } } }