Exemple #1
0
        private void BuildTradeMenu()
        {
            OptionPopups.ConfigOption[] options = new OptionPopups.ConfigOption[] {
                new OptionPopups.ConfigOption("Enable", true),
                new OptionPopups.ConfigOption("Disable", false)
            };

            popups.ShowMultiScrollPopup(this, "trade", "Inline Trade Prices", "Whether you want to see item prices inline in the trade window.", SetupOptions(config.GetBoolean("trade"), options));
        }
Exemple #2
0
        private void BuildReplayMenu()
        {
            OptionPopups.ConfigOption[] options = new OptionPopups.ConfigOption[] {
                new OptionPopups.ConfigOption("Ask After Matches", "ask"),
                new OptionPopups.ConfigOption("Automatically Upload", "auto"),
                new OptionPopups.ConfigOption("Don't Upload", "never")
            };

            popups.ShowMultiScrollPopup(this, "replay", "Select Replay Mode", "Configures how ScrollsPost should handle your replays.", SetupOptions((String) config.GetWithDefault("replay", (object) "ask"), options));
        }
Exemple #3
0
        private void BuildPeriodMenu()
        {
            OptionPopups.ConfigOption[] options = new OptionPopups.ConfigOption[] {
                new OptionPopups.ConfigOption("Last Hour", "1-hour"),
                new OptionPopups.ConfigOption("Last 24 Hours", "1-day"),
                new OptionPopups.ConfigOption("Last 3 Days", "3-days"),
                new OptionPopups.ConfigOption("Last 7 Days", "7-days"),
                new OptionPopups.ConfigOption("Last 14 Days", "14-days"),
                new OptionPopups.ConfigOption("Last 30 Days", "30-days"),
            };

            popups.ShowMultiScrollPopup(this, "period", "Select Period Type", "What time period to use for prices on the trade window.", SetupOptions((String) config.GetWithDefault("data-period", (object) "1-day"), options));
        }
Exemple #4
0
        // Menu builders
        private void BuildReplayListMenu()
        {
            List<OptionPopups.ConfigOption> options = new List<OptionPopups.ConfigOption>();

            String[] files = Directory.GetFiles(this.mod.replayLogger.replayFolder, "*.spr");
            Array.Sort(files);
            Array.Reverse(files);

            // Figure out what games we have multi perspectives for
            Dictionary<String, Boolean> gameIDs = new Dictionary<String, Boolean>();
            foreach( String path in files ) {
                String name = Path.GetFileNameWithoutExtension(path);
                name = name.Split(new char[] { '-' }, 2)[0];
                if( gameIDs.ContainsKey(name) ) {
                    gameIDs[name] = true;
                } else {
                    gameIDs[name] = false;
                }
            }

            // Figure out what has been uploaded already
            Dictionary<String, Boolean> notUploaded = new Dictionary<String, Boolean>();
            if( File.Exists(mod.replayLogger.uploadCachePath) ) {
                using( StreamReader sr = new StreamReader(mod.replayLogger.uploadCachePath) ) {
                    while( sr.Peek() > 0 ) {
                        notUploaded[sr.ReadLine()] = true;
                    }
                }
            }

            foreach( String path in files ) {
                using( StreamReader sr = new StreamReader(path) ) {
                    String line = sr.ReadLine();
                    if( line.StartsWith("metadata") ) {
                        line = line.Split(new char[] { '|' }, 2)[1];
                        String filename = Path.GetFileName(path);

                        Dictionary<String, object> metadata = new JsonReader().Read<Dictionary<String, object>>(line);
                        // If we have a multi viewpoint replay, only show the white one as that's the person who plays first
                        Boolean status = gameIDs[metadata["game-id"].ToString()];
                        if( status == true && !metadata["perspective"].Equals("white") ) {
                            continue;
                        }

                        DateTime played = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        played = played.AddSeconds(Convert.ToDouble(metadata["played-at"]));
                        played = TimeZone.CurrentTimeZone.ToLocalTime(played);

                        metadata["white-name"] = "<color=#fde50d>" + metadata["white-name"] + "</color>";
                        metadata["black-name"] = "<color=#fde50d>" + metadata["black-name"] + "</color>";

                        if( status == true ) {
                            metadata["white-name"] = "[VP] <color=#fde50d>" + metadata["white-name"] + "</color>";
                            metadata["black-name"] = "[VP] <color=#fde50d>" + metadata["black-name"] + "</color>";
                        } else {
                            metadata[metadata["perspective"] + "-name"] = "[VP] " + metadata[metadata["perspective"] + "-name"];
                        }

                        String deck;
                        if( notUploaded.ContainsKey(filename) ) {
                            deck = "<color=#D61320>Not Uploaded</color>";
                        } else {
                            deck = (String) metadata["deck"];
                        }

                        String label = String.Format("{0} {1} - {2}\n{3} vs {4}", played.ToShortDateString(), played.ToShortTimeString(), deck, metadata["white-name"], metadata["black-name"]);
                        OptionPopups.ConfigOption option = new OptionPopups.ConfigOption(label, path, path.Equals(replayPath));

                        options.Add(option);
                    }
                }
            }

            popups.ShowReplayScrollPopup(this, "pick-replay", "Select Replay", "Pick a replay to watch, share or delete.", options);
        }
Exemple #5
0
        private void BuildCollectionNotificationMenu()
        {
            OptionPopups.ConfigOption[] options = new OptionPopups.ConfigOption[] {
                new OptionPopups.ConfigOption("Enable", true),
                new OptionPopups.ConfigOption("Disable", false)
            };

            popups.ShowMultiScrollPopup(this, "sync-notif", "Collection Sync Notifications", "Whether you want to be notified every time your collection has been updated on ScrollsPost.com", SetupOptions(config.GetBoolean("sync-notif"), options));
        }