示例#1
0
        /// <summary>
        /// 设置按钮状态
        /// </summary>
        /// <param name="takeTheFieldState">是否在阵上</param>
        /// <param name="isThisPartner">是否是这个伙伴</param>
        private void SetBtn(bool takeTheFieldState, bool isThisPartner)
        {
            if (takeTheFieldState)
            {
                if (isThisPartner)
                {
                    QuitBtn.CustomSetActive(true);
                    TransferBtn.CustomSetActive(false);
                }
                else
                {
                    QuitBtn.CustomSetActive(false);
                    TransferBtn.CustomSetActive(true);
                }
            }
            else
            {
                QuitBtn.CustomSetActive(false);
                TransferBtn.CustomSetActive(false);
            }

            TakeTheFieldBtn.CustomSetActive(!takeTheFieldState);
        }
示例#2
0
    protected void Start()
    {
        if (SocialBtn == null)
        {
            Debug.LogError("Please add a Social Btn in main menu controller");
        }
        if (QuitBtn == null)
        {
            Debug.LogError("Please add a QuitBtn in main menu controller");
        }
        if (SettingsBtn == null)
        {
            Debug.LogError("Please add a SettingsBtn in main menu controller");
        }
        if (SocialPanel == null)
        {
            Debug.LogError("SocialPanel is missing in main menu controller");
        }


        //Refactor this soon, just make as shortcut for now
        if (SettingsBtn != null)
        {
            SettingsBtn.onClick.AddListener(delegate
            {
                SettingsPanel.SetActive(true);
                SocialBtn.GetComponent <AudioSource>().Play();
            });
        }
        if (QuitBtn != null)
        {
            QuitBtn.onClick.AddListener(delegate
            {
                QuitBtn.GetComponent <AudioSource>().Play();
                //Instantiate the modal
                var modal = new Modal("QUIT", "Do you want to quit?", Modal.Type.QuitGame);
                modal.AddConfirmListener(() => Application.Quit());
                modal.AddCancelListener(() => Destroy(modal.GetReference()));
                modal.Render();
            });
        }

        if (SocialBtn != null)
        {
            SocialBtn.onClick.AddListener(delegate
            {
                if (!SocialPanel.activeSelf)
                {
                    SocialPanel.SetActive(true);
                }

                SocialBtn.GetComponent <AudioSource>().Play();
                if (!SocialPanel.GetComponent <UI_Social>().isActive)
                {
                    SocialPanel.GetComponent <Animator>().SetTrigger("SlideIn");
                    SocialPanel.GetComponent <UI_Social>().isActive = true;
                }
                else
                {
                    SocialPanel.GetComponent <UI_Social>().isActive = false;
                    SocialPanel.GetComponent <Animator>().SetTrigger("SlideOut");
                }
            });
        }
    }