public ScoreDisplay(bool count) { _value.Set(MainGame.Inst.Profile.TotalPoints); _value.SetDelta(FloatMath.Max(537, MainGame.Inst.Profile.TotalPoints / 4f)); if (!count) { _value.Finish(); } _text = new HUDRawText { Alignment = HUDAlignment.CENTERLEFT, Text = ((int)_value.ActualValue).ToString(), TextColor = FlatColors.TextHUD, FontSize = 60f, RelativePosition = new FPoint(10 + 40 + 30, 0), }; _icon = new HUDImage { Image = Textures.TexIconScore, Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(10, 0), Size = new FSize(40, 40) }; Alignment = HUDAlignment.TOPRIGHT; RelativePosition = new FPoint(10, 10); Size = new FSize(250, 60); }
/// <summary> /// send a new event, to create a new floating text /// </summary> public GameObject NewText(string text, HUDType hudType, Transform trans, Color color, int size, float speed, float yAcceleration, float yAccelerationScaleFactor, bl_Guidance movement) { GameObject t = Instantiate(TextPrefab) as GameObject; //Create new text info to instatiate bl_Text item = t.GetComponent <bl_Text>(); item.m_Speed = speed; item.m_Color = color; item.m_Transform = trans; // text = ""; item.m_text = ""; item.m_Size = size; item.movement = movement; item.Yquickness = yAcceleration; item.YquicknessScaleFactor = yAccelerationScaleFactor; t.transform.SetParent(CanvasParent, false); // t.GetComponent<RectTransform>().anchoredPosition = Vector2.zero; texts.Add(item); HUDImage hudImage = t.GetComponent <HUDImage>(); hudImage.Show(text, hudType); return(item.gameObject); }
public void Load(Func <SCCMListPresenter, int, int, Task <LoadFuncResult> > loadFunc, SCCMListScrollbar sb, HUDImage wc, bool async = true) { Clear(); _currentRequest++; _scrollbar = sb; _waitingCog = wc; _scrollbar.Presenter = this; this.IsVisible = false; _scrollbar.IsVisible = false; _waitingCog.IsVisible = true; _loadFunc = loadFunc; _mode = PresenterMode.Loading; if (async) { DoLoad(0, _currentRequest, true).RunAsync(); } else { DoLoad(0, _currentRequest, false).Wait(); } }
public override void OnInitialize() { AddElement(_presenter = new SCCMListPresenter { Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(16, 0), Size = new FSize(Width - 16 - 16 - 48 - 16, Height - 16 - 16), }); AddElement(_scrollbar = new SCCMListScrollbar { Alignment = HUDAlignment.CENTERRIGHT, RelativePosition = new FPoint(16, 0), Size = new FSize(48, Height - 16 - 16), }); AddElement(_waitingCog = new HUDImage { Alignment = HUDAlignment.CENTER, RelativePosition = FPoint.Zero, Image = Textures.CannonCogBig, RotationSpeed = 0.35f, Color = FlatColors.Clouds, Size = new FSize(192, 192) }); _presenter.Load(QueryData, _scrollbar, _waitingCog, false); }
public StarsScoreDisplay(bool count) { _value.Set(MainGame.Inst.Profile.ScoreStars); _value.SetDelta(FloatMath.Max(37, MainGame.Inst.Profile.ScoreStars / 2f)); if (!count) { _value.Finish(); } _text = new HUDRawText { Alignment = HUDAlignment.CENTERLEFT, Text = ((int)_value.ActualValue).ToString(), TextColor = FlatColors.TextHUD, FontSize = 60f, RelativePosition = new FPoint(10 + 40 + 30, 0), }; _icon = new HUDImage { Image = Textures.TexIconStar, Color = FlatColors.SunFlower, Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(10, 0), Size = new FSize(40, 40), }; Alignment = HUDAlignment.TOPRIGHT; RelativePosition = new FPoint(10, 10); Size = new FSize(250, 60); IsVisible = (MainGame.Inst.Profile.ScoreStars > 0 || MainGame.Inst.Profile.HasCreatedLevels); UpdateRelativePosition(); }
private HUDLayoutContainer CreateHeader(int n) { header1 = new HUDImage { Alignment = HUDAlignment.TOPLEFT, Image = Textures.TexGenericTitle, Size = Textures.TexGenericTitle.Size().ScaleToHeight(3 * GDConstants.TILE_WIDTH), }; header2 = new HUDImage { Alignment = HUDAlignment.TOPRIGHT, Image = Textures.TexTitleNumber[n], Size = Textures.TexTitleNumber[n].Size().ScaleToHeight(3 * GDConstants.TILE_WIDTH), }; float w = header1.Size.Width + header2.Size.Width; HUDLayoutContainer c = new HUDLayoutContainer() { Alignment = HUDAlignment.TOPCENTER, Size = new FSize(w, 4 * GDConstants.TILE_WIDTH), }; c.AddElement(header1); c.AddElement(header2); return(c); }
public SCCMScoreDisplay(bool count) { _value.Set(MainGame.Inst.Profile.ScoreSCCM); _value.SetDelta(FloatMath.Max(37, MainGame.Inst.Profile.ScoreSCCM / 4f)); if (!count) { _value.Finish(); } _text = new HUDRawText { Alignment = HUDAlignment.CENTERLEFT, Text = ((int)_value.ActualValue).ToString(), TextColor = FlatColors.TextHUD, FontSize = 60f, RelativePosition = new FPoint(10 + 40 + 30, 0), }; _img = new HUDImage { Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(10, 0), Size = new FSize(40, 40), Image = Textures.TexCircle, Color = FlatColors.WetAsphalt * 0.4f, }; _ani = new HUDTetroAnimation { Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(10 + 1, 0), Size = new FSize(38, 38), Foreground = FlatColors.Alizarin, }; Alignment = HUDAlignment.TOPRIGHT; RelativePosition = new FPoint(10, 10); Size = new FSize(250, 60); IsVisible = (MainGame.Inst.Profile.ScoreSCCM > 0); UpdateRelativePosition(); }
public HUDIconMessageBox(int depth = 0) { Depth = depth; Alignment = HUDAlignment.CENTER; internalImage = new HUDImage { Alignment = HUDAlignment.CENTERLEFT, ImageAlignment = HUDImageAlignment.UNDERSCALE, Size = new FSize(96, 96), }; internalLabel = new HUDLabel { Alignment = HUDAlignment.CENTERLEFT, TextAlignment = HUDAlignment.CENTER, FontSize = 96, }; }
private void Start() { UpdateHealthBar(); for (int i = 0; i < LevelManager.instance.Crystals.Length; i++) { HUDImage hudImage = Instantiate(CrystalHUDPrefab, playerUI.HUDParent.transform).GetComponent <HUDImage>(); hudImage.Setup(playerUI.GetComponent <RectTransform>(), specialCamera.FPSCamera.transform, LevelManager.instance.Crystals[i].transform, LevelManager.instance.Crystals[i].Mesh.GetComponent <MeshRenderer>().sharedMaterial.color, LevelManager.instance.Crystals[i].Mesh); } for (int i = 0; i < LevelManager.instance.CrystalDocks.Length; i++) { HUDImage hudImage = Instantiate(CrystalDockHUDPrefab, playerUI.HUDParent.transform).GetComponent <HUDImage>(); hudImage.Setup(playerUI.GetComponent <RectTransform>(), specialCamera.FPSCamera.transform, LevelManager.instance.CrystalDocks[i].transform.GetChild(0), LevelManager.instance.Crystals[i].Mesh.GetComponent <MeshRenderer>().sharedMaterial.color); } }
public MultiplayerScoreDisplay(ScoreDisplay reference, bool count) { _ref = reference; _value.Set(MainGame.Inst.Profile.MultiplayerPoints); _value.SetDelta(FloatMath.Max(37, MainGame.Inst.Profile.MultiplayerPoints / 4f)); if (!count) { _value.Finish(); } _text = new HUDRawText { Alignment = HUDAlignment.CENTERLEFT, Text = ((int)_value.ActualValue).ToString(), TextColor = FlatColors.TextHUD, FontSize = 60f, RelativePosition = new FPoint(10 + 40 + 30, 0), }; _icon = new HUDImage { Image = Textures.TexIconMPScore, Color = FlatColors.Amethyst, Alignment = HUDAlignment.CENTERLEFT, RelativePosition = new FPoint(10, 0), Size = new FSize(40, 40), }; Alignment = HUDAlignment.TOPRIGHT; RelativePosition = new FPoint(10, 10); Size = new FSize(250, 60); IsVisible = MainGame.Inst.Profile.HasMultiplayerGames; UpdateRelativePosition(); }
public override void OnInitialize() { base.OnInitialize(); #region Footer AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT - 10), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Nephritis), }); AddElement(new HUDRectangle(1) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 2f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.PeterRiver), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Pomegranate), }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_LEVEL, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), Text = Level.Name, TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_MPPOINTS, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDIncrementIndicatorLabel(profile.MultiplayerPoints.ToString(), (successScreen ? "+" : "-") + Math.Abs(_deltaPoints), 2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(_loadingCog = new HUDImage(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 16), Size = new FSize(WIDTH / 3f, 80), Image = Textures.CannonCogBig, RotationSpeed = 0.3f, Color = FlatColors.TextHUD, ImageAlignment = HUDImageAlignment.UNDERSCALE, IsVisible = false, }); #endregion #region Buttons AddElement(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_BACK, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconBack, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 16), Click = (s, a) => { _server.KillSession(); _server.Stop(); GDScreen.ExitToMap(); }, }); if (_server.SessionUserID == 0 && _server.Mode != SAMNetworkConnection.ServerMode.Stopped && _server.Mode != SAMNetworkConnection.ServerMode.Error) { AddElement(_btnRand = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 90), Size = new FSize(6f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_RANDOMGAME, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconDice, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Wisteria, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Amethyst, 16), Click = (s, a) => OnRandomLevel(), }); AddElement(_btnNext = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(6f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_NEWGAME, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconRedo, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.SunFlower, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Orange, 16), Click = (s, a) => OnNextLevel(), }); } #endregion #region Icons AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 0) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(1 * ICON_MARGIN + 0 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 1) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(3 * ICON_MARGIN + 1 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(5 * ICON_MARGIN + 2 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 3) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(7 * ICON_MARGIN + 3 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); #endregion }
public GDMultiplayerGameHUD(GDGameScreen scrn, GDMultiplayerCommon mp) : base(scrn, Textures.HUDFontRegular) { AddElement(new HUDPauseButton(false, false, true)); _backgroundRect = new HUDRectangle(-10) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = FPoint.Zero, Definition = HUDBackgroundDefinition.CreateSimple(Color.Black * 0.3f), Size = new FSize(100, 100), }; AddElement(_backgroundRect); var mpcsc = new MultiplayerConnectionStateControl(mp) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(4, 4), TextColor = FlatColors.Clouds, }; AddElement(mpcsc); _cornerElements.Add(mpcsc); if (mp.SessionUserID == 0) { if (mp.SessionCapacity == 2) { var lbl = new HUDLambdaLabel { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(4, 44), Font = Textures.HUDFontBold, FontSize = 32, Size = new FSize(200, 32), TextColor = FlatColors.Clouds, AutoSize = true, Lambda = () => (mp.ConnState == SAMNetworkConnection.ConnectionState.Offline) ? "Ping: -" : $"Ping: {(int) (mp.UserConn[1].InGamePing.Value * 1000)}ms", }; AddElement(lbl); _cornerElements.Add(lbl); } else { int idx = 0; for (int i = 1; i < mp.SessionCapacity; i++) { int uid = i; var lbl = new HUDLambdaLabel { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(4, 44 + 40 * idx), Font = Textures.HUDFontBold, FontSize = 32, Size = new FSize(200, 32), TextColor = Color.White, AutoSize = true, Lambda = () => $"Ping[{uid}]: {(int) (mp.UserConn[uid].InGamePing.Value * 1000)}ms", }; AddElement(lbl); _cornerElements.Add(lbl); idx++; } } } else { var lbl = new HUDLambdaLabel { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(4, 44), Font = Textures.HUDFontBold, FontSize = 32, Size = new FSize(200, 32), TextColor = Color.White, AutoSize = true, Lambda = () => $"Ping: {(int) (mp.UserConn[0].InGamePing.Value * 1000)}ms", }; AddElement(lbl); _cornerElements.Add(lbl); } _countdown = new HUDImage(100) { Alignment = HUDAlignment.CENTER, Image = Textures.TexTitleNumber[3], ImageAlignment = HUDImageAlignmentAlgorithm.CENTER, ImageScale = HUDImageScaleAlgorithm.UNDERSCALE, Size = new FSize(320, 320), }; AddElement(_countdown); var x = _cornerElements.Max(e => e.Right); var y = _cornerElements.Max(e => e.Bottom); _backgroundRect.Size = new FSize(x + 4f, y + 4f); }
public override void OnInitialize() { base.OnInitialize(); AddElement(new HUDLabel { Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 48), TextAlignment = HUDAlignment.CENTER, Text = _level.FullName, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 48, }); AddElement(_cannonCog = new HUDImage(1) { Alignment = HUDAlignment.CENTER, Size = new FSize(4.5f * TW, 4.5f * TW), RelativePosition = FPoint.Zero, Rotation = 0f, RotationSpeed = 0.5f, Image = Textures.CannonCogBig, Color = FlatColors.BackgroundHUD.Lighten(0.9f), }); AddElement(_centerLabel = new HUDLabel(3) { Alignment = HUDAlignment.CENTER, Size = new FSize(WIDTH, 2 * TW), RelativePosition = FPoint.Zero, TextAlignment = HUDAlignment.CENTER, FontSize = 128, L10NText = L10NImpl.STR_LVLED_UPLOADING, TextColor = FlatColors.Clouds, Font = Textures.HUDFontBold, }); AddElement(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_LVLED_BTN_ABORT, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconError, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Pomegranate, 16), Click = (s, a) => MainGame.Inst.SetOverworldScreen(), }); AddElement(_btnReupload = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_LVLED_BTN_RETRY, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconError, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Orange, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.SunFlower, 16), IsVisible = false, Click = (s, a) => StartUpload(), }); StartUpload(); }
public override void OnInitialize() { base.OnInitialize(); AddElement(new HUDLabel(1) { TextAlignment = HUDAlignment.CENTER, Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 96), Font = Textures.HUDFontBold, FontSize = 64, L10NText = L10NImpl.STR_MENU_CAP_SEARCH, TextColor = FlatColors.Clouds, }); AddElement(new MultiplayerConnectionStateControl(_server) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(16, 16) }); AddElement(_cog = new HUDImage { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, (-FOOTER_HEIGHT / 2) + (96 / 2f)), Image = Textures.CannonCogBig, RotationSpeed = 0.35f, Color = FlatColors.Clouds, Size = new FSize(192, 192) }); AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(new HUDTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0.5f * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH), Size = new FSize(5.5f * GDConstants.TILE_WIDTH, 1.0f * GDConstants.TILE_WIDTH), L10NText = L10NImpl.STR_MENU_CANCEL, TextColor = Color.White, Font = Textures.HUDFontBold, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Asbestos, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.MidnightBlue, 16), Click = OnClickCancel, }); }
// Use this for initialization void Start() { walkinganim = GetComponentInChildren<Animator>(); player = GetComponentInChildren<Player> (); PlayerSprite = GameObject.FindGameObjectWithTag ("Player").transform; PlayerControlledObjects [0] = transform; if (GameObject.FindGameObjectWithTag("HUD") != null) textureswap = GameObject.FindGameObjectWithTag("HUD").GetComponent<HUDImage>(); }
public override void OnInitialize() { base.OnInitialize(); string txt = "?"; if (_showMultiplayer) { txt = L10N.T(L10NImpl.STR_HSP_MULTIPLAYERRANKING); } else if (_focus == null) { txt = L10N.T(L10NImpl.STR_HSP_GLOBALRANKING); } else { txt = L10N.TF(L10NImpl.STR_HSP_RANKINGFOR, L10N.T(Levels.WORLD_NAMES[_focus.ID])); } AddElement(new HUDLabel(1) { TextAlignment = (_showMultiplayer || _focus == null) ? HUDAlignment.CENTER : HUDAlignment.CENTERLEFT, Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(TAB_WIDTH, TEXT_HEIGHT_REAL), Font = Textures.HUDFontBold, FontSize = 64, Text = txt, TextColor = FlatColors.Clouds, }); if (MainGame.Inst.Profile.HasMultiplayerGames) { if (!_showMultiplayer) { AddElement(_btn = new HUDTextButton(1) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = FPoint.Zero, Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 48), L10NText = L10NImpl.STR_WORLD_MULTIPLAYER, TextColor = FlatColors.Foreground, Font = Textures.HUDFontBold, FontSize = 42, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false), Click = ShowMultiplayer, IsVisible = false, }); } else { AddElement(_btn = new HUDTextButton(1) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = FPoint.Zero, Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 48), L10NText = L10NImpl.STR_WORLD_SINGLEPLAYER, TextColor = FlatColors.Foreground, Font = Textures.HUDFontBold, FontSize = 42, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false), Click = ShowSingleplayer, IsVisible = false, }); } } _loader = new HUDImage { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(2 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), Color = FlatColors.Clouds, Image = Textures.CannonCogBig, RotationSpeed = 0.1f, IsVisible = true, }; AddElement(_loader); _table = new HUDScrollTable { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(TAB_WIDTH, TAB_HEIGHT), Background = FlatColors.BackgroundHUD2, Foreground = FlatColors.TextHUD, LineColor = Color.Black, HeaderBackground = FlatColors.Asbestos, HeaderForeground = Color.Black, ScrollThumbColor = FlatColors.Silver, ScrollWidth = 16, ScrollHeight = 64, LineWidth = 2 * HUD.PixelWidth, FontSize = 32, IsVisible = false, }; _table.FixHeightToMultipleOfRowHeight(); AddElement(_table); _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); if (!_showMultiplayer) { _table.AddColumn(L10N.T(L10NImpl.STR_TAB_TIME), 175); } LoadHighscore().EnsureNoError(); }
public override void OnInitialize() { AddElement(_textbox = new HUDSimpleTextBox { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(16, 16), Size = new FSize(Width - 16 - 16 - 64, 64), ColorText = Color.Black, Font = Textures.HUDFontRegular, FontSize = 48, MaxLength = SCCMLevelData.MaxNameLength, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth), BackgroundFocused = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth), EnterKey = (s, e) => StartSearch(), CloseKeyboard = (s, e) => StartSearch(), }); AddElement(new HUDImageButton { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = new FPoint(16 + HUD.PixelWidth, 16), Size = new FSize(64, 64), Image = Textures.TexHUDButtonIconMagnifier, ImagePadding = 8, ImageColor = FlatColors.Asbestos, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Concrete, Color.Black, HUD.PixelWidth), Click = (s, e) => StartSearch(), }); AddElement(_presenter = new SCCMListPresenter { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(16, 16), Size = new FSize(Width - 16 - 16 - 48 - 16, Height - 16 - 16 - 16 - 64), IsVisible = true, }); AddElement(_scrollbar = new SCCMListScrollbar { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(16, 16), Size = new FSize(48, Height - 16 - 16 - 16 - 64), IsVisible = true, }); AddElement(_waitingCog = new HUDImage { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, 16 + 32), Image = Textures.CannonCogBig, RotationSpeed = 0.35f, Color = FlatColors.Clouds, Size = new FSize(192, 192), IsVisible = false, }); _presenter.Load(QueryData, _scrollbar, _waitingCog); }
public override void OnInitialize() { base.OnInitialize(); string txt = "?"; switch (_mode) { case HighscoreCategory.GlobalPoints: txt = L10N.T(L10NImpl.STR_HSP_GLOBALRANKING); break; case HighscoreCategory.WorldPoints: txt = L10N.TF(L10NImpl.STR_HSP_RANKINGFOR, L10N.T(Levels.WORLD_NAMES[_focus.ID])); break; case HighscoreCategory.MultiplayerPoints: txt = L10N.T(L10NImpl.STR_HSP_MULTIPLAYERRANKING); break; case HighscoreCategory.CustomLevelStars: txt = L10N.T(L10NImpl.STR_HSP_STARRANKING); break; case HighscoreCategory.CustomLevelPoints: txt = L10N.T(L10NImpl.STR_HSP_SCCMRANKING); break; default: SAMLog.Error("HP::EnumSwitch_OI", "_mode: " + _mode); break; } AddElement(new HUDLabel(1) { TextAlignment = (txt.Length > 24) ? HUDAlignment.CENTERLEFT : HUDAlignment.CENTER, Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(TAB_WIDTH, TEXT_HEIGHT_REAL), Font = Textures.HUDFontBold, FontSize = 64, Text = txt, TextColor = FlatColors.Clouds, }); AddElement(_btnPrev = new HUDImageButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = FPoint.Zero, Size = new FSize(72, 72), Image = GetModeIcon(NextCategory(_mode, false)), ImageColor = GetModeColor(NextCategory(_mode, false)), ImagePadding = 8, ImageAlignment = HUDImageAlignmentAlgorithm.CENTER, ImageScale = HUDImageScaleAlgorithm.UNDERSCALE, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 16, true, false, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 16, true, false, false, false), Click = (s, e) => SwitchMode(false), IsVisible = false, }); AddElement(_btnNext = new HUDImageButton(1) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = FPoint.Zero, Size = new FSize(72, 72), Image = GetModeIcon(NextCategory(_mode, true)), ImageColor = GetModeColor(NextCategory(_mode, true)), ImagePadding = 8, ImageAlignment = HUDImageAlignmentAlgorithm.CENTER, ImageScale = HUDImageScaleAlgorithm.UNDERSCALE, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 16, false, true, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 16, false, true, false, false), Click = (s, e) => SwitchMode(true), IsVisible = false, }); _loader = new HUDImage { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(2 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), Color = FlatColors.Clouds, Image = Textures.CannonCogBig, RotationSpeed = 0.1f, IsVisible = true, }; AddElement(_loader); _table = new HUDScrollTable { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(TAB_WIDTH, TAB_HEIGHT), Background = FlatColors.BackgroundHUD2, Foreground = FlatColors.TextHUD, LineColor = Color.Black, HeaderBackground = FlatColors.Asbestos, HeaderForeground = Color.Black, ScrollThumbColor = FlatColors.Silver, ScrollWidth = 16, ScrollHeight = 64, LineWidth = 2 * HUD.PixelWidth, FontSize = 32, IsVisible = false, }; _table.FixHeightToMultipleOfRowHeight(); AddElement(_table); switch (_mode) { case HighscoreCategory.GlobalPoints: _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_TIME), 175); break; case HighscoreCategory.WorldPoints: _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_TIME), 175); break; case HighscoreCategory.MultiplayerPoints: _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); break; case HighscoreCategory.CustomLevelStars: _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_STARS), 100); break; case HighscoreCategory.CustomLevelPoints: _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); break; default: SAMLog.Error("HP::EnumSwitch_OI2", "_mode: " + _mode); break; } LoadHighscore().EnsureNoError(); }