public static IngameUIViewTools CheckHasUIViewTools(this Transform t) { IngameUIViewTools tool = t.GetComponent <IngameUIViewTools>(); if (tool == null) { Debug.LogError("预制体:" + t.name + " 没有手动添加IngameUIViewTools组件,请事后手动添加(目前自动动态添加仅在运行时)"); tool = t.gameObject.AddComponent <IngameUIViewTools>(); tool.FindAllGameObejct(); } return(tool); }
private void Awake() { t = IngameUIService.CheckHasUIViewTools(transform); go_FailTips = t.GetComponentByObjectName <Transform>("go_FailTips").gameObject; btn_failNextEnd = t.GetComponentByObjectName <Button>("btn_failNextEnd"); go_WinTips = t.GetComponentByObjectName <Transform>("go_WinTips").gameObject; btn_winNextEnd = t.GetComponentByObjectName <Button>("btn_winNextEnd"); go_QuseTips = t.GetComponentByObjectName <Transform>("go_QuseTips").gameObject; btn_Yes = t.GetComponentByObjectName <Button>("btn_Yes"); btn_No = t.GetComponentByObjectName <Button>("btn_No"); InitBtn(); }
private void Awake() { CurrentUIType.uiShowMode = UIShowMode.Normal; t = IngameUIService.CheckHasUIViewTools(transform); image_hp = t.GetComponentByObjectName <Image>("image_hp"); txt_hpCur = t.GetComponentByObjectName <Text>("txt_hpCur"); txt_hpMax = t.GetComponentByObjectName <Text>("txt_hpMax"); txt_needCur = t.GetComponentByObjectName <Text>("txt_needCur"); txt_needMax = t.GetComponentByObjectName <Text>("txt_needMax"); btn_NextEnd = t.GetComponentByObjectName <Button>("btn_NextEnd"); go_TaskTips = t.GetComponentByObjectName <Transform>("go_TaskTips").gameObject; txt_taskNeedNum = t.GetComponentByObjectName <Text>("txt_taskNeedNum"); }
void OnEnable() { view = (IngameUIViewTools)target; }