Ejemplo n.º 1
0
    GameObject AddMakeupOptions(Makeup makeupitem)
    {
        GameObject option = Instantiate(BeautyFilter_UIExample);

        option.transform.SetParent(BeautyOptionContentTrans, false);
        option.transform.localScale    = Vector3.one;
        option.transform.localPosition = Vector3.zero;
        option.name = makeupitem.name;
        option.GetComponentInChildren <Text>().text    = makeupitem.name;
        option.GetComponentInChildren <Image>().sprite = uisprites.GetSprite(ItemType.Makeup, makeupitem.iconid);

        if (MakeupGOs.ContainsKey(makeupitem))
        {
            MakeupGOs.Remove(makeupitem);
        }
        MakeupGOs.Add(makeupitem, option);
        option.GetComponent <AddClickEvent>().AddListener(delegate(GameObject go)
        {
            if (go != currentSelected)
            {
                currentSelected = go;
                foreach (var bgo in MakeupGOs)
                {
                    bgo.Value.transform.Find("Image_bg").gameObject.SetActive(false);
                }
                go.transform.Find("Image_bg").gameObject.SetActive(true);
            }
            currentSelectedMakeupName = makeupitem.name;
            currentMakeupfilterV      = makeupitem.filter_intensity / makeupitem.intensity;

            if (makeupitem.intensity <= 0)
            {
                rtt.SetItemParamd((int)SlotForItems.Makeup, "is_makeup_on", 0);
            }
            else
            {
                rtt.SetItemParamd((int)SlotForItems.Makeup, "is_makeup_on", 1);
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_intensity", makeupitem.intensity);

                rtt.SetItemParamdv((int)SlotForItems.Makeup, "makeup_lip_color", makeupitem.Lipstick_color);
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_intensity_lip", makeupitem.Lipstick_intensity);
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_lip_mask", 1.0);

                CreateTexForItem(uisprites.GetTexture(MakeupType.Blush, makeupitem.Blush_id), "tex_blusher");
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_intensity_blusher", makeupitem.Blush_intensity);

                CreateTexForItem(uisprites.GetTexture(MakeupType.Eyebrow, makeupitem.Eyebrow_id), "tex_brow");
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_intensity_eyeBrow", makeupitem.Eyebrow_intensity);

                CreateTexForItem(uisprites.GetTexture(MakeupType.Eyeshadow, makeupitem.Eyeshadow_id), "tex_eye");
                rtt.SetItemParamd((int)SlotForItems.Makeup, "makeup_intensity_eye", makeupitem.Eyeshadow_intensity);

                rtt.SetItemParams(BeautySkinItemName, "filter_name", makeupitem.filter_name);
                rtt.SetItemParamd(BeautySkinItemName, "filter_level", makeupitem.filter_intensity);
            }

            if (string.Compare(BeautyConfig.makeupGroup_1[0].name, makeupitem.name, true) != 0)
            {
                BeautySkin_Slider.onValueChanged.RemoveAllListeners();
                BeautySkin_Slider.minValue = 0;
                BeautySkin_Slider.maxValue = 1;
                BeautySkin_Slider.value    = (float)rtt.GetItemParamd(MakeupItemName, "makeup_intensity");
                BeautySkin_Slider.onValueChanged.AddListener(delegate
                {
                    rtt.SetItemParamd(MakeupItemName, "makeup_intensity", BeautySkin_Slider.value);
                    float v = BeautySkin_Slider.value * currentMakeupfilterV;
                    v       = v > 1 ? 1 : v;
                    v       = v < 0 ? 0 : v;
                    rtt.SetItemParamd(BeautySkinItemName, "filter_level", v);
                });
                BeautySkinContentPanels[1].SetActive(true);
            }
            else
            {
                BeautySkin_Slider.onValueChanged.RemoveAllListeners();
                BeautySkinContentPanels[1].SetActive(false);
            }
        });
        return(option);
    }