本文整理汇总了C#中Canvas类的典型用法代码示例。如果您正苦于以下问题:C# Canvas类的具体用法?C# Canvas怎么用?C# Canvas使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Canvas类属于命名空间,在下文中一共展示了Canvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
cpt = 0.0F;
GetComponent<AudioSource>().PlayOneShot(nekoNya);
canvas = GameObject.FindGameObjectWithTag("marmotteUI").GetComponent<Canvas>();
canvas.enabled = false;
}
示例2: OnShown
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
mvarHDC = Internal.System.Windows.Methods.GetDC(this.Handle);
mvarCanvas = new Canvas(mvarHDC, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
}
示例3: Start
// Use this for initialization
void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<PuppetScript>();
theGUI = GameObject.Find("GUI").GetComponent<Canvas>();
tutorial = GameObject.Find("Tutorial").GetComponent<Canvas>();
if (theGUI)
{
guardLeft = GameObject.Find("GUI/Panel/Guard HUD/Guard Left").GetComponent<Image>();
guardRight = GameObject.Find("GUI/Panel/Guard HUD/Guard Right").GetComponent<Image>();
guardTop = GameObject.Find("GUI/Panel/Guard HUD/Guard Top").GetComponent<Image>();
tally1 = GameObject.Find("GUI/Panel/Tally1").GetComponent<Image>();
tally2 = GameObject.Find("GUI/Panel/Tally2").GetComponent<Image>();
tally3 = GameObject.Find("GUI/Panel/Tally3").GetComponent<Image>();
}
dances.Add("Twerk");
dances.Add("Gangnam Style");
dances.Add("Robot");
dances.Add("Thriller 1");
dances.Add("Thriller 2");
dances.Add("Thriller 3");
dances.Add("Thriller 4");
}
示例4: UnregisterGraphicForCanvas
/// <summary>
/// <para>Deregister the given Graphic from a Canvas.</para>
/// </summary>
/// <param name="c">Canvas.</param>
/// <param name="graphic">Graphic to deregister.</param>
public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
{
IndexedSet<Graphic> indexedSet;
if ((Object) c == (Object) null || !GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet))
return;
indexedSet.Remove(graphic);
}
示例5: GetGraphicsForCanvas
/// <summary>
/// <para>Return a list of Graphics that are registered on the Canvas.</para>
/// </summary>
/// <param name="canvas">Input canvas.</param>
/// <returns>
/// <para>Graphics on the input canvas.</para>
/// </returns>
public static IList<Graphic> GetGraphicsForCanvas(Canvas canvas)
{
IndexedSet<Graphic> indexedSet;
if (GraphicRegistry.instance.m_Graphics.TryGetValue(canvas, out indexedSet))
return (IList<Graphic>) indexedSet;
return (IList<Graphic>) GraphicRegistry.s_EmptyList;
}
示例6: Start
// Use this for initialization
void Start () {
winningPlayer = 0;
Time.timeScale = 1;
players = GameObject.FindGameObjectsWithTag("Player");
if (players.Length > numOfPlayers)
{
for (int i = 0; i < players.Length; i++)
{
if (players[i].GetComponent<CarScript>().player > numOfPlayers)
if (players[i].transform.name != ("RC Car 1"))
{
Destroy(players[i].gameObject);
}
else
continue;
}
}
lapText = GameObject.Find("Lap Text").GetComponent<Text>();
winnerText = GameObject.Find("Winner Text").GetComponent<Text>();
gameOverCanvas = GameObject.Find("Game Over Canvas").GetComponent<Canvas>();
pauseCanvas = GameObject.Find("Pause Canvas").GetComponent<Canvas>();
hudCanvas = GameObject.Find("HUD").GetComponent<Canvas>();
pauseCanvas.enabled = false;
gameOverCanvas.enabled = false;
}
示例7: Start
// Use this for initialization
void Start()
{
quitMenu = quitMenu.GetComponent<Canvas> ();
play = play.GetComponent<Button> ();
quit = quit.GetComponent<Button> ();
quitMenu.enabled = false;
}
示例8: Start
// Use this for initialization
void Start()
{
SetSound();
Image[] images = GetComponentsInChildren<Image>();
foreach (Image i in images)
if (i.name == "SoundButton")
{
_soundImage = i;
_soundImage.sprite = (sound == 1) ? soundOnImage : soundOffImage;
}
_startMenuCanvas = GetComponentInChildren<Canvas>();
_startMenuCanvas.enabled = true;
try {
_highScoreCanvas = GameObject.Find("HighScoreUI").GetComponentInChildren<Canvas>();
if (_highScoreCanvas != null)
{
_highScoreCanvas.enabled = false;
SetFontSize(_startMenuCanvas);
}
}
catch(Exception e) { Debug.Log(e); }
Text[] textArry = _startMenuCanvas.GetComponentsInChildren<Text>();
foreach (Text ctext in textArry)
{
if (ctext.name.Contains("Score")) ctext.text = "" + Score.getScore();
}
}
示例9: Awake
public void Awake ()
{
_canvas = FindObjectOfType<Canvas>();
_renderers = FindObjectsOfType<Renderer>();
_scnManager = FindObjectOfType<SceneManager> ();
DOTween.Init();
}
示例10: Start
public int KeepWindowInCanvas = 5; // # of pixels of the window that must stay inside the canvas view.
// Use this for initialization
void Start()
{
m_transform = GetComponent<RectTransform>();
m_originalCoods = m_transform.position;
m_canvas = GetComponentInParent<Canvas>();
m_canvasRectTransform = m_canvas.GetComponent<RectTransform>();
}
示例11: initUI
private void initUI()
{
//UI Initializations - Grab Canvas with find object, then grab children for efficiency
gameUI = FindObjectOfType<Canvas>();
//get all child sliders
Component[] canvasSliders = gameUI.GetComponentsInChildren<Slider> ();
//get all text sliders
Component[] canvasTexts = gameUI.GetComponentsInChildren<Text> ();
//loop through and find specific slider
foreach (Slider child in canvasSliders) {
if (child.tag.Equals("Enemy HP")) {
enemyHealth = child;
}
}
//loop through and find specific text
foreach (Text child in canvasTexts) {
if (child.tag.Equals("Enemy Ratio")) {
enemyRatio = child;
}
}
//create listener to run delegate function for updating text ratio of enemy
enemyHealth.onValueChanged.AddListener (updateEnemyRatio);
}
示例12: Start
// Use this for initialization
void Start () {
quitMenu = quitMenu.GetComponent<Canvas> ();
playText = playText.GetComponent<Button> ();
exitText = exitText.GetComponent<Button> ();
quitMenu.enabled = false;
}
示例13: Start
void Start () {
sceneManagerScript.setUserVisited(41);
sceneManagerScript.printCurrentKillerID();
dialogue_1 = sceneManagerScript.readFile("Scene41_1.txt");
emotion_1 = sceneManagerScript.readEmotion("41_1.txt");
dialogue_1Length = dialogue_1.Length;
dialogue_2 = sceneManagerScript.readFile("Scene41_2.txt");
emotion_2 = sceneManagerScript.readEmotion("41_2.txt");
dialogue_2Length = dialogue_2.Length;
dialogue_3 = sceneManagerScript.readFile("Scene41_3.txt");
emotion_3 = sceneManagerScript.readEmotion("41_3.txt");
dialogue_3Length = dialogue_3.Length;
dialogue_4 = sceneManagerScript.readFile("Scene41_4.txt");
emotion_4 = sceneManagerScript.readEmotion("41_4.txt");
dialogue_4Length = dialogue_4.Length;
dialogue_5 = sceneManagerScript.readFile("Scene41_5.txt");
emotion_5 = sceneManagerScript.readEmotion("41_5.txt");
dialogue_5Length = dialogue_5.Length;
dialogue_6 = sceneManagerScript.readFile("Scene41_6.txt");
emotion_6 = sceneManagerScript.readEmotion("41_6.txt");
dialogue_6Length = dialogue_6.Length;
displayDialogue();
sceneCanvas = sceneCanvas.GetComponent<Canvas>();
sceneCanvas.enabled = true;
decision1Canvas = decision1Canvas.GetComponent<Canvas>();
decision1Canvas.enabled = false;
}
示例14: Start
void Start()
{
exitText = exitText.GetComponent<Canvas> ();
menu = menu.GetComponent<Canvas> ();
menu.enabled = true;
exitText.enabled = false;
}
示例15: Awake
void Awake()
{
text = GameObject.Find("Info").GetComponent<Text>();
myCanvas = transform.parent.parent.parent.GetComponent<Canvas>();
infoMessage = new List<string>();
DisableMe();
}