Example #1
0
    public static void Open(string strText = "", float maskAlpha = 0.5f)
    {
        if (_instance == null)
        {
            Object     pro    = PrefabLoader.loadFromPack("Comload/pbComLoading");
            GameObject prefab = GameObject.Instantiate(pro) as GameObject;

            GameObject parent = null;
            if (DBUIController.mDBUIInstance != null)
            {
                parent = DBUIController.mDBUIInstance._TopRoot;
            }
            else
            {
                Behaviour uic = UICamera.currentCamera;
                if (uic == null)                  //空的情况下,可以再次去战斗场景里面去相机
                {
                    uic = BattleCamera.Instance.Camera1;
                }

                if (uic == null)
                {
                    return;
                }
                parent = uic.gameObject;
            }

            RED.AddChild(prefab, parent);
            if (Core.SM.CurScenesName == SceneName.GAME_BATTLE)
            {
                prefab.layer = LayerMask.NameToLayer("UI");
            }
            else
            {
                prefab.layer = LayerMask.NameToLayer("UITop");
            }
            prefab.name = "ComloadingUI";

            _instance = prefab.GetComponent <ComLoading>();
        }
        else
        {
            RED.SetActive(true, _instance.gameObject);
        }
        if (_instance != null)
        {
            if (strText == "")
            {
                strText = Core.Data.stringManager.getString(9125);
            }
            _instance._txtDesp.text = strText;
            _instance.Init();
            _instance.maskAlpha = maskAlpha;
        }
    }