Beispiel #1
0
        public override void OnOpen()
        {
            base.OnOpen();
            text.text = content;
            if (fun == Function.CloseDialog)
            {
                btn.onClick.AddListener(ClosePanel);
            }
            else if (fun == Function.Quit)
            {
                btn.onClick.AddListener(OnQuit);
            }
            else if (fun == Function.Tip)
            {
                //                btn.gameObject.SetActive(false);
                btn.onClick.AddListener(ClosePanel);

                MTRunner.Instance.StartRunner(wait());
            }
            else if (fun == Function.OpenDialog)
            {
                Cancelbtn.gameObject.SetActive(true);
                Cancelbtn.onClick.AddListener(ClosePanel);
                Vector3 pos = btn.GetComponent <RectTransform>().position;
                btn.GetComponent <RectTransform>().anchoredPosition = new Vector3(-85.35f, -86f, pos.z);
                btn.onClick.AddListener((() =>
                {
                    ClosePanel();

                    if (viewNames != null)
                    {
                        Open(viewNames);
                    }
                    if (click != null)
                    {
                        click();
                    }
                }
                                         ));
            }
            else if (fun == Function.GetDialog)
            {
                btn.onClick.AddListener(ClosePanel);

                MTRunner.Instance.StartRunner(wait());
                ResourceMgr.Instance.LoadResource("Prefab/GetItem", ((resource, b) =>
                {
                    GameObject go = resource.UnityObj as GameObject;

                    for (int i = 0; i < ids.Count; i++)
                    {
                        GameObject item = GameObject.Instantiate(go);
                        GetItem getItem = item.AddComponent <GetItem>();
                        getItem.SetData(ids[i]);
                        item.transform.SetParent(gridLayout.transform);
                    }
                }));
            }
        }