Ejemplo n.º 1
0
        public static void OnCourseBtnPressedPatch_multiCourseSelect(ref UIElective __instance)
        {
            if (multiCourseSelect.Value)
            {
                Heluo.Logger.LogError("OnCourseBtnPressedPatch_multiCourseSelect start");

                CtrlElective controller = Traverse.Create(__instance).Field("controller").GetValue <CtrlElective>();

                EnumArray <Grade, List <ElectiveInfo> > sort = Traverse.Create(controller).Field("sort").GetValue <EnumArray <Grade, List <ElectiveInfo> > >();
                int gradeIndex  = Traverse.Create(controller).Field("gradeIndex").GetValue <int>();
                int courseIndex = Traverse.Create(controller).Field("courseIndex").GetValue <int>();

                ElectiveInfo electiveInfo = sort[gradeIndex][courseIndex];

                InputSelectable ElectiveSelectable = Traverse.Create(__instance).Field("ElectiveSelectable").GetValue <InputSelectable>();
                InputNavigation CurrentSelected    = ElectiveSelectable.CurrentSelected;

                if (selectElectiveInfos.Contains(electiveInfo))
                {
                    selectElectiveInfos.Remove(electiveInfo);

                    hideSelectIcon(CurrentSelected);
                }
                else
                {
                    selectElectiveInfos.Add(electiveInfo);

                    showSelectIcon(CurrentSelected);
                }

                Heluo.Logger.LogError("OnCourseBtnPressedPatch_multiCourseSelect end");
            }
        }
Ejemplo n.º 2
0
        public static void OnTabBtnIsOnPatch_multiCourseSelect(ref UIElective __instance, ref int index)
        {
            if (multiCourseSelect.Value)
            {
                CtrlElective controller = Traverse.Create(__instance).Field("controller").GetValue <CtrlElective>();
                EnumArray <Grade, List <ElectiveInfo> > sort = Traverse.Create(controller).Field("sort").GetValue <EnumArray <Grade, List <ElectiveInfo> > >();
                int gradeIndex = Traverse.Create(controller).Field("gradeIndex").GetValue <int>();

                List <ElectiveInfo> courses = sort[gradeIndex];

                InputSelectable        ElectiveSelectable = Traverse.Create(__instance).Field("ElectiveSelectable").GetValue <InputSelectable>();
                List <InputNavigation> InputNavigations   = ElectiveSelectable.InputNavigations;

                for (int i = 0; i < courses.Count; i++)
                {
                    InputNavigation CurrentSelected = InputNavigations[i];

                    if (selectElectiveInfos.Contains(courses[i]))
                    {
                        showSelectIcon(CurrentSelected);
                    }
                    else
                    {
                        hideSelectIcon(CurrentSelected);
                    }
                }
            }
        }