Ejemplo n.º 1
0
 public BotsController(BotsUnitOfWork uow, BotsManager botsManager, DbContextOptions <TwoButtonsContext> dbOptions, ILogger <BotsController> logger)
 {
     _uow         = uow;
     _botsManager = botsManager;
     _dbOptions   = dbOptions;
     _logger      = logger;
 }
Ejemplo n.º 2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
 private void BM_ManagerStatusChanged(object sender, BotsManager.ManagerStatusType e)
 {
     if (e == BotsManager.ManagerStatusType.Started)
     {
         this.Invoke(new MethodInvoker(() =>
         {
             TmrUIBotInfo.Start();
         }));
     }
     else if (e == BotsManager.ManagerStatusType.Stoped)
         TmrUIBotInfo.Enabled = false;
 }
Ejemplo n.º 4
0
        public async Task AddBotToLobby(string lobbyName)
        {
            var lobby = this.lobbyManagerService.Lobbies.FirstOrDefault(x => x.Name == lobbyName);

            if (lobby.LobbyUsers.Count == 4)
            {
                return;
            }

            BotsManager.CreateBotForLobby(lobby.Name);

            await this.UpdateLobbies(lobby.Type);
        }
Ejemplo n.º 5
0
 private void BM_BotListChanged(object sender, BotsManager.ChangesType e)
 {
     SBot bot = (SBot)sender;
     switch (e)
     {
         case BotsManager.ChangesType.Added:
             AddBotVisual(bot);
             bot.StateChanged += Bot_StateChanged;
             bot.PropertyChanged += Bot_PropertyChanged;
             break;
         case BotsManager.ChangesType.Deleted:
             bot.StateChanged -= Bot_StateChanged;
             bot.PropertyChanged -= Bot_PropertyChanged;
             RemoveBotVisual(bot);
             break;
         default:
             break;
     }
 }
Ejemplo n.º 6
0
 private void BM_ManagerStatusChanged(object sender, BotsManager.ManagerStatusType e)
 {
     switch (e)
     {
         case BotsManager.ManagerStatusType.Started:
             break;
         case BotsManager.ManagerStatusType.Stoped:
             break;
         default:
             break;
     }
 }
Ejemplo n.º 7
0
 void BM_BotListChanged(object sender, BotsManager.ChangesType e)
 {
     MethodInvoker action = new MethodInvoker(() =>
         {
             IBot bot = (IBot)sender;
             switch (e)
             {
                 case BotsManager.ChangesType.Added:
                     ListViewItem lvi = new ListViewItem(bot.CharName);
                     lvi.SubItems.Add(bot.ServerName);
                     if (bot.Visable)
                         lvi.SubItems.Add("V");
                     else
                         lvi.SubItems.Add("H");
                     lvi.SubItems.Add(bot.ID.ToString());
                     lvi.StateImageIndex = 0;
                     LVBots.Items.Add(lvi);
                     bot.StateChanged += bot_StateChanged;
                     bot.PropertyChanged += bot_PropertyChanged;
                     bot.LogAdded += bot_LogAdded;
                     break;
                 case BotsManager.ChangesType.Deleted:
                     foreach (ListViewItem item in LVBots.Items)
                     {
                         if (item.Text == bot.CharName && item.SubItems[1].Text == bot.ServerName)
                         {
                             item.Remove();
                             break; ;
                         }
                     }
                     break;
             }
         });
     this.Invoke(action);
 }
Ejemplo n.º 8
0
 void BM_AccountListChanged(object sender, BotsManager.ChangesType e)
 {
     Account account = (Account)sender;
     switch (e)
     {
         case BotsManager.ChangesType.Added:
             ListViewItem lviAdd = new ListViewItem(account.autoSelectChar);
             if (account.Start)
                 lviAdd.ForeColor = AccountAutoStartEnabledColor;
             else
                 lviAdd.ForeColor = AccountAutoStartDisabledColor;
             lviAdd.SubItems.Add(DataManager.ServerList[account.silkroadServer]);
             lvAccount.Items.Add(lviAdd);
             break;
         case BotsManager.ChangesType.Updated:
             ListViewItem lviUpdate = lvAccount.SelectedItems[0];
             lviUpdate.Text = account.autoSelectChar;
             if (account.Start)
                 lviUpdate.ForeColor = AccountAutoStartEnabledColor;
             else
                 lviUpdate.ForeColor = AccountAutoStartDisabledColor;
             lviUpdate.SubItems[1].Text = DataManager.ServerList[account.silkroadServer];
             break;
         case BotsManager.ChangesType.Deleted:
             foreach (ListViewItem item in lvAccount.Items)
             {
                 if (item.Text == account.autoSelectChar && item.SubItems[1].Text == DataManager.ServerList[account.silkroadServer])
                 {
                     item.Remove();
                     break;
                 }
             }
             break;
     }
 }
Ejemplo n.º 9
0
        private void BM_ManagerStatusChanged(object sender, BotsManager.ManagerStatusType e)
        {
            try
            {
                if (e == BotsManager.ManagerStatusType.Started)
                {
                    this.Invoke(new MethodInvoker(() =>
                    {
                        TmrUIBotInfo.Start();
                    }));

                }
                else if (e == BotsManager.ManagerStatusType.Stoped)
                {
                    TmrUIBotInfo.Enabled = false;
                }
            }
            catch (Exception ex)
            { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
        }