本文整理汇总了C#中Text.SetColor方法的典型用法代码示例。如果您正苦于以下问题:C# Text.SetColor方法的具体用法?C# Text.SetColor怎么用?C# Text.SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text.SetColor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button
public Button(EventHandler onPressEvent, Text label)
{
_onPressEvent = onPressEvent;
_label = label;
_label.SetColor(new Color(0, 0, 0, 1));
UpdatePosition();
}
示例2: Show
public void Show(Color color, int fontSize = 18)
{
if (text != null)
return;
text = new Text();
text.SetColor(color);
text.VerticalAlignment = VerticalAlignment.Top;
text.HorizontalAlignment = HorizontalAlignment.Right;
text.TextAlignment = HorizontalAlignment.Right;
text.SetFont(CoreAssets.Fonts.AnonymousPro, fontSize);
application.UI.Root.AddChild(text);
subscription = application.Engine.SubscribeToPostUpdate(OnPostUpdate);
}
示例3: CreateScene
async void CreateScene()
{
// UI text
var helloText = new Text(Context);
helloText.Value = "Hello World from UrhoSharp";
helloText.HorizontalAlignment = HorizontalAlignment.Center;
helloText.VerticalAlignment = VerticalAlignment.Top;
helloText.SetColor(new Color(r: 0f, g: 1f, b: 1f));
helloText.SetFont(font: ResourceCache.GetFont("Fonts/Font.ttf"), size: 30);
UI.Root.AddChild(helloText);
// 3D scene with Octree
var scene = new Scene(Context);
scene.CreateComponent<Octree>();
// Box
Node boxNode = scene.CreateChild(name: "Box node");
boxNode.Position = new Vector3(x: 0, y: 0, z: 5);
boxNode.SetScale(0f);
boxNode.Rotation = new Quaternion(x: 60, y: 0, z: 30);
StaticModel boxModel = boxNode.CreateComponent<StaticModel>();
boxModel.Model = ResourceCache.GetModel("Models/Box.mdl");
boxModel.SetMaterial(ResourceCache.GetMaterial("Materials/BoxMaterial.xml"));
// Light
Node lightNode = scene.CreateChild(name: "light");
var light = lightNode.CreateComponent<Light>();
light.Range = 10;
light.Brightness = 1.5f;
// Camera
Node cameraNode = scene.CreateChild(name: "camera");
Camera camera = cameraNode.CreateComponent<Camera>();
// Viewport
Renderer.SetViewport(0, new Viewport(Context, scene, camera, null));
// Do actions
await boxNode.RunActionsAsync(new EaseBounceOut(new ScaleTo(duration: 1f, scale: 1)));
await boxNode.RunActionsAsync(new RepeatForever(
new RotateBy(duration: 1, deltaAngleX: 90, deltaAngleY: 0, deltaAngleZ: 0)));
}
示例4: Start
protected override void Start()
{
var cache = ResourceCache;
var helloText = new Text()
{
Value = "Hello World from UrhoSharp",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
helloText.SetColor(new Color(0f, 1f, 0f));
helloText.SetFont(font: cache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30);
UI.Root.AddChild(helloText);
Graphics.SetWindowIcon(cache.GetImage("Textures/UrhoIcon.png"));
Graphics.WindowTitle = "UrhoSharp Sample";
// Subscribe to Esc key:
Input.SubscribeToKeyDown(args => { if (args.Key == Key.Esc) Exit(); });
}
示例5: CreateScene
async void CreateScene()
{
// UI text
helloText = new Text()
{
Value = "Hello World from MySample",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
helloText.SetColor(new Color(0f, 1f, 1f));
helloText.SetFont(
font: ResourceCache.GetFont("Fonts/BlueHighway.ttf"),
size: 30);
UI.Root.AddChild(helloText);
// Create a top-level scene, must add the Octree
// to visualize any 3D content.
var scene = new Scene();
scene.CreateComponent<Octree>();
// Box
Node boxNode = scene.CreateChild();
boxNode.Position = new Vector3(0, 0, 5);
boxNode.Rotation = new Quaternion(60, 0, 30);
boxNode.SetScale(0f);
StaticModel modelObject = boxNode.CreateComponent<StaticModel>();
modelObject.Model = ResourceCache.GetModel("Models/Box.mdl");
// Light
Node lightNode = scene.CreateChild(name: "light");
lightNode.SetDirection(new Vector3(0.6f, -1.0f, 0.8f));
lightNode.CreateComponent<Light>();
// Camera
Node cameraNode = scene.CreateChild(name: "camera");
Camera camera = cameraNode.CreateComponent<Camera>();
// Viewport
Renderer.SetViewport(0, new Viewport(scene, camera, null));
// Perform some actions
await boxNode.RunActionsAsync(
new EaseBounceOut(new ScaleTo(duration: 1f, scale: 1)));
await boxNode.RunActionsAsync(
new RepeatForever(new RotateBy(duration: 1,
deltaAngleX: 90, deltaAngleY: 0, deltaAngleZ: 0)));
}
示例6: Start
protected override void Start()
{
// UI text
var helloText = new Text(Context);
helloText.Value = "UrhoSharp face detection";
helloText.HorizontalAlignment = Urho.Gui.HorizontalAlignment.Center;
helloText.VerticalAlignment = Urho.Gui.VerticalAlignment.Top;
helloText.SetColor(new Color(r: 0f, g: 0f, b: 1f));
helloText.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 30);
UI.Root.AddChild(helloText);
// 3D scene with Octree
scene = new Scene(Context);
scene.CreateComponent<Octree>();
// Mask
maskNode = scene.CreateChild();
maskNode.Position = new Vector3(x: 1, y: 0, z: 5);
maskNode.Scale = new Vector3(1, 1, 1) / 3f;
var leftEye = maskNode.CreateChild();
var leftEyeModel = leftEye.CreateComponent<Urho.Shapes.Sphere>();
var rightEye = maskNode.CreateChild();
var rightEyeModel = rightEye.CreateComponent<Urho.Shapes.Sphere>();
leftEye.Position = new Vector3(-0.6f, 0, 0);
rightEye.Position = new Vector3(0.6f, 0, 0);
leftEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next()));
rightEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next()));
// Light
Node lightNode = scene.CreateChild();
lightNode.Position = new Vector3(-2, 0, 0);
var light = lightNode.CreateComponent<Light>();
light.Range = 20;
light.Brightness = 1f;
// Camera
Node cameraNode = scene.CreateChild();
camera = cameraNode.CreateComponent<Camera>();
// Viewport
var vp = new Viewport(Context, scene, camera, null);
Renderer.SetViewport(0, vp);
vp.SetClearColor(Color.White);
}
示例7: Main
static void Main()
{
Clutter.Application.Init ();
Stage = new Stage ();
Stage.Title = "Deal!";
Stage.Add (new Texture ("Pixmaps/Table.png"));
Stage.SetSize (800, 480);
Stage.KeyPressEvent += HandleKeyPress;
Texture C = new Texture ("Pixmaps/Coin.png");
C.SetSize (50, 50);
C.SetPosition (35, 405);
Stage.Add (C);
Bet = 0;
BetButton = new BetButton ();
BetButton.ButtonPressEvent += IncreaseBet;
Stage.Add (BetButton);
DealButton = new DealButton ();
DealButton.ButtonPressEvent += NewGame;
Stage.Add (DealButton);
StepButton = new StepButton ();
StepButton.ButtonPressEvent += NextStep;
Stage.Add (StepButton);
Stack = new Stack ();
Stack.Decrease (20);
ScoreText = new Text ("Droid Sans Bold 21", "" + Stack.GetAmount());
ScoreText.SetColor (new Clutter.Color (0xff, 0xff, 0xff, 0xff));
ScoreText.SetPosition (100, 413);
Stage.Add (ScoreText);
Coins = new Coin [5];
Coins [0] = new Coin ();
Coins [1] = new Coin ();
Coins [2] = new Coin ();
Coins [3] = new Coin ();
Coins [4] = new Coin ();
for (int i = 0; i < 5; i++) {
Coins [i].SetPosition (35, 405);
Stage.Add (Coins [i]);
}
Deck = new Deck ();
PlayerHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());
OpponentHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());
SetupAnimation ();
Stage.ShowAll();
Clutter.Application.Run ();
}