protected override void OnHide() { base.OnHide(); // Stop all the sounds foreach (var sound in m_loopingSounds.Values) { sound.Stop(); } // Remove the GUI if (m_scrollingText != null) { Game.Screen.Elements.Remove(m_scrollingText); m_scrollingText.Dispose(); m_scrollingText = null; } if (m_terminal != null) { Game.Screen.Elements.Remove(m_terminal); m_terminal.Dispose(); m_terminal = null; } Game.Screen.Elements.Remove(m_border); m_border.Dispose(); }
// Start is called before the first frame update public void OnTriggerEnter(Collider other) { if (other.tag.CompareTo("Player") == 0) { ScrollingText.StartSentence(new string[] { "Urgh... I can't leave this something...?" }, new string[] { "NoLeave" }); } }
// scrolling text private void createScrollingText(Vector2 pos, string contents, Color color, float delay, float duration, Controller c, State s, int size = 30, bool bold = true) { GameObject scrollingTextObj = Instantiate(scrolling_text, canvas.transform); scrollingTextObj.GetComponent <RectTransform> ().anchoredPosition = pos; Text text = scrollingTextObj.GetComponent <Text> (); text.text = contents; text.color = color; text.fontSize = size; if (bold) { text.fontStyle = FontStyle.Bold; } else { text.fontStyle = FontStyle.Normal; } ScrollingText scrollingText = scrollingTextObj.GetComponent <ScrollingText> (); scrollingText.delay = delay; scrollingText.setDuration(duration); scrollingText.controller = c; scrollingText.state = s; scrollingTextObj = null; scrollingText = null; text = null; }
void Start() { // Grab references. thisObject = gameObject; textBox = GetComponentInChildren <ScrollingText>(); if (GameObject.FindGameObjectWithTag("Player") != null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.RigidbodyFirstPersonController>(); } starterName = starterNameRef; nameBox = nameBoxRef; // Set initial values of sensitivity temps. if (player != null) { sensitivityXTemp = player.mouseLook.XSensitivity; sensitivityYTemp = player.mouseLook.YSensitivity; } // Disable to start with. FakeActive(gameObject, false); // prevents problem with OnEnable() calling Start() AFTER a trigger has been enabled if (currentlyEnabled) { FakeActive(gameObject, true); } }
// Enable the text box, supplying a trigger. This is generally better when possible, since it will set name / escape rule. public static void Enable(ConversationTrigger trigger) { // Make sure we didn't lose our ref somehow... if (textBox == null || textBox.isActiveAndEnabled == false) { textBox = thisObject.GetComponentInChildren <ScrollingText>(); textBox.enabled = true; } // Make sure the dictionary is prepped if a "bad" key is given. if (!ConversationsDB.convos.ContainsKey(trigger.conversationName)) { ConversationsDB.LoadConversationsFromFiles(); } textBox.ApplyConversation(ConversationsDB.convos[trigger.conversationName]); currentConversationName = trigger.conversationName; currentEscRule = trigger.allowEscape; if (trigger.conversationName == "nowhere") { SoftDisable(); return; } SetStarterName(trigger.nameOfStarter); FakeActive(thisObject, true); currentlyEnabled = true; AllowMouse(); // Oneshot destroys the trigger and marks it with a token so it never comes back again. Ever. // You'll have to delete the save file to have it trigger again. if (trigger.oneShot) { Destroy(trigger); ConversationTrigger.AddToken("oneShot_" + trigger.conversationName); } }
protected override async Task LoadContent() { await base.LoadContent(); textScroller = new ScrollingText { Name = "Text Scroller", DesiredCharacterNumber = 25, Text = InitialText, TextColor = Color.Black, Font = Content.Load <SpriteFont>("CourierNew12"), IsEnabled = ForceInteractiveMode, SynchronousCharacterGeneration = true }; decorator = new ContentDecorator { Name = "ContentDecorator", Content = textScroller, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, BackgroundImage = (SpriteFromTexture) new Sprite(Content.Load <Texture>("DumbWhite")) }; UIComponent.Page = new Engine.UIPage { RootElement = decorator }; }
protected override async Task LoadContent() { await base.LoadContent(); textScroller = new ScrollingText { Name = "Text Scroller", DesiredCharacterNumber = 25, Text = InitialText, TextColor = Color.Black, Font = Asset.Load <SpriteFont>("CourierNew12"), IsEnabled = IsAutomatic, SynchronousCharacterGeneration = true }; decorator = new ContentDecorator { Name = "ContentDecorator", Content = textScroller, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, BackgroundImage = new UIImage(Asset.Load <Texture2D>("DumbWhite")) }; UI.RootElement = decorator; }
public void OnAttack(GameObject attacker, Attack attack) { // Since the text is automatically facing the camera! We dont need to set the ScrollingText spawnedText = Instantiate(text, transform.position, Quaternion.identity); spawnedText.SetText(attack.Damage.ToString()); spawnedText.SetColor(textColor); }
void Start() { // Re-map all this ascii because I hate myself. Nothing to see here. indices = new Dictionary <char, int>(); indices.Add('a', 0); indices.Add('b', 1); indices.Add('c', 2); indices.Add('d', 3); indices.Add('e', 4); indices.Add('f', 5); indices.Add('g', 6); indices.Add('h', 7); indices.Add('i', 8); indices.Add('j', 9); indices.Add('k', 10); indices.Add('l', 11); indices.Add('m', 12); indices.Add('n', 13); indices.Add('o', 14); indices.Add('p', 15); indices.Add('q', 16); indices.Add('r', 17); indices.Add('s', 18); indices.Add('t', 19); indices.Add('u', 20); indices.Add('v', 21); indices.Add('w', 22); indices.Add('x', 23); indices.Add('y', 24); indices.Add('z', 25); indices.Add('1', 26); indices.Add('2', 27); indices.Add('3', 28); indices.Add('4', 29); indices.Add('5', 30); indices.Add('6', 31); indices.Add('7', 32); indices.Add('8', 33); indices.Add('9', 34); indices.Add('0', 35); indices.Add('!', 36); indices.Add('@', 37); indices.Add('#', 38); indices.Add('$', 39); indices.Add('%', 40); indices.Add('^', 41); indices.Add('&', 42); indices.Add('*', 43); indices.Add('(', 44); indices.Add(')', 45); indices.Add('[', 46); indices.Add(']', 47); indices.Add('/', 48); indices.Add('\\', 49); indices.Add('+', 50); indices.Add('-', 51); indices.Add('=', 52); indices.Add('?', 53); indices.Add('.', 54); indices.Add(',', 55); indices.Add('\'', 56); indices.Add('"', 57); indices.Add(':', 58); indices.Add(';', 59); indices.Add('|', 60); indices.Add(' ', 61); indices.Add('\n', 61); indices.Add('\t', 61); // Check for a scrolling text controller. scrollController = GetComponent <ScrollingText>(); // Load each sprite on the sheet so we can reference it with our silly map. sprites = Resources.LoadAll <Sprite>("HUDElements/Font"); // Init our letter prefab. letterPrefab = Resources.Load <GameObject>("Prefabs/TextSystem/TextElement"); // Init our list letterObjects = new List <GameObject>(); // Get and check the text component txt = GetComponent <Text>(); if (txt == null) { Debug.LogError("No Text component found on object marked as text!"); Destroy(this); // Delete this script for safety. } // Prepare the object for sprite text. layout = gameObject.AddComponent <GridLayoutGroup>(); layout.cellSize = new Vector2(8 * sizeMultiplierX * kerningMultiplier, 16 * sizeMultiplierY * leadingMultiplier); layout.spacing = new Vector2(spacingX, spacingY); // Disappearify the default text in the hackiest way possible so as to conserve its other attributes for use with sprite text. txt.material = Resources.Load <Material>("HUDElements/FontBeGone"); // Populate initial text RefreshText(); }
public void StopScrollingText() { if (m_scrollingText != null) { Game.Screen.Elements.Remove(m_scrollingText); m_scrollingText.Dispose(); m_scrollingText = null; } }
protected void ApplyScrollingTextDefaultStyle(ScrollingText scollingText) { if (scollingText == null) { throw new ArgumentNullException(nameof(scollingText)); } ApplyTextBlockDefaultStyle(scollingText); scollingText.TextColor = scrollingTextTextColor; }
//---------------- // Utility //---------------- public void SpawnText(string text, Color color) { Vector3 viewPos = Camera.main.WorldToViewportPoint(new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z)); GameObject go = Instantiate(m_ScrollingTextPrefab, viewPos, Quaternion.identity) as GameObject; ScrollingText scrollingText = go.GetComponent <ScrollingText>(); scrollingText.Text = text; scrollingText.TextColor = color; }
private void OnTriggerEnter(Collider other) { if (other.tag.CompareTo("Player") == 0) { if (PlayerPrefs.GetInt("FinalItem") == 1) { PlayerPrefs.SetInt("FinalItem", 0); SceneManager.LoadScene("GameEnd"); } else { ScrollingText.StartSentence(new string[] { "I need to find the missing item to activate" }, new string[] { "Main" }); } } }
void CreateBumper() { holdMouthOpen += 1.0f; GameObject newBumper = Instantiate(bumper); newBumper.transform.position = this.transform.position; newBumper.GetComponent <InterpolateToPosition>().StartInterpolationTo(targetBumperPosition.position); LevelManager.thingsToUnspawn.Add(newBumper); if (firstTime) { ScrollingText.SetText(new[] { "Tell no one..." }); firstTime = false; } }
public AboutPL() { InitializeComponent(); // Initialize a table of new bubbles Bubbles = new Bubble[BubbleCount].Select(x => Bubble.Create(Size, rand)).ToList(); // Creation of current buffer to be printed on window Buffer = new Bitmap(Width, Height); // Creation of window content TitleImage = Properties.Resources.PL_Splashscreen_Krypton; sText = new ScrollingText(this, Properties.Resources.AboutThanks); // Set window title Text = "À propos de " + Properties.Resources.ProjectName + " " + Properties.Resources.CurrentVersion; }
private void Start() { _inventory = GetComponent<Inventory>(); _scrollingText = GetComponent<ScrollingText>(); _animator = GetComponent<Animator>(); _movementController = GetComponent<MovementController>(); _compass = transform.Find("Compass"); _characterController = GetComponent<CharacterController>(); switch (Job) { case Job.None: return; // Do nothing case Job.WoodCutter: _jobTask = WorkTask.ChopWood; break; case Job.Miner: _jobTask = WorkTask.Mine; break; } _currentTask = _jobTask; }
void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Scorable") { Destroy(collision.gameObject); var movable = collision.gameObject.GetComponent <Movable>(); bool valid = movable == null || !movable.invalid; if (valid) { LevelManager.IncrementScore(); } else { ScrollingText.InsertText(new[] { "Hey!", "NO CHEATING!" }); } source.PlayOneShot(PlayerControls.instance.portalSound); } }
private void OnTriggerEnter(Collider other) { if (!Active) { return; } GameObject gobject = other.gameObject; if (other.CompareTag("Player") && Active) { Vector3 position = other.transform.position; AddImpact(position, Force); if (Rooms.RollRoom() == false) { int numb = Random.Range(0, 100); if (numb < 20) { spawn.Chest(); } spawnEnemies.Spawn(); EnemyCount = spawnEnemies.amount; Debug.Log("Yolo"); } else { ScrollingText.StartSentence(new string[] { "I found the room with missing item, I need to leave now" }, new string[] { "NoLeave" }); PlayerPrefs.SetInt("FinalItem", 1); spawnExit.SetActive(true); } SpawnedEnemy = true; } }
protected override async Task LoadContent() { await base.LoadContent(); var resolution = (Vector3)UIComponent.VirtualResolution; var canvas = new Canvas(); var imgElt = new ImageElement { Name = "UV image", Source = new Sprite(Asset.Load <Texture>("uv")), Width = resolution.X / 5, Height = resolution.Y / 5, StretchType = StretchType.Fill }; imgElt.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One); imgElt.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(resolution.X / 10, resolution.Y / 10, 0)); imgElt.DependencyProperties.Set(Panel.ZIndexPropertyKey, -1); stackPanel = new StackPanel { Orientation = Orientation.Vertical }; scrollViewer = new ScrollViewer { ScrollMode = ScrollingMode.Vertical }; scrollViewer.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(resolution.X / 4, resolution.Y / 10, 0)); scrollViewer.Content = stackPanel; var button1 = new Button { Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5), LocalMatrix = Matrix.Scaling(2, 2, 2) }; var textOnly = new TextBlock { Text = "Text only button", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), TextColor = new Color(1f, 0, 0, 0.5f) }; button1.Content = textOnly; var button2 = new Button { Name = "Button2", Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5) }; var imageContent = new ImageElement { Name = "Image Button2", Source = new Sprite(Asset.Load <Texture>("uv")), StretchType = StretchType.FillOnStretch, MaximumHeight = 50 }; button2.Content = imageContent; var button3 = new Button { Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5) }; var stackContent = new StackPanel { Orientation = Orientation.Horizontal }; var stackImage = new ImageElement { Name = "Image stack panel", Source = new Sprite(Asset.Load <Texture>("uv")), MaximumHeight = 50 }; var stackText = new TextBlock { Text = "button text", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), Margin = Thickness.UniformRectangle(5) }; stackContent.Children.Add(stackImage); stackContent.Children.Add(stackText); button3.Content = stackContent; var button4 = new Button { Margin = Thickness.UniformRectangle(5), HorizontalAlignment = HorizontalAlignment.Right, Padding = Thickness.UniformRectangle(5) }; var imageContent2 = new ImageElement { Name = "button 4 uv image", Source = new Sprite(Asset.Load <Texture>("uv")), StretchType = StretchType.FillOnStretch, MaximumHeight = 40, Opacity = 0.5f }; button4.Content = imageContent2; var button5 = new Button { Margin = Thickness.UniformRectangle(5), HorizontalAlignment = HorizontalAlignment.Left, Padding = Thickness.UniformRectangle(5) }; var textOnly2 = new TextBlock { Text = "Left aligned", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15") }; button5.Content = textOnly2; var button6 = new ImageButton { Height = 50, Margin = Thickness.UniformRectangle(5), HorizontalAlignment = HorizontalAlignment.Center, PressedImage = new Sprite(Asset.Load <Texture>("ImageButtonPressed")), NotPressedImage = new Sprite(Asset.Load <Texture>("ImageButtonNotPressed")), }; toggle = new ToggleButton { Content = new TextBlock { Text = "Toggle button test", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15") }, IsThreeState = true }; scrollingText = new ScrollingText { Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), Text = "<<<--- Scrolling text in a button ", IsEnabled = IsUpdateAutomatic }; var button7 = new Button { Margin = Thickness.UniformRectangle(5), Content = scrollingText }; var uniformGrid = new UniformGrid { Rows = 2, Columns = 2 }; var gridText = new TextBlock { Text = "Uniform grid", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center }; gridText.DependencyProperties.Set(GridBase.ColumnSpanPropertyKey, 2); var buttonLeft = new Button { Content = new TextBlock { Text = "unif-grid left", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center } }; buttonLeft.DependencyProperties.Set(GridBase.RowPropertyKey, 1); var buttonRight = new Button { Content = new TextBlock { Text = "unif-grid right", Font = Asset.Load <SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center } }; buttonRight.DependencyProperties.Set(GridBase.RowPropertyKey, 1); buttonRight.DependencyProperties.Set(GridBase.ColumnPropertyKey, 1); uniformGrid.Children.Add(gridText); uniformGrid.Children.Add(buttonLeft); uniformGrid.Children.Add(buttonRight); stackPanel.Children.Add(button1); stackPanel.Children.Add(button2); stackPanel.Children.Add(button3); stackPanel.Children.Add(button4); stackPanel.Children.Add(button5); stackPanel.Children.Add(button6); stackPanel.Children.Add(toggle); stackPanel.Children.Add(button7); stackPanel.Children.Add(uniformGrid); canvas.Children.Add(imgElt); canvas.Children.Add(scrollViewer); UIComponent.RootElement = canvas; }
/// <summary> /// 动态布局 /// </summary> /// <param name="layoutPanel"></param> /// <param name="row"></param> /// <param name="col"></param> private void DynamicLayout(TableLayoutPanel layoutPanel, int row, int col) { try { layoutPanel.Controls.Clear(); layoutPanel.RowStyles.Clear(); layoutPanel.ColumnStyles.Clear(); layoutPanel.RowCount = row; panelControl2.Height = row * Convert.ToInt32(AppContext.AppConfig.Interval); panelControl2.Dock = DockStyle.Top; panelControl3.Dock = DockStyle.Fill; for (var i = 0; i < row; i++) { layoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); } layoutPanel.ColumnCount = col; for (var i = 0; i < col; i++) { layoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F)); } for (var i = 0; i < row; i++) { for (var j = 0; j < col; j++) { var label = new Label(); label.Dock = DockStyle.Fill; label.TextAlign = ContentAlignment.MiddleCenter; label.Margin = new Padding(1, 1, 1, 1); label.Font = new Font("微软雅黑", Convert.ToInt32(AppContext.AppConfig.FontSize), FontStyle.Regular); label.BackColor = Color.Transparent; label.ForeColor = Color.Yellow; label.Name = "label" + i + j; var st = new ScrollingText(); st.Dock = DockStyle.Fill; st.ScrollText = string.Empty; st.Margin = new Padding(1, 1, 1, 1); st.Font = new Font("微软雅黑", Convert.ToInt32(AppContext.AppConfig.FontSize), FontStyle.Regular); st.ForeColor = Color.Yellow; st.Name = "st" + i + j; st.TextScrollSpeed = 10; st.TextScrollDistance = 3; switch (label.Name) { case "label00": label.Text = "诊室"; break; case "label01": label.Text = "在诊患者"; break; case "label02": label.Text = "下一位"; break; case "label03": label.Text = "候诊患者"; break; case "label04": label.Text = "已约数"; break; case "label05": label.Text = "候诊数"; break; } if (j == 3 && label.Name != "label03") { layoutPanel.Controls.Add(st); layoutPanel.SetRow(st, i); layoutPanel.SetColumn(st, j); } else { layoutPanel.Controls.Add(label); layoutPanel.SetRow(label, i); layoutPanel.SetColumn(label, j); } } } } catch (Exception ex) { Log4net.LogHelper.Error("绘制控件时出现错误:" + ex.Message); } }
public bool IsColliding(Vector2 center, float radius, out Vector2[] collisionsWithNormal, out Vector2[] nearestPoints) { List<Vector2> collisionList = new List<Vector2>(); List<Vector2> nearestPointList = new List<Vector2>(); bool collision = false; Vector2 collisionWithNormal; Vector2 nearestPoint; for (int i = 0; i < _bricks.Count; i++) { if (_bricks[i].IsColliding(center, radius, out collisionWithNormal, out nearestPoint)) { collision = true; collisionList.Add(collisionWithNormal); nearestPointList.Add(nearestPoint); string score = _bricks[i].Score.ToString(); Vector2 scoreDimension = _game.DefaultUIFont.MeasureString(score); ScrollingText st = new ScrollingText( _game, _spriteBatch, _game.DefaultUIFont, new Vector2( _bricks[i].Position.X + _bricks[i].Width / 2, _bricks[i].Position.Y + _bricks[i].Height / 2 ), score, Color.LightBlue, 4.0f, -20.0f); _game.Components.Add(st); if (OnBrickDie != null) OnBrickDie(_bricks[i].Score); _game.Components.Remove(_bricks[i]); _bricks.RemoveAt(i); i--; } } if (collision) { nearestPoints = nearestPointList.ToArray(); collisionsWithNormal = collisionList.ToArray(); } else { nearestPoints = null; collisionsWithNormal = null; } return collision; }
void Start() { // Re-map all this ascii because I hate myself. Nothing to see here. indices = new Dictionary<char, int>(); indices.Add('a', 0); indices.Add('b', 1); indices.Add('c', 2); indices.Add('d', 3); indices.Add('e', 4); indices.Add('f', 5); indices.Add('g', 6); indices.Add('h', 7); indices.Add('i', 8); indices.Add('j', 9); indices.Add('k', 10); indices.Add('l', 11); indices.Add('m', 12); indices.Add('n', 13); indices.Add('o', 14); indices.Add('p', 15); indices.Add('q', 16); indices.Add('r', 17); indices.Add('s', 18); indices.Add('t', 19); indices.Add('u', 20); indices.Add('v', 21); indices.Add('w', 22); indices.Add('x', 23); indices.Add('y', 24); indices.Add('z', 25); indices.Add('1', 26); indices.Add('2', 27); indices.Add('3', 28); indices.Add('4', 29); indices.Add('5', 30); indices.Add('6', 31); indices.Add('7', 32); indices.Add('8', 33); indices.Add('9', 34); indices.Add('0', 35); indices.Add('!', 36); indices.Add('@', 37); indices.Add('#', 38); indices.Add('$', 39); indices.Add('%', 40); indices.Add('^', 41); indices.Add('&', 42); indices.Add('*', 43); indices.Add('(', 44); indices.Add(')', 45); indices.Add('[', 46); indices.Add(']', 47); indices.Add('/', 48); indices.Add('\\',49); indices.Add('+', 50); indices.Add('-', 51); indices.Add('=', 52); indices.Add('?', 53); indices.Add('.', 54); indices.Add(',', 55); indices.Add('\'',56); indices.Add('"', 57); indices.Add(':', 58); indices.Add(';', 59); indices.Add('|', 60); indices.Add(' ', 61); indices.Add('\n',61); indices.Add('\t',61); // Check for a scrolling text controller. scrollController = GetComponent<ScrollingText>(); // Load each sprite on the sheet so we can reference it with our silly map. sprites = Resources.LoadAll<Sprite>("HUDElements/Font"); // Init our letter prefab. letterPrefab = Resources.Load<GameObject>("Prefabs/TextSystem/TextElement"); // Init our list letterObjects = new List<GameObject>(); // Get and check the text component txt = GetComponent<Text>(); if (txt == null) { Debug.LogError("No Text component found on object marked as text!"); Destroy(this); // Delete this script for safety. } // Prepare the object for sprite text. layout = gameObject.AddComponent<GridLayoutGroup>(); layout.cellSize = new Vector2(8 * sizeMultiplierX * kerningMultiplier, 16 * sizeMultiplierY * leadingMultiplier); layout.spacing = new Vector2(spacingX, spacingY); // Disappearify the default text in the hackiest way possible so as to conserve its other attributes for use with sprite text. txt.material = Resources.Load<Material>("HUDElements/FontBeGone"); // Populate initial text RefreshText(); }
/// <summary> /// 动态布局 /// </summary> /// <param name="layoutPanel"></param> /// <param name="row"></param> /// <param name="col"></param> private void DynamicLayout(TableLayoutPanel layoutPanel, int row, int col) { try { if (InvokeRequired) { Invoke(new MethodInvoker(delegate { DynamicLayout(layoutPanel, row, col); })); return; } layoutPanel.Controls.Clear(); layoutPanel.RowStyles.Clear(); layoutPanel.ColumnStyles.Clear(); layoutPanel.RowCount = row; for (var i = 0; i < row; i++) { layoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); } layoutPanel.ColumnCount = col; for (var i = 0; i < col; i++) { layoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F)); } for (var i = 0; i < row; i++) { for (var j = 0; j < col; j++) { var label = new Label(); label.Dock = DockStyle.Fill; label.TextAlign = ContentAlignment.MiddleCenter; label.Margin = new Padding(1, 1, 1, 1); label.Font = new Font("微软雅黑", Convert.ToInt32(AppContext.AppConfig.FontSize), FontStyle.Regular); label.BackColor = Color.Transparent; label.ForeColor = Color.Yellow; label.Name = "label" + i + j; var st = new ScrollingText(); st.Dock = DockStyle.Fill; st.ScrollText = string.Empty; st.Margin = new Padding(1, 1, 1, 1); st.Font = new Font("微软雅黑", Convert.ToInt32(AppContext.AppConfig.FontSize), FontStyle.Regular); st.ForeColor = Color.Yellow; st.Name = "st" + i + j; st.TextScrollSpeed = 10; st.TextScrollDistance = 1; switch (label.Name) { case "label00": label.Text = "科室"; label.ForeColor = Color.GreenYellow; break; case "label01": label.Text = "医生姓名"; label.ForeColor = Color.GreenYellow; break; case "label02": label.Text = "职称"; label.ForeColor = Color.GreenYellow; break; case "label03": label.Text = "诊时"; label.ForeColor = Color.GreenYellow; break; case "label04": label.Text = "诊室"; label.ForeColor = Color.GreenYellow; break; case "label05": label.Text = "专长"; label.ForeColor = Color.GreenYellow; break; } if (j == 5 && label.Name != "label05") { layoutPanel.Controls.Add(st); layoutPanel.SetRow(st, i); layoutPanel.SetColumn(st, j); } else { layoutPanel.Controls.Add(label); layoutPanel.SetRow(label, i); layoutPanel.SetColumn(label, j); } } } } catch (Exception ex) { Log4net.LogHelper.Error("绘制控件时出现错误:" + ex.Message); } }
// Use this for initialization void Start() { LoadTextBox(); instance = this; }
public void OnCollision(IEntity collisionWith) { if (collisionWith.GetType() == typeof(Ball)) { if (OnBrickDie != null) OnBrickDie(100); ScrollingText text = new ScrollingText( _game, _game.DefaultUIFont, new Vector2( _position.X + (BRICK_WIDTH / 2), _position.Y + (BRICK_HEIGHT / 2)), "100", Color.LightBlue, 4.0f, -20.0f); _game.Components.Add(text); Dead = true; } }
private void Start() { thisTransform = GetComponent <Transform>(); textScript = GameController.Instance.itemText.GetComponent <ScrollingText>(); }
private void Start() { _scrollingText = GetComponent<ScrollingText>(); }
public void StartScrollingText(TextAsset text) { StopScrollingText(); m_scrollingText = new ScrollingText(text, m_border); Game.Screen.Elements.AddBefore(m_scrollingText, m_border); }