private void Update()
    {
        try
        {
            if (queue.Count != 0 && !IsDialogActive)
            {
                DialogParameter parameter    = queue.Dequeue();
                UIDialogBase    activeDialog = LoadScene(parameter._strPath); // 去加载这个UI界面
                if (activeDialog != null)
                {
                    openedList.Add(activeDialog);                    // 加到openedList里
                    activeDialog.transform.SetAsLastSibling();
                    activeDialog.OnSceneActivated(parameter._paras); // 场景打开的时候,把参数传递进去
                }
                else
                {
                    PPP.pppShow();
                }
            }

            if (tipsQueue.Count != 0)
            {
                DialogParameter parameter = tipsQueue.Dequeue();
                UIDialogBase    dialog    = LoadScene(parameter._strPath);
                dialog.transform.SetAsLastSibling();
                dialog.OnSceneActivated(parameter._paras);
            }
        }
        catch (Exception ex)
        {
            PPP.pppShow(true, ex.ToString());
        }
    }
Example #2
0
 public void CacheDialog(UIDialogBase dialog, bool isOk)
 {
     if (null != dialog)
     {
         openedDialogList.Remove(dialog);
         cacheDialogList.Add(dialog);
     }
 }
Example #3
0
    public void PushDialogImmediately(UIDialog dialog, params object[] paras)
    {
        DialogParameter parameter    = new DialogParameter(dialog, paras);
        UIDialogBase    activeDialog = LoadScene(parameter.dialog);

        openedList.Add(activeDialog);
        activeDialog.transform.SetAsLastSibling();
        activeDialog.OnSceneActivated(parameter.paras);
    }
Example #4
0
    public void Cache(UIDialogBase dialog, bool isOk)
    {
        if (null != dialog)
        {
            openedList.Remove(dialog);
            cacheList.Add(dialog);

            if (null != OnDialogCallBack)
            {
                OnDialogCallBack(dialog.dialog, isOk);
            }
        }
    }
 public void Cache(UIDialogBase dialog, bool isOk)
 {
     if (null != dialog)
     {
         openedList.Remove(dialog);
         if (!cacheList.Contains(dialog))
         {
             cacheList.Add(dialog);
         }
         if (null != OnDialogCallBack)
         {
             OnDialogCallBack(dialog.name, isOk);
         }
     }
 }
    /// <summary>
    /// 立刻加载UI界面
    /// </summary>
    /// <param name="strPath"></param>
    /// <param name="paras"></param>
    /// <returns></returns>
    public UIDialogBase PushDialogImmediately(string strPath, params object[] paras)
    {
        DialogParameter parameter    = new DialogParameter(strPath, paras);
        UIDialogBase    activeDialog = LoadScene(parameter._strPath);

        if (activeDialog == null)
        {
            PPP.pppShow();
            return(null);
        }
        openedList.Add(activeDialog);
        activeDialog.transform.SetAsLastSibling();
        activeDialog.OnSceneActivated(parameter._paras);
        return(activeDialog);
    }
Example #7
0
        public void LoadDialog(string key, System.Action <UIDialogBase> callback)
        {
            UIDialogBase dialog = FindDialogInCache(key);

            if (dialog == null)
            {
                string assetName = key + "Dialog";
                string abName    = AppConst.ResDir + "Prefabs/UI/Dialog/" + assetName + ".prefab";
                ResManager.LoadPrefab(abName, delegate(UnityEngine.Object[] objs)
                {
                    if (objs.Length == 0)
                    {
                        return;
                    }
                    GameObject newSceneGameObject = objs[0] as GameObject;
                    if (newSceneGameObject != null)
                    {
                        newSceneGameObject = UIUtils.AddChild(DialogRoot, newSceneGameObject);
                        if (newSceneGameObject.activeSelf == true)
                        {
                            Debug.Log("newSceneGameObject activity true:" + newSceneGameObject.name);
                        }
                        else
                        {
                            Debug.Log("newSceneGameObject activity false:" + newSceneGameObject.name);
                        }
                        if (newSceneGameObject != null)
                        {
                            dialog = newSceneGameObject.GetComponent <UIDialogBase>();
                            dialog.InitializeScene();
                            callback(dialog);
                        }
                        else
                        {
                            Debug.LogWarning("UISystem::LoadDialog() Failed to add new scene to parent UISystem with name: " + key);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("UISystem::LoadDialog() Failed to load new scene with name: " + key);
                    }
                });
            }
            else
            {
                callback(dialog);
            }
        }
Example #8
0
    public override void OnInspectorGUI()
    {
        UIDialogBase ui = (UIDialogBase)target;

        if (GUILayout.Button("设置引用对象"))
        {
            ui.SetAllMemberValue();
        }

        EditorGUILayout.BeginHorizontal();
        ui.UseBoxCollider = GUILayout.Toggle(ui.UseBoxCollider, "阻挡", "button", GUILayout.Width(35));
        ui.UseBlackMask   = GUILayout.Toggle(ui.UseBlackMask, "蒙版", "button", GUILayout.Width(35));
        EditorGUILayout.EndHorizontal();

        base.OnInspectorGUI();
    }
Example #9
0
    private void Update()
    {
        if (queue.Count != 0 && !IsDialogActive)
        {
            DialogParameter parameter    = queue.Dequeue();
            UIDialogBase    activeDialog = LoadScene(parameter.dialog);
            openedList.Add(activeDialog);
            activeDialog.transform.SetAsLastSibling();
            activeDialog.OnSceneActivated(parameter.paras);
        }

        if (tipsQueue.Count != 0)
        {
            DialogParameter parameter = tipsQueue.Dequeue();
            UIDialogBase    dialog    = LoadScene(parameter.dialog);
            dialog.transform.SetAsLastSibling();
            dialog.OnSceneActivated(parameter.paras);
        }
    }
Example #10
0
    /// <summary>
    /// 加载UI界面
    /// </summary>
    /// <param name="strPrefabePath"></param>
    /// <returns></returns>
    public UIDialogBase LoadScene(string strPrefabePath)
    {
        UIDialogBase dialog = FindInCache(strPrefabePath);


        if (dialog == null)
        {
            GameObject newSceneGameObject = Resources.Load <GameObject>(strPrefabePath);

            if (newSceneGameObject != null)
            {
                newSceneGameObject = UIUtils.AddChild(this.gameObject, newSceneGameObject);
                if (newSceneGameObject != null)
                {
                    dialog = newSceneGameObject.GetComponent <UIDialogBase>();
                    if (dialog == null)
                    {
                        newSceneGameObject.name = newSceneGameObject.name.Replace("(Clone)", "");
                        dialog = PPPUIBase.addScript(newSceneGameObject, newSceneGameObject.name) as UIDialogBase;
                    }

                    if (dialog != null)
                    {
                        dialog.name = strPrefabePath;
                        dialog.InitializeScene();
                    }
                }
                else
                {
                    PPP.pppShow(true, "UISystem::LoadDialog() Failed to add new scene to parent UISystem with name: " + strPrefabePath);
                }
            }
            else
            {
                PPP.pppShow(true, "UISystem::LoadDialog() Failed to load new scene with name: " + strPrefabePath);
            }
        }

        return(dialog);
    }
Example #11
0
    public UIDialogBase LoadScene(UIDialog key)
    {
        UIDialogBase dialog = FindInCache(key);

        if (dialog == null)
        {
            string     strPrefabeName     = Utils.GetEnumDes(key);
            GameObject newSceneGameObject = Resources.Load(strPrefabeName) as GameObject;

            if (newSceneGameObject != null)
            {
                newSceneGameObject = UIUtils.AddChild(this.gameObject, newSceneGameObject);
                if (newSceneGameObject.activeSelf == true)
                {
                    Debug.Log("newSceneGameObject activity true:" + newSceneGameObject.name);
                }
                else
                {
                    Debug.Log("newSceneGameObject activity false:" + newSceneGameObject.name);
                }
                if (newSceneGameObject != null)
                {
                    dialog = newSceneGameObject.GetComponent <UIDialogBase>();
                    dialog.InitializeScene();
                }
                else
                {
                    Debug.LogWarning("UISystem::LoadDialog() Failed to add new scene to parent UISystem with name: " + key);
                }
            }
            else
            {
                Debug.LogWarning("UISystem::LoadDialog() Failed to load new scene with name: " + key);
            }
        }

        return(dialog);
    }
Example #12
0
    /// <summary>
    /// 从缓存里找UI界面
    /// </summary>
    /// <param name="key"></param>
    /// <returns></returns>
    UIDialogBase FindInCache(string key)
    {
        //foreach (UIDialogBase dialog in cacheList)
        //{
        //    if (dialog.name == key)
        //    {
        //        cacheList.Remove(dialog);
        //        return dialog;
        //    }
        //}

        // guoShuai 修改
        for (int i = 0; i < cacheList.Count; i++)
        {
            if (cacheList[i].name == key)
            {
                UIDialogBase tmpDialog = cacheList[i];
                cacheList.Remove(cacheList[i]);
                return(tmpDialog);
            }
        }

        return(null);
    }