コード例 #1
1
ファイル: MainWindow.cs プロジェクト: D4n13le/OGameBot
        public MainWindow(Form parent, OGameBot bot, UGInfos forumInfos)
        {
            _bot = bot;
            _parent = parent;
            InitializeComponent();
            forumUserLabel.Text = @"User: "******"Post: " + forumInfos.Post;
            forumPostLabel.Text = @"UID: " + forumInfos.UID;
            forumStatusLabel.Text = @"Status: " + forumInfos.Status;
            PopulateAddBuildingList();

            _bot.BeganBuild += (o, b) => DisplayLogMessage(@"Iniziata la costruzione di " + b.GetDescription());

            _bot.Built += (o, b) =>
                              {
                                  DisplayLogMessage(@"Terminata la costruzione di " + b.GetDescription());
                                  buildingListView.Invoke(new Action(() => buildingListView.Items.RemoveAt(0)));
                              };

            _bot.BuildingUnavaiable += (o, b) => DisplayLogMessage(@"Non puoi costruire " + b.GetDescription() + ", verrà spostato in fondo alla coda.");
            _bot.NotEnoughResources += (o, b) =>
                                           {
                                               if (_notEnoughResourcesCount == 0)
                                                   DisplayLogMessage(@"Risorse non sufficenti per " + b.GetDescription() +
                                                                     ", in attesa");
                                               _notEnoughResourcesCount = ++_notEnoughResourcesCount%20;
                                           };

            _bot.InConstruction += o =>
                                       {
                                           if (_inConstructionCount == 0)
                                               DisplayLogMessage(
                                                   @"E' già presente un edificio in costruzione, in attesa");
                                           _inConstructionCount = ++_inConstructionCount%20;
                                       };
            _bot.Stopped += o => _parent.Invoke(new Action(Close));
        }
コード例 #2
0
ファイル: LoginWindow.cs プロジェクト: D4n13le/OGameBot
 private void DoLogIn()
 {
     loginButton.Enabled = false;
     _bot = new OGameBot();
     if (UGLogin())
         OGLogin();
     else
     {
         MessageBox.Show(null, @"Dati Unfair-Gamers inseriti non corretti", @"Autentificazione Fallita",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }