Exemple #1
0
    void OnGUI()
    {
        if (GUILayout.Button("StartLoading"))
        {
            LoadingMask.StartLoading();
        }
        if (GUILayout.Button("EndLoading"))
        {
            LoadingMask.EndLoading();
        }
        EditorGUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("EnterMajorLevel"))
            {
                PushLevelUI.Instance.EnterMajorLevel(new MajorLevelUnlockInfo(2, true));
            }
            if (GUILayout.Button("EndChallengeRound"))
            {
                GameManager.Instance.StartCoroutine(GameManager.Instance.EndChallengeRoundCoroutine());
                GameManager.Instance.EndChallengeRound(true);
            }
        }
        EditorGUILayout.EndHorizontal();

        Clip = EditorGUILayout.ObjectField("Button Audio", Clip, typeof(AudioClip), false) as AudioClip;
        if (GUILayout.Button("ChangeAllButtonAudio"))
        {
            if (!Clip)
            {
                Debug.LogError("没Clip"); return;
            }
            var allGo = Resources.FindObjectsOfTypeAll <GameObject>();

            var count = 0;
            foreach (var g in allGo)
            {
                var allPs = g.GetComponentsInChildren <UIPlaySound>();
                foreach (var uiPlaySound in allPs)
                {
                    if (uiPlaySound.GetComponent <UIButtonColor>() || uiPlaySound.GetComponent <MorlnUIButtonScale>() ||
                        uiPlaySound.GetComponent <UIButtonScale>())
                    {
                        uiPlaySound.audioClip = Clip;
                        EditorUtility.SetDirty(uiPlaySound);
                        count++;
                    }
                }
            }
            Debug.Log("Finish Op:cou:" + count);
        }
    }
Exemple #2
0
    IEnumerator _Goto()
    {
        _isSwitching = true;
        if (GetNeedLoadingMask())
        {
            LoadingMask.StartLoading();
            yield return(new WaitForSeconds(LoadingMask.Instance.TimeToUnload));
        }

        BaseUI newUI = null;

        switch (_targetUIState)
        {
        case UIStateName.Entrance:
            newUI = EntranceUI.EnterStage();
            break;

        case UIStateName.Menu:
            newUI = MenuUI.EnterStage();
            break;

        case UIStateName.Match:
            newUI = MatchUI.EnterStage();
            break;

        case UIStateName.Game:
            newUI = GameUI.EnterStage();
            break;

        case UIStateName.PushLevel:
            newUI = PushLevelUI.EnterStage();
            break;

        case UIStateName.EndRound:
            newUI = EndRoundUI.EnterStage();
            break;

        default:
            Debug.LogError("ERROR uiState:" + _targetUIState);
            break;
        }
        switch (_targetUIState)
        {
        case UIStateName.Entrance:
            var sr = Background.GetComponent <SpriteRenderer>();
            sr.sprite = SprSplash;
            break;

        case UIStateName.PushLevel:
            //Background.gameObject.SetActive(false);
            break;

        default:
            //Background.gameObject.SetActive(true);
            sr        = Background.GetComponent <SpriteRenderer>();
            sr.sprite = SprBg;
            break;
        }

        if (!newUI)
        {
            Debug.LogError("GotoUI却没有成功创建UI:" + _targetUIState);
        }

        for (int i = 0; i < _baseUIs.Length; i++)
        {
            if (i == (int)_targetUIState)
            {
                _baseUIs[i] = newUI;
            }
            else
            {
                if (_baseUIs[i])
                {
                    _baseUIs[i].OffStage();
                    _baseUIs[i] = null;
                    Resources.UnloadUnusedAssets();
                }
            }
        }

        LoadingMask.EndLoading();
        _isSwitching = false;
    }