當前位置: 首頁>>代碼示例>>C#>>正文


C# Canvas類代碼示例

本文整理匯總了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;
 }
開發者ID:FuriousCatInteractive,項目名稱:MarmotteWorld,代碼行數:8,代碼來源:marmotteSpeak.cs

示例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);
        }
開發者ID:Narinyir,項目名稱:Sanjigen,代碼行數:7,代碼來源:WindowsForm.cs

示例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");
	}
開發者ID:JPStank,項目名稱:CRISPY_Samurai,代碼行數:27,代碼來源:GUI.cs

示例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);
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:12,代碼來源:GraphicRegistry.cs

示例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;
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:14,代碼來源:GraphicRegistry.cs

示例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;
	
	}
開發者ID:johnsonnikolaus,項目名稱:VR-RC-Racing,代碼行數:31,代碼來源:GameManager.cs

示例7: Start

 // Use this for initialization
 void Start()
 {
     quitMenu = quitMenu.GetComponent<Canvas> ();
     play = play.GetComponent<Button> ();
     quit = quit.GetComponent<Button> ();
     quitMenu.enabled = false;
 }
開發者ID:Menkid,項目名稱:OKUNiD,代碼行數:8,代碼來源:MenuScript.cs

示例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();
        }
    }
開發者ID:ShinWonYoung,項目名稱:HGU-SE-15,代碼行數:32,代碼來源:MenuManager.cs

示例9: Awake

	public void Awake () 
	{
		_canvas = FindObjectOfType<Canvas>();
		_renderers = FindObjectsOfType<Renderer>();
		_scnManager = FindObjectOfType<SceneManager> ();
		DOTween.Init();
	}
開發者ID:MaDDoXbr,項目名稱:https---github.com-magneticservices-Palomar,代碼行數:7,代碼來源:LineGraph.cs

示例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>();
        }
開發者ID:illvisation,項目名稱:cellVIEW_bdbox,代碼行數:10,代碼來源:UIWindowBase.cs

示例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);
    }
開發者ID:Edj3,項目名稱:Unity_3PShooter,代碼行數:27,代碼來源:FireGun.cs

示例12: Start

	// Use this for initialization
	void Start () {
		quitMenu = quitMenu.GetComponent<Canvas> ();
		playText = playText.GetComponent<Button> ();
		exitText = exitText.GetComponent<Button> ();
		quitMenu.enabled = false;

	}
開發者ID:ajm1996,項目名稱:MorningRitual,代碼行數:8,代碼來源:Menu.cs

示例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;
	}
開發者ID:InvistiGator,項目名稱:DogTective,代碼行數:35,代碼來源:scene41Manager.cs

示例14: Start

 void Start()
 {
     exitText = exitText.GetComponent<Canvas> ();
     menu = menu.GetComponent<Canvas> ();
     menu.enabled = true;
     exitText.enabled = false;
 }
開發者ID:YoGames,項目名稱:SumoWrestling,代碼行數:7,代碼來源:Menu.cs

示例15: Awake

 void Awake()
 {
     text = GameObject.Find("Info").GetComponent<Text>();
     myCanvas = transform.parent.parent.parent.GetComponent<Canvas>();
     infoMessage = new List<string>();
     DisableMe();
 }
開發者ID:HaKDMoDz,項目名稱:Capstone_Space_Game,代碼行數:7,代碼來源:Info.cs


注:本文中的Canvas類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。