private void _RefreshQuestionList(string groupName) { currentDataDict = consultingDataDict[groupName]; int flag = currentDataDict.Count - questionInfoList.Count; if (flag > 0) { UIConsultingQuestionInfo info = null; GameObject clone = null; for (int i = 0; i < flag; i++) { clone = UICommonTool.Clone(_questionPrefab.gameObject, _contentTrans); info = new UIConsultingQuestionInfo(); info.Init(clone, _OnClickQuestionCallBack); QuestionAction += info.MovePanel; questionInfoList.Add(info); } } else if (flag < 0) { for (int i = 0; i < questionInfoList.Count; i++) { questionInfoList[i].SetEnable(currentDataDict.Count > i); } } flag = 0; foreach (KeyValuePair <string, string> item in currentDataDict) { questionInfoList[flag].SetEnable(true); questionInfoList[flag].SetData(item.Key, item.Value); flag++; } }
private void ClosePanel() { isOpen = false; UICommonTool.SetComponentState(ref _lbDescribe, false); SetLayOutElementHeight(minHeight); UICommonTool.SetComponentHeight(ref _imgBG, minHeight); UICommonTool.SetComponentY(ref _imgBG, minY); }
private void OpenPanel() { isOpen = true; UICommonTool.SetComponentState(ref _lbDescribe, true); float height = GetContextHeight(); SetLayOutElementHeight(height); UICommonTool.SetComponentHeight(ref _imgBG, height); UICommonTool.SetComponentY(ref _imgBG, heightOffset - height / 2); }
private void ClosePanel() { isOpen = false; UICommonTool.SetComponentState(ref _lbDescribe, false); SetLayOutElementHeight(minHeight); UICommonTool.SetComponentHeight(ref _imgBG, minHeight); UICommonTool.SetComponentY(ref _imgBG, minY); this._lbDescribe.SetActiveEx(false); this._lbQuestionName.SetActiveEx(true); }
public void SetData(string questionName, string describe) { _questionName = questionName; _describe = describe; UICommonTool.SetTextContext(ref _lbQuestionName, questionName); UICommonTool.SetTextContext(ref _lbDescribe, describe); UICommonTool.SetComponentState(ref _lbDescribe, false); ClosePanel(); }
private void OpenPanel() { isOpen = true; UICommonTool.SetComponentState(ref _lbDescribe, true); float height = GetContextHeight(); SetLayOutElementHeight(height); UICommonTool.SetComponentHeight(ref _imgBG, height); //UICommonTool.SetComponentY(ref _imgBG, heightOffset - height / 2); this._lbDescribe.SetActiveEx(true); this._lbQuestionName.SetActiveEx(false); }
private void _OnSelectGroupCallBack(string groupName) { Audio.AudioManager.Instance.BtnMusic(); for (var i = 0; i < groupInfo.Length; i++) { groupInfo [i].SetBtnGray(); } UICommonTool.SetTransformY(ref _contentTrans, TopHigh); _RefreshQuestionList(groupName); }
public void Init(GameObject obj, string name, Action <string> clickCallBack) { _obj = obj; titleName = name; _btnQuestionGroup = obj.GetComponent <Button>(); EventTriggerListener.Get(_btnQuestionGroup.gameObject).onClick = (go) => { clickCallBack(titleName); SetBtnBright(); }; _lbQuestionGroupName = obj.GetComponentEx <Text>(Layout.lb_QuestionGroupName); UICommonTool.SetTextContext(ref _lbQuestionGroupName, name); }
/// <summary> /// 设置组件存储的数据 /// </summary> /// <param name="questionName"></param> /// <param name="describe"></param> public void SetData(FeelingVo value) { var tmpStri = value.content; var titleStr = ""; if (tmpStri.Length > 22) { titleStr = tmpStri.Substring(0, 2); } else { titleStr = tmpStri; } UICommonTool.SetTextContext(ref _lbQuestionName, titleStr); UICommonTool.SetTextContext(ref _lbDescribe, tmpStri); UICommonTool.SetComponentState(ref _lbDescribe, false); ClosePanel(); }
private void InitQuestionGroup(GameObject go) { _questionGroupPrefab = go.GetComponentEx <Transform>(Layout.btn_QuestionGroup); groupInfo = new UIConsultingQuestionGroupInfo[consultingDataDict.Count]; int flag = 0; foreach (string item in consultingDataDict.Keys) { groupInfo[flag] = new UIConsultingQuestionGroupInfo(); if (flag == 0) { groupInfo[flag].Init(_questionGroupPrefab.gameObject, item, _OnSelectGroupCallBack); } else { GameObject clone = UICommonTool.Clone(_questionGroupPrefab.gameObject, go.transform); groupInfo[flag].Init(clone, item, _OnSelectGroupCallBack); groupInfo [flag].SetBtnGray(); } flag++; } }