コード例 #1
0
            // ReSharper disable once InconsistentNaming
            //internal static void Info_CreateSelectADV_Prefix(Info __instance, ref Info.SelectInfo _info)
            internal static void Info_CreateSelectADV_Prefix(Info __instance, Info.SelectInfo _info)
            {
                if (EnabledForCurrentHeroine())
                {
                    var id = _info.GetQuestionId();
                    Logger.LogError($"{_info.row} {_info.introduction.file} {id}");
                    SetCurrentDialog(_info.GetQuestionId(), InfoCheckSelectConditions(__instance, _info.conditions), _info.choice.Length);

                    if (CurrentDialog.QuestionInfo.Id == -1)
                    {
                        Logger.LogDebug($"Unknown question: {CurrentDialog.QuestionId}: {_info.introduction.text}");
                    }
                }
                else
                {
                    ClearCurrentDialog();
                }
            }
コード例 #2
0
ファイル: KK.Extensions.cs プロジェクト: GeBo1/GeBoPlugins
        public static int GetQuestionId(this Info.SelectInfo selectInfo)
        {
            if (selectInfo?.introduction == null)
            {
                return(-1);
            }
            var tmp = selectInfo.introduction.file?.Split('_');

            if (tmp?.Length != 4)
            {
                return(-1);
            }
            try
            {
                return(int.Parse(tmp[3], NumberStyles.Integer));
            }
//             catch (OverflowException) { }
            catch (FormatException) { }
            catch (ArgumentException) { }

//
            return(-1);
        }
コード例 #3
0
        public static int GetQuestionId(this Info.SelectInfo selectInfo)
        {
            if (selectInfo?.introduction == null)
            {
                return(-1);
            }
            var tmp = selectInfo.introduction.file?.Split('_');

            if (tmp?.Length != 4)
            {
                return(-1);
            }
            try
            {
                return(int.Parse(tmp[3], NumberStyles.Integer));
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (OverflowException) { }
            catch (FormatException) { }
            catch (ArgumentException) { }
#pragma warning restore CA1031 // Do not catch general exception types

            return(-1);
        }