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


C# UnityEngine.CanvasGroup類代碼示例

本文整理匯總了C#中UnityEngine.CanvasGroup的典型用法代碼示例。如果您正苦於以下問題:C# CanvasGroup類的具體用法?C# CanvasGroup怎麽用?C# CanvasGroup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CanvasGroup類屬於UnityEngine命名空間,在下文中一共展示了CanvasGroup類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Start

	void Start () {

		mayUseHealth = false;
		mayUseMana = false;

		RectTransform slotRect = GetComponent<RectTransform> (); 
		RectTransform txtRect = stackTxt.GetComponent<RectTransform> (); 

		int txtScaleFactor = (int)(slotRect.sizeDelta.x * 0.55); 

		stackTxt.resizeTextMaxSize = txtScaleFactor; 
		stackTxt.resizeTextMinSize = txtScaleFactor; 

		txtRect.SetSizeWithCurrentAnchors (RectTransform.Axis.Horizontal, slotRect.sizeDelta.x); 
		txtRect.SetSizeWithCurrentAnchors (RectTransform.Axis.Vertical, slotRect.sizeDelta.y);

        if (transform.parent != null) {

            if (itemGroup == null) {
                itemGroup = transform.parent.GetComponent<CanvasGroup>();
            }
            EventTrigger trigger = GetComponentInParent<EventTrigger>();
            EventTrigger.Entry entry = new EventTrigger.Entry();
            entry.eventID = EventTriggerType.PointerEnter;
            entry.callback.AddListener((eventData) => { transform.parent.GetComponent<Inventory>().ShowToolTip(gameObject); });
            trigger.triggers.Add(entry);
        }
    }
開發者ID:Fahrettin52,項目名稱:Game-Lab-1.1,代碼行數:28,代碼來源:Slot.cs

示例2: CallLoading

    public static void CallLoading(ModalPanel modalPanel, CanvasGroup canvasGroup, string messageText, UnityAction callback)
    {
        ShowModal (modalPanel, canvasGroup);

        modalPanel.loadingPanel.gameObject.SetActive (true);
        modalPanel.loadingPanel.Show (messageText, callback);
    }
開發者ID:rodsordi,項目名稱:Gude,代碼行數:7,代碼來源:ModalPanel.cs

示例3: Start

 void Start()
 {
     _debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>();
     _text = gameObject.GetComponent<Text>();
     _canvasGroup = gameObject.GetComponent<CanvasGroup> ();
     _baseAlpha = 1f;
 }
開發者ID:EpicPants90,項目名稱:ELB,代碼行數:7,代碼來源:DebugText.cs

示例4: Awake

    void Awake()
    {
        if (UI_Manager == null)
        {
            UI_Manager = this;
            
            DontDestroyOnLoad(gameObject);            
        }
        else if (UI_Manager != null)
        {
            Destroy(gameObject);
        }        

        _titleScreenAnim = titleScreen.GetComponent<Animator>();
        _soundScreenAnim = soundScreen.GetComponent<Animator>();
        _pauseScreenAnim = pauseScreen.GetComponent<Animator>();
        _loseScreenAnim = loseScreen.GetComponent<Animator>();
        _fadeScreenAnim = fadeScreen.GetComponent<Animator>();
        _oFScreenAnim = overlayFadeScreen.GetComponent<Animator>();

        _titleCanvas = titleScreen.GetComponent<CanvasGroup>();
        _pauseCanvas = pauseScreen.GetComponent<CanvasGroup>();
        _loseCanvas = loseScreen.GetComponent<CanvasGroup>();

        _source = GetComponent<AudioSource>();        

        Setup();
    }
開發者ID:Darylcxz,項目名稱:GameJam2016,代碼行數:28,代碼來源:UIManager.cs

示例5: Awake

	void Awake() {
		// get components
		canvas = transform.GetComponent<CanvasGroup> ();
		// bind events
		_dispatcher.AddListener ("close_new_game_panel", hide);
		_dispatcher.AddListener ("open_new_game_panel", show);
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:7,代碼來源:NewGamePanelScript.cs

示例6: Awake

	void Awake () {
		// get elements
		panel = transform.GetComponent<CanvasGroup> ();
		// bind events
		_dispatcher.AddListener ("loading_interstitial_open", open);
		_dispatcher.AddListener ("loading_interstitial_close", close);
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:7,代碼來源:LoadingPanelScript.cs

示例7: Start

 //private PlayerController player;
 void Start()
 {
     //player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
     visibility = GetComponent<CanvasGroup>();
     visibility.alpha = 0;
     StartCoroutine( showUI());
 }
開發者ID:KeiranG19,項目名稱:Straypunch-Studios,代碼行數:8,代碼來源:UImanager.cs

示例8: Awake

	public void Awake(){
		_animator = GetComponent<Animator> ();
		_canvasGroup = GetComponent<CanvasGroup> ();

		var rect = GetComponent<RectTransform> ();
		rect.offsetMax = rect.offsetMin = new Vector2 (0, 0);
	}
開發者ID:marcochiu2-c,項目名稱:MainMenu_uFrame1.6,代碼行數:7,代碼來源:Menu.cs

示例9: FadeToGroupCoroutine

    private IEnumerator FadeToGroupCoroutine(CanvasGroup group, float duration)
    {
        // Prevent interaction with the first group.
        currentGroup.interactable = false;

        // Activate the next Group.
        group.gameObject.SetActive(true);

        float t = 0f;
        while (t < duration)
        {
            // Increase t in real time.
            t += Time.unscaledDeltaTime;

            // Fade current group out.
            currentGroup.alpha = Mathf.SmoothStep (1f, 0f, t);

            // Fade new group in.
            group.alpha = Mathf.SmoothStep (0f, 1f, t);

            yield return new WaitForEndOfFrame();
        }

        // Update previous and current Group tracking variables.
        previousGroup = currentGroup;
        currentGroup = group;

        // Deactivate the last Group.
        previousGroup.gameObject.SetActive(false);

        //Enable interaction.
        currentGroup.interactable = true;
    }
開發者ID:Abengoshis,項目名稱:PlanetGame,代碼行數:33,代碼來源:CanvasGroupController.cs

示例10: BringToForefront

    public void BringToForefront(CanvasGroup panel)
    {
        panel.transform.SetAsLastSibling();

        panel.DOKill();
        panel.DOFade(1.0f, this.FadeInDuration).SetEase(this.FadeEase);
    }
開發者ID:jose-villegas,項目名稱:GameJam16,代碼行數:7,代碼來源:MainMenuPresenter.cs

示例11: OnEnable

    void OnEnable()
    {
        _canvasGroup = GetComponent<CanvasGroup>();
        _image = GetComponent<Image>();

        LateUpdate();
    }
開發者ID:juliabax,項目名稱:AulaUnity,代碼行數:7,代碼來源:AnimatedAlpha.cs

示例12: Start

    void Start()
    {
        instance = this;
        infoBar = GetComponent<CanvasGroup>();

        MWM_CMS_DatabaseManager.instance.apartmentManager.SelectedApartmentAction += HandleSelectedApartment;
    }
開發者ID:xinleng,項目名稱:Scripts-FromStreatham,代碼行數:7,代碼來源:ApartmentInfoBar.cs

示例13: Awake

 void Awake()
 {
     PlayerPrefs.SetFloat("Difficulty", FindObjectOfType<Slider>().value);
     PlayerPrefs.SetInt("KilledBacterias", 0);
     _confirmQuitCanvasGroup = GameObject.Find("QuitPanel").GetComponent<CanvasGroup>();
     _uiCanvasGroup = GameObject.Find("MainMenu").GetComponent<CanvasGroup>();
 }
開發者ID:tpeet,項目名稱:FightForLife,代碼行數:7,代碼來源:MenuController.cs

示例14: Start

 void Start()
 {
     minimap = GetComponent<RectTransform>();
     minimapGroup = GetComponent<CanvasGroup>();
     parentTransform = transform.parent.GetComponent<RectTransform>();
     eventer.OnPlayerJoined += OnPlayerJoined;
 }
開發者ID:Chaosed0,項目名稱:foxstar,代碼行數:7,代碼來源:MinimapPositioner.cs

示例15: ShowPanel

 public void ShowPanel(CanvasGroup panel)
 {
     HideAll();
     panel.alpha = 1;
     panel.interactable = true;
     panel.blocksRaycasts = true;
 }
開發者ID:idaelDev,項目名稱:Meditate-Em-Up-GGJ2016,代碼行數:7,代碼來源:MenuController.cs


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