Пример #1
0
        public static string[] ReadRulesetFromResources(LogicMode mode, string userLogicFileName)
        {
            string[] lines = null;

            if (mode == LogicMode.Casual)
            {
                lines = Properties.Resources.REQ_CASUAL.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
            }
            else if (mode == LogicMode.Glitched)
            {
                lines = Properties.Resources.REQ_GLITCH.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
            }
            else if (mode == LogicMode.UserLogic)
            {
                using (StreamReader Req = new StreamReader(File.OpenRead(userLogicFileName)))
                {
                    var logic = Req.ReadToEnd();
                    if (logic.StartsWith("{"))
                    {
                        var configurationLogic = Configuration.FromJson(logic);
                        logic = configurationLogic.GameplaySettings.Logic;
                    }
                    lines = logic.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
                }
            }

            return(lines);
        }
Пример #2
0
        public ToggleTricksForm(LogicMode logicMode, string userLogicFilename, IEnumerable <string> tricksEnabled)
        {
            InitializeComponent();
            Result = tricksEnabled.ToList();

            var lines    = LogicUtils.ReadRulesetFromResources(logicMode, userLogicFilename);
            var itemList = LogicUtils.PopulateItemListFromLogicData(lines);

            var y      = 9;
            var deltaY = 23;
            var tricks = itemList.Where(io => io.IsTrick);

            foreach (var itemObject in tricks.OrderBy(io => io.Name))
            {
                var cTrick = new CheckBox();
                cTrick.Tag     = itemObject;
                cTrick.Checked = tricksEnabled.Contains(itemObject.Name);
                cTrick.Text    = itemObject.Name;
                TooltipBuilder.SetTooltip(cTrick, itemObject.TrickTooltip);
                cTrick.Location        = new Point(9, y);
                cTrick.Size            = new Size(pTricks.Width - 50, deltaY);
                cTrick.CheckedChanged += cTrick_CheckedChanged;
                pTricks.Controls.Add(cTrick);
                y += deltaY;
            }
        }
        private void LoadSemiStaticData()
        {
            logicPtrVal = MemoryReader.ReadIntPtr(EngineAddr + logicOffset);
            if (logicPtrVal == IntPtr.Zero)
            {
                throw new InconsistentDataException();
            }

            string logicName = RttiReader.GetMangledClassNameFromObjPtr(logicPtrVal);

            switch (logicName)
            {
            case ".?AVLogicGame@Queen@@":
                logicMode = LogicMode.Game;
                break;

            case ".?AVLogicDemo@Queen@@":
                logicMode = LogicMode.Demo;
                break;

            case ".?AVLogicInterview@Queen@@":
                logicMode = LogicMode.Interview;
                break;

            default:
                throw new InvalidDataException("Unrecognized logic type");
            }
        }
Пример #4
0
 public ToggleTricksForm(LogicMode logicMode, string userLogicFilename, IEnumerable <string> tricksEnabled)
 {
     InitializeComponent();
     Result    = tricksEnabled.ToHashSet();
     LogicFile = LogicUtils.ReadRulesetFromResources(logicMode, userLogicFilename);
     Write_Tricks();
 }
Пример #5
0
        public static LogicFile ReadRulesetFromResources(LogicMode mode, string userLogicFileName)
        {
            if (mode == LogicMode.Casual)
            {
                return(LogicFile.FromJson(Properties.Resources.REQ_CASUAL));
            }
            else if (mode == LogicMode.Glitched)
            {
                return(LogicFile.FromJson(Properties.Resources.REQ_GLITCH));
            }
            else if (mode == LogicMode.UserLogic)
            {
                using (StreamReader Req = new StreamReader(File.OpenRead(userLogicFileName)))
                {
                    var logic = Req.ReadToEnd();

                    var logicConfiguration = Configuration.FromJson(logic);
                    if (logicConfiguration.GameplaySettings != null)
                    {
                        logic = logicConfiguration.GameplaySettings.Logic;
                    }

                    return(LogicFile.FromJson(logic));
                }
            }

            return(null);
        }
Пример #6
0
        public static LogicFile ReadRulesetFromResources(LogicMode mode, string userLogicFileName)
        {
            if (mode == LogicMode.Casual)
            {
                return(LogicFile.FromJson(Properties.Resources.REQ_CASUAL));
            }
            else if (mode == LogicMode.Glitched)
            {
                return(LogicFile.FromJson(Properties.Resources.REQ_GLITCH));
            }
            else if (mode == LogicMode.UserLogic)
            {
                using (StreamReader Req = new StreamReader(File.OpenRead(userLogicFileName)))
                {
                    var logic = Req.ReadToEnd();

                    return(LogicFile.FromJson(logic));

                    // TODO handle logic within settings file
                }
            }

            return(null);
        }