예제 #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");
            }
        }
예제 #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);
                    }
                }
            }
        }
예제 #3
0
        public static bool ConfirmElectivePatch_multiCourseSelect(ref CtrlElective __instance)
        {
            if (multiCourseSelect.Value)
            {
                //先排个序
                ElectiveInfosSort();

                string ids = "";
                for (int i = 0; i < selectElectiveInfos.Count; i++)
                {
                    Elective elective = selectElectiveInfos[i].Elective;
                    Game.GameData.Elective.ConfirmElective(elective.Id, elective.IsRepeat);
                    ids += selectElectiveInfos[i].Elective.Id + "_";
                }
                ids = ids.Substring(0, ids.Length - 1);
                Game.GameData.Elective.Id = ids;                //这里写的selectElectiveList存不下来,所以把所有id拼起来存到原id中,到时候拆分后用
                return(false);
            }
            return(true);
        }
예제 #4
0
        public static bool OpenConfirmWindowPatch_multiCourseSelect(ref CtrlElective __instance)
        {
            if (multiCourseSelect.Value)
            {
                UIElective view       = Traverse.Create(__instance).Field("view").GetValue <UIElective>();
                bool       IsViewMode = Traverse.Create(__instance).Field("IsViewMode").GetValue <bool>();
                if (IsViewMode)
                {
                    return(false);
                }

                string electiveNames = "";
                for (int i = 0; i < selectElectiveInfos.Count; i++)
                {
                    if (!selectElectiveInfos[i].IsConditionPass)
                    {
                        StringTable stringTable = Game.Data.Get <StringTable>("SecondaryInterface0102");
                        string      message     = (stringTable != null) ? stringTable.Text : null;


                        view.OpenConditionFailWindow(message);
                        return(false);
                    }
                    Elective elective = selectElectiveInfos[i].Elective;
                    electiveNames += elective.Name + ",";
                }
                StringTable stringTable2 = Game.Data.Get <StringTable>("SecondaryInterface0101");
                string      text         = (stringTable2 != null) ? stringTable2.Text : null;
                electiveNames = electiveNames.Substring(0, electiveNames.Length - 1);
                text          = (text.IsNullOrEmpty() ? string.Empty : string.Format(text, electiveNames));
                view.OpenConfirmWindow(text);

                return(false);
            }
            return(true);
        }