/* protected - [Event] Function * 자식 객체가 호출(For Child class call) */ /* protected - Override & Unity API */ protected override void OnAwake() { base.OnAwake(); Button[] arrButton = GetComponentsInChildren <Button>(true); for (int i = 0; i < arrButton.Length; i++) { Button pButton = arrButton[i]; string strButtonName = pButton.name; Enum_InputName eButtonName; if (strButtonName.ConvertEnum(out eButtonName)) { pButton.onClick.AddListener(() => { OnClick_Buttons(eButtonName, pButton); }); _mapButton.Add(strButtonName, pButton); CUGUIButton_Press pButtonPress = pButton.GetComponent <CUGUIButton_Press>(); if (pButtonPress != null) { pButtonPress.p_Event_OnPress_Down.AddListener(delegate { OnPress_And_Hold_Buttons(eButtonName, true); }); pButtonPress.p_Event_OnPress_Up.AddListener(delegate { OnPress_And_Hold_Buttons(eButtonName, false); }); } } } CUGUIDropDown[] arrDropDown = GetComponentsInChildren <CUGUIDropDown>(); for (int i = 0; i < arrDropDown.Length; i++) { CUGUIDropDown pDropDown = arrDropDown[i]; Enum_InputName eDropDownName; if (pDropDown.name.ConvertEnum(out eDropDownName)) { pDropDown.onValueChanged.AddListener(delegate { EventOnChangeDropDown(eDropDownName, pDropDown); }); } } GetComponentsInChildren(true, _listScrollView); for (int i = 0; i < _listScrollView.Count; i++) { _listScrollView[i].EventInitScrollItem <Enum_InputName>(OnScrollView_ClickItem); } }
/* protected - Override & Unity API */ protected override void OnAwake() { base.OnAwake(); Button[] arrButton = GetComponentsInChildren <Button>(true); for (int i = 0; i < arrButton.Length; i++) { Button pButton = arrButton[i]; string strButtonName = pButton.name; Enum_InputName eButtonName; if (strButtonName.ConvertEnum(out eButtonName)) { pButton.onClick.AddListener(() => { OnClick_Buttons_Wrapper(eButtonName, pButton); }); if (_mapButton == null) { _mapButton = new Dictionary <string, Button>(); } if (_mapButton.ContainsKey(strButtonName)) { Debug.LogWarning(name + "Already Button Exist A - " + strButtonName, _mapButton[strButtonName]); Debug.LogWarning(name + "Already Button Exist B - " + strButtonName, pButton); continue; } _mapButton.Add(strButtonName, pButton); CUGUIButton_Press pButtonPress = pButton.GetComponent <CUGUIButton_Press>(); if (pButtonPress != null) { pButtonPress.p_Event_OnPress_Down.AddListener(delegate { OnButtons_Press_And_Hold(eButtonName, true); }); pButtonPress.p_Event_OnPress_Up.AddListener(delegate { OnButtons_Press_And_Hold(eButtonName, false); }); } } } Toggle[] arrToggle = GetComponentsInChildren <Toggle>(true); int iLen = arrToggle.Length; for (int i = 0; i < iLen; i++) { Toggle pToggle = arrToggle[i]; Enum_InputName eToggleName; string strToggleName = pToggle.name; if (strToggleName.ConvertEnum(out eToggleName)) { pToggle.onValueChanged.AddListener((bool bIsOn) => { OnToggles_Click(eToggleName, bIsOn); }); if (_mapToggle == null) { _mapToggle = new Dictionary <string, Toggle>(); } if (_mapToggle.ContainsKey(strToggleName) == false) { _mapToggle.Add(strToggleName, pToggle); } } } CUGUIDropDown[] arrDropDown = GetComponentsInChildren <CUGUIDropDown>(true); for (int i = 0; i < arrDropDown.Length; i++) { CUGUIDropDown pDropDown = arrDropDown[i]; Enum_InputName eDropDownName; if (pDropDown.name.ConvertEnum(out eDropDownName)) { pDropDown.onValueChanged.AddListener(delegate { EventOnChangeDropDown(eDropDownName, pDropDown); }); } } GetComponentsInChildren(true, _listScrollView); for (int i = 0; i < _listScrollView.Count; i++) { _listScrollView[i].EventInitScrollItem <Enum_InputName>(OnScrollView_ClickItem); } InputField[] arrInputField = GetComponentsInChildren <InputField>(true); for (int i = 0; i < arrInputField.Length; i++) { InputField pInputField = arrInputField[i]; Enum_InputName eInputField_Name; if (pInputField.name.ConvertEnum(out eInputField_Name)) { pInputField.onValueChanged.AddListener(( string strInput ) => { OnInputFields_ValueChanged(eInputField_Name, strInput); }); pInputField.onEndEdit.AddListener(( string strInput ) => { OnInputFields_Submit(eInputField_Name, strInput); }); } } Slider[] arrSlider = GetComponentsInChildren <Slider>(); for (int i = 0; i < arrSlider.Length; i++) { var pInput = arrSlider[i]; Enum_InputName eInputField_Name; if (pInput.name.ConvertEnum(out eInputField_Name)) { pInput.onValueChanged.AddListener((float fValue) => OnSlider_SetValue(eInputField_Name, pInput.value)); } } }