Example #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");
            }
        }
Example #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);
                    }
                }
            }
        }
Example #3
0
        public static void ExecuteCinematicPatch_multiCourseSelect(ref ElectiveManager __instance, Action _onCompleted)
        {
            //顺便把这个初始化一下,防止下半年选课出错
            selectElectiveInfos = new List <ElectiveInfo>();


            onCompletedFinal = _onCompleted;
            Heluo.Logger.LogError("onCompleted:" + onCompletedFinal);
            ElectiveManager electiveManager = __instance;

            UIElective uielective = Game.UI.Open <UIElective>();

            //提交选课后调用的继续对话
            uielective.SetContinuationTalk(delegate
            {
                List <string> electiveIdList = electiveManager.Id.Split('_').ToList();
                createContinuationTalk(electiveIdList, 0);
            });
        }
Example #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);
        }