private bool HasDrag;//本次触摸是否触发了拖拽 void Init() { joinMainView = GetComponentInParent <JoinMainView>(); joinGuide = GetComponentInParent <JoinGuide>(); leftTop = joinMainView.PosLeftTop.position; rightBottom = joinMainView.PosRightBottom.position; anchorLeftTop = joinMainView.PosLeftTop.GetComponent <RectTransform>().anchoredPosition; anchorRightBottom = joinMainView.PosRightBottom.GetComponent <RectTransform>().anchoredPosition; rt = transform.GetComponent <RectTransform>(); image = transform.GetComponent <Image>(); isInit = true; }
// Use this for initialization void Start() { joinMainView = transform.GetComponentInParent <JoinMainView>(); joinGuide = transform.GetComponentInParent <JoinGuide>(); tg = transform.GetComponent <ToggleGroup>(); int count = transform.childCount; for (int i = 0; i < count; i++) { int index = i; Toggle t = transform.GetChild(i).GetComponent <Toggle>(); t.group = tg; t.onValueChanged.AddListener(delegate { SelectOneColor(t.isOn, index); }); toggleLst.Add(t); } toggleLst[2].isOn = true; //初始选中红色单色蜡笔 joinMainView.SelectColor(2, GameData.instance.ColorList[2]); }
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); }
void Start() { scrollRect = transform.GetComponentInParent <ScrollRect>(); joinMainView = GetComponentInParent <JoinMainView>(); joinGuide = GetComponentInParent <JoinGuide>(); }