private void SelectOneColor(bool isOn, int index)
 {
     if (isOn)
     {
         //播放音效
         if (isFirstValueChange == false)
         {
             joinGuide.DoOperation();
             AudioManager.instance.PlayAudio(EffectAudioType.Option, "Audio/option_audio/color_option_audio|color_" + index);
         }
         if (isFirstValueChange)
         {
             isFirstValueChange = false;
         }
         //index:0为七彩笔 1为橡皮擦 2以后为颜色
         joinMainView.SelectColor(index, GameData.instance.ColorList[index]);
         joinMainView.ShowBackBtn(false);
     }
 }
Exemple #2
0
    private void Init()
    {
        step = 1;
        //暂时处理适配
        if (Screen.width == 2388 && Screen.height == 1688)
        {
            Debug.Log("2388*1688");
            ImgDraw.transform.localScale      = new Vector3(1.06f, 1.06f, 1.06f);
            ImgDraw.transform.localPosition   = new Vector3(8, -6, 0);
            ImgDrawBg.transform.localScale    = new Vector3(1.06f, 1.06f, 1.06f);
            ImgDrawBg.transform.localPosition = new Vector3(7, -5, 0);
        }
        AudioManager.instance.PlayAudio(EffectAudioType.Guide, GameData.instance.drawAudioPathList[GameManager.instance.homeSelectIndex]);
        //补充脚本
        joinPlus = GetComponent <JoinPlus>();
        mobilePaint.gameObject.SetActive(false);
        //引导脚本
        joinGuide = GetComponent <JoinGuide>();
        if (joinGuide == null)
        {
            joinGuide = gameObject.AddComponent <JoinGuide>();
        }
        //按钮点击
        AddClickEvent();
        //左下角参考缩略图
        UIHelper.instance.SetImage(GameData.instance.homePathList[GameManager.instance.homeSelectIndex], ImgReference, true);
        //参考图默认做一次放大缩小
        ReferenceClickHandler();
        //未选择素材时,滑块不出现
        if (curSelectResObj == null)
        {
            ImageScaleSlider.gameObject.SetActive(false);
        }
        //返回按钮显示半透明
        ShowBackBtn(false);

        for (int i = 0; i < TypeBtnConList.Count; i++)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(TypeBtnConList[i].GetComponent <RectTransform>());
        }
        //右边素材切换按钮
        for (int i = 0; i < GameData.instance.resTypeCount; i++)
        {
            int clickType = i;
            typeTransList[i].GetComponent <Button>().onClick.AddListener(delegate
            {
                joinGuide.DoOperation();
                AudioManager.instance.PlayAudio(EffectAudioType.Option, "Audio/option_audio/material_option_audio|material_" + clickType);
                TypeButtonClick((TemplateResType)clickType, true);
            });
        }
        if (GameManager.instance.curJoinType == JoinType.Animal)
        {
            drawPercent = 100;
        }
        else
        {
            drawPercent = 0;
            SetDrawMessage();
            ContentColor.gameObject.AddComponent <ColorToggleCtrl>();
        }

        //打开保存的文件
        if ((GameManager.instance.openType == OpenType.ReEdit || GameManager.instance.openType == OpenType.BackEdit) && GameManager.instance.curWhole != null)
        {
            if (GameManager.instance.curJoinType == JoinType.Animal)
            {
                joinPlus.LoadFileAnimal(GameManager.instance.curWhole);
                step = 2;
            }
            else
            {
                joinPlus.LoadFile(GameManager.instance.curWhole);
            }
            GameManager.instance.SetJoinShowAll(true);
            for (int i = 0; i < guideResult.Length; i++)
            {
                guideResult[i] = true;
            }
            for (int i = 0; i < loadResult.Length; i++)
            {
                loadResult[i] = false;
            }
        }
        ShowTypeByStep(step, true);
    }