• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Canvas类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Canvas的典型用法代码示例。如果您正苦于以下问题:C# Canvas类的具体用法?C# Canvas怎么用?C# Canvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Canvas类属于命名空间,在下文中一共展示了Canvas类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: TextLayout

 public TextLayout(Canvas canvas)
 {
     ToolkitEngine = canvas.Surface.ToolkitEngine;
     handler = ToolkitEngine.TextLayoutBackendHandler;
     Backend = handler.Create ((ICanvasBackend)Toolkit.GetBackend (canvas));
     Font = canvas.Font;
 }
开发者ID:garuma,项目名称:xwt,代码行数:7,代码来源:TextLayout.cs


示例17: Start

	// Use this for initialization
	void Start () {

        canvas = GetComponent<Canvas>();
       
        foreach (Transform t in transform)
        {
            if (t.name == "Item0")
                items[0] = t.gameObject;
            if (t.name == "Item1")
                items[1] = t.gameObject;
            if (t.name == "Item2")
                items[2] = t.gameObject;
            if (t.name == "Item3")
                items[3] = t.gameObject;
            if (t.name == "Item4")
                items[4] = t.gameObject;
            if (t.name == "Item5")
                items[5] = t.gameObject;
            if (t.name == "Item6")
                items[6] = t.gameObject;
            if (t.name == "Item7")
                items[7] = t.gameObject;
            if (t.name == "HandCursor")
                handCursor = t.gameObject;
            if (t.name == "Background")
                background = t.gameObject;
        }

        handCusorPositionX = handCursor.GetComponent<RectTransform>().position.x;
        originalHandCursorPositionX = handCusorPositionX;
    }
开发者ID:NicholasGennadyKorta,项目名称:TBS-Toolkit-Early-Source,代码行数:32,代码来源:GUICommandMenu.cs


示例18: Start

 // Use this for initialization
 void Start()
 {
     startMenu = startMenu.GetComponent<Canvas> ();
     gameoverMenu = gameoverMenu.GetComponent<Canvas> ();
     startMenu.enabled = true;
     gameoverMenu.enabled = false;
 }
开发者ID:tristanbell,项目名称:Halloween-Jam-2015,代码行数:8,代码来源:MenuControl.cs


示例19: Start

 void Start()
 {
     QuitMenu = QuitMenu.GetComponent<Canvas>();
     startText = startText.GetComponent<Button>();
     exitText = exitText.GetComponent<Button>();
     QuitMenu.enabled = false;
 }
开发者ID:Kickerino,项目名称:Pinball3D,代码行数:7,代码来源:menuScript.cs


示例20: CanvasExample

		public CanvasExample () {
			Gtk.Window win = new Gtk.Window ("Canvas example");
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			VBox vbox = new VBox (false, 0);
			win.Add (vbox);

			vbox.PackStart (new Label ("Drag - move object.\n" +
						   "Double click - change color\n" +
						   "Right click - delete object"),
					false, false, 0);
			
			canvas = new Canvas ();
			canvas.SetSizeRequest (width, height);
			canvas.SetScrollRegion (0.0, 0.0, (double) width, (double) height);
			vbox.PackStart (canvas, false, false, 0);

			HBox hbox = new HBox (false, 0);
			vbox.PackStart (hbox, false, false, 0);

			Button add_button = new Button ("Add an object");
			add_button.Clicked += new EventHandler (AddObject);
			hbox.PackStart (add_button, false, false, 0);

			Button quit_button = new Button ("Quit");
			quit_button.Clicked += new EventHandler (Quit);
			hbox.PackStart (quit_button, false, false, 0);

			win.ShowAll ();
		}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:30,代码来源:CanvasExample.cs



注:本文中的Canvas类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CanvasAnimatedDrawEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# Canguro类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap