コード例 #1
0
        protected override void Init()
        {
            Settings        = CheckPointsSettings.ReadFromFile(PluginSettingsFilePath);
            BestCheckPoints = new Dictionary <string, Dictionary <int, int> >();

            Context.RPCClient.Callbacks.PlayerDisconnect  += Callbacks_PlayerDisconnect;
            Context.RPCClient.Callbacks.BeginChallenge    += Callbacks_BeginChallenge;
            Context.RPCClient.Callbacks.EndChallenge      += Callbacks_EndChallenge;
            Context.RPCClient.Callbacks.PlayerCheckpoint  += Callbacks_PlayerCheckpoint;
            Context.RPCClient.Callbacks.PlayerFinish      += Callbacks_PlayerFinish;
            Context.RPCClient.Callbacks.PlayerInfoChanged += Callbacks_PlayerInfoChanged;
        }
コード例 #2
0
        public static CheckPointsSettings ReadFromFile(string xmlConfigurationFile)
        {
            CheckPointsSettings result         = new CheckPointsSettings();
            XDocument           configDocument = XDocument.Load(xmlConfigurationFile);

            if (configDocument.Root == null)
            {
                throw new ConfigurationErrorsException("Could not find root node in file: " + xmlConfigurationFile);
            }

            result.Template = ReadConfigString(configDocument.Root, "Template", xmlConfigurationFile);
            result.SuperiorTimeTextStyle = ReadConfigString(configDocument.Root, "SuperiorTimeTextStyle", string.Empty, xmlConfigurationFile);
            result.InferiorTimeTextStyle = ReadConfigString(configDocument.Root, "InferiorTimeTextStyle", string.Empty, xmlConfigurationFile);
            result.TimeoutInSeconds      = ReadConfigUInt(configDocument.Root, "TimeoutInSeconds", 3, xmlConfigurationFile);

            return(result);
        }