Exemplo n.º 1
0
    private static GameObject Show(string message, string title, GameObject parentGO, GameObject receiverGO, bool isSingle, string okStr, OnOK okFun, string cancelStr, OnCancel cancelFun, string checkStr = "", int bgClickType = 0, DirectionPostion align = DirectionPostion.Center)
    {
        GameObject prefab = ResourceManager.Instance.LoadExistsAsset <GameObject>("Prefab/UI/TipAlter/AlertBox");

        if (parentGO == null)
        {
            parentGO = UIManager.TipLayer.gameObject;
        }

        GameObject obj3 = UGUITools.AddChild(parentGO, prefab);

        Util.SetLayer(obj3, parentGO.layer);
        AlertBox component = obj3.AddMissingComponent <AlertBox>();

        if (string.IsNullOrEmpty(title))
        {
            title = "提示";
        }
        if (string.IsNullOrEmpty(okStr))
        {
            okStr = "确定";
        }
        if (string.IsNullOrEmpty(cancelStr))
        {
            cancelStr = "取消";
        }
        // 默认都是enable
        component.InitSetCommon(title, message, bgClickType, okStr, cancelStr, isSingle);
        component.mOnOK     = okFun;
        component.mOnCancel = cancelFun;

        if (!string.IsNullOrEmpty(checkStr))
        {
            component.AddSetCheckBoxInfo(checkStr);
        }

        return(obj3);
    }