Ejemplo n.º 1
0
    void RegisterUIFunc()
    {
        Btn_Switch.onClick.AddListener(delegate { rtt.SwitchCamera(); });
        Btn_Back.onClick.AddListener(delegate {
            if (musiccor != null)
            {
                StopCoroutine(musiccor);
                musiccor = null;
                audios.Stop();
            }
            Canvas_TopUI.SetActive(true);
            rtt.UnLoadItem(rtt.GetCurrentItemName());
            CloseBeautySkinUI();
            CloseItemUI();
        });
        Btn_Cancel.onClick.AddListener(OnCancelTakePicture);
        Btn_SavePic.onClick.AddListener(OnSavePicture);
        Btn_TakePic_mini_1.onClick.AddListener(TakePicture);
        Btn_TakePic_mini_2.onClick.AddListener(TakePicture);

        for (int i = 0; i < ItemSelecters.Length; i++)
        {
            if (ItemSelecters[i].activeSelf)
            {
                ItemSelecters[i].GetComponent <AddClickEvent>().AddListener(delegate(GameObject go)
                {
                    int id = int.Parse(go.name);
                    if (id == 0)
                    {
                        OpenBeautySkinUI(BeautySkinType.None);
                    }
                    else
                    {
                        OpenItemsUI((ItemType)id);
                    }
                    Canvas_TopUI.SetActive(false);
                });
            }
        }

        rtt.RawImg_BackGroud.GetComponent <AddClickEvent>().AddListener(delegate {
            if (currentItemType == ItemType.Beauty)
            {
                CloseAllBeautySkinContent();
                BeautySkinContentPanels[3].gameObject.SetActive(true);
            }
        });

        BeautySkinSelecterOptions[0].GetComponent <AddClickEvent>().AddListener(delegate { OpenBeautySkinUI(BeautySkinType.BeautySkin); });
        BeautySkinSelecterOptions[1].GetComponent <AddClickEvent>().AddListener(delegate { OpenBeautySkinUI(BeautySkinType.BeautyShape); });
        BeautySkinSelecterOptions[2].GetComponent <AddClickEvent>().AddListener(delegate { OpenBeautySkinUI(BeautySkinType.BeautyFilter); });
        BeautySkinSelecterOptions[3].GetComponent <AddClickEvent>().AddListener(delegate { OpenBeautySkinUI(BeautySkinType.Filter); });
    }
Ejemplo n.º 2
0
    //for循环配合delegate是个坑,小心。
    void RegisterUIFunc()
    {
        Btn_Switch.onClick.AddListener(delegate
        {
            rtt.SwitchCamera();
        });
        Btn_Back.onClick.AddListener(delegate
        {
            if (musiccor != null)
            {
                StopCoroutine(musiccor);
                musiccor = null;
                audios.Stop();
            }
            Canvas_TopUI.SetActive(true);
            //unload除了美颜以外所有道具
            for (int i = 0; i < RenderToTexture.SLOTLENGTH; i++)
            {
                //if (i == (int)SlotForItems.Beauty)
                //    continue;
                rtt.UnLoadItem(i);
            }
            CloseBeautySkinUI();
            CloseItemUI();
        });
        Btn_Cancel.onClick.AddListener(OnCancelTakePicture);
        Btn_SavePic.onClick.AddListener(OnSavePicture);
        Btn_TakePic_mini_1.onClick.AddListener(TakePicture);
        Btn_TakePic_mini_2.onClick.AddListener(TakePicture);

        for (int i = 0; i < ItemSelecters.Length; i++)
        {
            if (ItemSelecters[i].activeSelf)
            {
                ItemSelecters[i].GetComponent <AddClickEvent>().AddListener(delegate(GameObject go)
                {
                    if (go.name.CompareTo(ItemType.Beauty.ToString()) == 0)
                    {
                        StartCoroutine(OpenBeautySkinUI(BeautySkinType.None));
                    }
                    else
                    {
                        OpenItemsUI(go.name);
                    }
                    Canvas_TopUI.SetActive(false);
                });
            }
        }

        rtt.RawImg_BackGroud.GetComponent <AddClickEvent>().AddListener(delegate
        {
            if (currentItemType == ItemType.Beauty)
            {
                CloseAllBeautySkinContent();
                BeautySkinContentPanels[3].SetActive(true);
            }
        });

        BeautySkinSelecterOptions[0].GetComponent <AddClickEvent>().AddListener(delegate { StartCoroutine(OpenBeautySkinUI(BeautySkinType.BeautySkin)); });
        BeautySkinSelecterOptions[1].GetComponent <AddClickEvent>().AddListener(delegate { StartCoroutine(OpenBeautySkinUI(BeautySkinType.BeautyShape)); });
        BeautySkinSelecterOptions[2].GetComponent <AddClickEvent>().AddListener(delegate { StartCoroutine(OpenBeautySkinUI(BeautySkinType.BeautyFilter)); });
        BeautySkinSelecterOptions[3].GetComponent <AddClickEvent>().AddListener(delegate { StartCoroutine(OpenBeautySkinUI(BeautySkinType.MakeupGroup)); });
    }