当前位置: 首页>>代码示例>>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;未经允许,请勿转载。