示例#1
0
        static void Main(string[] args)
        {
            var gameServer = new Bootstrapper().Build();

            var token = gameServer.Authenticate("DR", args[0], args[1], args[2]);
            if(token == null)
            {
                console.WriteLine("Unable to authenticate.");
                return;
            }
            gameServer.Connect(token);
            gameServer.GameState.TextLog += (msg) => {
                console.Write(msg);
            };

            while(true) {
                string stringToSend = console.ReadLine();

                gameServer.SendCommand(stringToSend + "\r\n");

                if (stringToSend == "exit") {
                    break;
                }
            }
            gameServer.Disconnect();
            console.ReadLine();
        }
        // Shared initialization code
        void Initialize()
        {
            _bootStrapper = new Bootstrapper();
            _commandCache = new CommandCache();
            _expTracker = new ExpTracker();

            _spellTimer = new Timer();
            _spellTimer.Interval = 1000;
            _spellTimer.Elapsed += (sender, e) => {
                _count++;
                _gameServer.GameState.Set(ComponentKeys.SpellTime, _count.ToString());
                BeginInvokeOnMainThread(() => SpellLabel.StringValue = "S: ({0}) {1}".ToFormat(_count, _spell));
            };
        }