|
@@ -15,13 +15,23 @@ public class MainMenuControllerUpdateSystem : UpdateSystem<MainMenuController>
|
|
|
self.Update();
|
|
|
}
|
|
|
}
|
|
|
+/// <summary> 课程选项数据 </summary>
|
|
|
+class CourseItemDate
|
|
|
+{
|
|
|
+ /// <summary> 课程索引 </summary>
|
|
|
+ public int courseIndex;
|
|
|
+ /// <summary> 课程名称 </summary>
|
|
|
+ public string name;
|
|
|
+ /// <summary> 课程类型 </summary>
|
|
|
+ public CoursType coursType;
|
|
|
+}
|
|
|
public class MainMenuController : Controller<MainMenuView, MainMenuModel>
|
|
|
{
|
|
|
List<CoursType> courses = new List<CoursType>
|
|
|
{
|
|
|
CoursType.中药检索,
|
|
|
CoursType.中药学古文献,
|
|
|
- CoursType.药物采集与加工,
|
|
|
+ CoursType.药物采集,
|
|
|
CoursType.药物炮制,
|
|
|
CoursType.药物化学,
|
|
|
CoursType.药物药理,
|
|
@@ -31,12 +41,14 @@ public class MainMenuController : Controller<MainMenuView, MainMenuModel>
|
|
|
CoursType.药事管理法规,
|
|
|
CoursType.中医药方剂
|
|
|
};
|
|
|
+ /// <summary> 当前页的课程类型列表 </summary>
|
|
|
+ CoursType[] currentPageCourse = new CoursType[6];
|
|
|
protected override void BindingViewModel()
|
|
|
{
|
|
|
_Model.currentPageIndex.Value = 1;
|
|
|
refreshCourseList();
|
|
|
ToggleGroupAddListener();
|
|
|
- _Model.Bind(_View.nextPageBtn, NextBtnClick);
|
|
|
+ _Model.Bind(_View.nextPageBtn,NextBtnClick);
|
|
|
_Model.Bind(_View.lastPageBtn, LastBtnClick);
|
|
|
}
|
|
|
public override void OpenView()
|
|
@@ -66,31 +78,32 @@ public class MainMenuController : Controller<MainMenuView, MainMenuModel>
|
|
|
void NextBtnClick()
|
|
|
{
|
|
|
_Model.currentPageIndex.Value++;
|
|
|
- refreshCourseList();
|
|
|
+ refreshCourseList() ;
|
|
|
}
|
|
|
void LastBtnClick()
|
|
|
{
|
|
|
_Model.currentPageIndex.Value--;
|
|
|
- refreshCourseList();
|
|
|
+ refreshCourseList() ;
|
|
|
}
|
|
|
+ /// <summary> 刷新页面数据 </summary>
|
|
|
void refreshCourseList()
|
|
|
{
|
|
|
-
|
|
|
ReferenceCollector[] rcArray = _View.group.GetComponentsInChildren<ReferenceCollector>();
|
|
|
for (int i = 0; i < rcArray.Length; i++)
|
|
|
{
|
|
|
- int courseIndex = (_Model.currentPageIndex.Value - 1) * 6 + i;
|
|
|
- if (courseIndex >= courses.Count)
|
|
|
+ int courseIndex = (_Model.currentPageIndex.Value - 1)*6+i;
|
|
|
+ if (courseIndex>=courses.Count)
|
|
|
{
|
|
|
rcArray[i].GetComponent<CanvasGroup>().alpha = 0;
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- rcArray[i].GetComponent<CanvasGroup>().alpha = 1;
|
|
|
+ rcArray[i].GetComponent<CanvasGroup>().alpha=1;
|
|
|
rcArray[i].GetComponent<TextMeshProUGUI>("Index").text = courseIndex.ToString();
|
|
|
rcArray[i].GetComponent<TextMeshProUGUI>("CourseName").text = courses[courseIndex].ToString();
|
|
|
+ currentPageCourse[i] = (CoursType)courseIndex;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
void ToggleGroupAddListener()
|
|
@@ -105,23 +118,24 @@ public class MainMenuController : Controller<MainMenuView, MainMenuModel>
|
|
|
{
|
|
|
if (isOn)
|
|
|
{
|
|
|
- _Model.onSelectCourse.Value = courses[index];
|
|
|
+ _Model.onSelectCourse.Value = currentPageCourse[index];
|
|
|
+ //Debug.Log(_Model.onSelectCourse.Value);
|
|
|
}
|
|
|
|
|
|
Color color;
|
|
|
- ColorUtility.TryParseHtmlString("#FFDC63", out color);
|
|
|
- rc.GetComponent<TextMeshProUGUI>("Index").color = isOn ? color : Color.black;
|
|
|
+ ColorUtility.TryParseHtmlString("#FFDC63",out color);
|
|
|
+ rc.GetComponent<TextMeshProUGUI>("Index").color=isOn?color:Color.black;
|
|
|
rc.GetComponent<TextMeshProUGUI>("CourseName").color = isOn ? color : Color.black;
|
|
|
rc.Get<GameObject>("EnterBtn").SetActive(isOn);
|
|
|
- toggles[index].GetComponent<Canvas>().sortingOrder = isOn ? 1001 : 1000;
|
|
|
+ toggles[index].GetComponent<Canvas>().sortingOrder = isOn?1001:1000;
|
|
|
});
|
|
|
}
|
|
|
toggles[0].isOn = true;
|
|
|
}
|
|
|
void OnEnterBtnClick()
|
|
|
{
|
|
|
-
|
|
|
- if (_Model.onSelectCourse.Value == CoursType.中药检索)
|
|
|
+ Debug.Log(_Model.onSelectCourse.Value);
|
|
|
+ if (_Model.onSelectCourse.Value==CoursType.中药检索)
|
|
|
{
|
|
|
SearchViewController searchView = FacadeComponent.Instance.CreateController<SearchViewController>();
|
|
|
searchView.OpenView();
|
|
@@ -130,8 +144,6 @@ public class MainMenuController : Controller<MainMenuView, MainMenuModel>
|
|
|
{
|
|
|
SearchTypeEntryController controller = FacadeComponent.Instance.CreateController<SearchTypeEntryController>();
|
|
|
controller.OpenView();
|
|
|
- controller.ShowUI(_Model.onSelectCourse.Value);
|
|
|
-
|
|
|
}
|
|
|
CloseView();
|
|
|
}
|
|
@@ -167,6 +179,7 @@ public class MainMenuView : View
|
|
|
//}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public class MainMenuModel : Model
|
|
|
{
|
|
|
/// <summary>
|