void HighlightButton(GameObject gameObj) { ButtonHighlightController highlightScript = gameObj.GetComponent <ButtonHighlightController>(); highlightScript.HighlightAnim(); }
private void InitIfMode(ifType ifModeType) { source.PlayOneShot(selectSound2, audioVolume); if (!isPlaying && curIfMode == ifType.None && scriptList.Count < 5) { curIfMode = ifModeType; // 새로운 ifMode에 들어갈 때에만 ifblock을 그려준다 // 05.02 기획 변경으로 이프문 종료 후 동일한 종류의 이프문 바로 시작해도 새로운 ifBlock으로 그려주려고 했으나 사이드이펙트가 커서 나중에 수정할 예정 if (scriptList.Count == 0 || scriptList[scriptList.Count - 1].ifType != curIfMode) { var ifBlock = Instantiate(IfBtn, QueuePanel.transform) as GameObject; ifBtnList.Add(ifBlock); RectTransform rt = ifBlock.GetComponent <RectTransform>(); rt.anchoredPosition = new Vector2((scriptList.Count) * 208 - 522, 0); rt.localScale = Vector3.one; // Set ifBtn image that is on the ifBlock ifBtn = ifBlock.transform.Find("Button"); if (ifBtn != null) { switch (curIfMode) { case ifType.ifGasi: ifBtn.GetComponent <Image>().sprite = ifBtn_gasi; break; case ifType.ifArrow: ifBtn.GetComponent <Image>().sprite = ifBtn_arrow; break; case ifType.ifNotGasi: ifBtn.GetComponent <Image>().sprite = ifBtn_notGasi; break; case ifType.ifNotArrow: ifBtn.GetComponent <Image>().sprite = ifBtn_notArrow; break; } ifBtn.GetComponent <Button>().onClick.AddListener(() => { if (scriptList.Count == 0 || (scriptList[scriptList.Count - 1].ifType != curIfMode && curIfMode != ifType.None)) { if (ifBtnList.Count != 0) { var latestIfBtn = ifBtnList[ifBtnList.Count - 1]; ifBtnList.RemoveAt(ifBtnList.Count - 1); Destroy(latestIfBtn); } } curIfMode = ifType.None; buttonScript.stopBlinkAnim(); //이프문 종료 후 다시 해당 이프문 편집으로 진입하고 싶은 경우 때문에 밑줄 주석 처리했다가... //05.02 그냥 이프문을 삭제하고 다시 만드는 걸로 UX를 변경함에 따라 주석 해제 하려다가.... 사이드이펙트가 커서 나중에하기로 //ifBtn.GetComponent<Button>().onClick.RemoveAllListeners(); }); } // end of Set ifBtn image that is on the ifBlock } else // 새 블록이 아니라 기존거에 연결되는거일 때, 애니메이션을 다시 켜준다 { if (buttonScript != null) { buttonScript.blinkAnim(); } } buttonScript = ifBtn.GetComponent <ButtonHighlightController>(); } }