Exemplo n.º 1
0
    private void AddPlayer(Player player)
    {
        Debug.Log("player added");
        PlayerListing listing = Instantiate(playerListing, hover);

        if (listing != null)
        {
            listing.Player = player;
            listings.Add(listing);
        }
    }
Exemplo n.º 2
0
    // populates list of players and sets their info
    private void AddPlayerListing(Photon.Realtime.Player player)
    {
        // creates listing and adds to list of rooms
        PlayerListing listing = Instantiate(playerListing, content);

        if (listing != null)
        {
            listing.SetPlayerInfo(player);
            listings.Add(listing);
        }
    }
    private void AddPlayerListing(Player player)
    {
        //player.NickName = player.NickName;

        PlayerListing listing = Instantiate(_playerListing, _content);

        if (listing != null)
        {
            listing.SetPlayerInfo(player);
        }
        listings.Add(listing);
    }
Exemplo n.º 4
0
 private void GeneratePlayerList()
 {
     foreach (KeyValuePair <int, Player> playerInfo in PhotonNetwork.CurrentRoom.Players)
     {
         PlayerListing listing = Instantiate(_playerListing, _content);
         if (listing != null)
         {
             listing.SetPlayerInfo(playerInfo.Value);
         }
         listings.Add(listing);
     }
 }
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null) return;
        PlayerLeftRoom(photonPlayer);

        GameObject playerListingObj = Instantiate(PlayerListingPrefab);
        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent<PlayerListing>();
        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 6
0
    public void ResetPosition(Player player, Role role)
    {
        int index = listings.FindIndex(x => x.Player == player);

        if (index != -1)
        {
            PlayerListing playerObject = listings[index];
            playerObject.isReady = false;
            playerObject.setPlayerRole((int)role);
        }

        UpdateRoleBtnState();
        checkGameStartButton();
    }
Exemplo n.º 7
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     using (PlayerListing pl = new PlayerListing(new MessageQueue()))
     {
         pl.SetPlayer(txtPlayerID.Text, txtPlayerID.Text, txtPlayerRealm.Text, txtWatchFile.Text, checkFTPFile.Checked);
         pl.Save();
         if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db")))
         {
             Directory.CreateDirectory(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle"));
             DatabaseSanityChecker.Create(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db"));
         }
     }
     Close();
 }
 private void Start()
 {
     if (_fakePlayers)
     {
         for (int x = 0; x < _numFakePlayers; x++)
         {
             PlayerListing listing = Instantiate(_playerListing, _content);
             if (listing != null)
             {
                 listing.SetFakePlayerInfo(x.ToString(), Random.Range(100, 100000));
             }
             listings.Add(listing);
         }
     }
 }
Exemplo n.º 9
0
        public PlayerListing QueryPlayerListing(string userToken, out ECode ec)
        {
            ec = ECode.None;
            PlayerListing playerListing = null;

            if (PlayerRegistry.IsClientRegistered(userToken))
            {
                playerListing = GetPlayerListing();
            }
            else
            {
                ec = ECode.AuthenticationFail;
            }

            return(playerListing);
        }
    private void AddPlayerListing(Player player)
    {
        int index = _listings.FindIndex(x => x.Player == player);

        if (index != -1)
        {
            _listings[index].SetPlayerInfo(player);
        }
        PlayerListing listing = Instantiate(_playerListing, _content);

        if (listing != null)
        {
            listing.SetPlayerInfo(player);
            _listings.Add(listing);
        }
    }
Exemplo n.º 11
0
        //////////////////////////////////////////////////

        ///// STRUCTORS //////////////////////////////////
        public App()
        {
            // Allows WPF windows to be closed without triggering a shutdown
            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            Token      = null;
            FriendList = new List <string>();
            HeroList   = new List <Hero>();
            PlayerList = new PlayerListing();
            GameLog    = new GameEventLog();

            UPSConnection = new UserPortalServerConnection();
            GSConnection  = new GameServerConnection();

            HeroSelection   = null;
            GameServerReady = false;
        }
Exemplo n.º 12
0
    void AddPlayer(Player newPlayer)
    {
        if (newPlayer == null)
        {
            return;
        }
        int index = m_playerListings.FindIndex(x => x.m_photonPlayer == newPlayer);

        if (index != -1)
        {
            return;
        }
        GameObject playerListingObj = Instantiate(m_playerListingPrefabs);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(newPlayer);
        m_playerListings.Add(playerListing);

        if (newPlayer.IsMasterClient)
        {
            playerListing.m_keyIcon.SetActive(true);
        }
        else
        {
            playerListing.m_keyIcon.SetActive(false);
        }
        if (PhotonNetwork.IsMasterClient)
        {
            if (newPlayer.IsMasterClient)
            {
                playerListing.m_kickButton.SetActive(false);
            }
            else
            {
                playerListing.m_kickButton.SetActive(true);
                playerListing.m_kickButton.GetComponent <Button>().onClick.AddListener(() => MainCanvasManager.m_instance.m_currentRoomCanvas.OnClickKickPlayer(playerListing));
            }
        }
        else
        {
            playerListing.m_kickButton.SetActive(false);
        }
    }
Exemplo n.º 13
0
    private void AddPlayerListing(Player player)
    {
        int index = _listing.FindIndex(x => x.Player == player);

        if (index != -1)
        {
            _listing[index].SetPlayerInfo(player);
        }
        else
        {
            PlayerListing listing = (PlayerListing)Instantiate(_playerListPrefab, _content);
            if (listing != null)
            {
                listing.SetPlayerInfo(player);
                _listing.Add(listing);
            }
        }
    }
    internal void PlayerJoinedRoom(PhotonPlayer phoPlayer)
    {
        if (phoPlayer == null)
        {
            return;
        }
        PlayerLeftRoom(phoPlayer);

        GameObject playerListingObj = Instantiate(playerListingGameObject);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerlisting = playerListingObj.GetComponent <PlayerListing>();

        playerlisting.ApplyPhotonPlayer(phoPlayer);

        playerListings.Add(playerlisting);
    }
Exemplo n.º 15
0
    private void AddPlayerListing(Player player)
    {
        int index = _listings.FindIndex(x => x.Player == player);//x is some element in the _listings list.

        if (index != -1)
        {
            _listings[index].SetPlayerInfo(player);//Just update it if it exists
        }
        else
        {
            PlayerListing listing = Instantiate(_playerListing, _content);
            if (listing != null)
            {
                listing.SetPlayerInfo(player);//Update the text on the Room Listing
                _listings.Add(listing);
            }
        }
    }
Exemplo n.º 16
0
    private void AddPlayerListing(Player player)
    {
        int index = listings.FindIndex(x => x.player == player);

        if (index == -1)
        {
            PlayerListing listing = Instantiate(playerListing, content);
            if (listing != null)
            {
                listing.SetPlayerInfo(player);
                listings.Add(listing);
            }
        }
        else
        {
            listings[index].SetPlayerInfo(player);
        }
    }
Exemplo n.º 17
0
    void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)
        {
            return;
        }
        if (!photonPlayer.IsLocal)
        {
            AudioFW.Play("Joined");
        }
        GameObject playerListingsObj = Instantiate(playerListingPrefab);

        playerListingsObj.transform.SetParent(transform, false);
        PlayerListing playerListing = playerListingsObj.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(photonPlayer);
        playerListings.Add(playerListing);
    }
Exemplo n.º 18
0
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)
        {
            return;
        }
        //same person joined room remove it
        PlayerLeftRoom(photonPlayer);

        GameObject playerListingOBJ = Instantiate(PlayerListingPrefab);

        playerListingOBJ.transform.SetParent(content.transform, false);
        PlayerListing playerListing = playerListingOBJ.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 19
0
    private void AddPlayerListing(Player thisPlayer)
    {
        int index = _playerListings.FindIndex(x => x.Player == thisPlayer);

        if (index != -1)
        {
            _playerListings[index].SetPlayerInfo(thisPlayer);
        }
        else
        {
            PlayerListing listing = Instantiate(_playerListingPrefab, PlayersContent);

            if (listing != null)
            {
                listing.SetPlayerInfo(thisPlayer);
                _playerListings.Add(listing);
            }
        }
    }
Exemplo n.º 20
0
    private void AddPlayerListing(Player newPlayer)
    {
        int index = roomListings.FindIndex(x => x.Player == newPlayer);

        if (index != -1)
        {
            roomListings[index].SetPlayer(newPlayer);
        }
        else
        {
            PlayerListing listing = Instantiate(prefabListing, content);
            if (listing != null)
            {
                listing.SetPlayer(newPlayer);

                roomListings.Add(listing);
            }
        }
    }
Exemplo n.º 21
0
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)
        {
            return;
        }

        PlayerLeftRoom(photonPlayer);   // чтоб не дублировались пользователи в лобби

        GameObject PlayerListingObj = Instantiate(PlayerListingPrefab);

        PlayerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = PlayerListingObj.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 22
0
    public void playerJoinedRoom(PhotonPlayer unPhotonPlayer)
    {
        if (unPhotonPlayer == null)
        {
            return;
        }

        playerLeftRoom(unPhotonPlayer);

        GameObject playerListingObj = Instantiate(playerListingPrefab);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing>();

        playerListing.applyPhotonPlayer(unPhotonPlayer);

        listeDeJoueur.Add(playerListing);
    }
Exemplo n.º 23
0
    /// <summary>
    /// When a player joins the room
    /// </summary>
    /// <param name="photonPlayer"></param>
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null) //If there is no player, should never happen but just incase
        {
            return;
        }

        PlayerLeftRoom(photonPlayer);

        GameObject playerListingObject = Instantiate(PlayerListingPrefab);                //Instantaiting the prefab, player list that shows the player name

        playerListingObject.transform.SetParent(transform, false);                        //Sets the parent of the prefab to 'PlayerLayoutGroup'

        PlayerListing playerListing = playerListingObject.GetComponent <PlayerListing>(); //Gets the script component

        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing); //Add the script to each prefab in player listings
    }
Exemplo n.º 24
0
    //place holder
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)
        {
            return;
        }

        PlayerLeftRoom(photonPlayer);           //in case OnjoinedRoom message is sent when player is already in room, this prevents  getting duplicates

        GameObject playerListingObj = Instantiate(PlayerListingPrefab);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing> ();

        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 25
0
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)                                     // I don't think this would ever happen but better be safe and secured :)
        {
            return;
        }

        PlayerLeftRoom(photonPlayer);

        GameObject playerListingObj = Instantiate(PlayerListingPrefab);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(photonPlayer);                  // This will set the text on the prefab as well.

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 26
0
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)
        {
            return;
        }

        //preventing whenever a player join room messages is sent when the player is already in the room.
        PlayerLeftRoom(photonPlayer);

        GameObject playerListingObj = Instantiate(PlayerListingPrefab);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 27
0
    private void PlayerJoinedRoom(PhotonPlayer photonPlayer)
    {
        if (photonPlayer == null)       //prevents duplicates
        {
            return;
        }

        PlayerLeftRoom(photonPlayer);

        GameObject playerListingObj = Instantiate(PlayerListingPrefab);

        playerListingObj.transform.SetParent(transform, false);

        PlayerListing playerListing = playerListingObj.GetComponent <PlayerListing>();       //get the playerlisting script from this gameobject

        //pass in the photon player
        playerListing.ApplyPhotonPlayer(photonPlayer);

        PlayerListings.Add(playerListing);
    }
Exemplo n.º 28
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            if (e.CloseReason == CloseReason.WindowsShutDown || e.CloseReason == CloseReason.TaskManagerClosing)
            {
                return;
            }


            if (e.CloseReason == CloseReason.ApplicationExitCall)
            {
                Application.Exit();
                return;
            }

            using (PlayerListing pl = new PlayerListing(new MessageQueue()))
            {
                if (pl.Count > 0)
                {
                    var dirtyFields = from x in _propertyFields
                                      where x.Value.IsDirty == true
                                      select x;
                    if (dirtyFields.Count() > 0)
                    {
                        if (DialogResult.No == DevExpress.XtraEditors.XtraMessageBox.Show(Translations.TranslationGet("STR_SSAVENOTICE", "DE", "Changes you made to Setup would not be saved! " + Environment.NewLine + Environment.NewLine + "Would you like to close Setup window anyway?"), "WOT Statistics", MessageBoxButtons.YesNo, MessageBoxIcon.Stop))
                        {
                            e.Cancel = true;
                        }
                    }
                }
                else
                {
                    if (DialogResult.No == DevExpress.XtraEditors.XtraMessageBox.Show(Translations.TranslationGet("STR_SNOPLAYERNOTICE", "DE", "No players has been selected to monitor. Do you want to continue?"), "WOT Statistics", MessageBoxButtons.YesNo, MessageBoxIcon.Stop))
                    {
                        e.Cancel = true;
                        SetNodeFocus("Players");
                    }
                }
            }
        }
    private void AddPlayerListing(Player player)
    {
        int index = _listings.FindIndex(x => x.Player == player);

        // If we already had that player listing, update it
        if (index != -1)
        {
            _listings[index].SetPlayerInfo(player);
        }
        // Otherwise, create a new listing
        else
        {
            PlayerListing listing = Instantiate(_playerListing, _content);

            if (listing != null)
            {
                listing.SetPlayerInfo(player);
                _listings.Add(listing);
            }
        }
    }
Exemplo n.º 30
0
    //当玩家进入这个房间时
    public void PlayerJoinedRoom(PhotonPlayer player)
    {
        if (player == null)
        {
            return;
        }

        PlayerLeftRoom(player);

        //实例化名字条
        GameObject playerListItem = NGUITools.AddChild(this.gameObject, PlayerListingPrefab);

        this.GetComponent <UIGrid>().AddChild(playerListItem.transform);
        //更新名字条内容
        PlayerListing playerListing = playerListItem.GetComponent <PlayerListing>();

        playerListing.ApplyPhotonPlayer(player);

        //加入list
        PlayerList.Add(playerListing);
    }
Exemplo n.º 31
0
        public void UploadToVBAddict(string filePath, string playerID, MessageQueue message)
        {
            try
            {
                FileInfo toUpload = new FileInfo(filePath);
                byte[] data = File.ReadAllBytes(filePath);

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.vbaddict.net/xxx.php");
                request.Proxy.Credentials = CredentialCache.DefaultCredentials;
                request.Method = "PUT";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;
                request.Headers.Clear();
                request.Referer = toUpload.Name;
                request.UserAgent = "WOTStatistics 2.1.0.0";
                request.ServicePoint.Expect100Continue = false;

                using (Stream stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = request.GetResponse();
                Stream outStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(outStream);
                // Read the content.
                string responseFromServer = reader.ReadToEnd();

                if (responseFromServer.Contains("SUCCESS"))
                {
                    using (PlayerListing pl = new PlayerListing(new MessageQueue()))
                    {
                        if (pl.GetPlayer(playerID).OnlineURL == "#")
                        {
                            pl.SetPlayerOnlineURL(playerID, responseFromServer.Substring(responseFromServer.IndexOf("Link: ") + 6).Replace("SUCCESS", ""));
                            try
                            {
                                pl.Save();
                            }
                            catch
                            {
                            }
                        }
                    }
                }

                response.Close();
            }
            catch (Exception ex)
            {
                message.Add(ex.Message);
            }
        }
Exemplo n.º 32
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            using (PlayerListing pl = new PlayerListing(new MessageQueue()))
            {

                pl.SetPlayer(txtPlayerID.Text, txtPlayerID.Text, txtPlayerRealm.Text, txtWatchFile.Text, checkFTPFile.Checked);
                pl.Save();
                if (!File.Exists(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db")))
                {
                    Directory.CreateDirectory(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle"));
                    DatabaseSanityChecker.Create(Path.Combine(WOTHelper.GetApplicationData(), "Hist_" + txtPlayerID.Text, "LastBattle", "WOTSStore.db"));
                }
            }
            Close();
        }
Exemplo n.º 33
0
        void CreateTitle()
        {
            this.Text = _title + " (Version : " + Application.ProductVersion + ")";
            DossierManager dm;
            dictPlayers.TryGetValue(_currentPlayer.Replace("_", "*"), out dm);

            barButtonItem1.Enabled = new FTPDetails().AllowFTP;

            if (UserSettings.AllowvBAddictUpload || UserSettings.AllowvBAddictUploadDossier || UserSettings.AllowvBAddictUploadDossierBattleResult || UserSettings.AllowvBAddictUploadDossierBattleResultReplay)
            {
                STR_ONLINEANALYZER.Enabled = true;
                PlayerListing pl = new PlayerListing(_message);
                if (pl.GetPlayer(_currentPlayer).OnlineURL == "#")
                    STR_ONLINEANALYZER.Enabled = false;
            }
            else
                STR_ONLINEANALYZER.Enabled = false;

            string caption = _currentPlayer + " (";
            if (dm != null)
            {

                if (dm.GetFileA() != 0 && dm.GetFileB() != 0)
                {
                    caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat));
                }
                else
                {

                    if (dm.GetFileA() != 0 && dm.GetFileB() == 0)
                    {

                        caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileA())).ToString(UserSettings.DateFormat));
                    }
                    else if (dm.GetFileB() != 0 && dm.GetFileA() == 0)
                    {

                        caption += String.Format("{0} To {1}", DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat), DateTime.Parse(dm.GetPlayerFileName(dm.GetFileB())).ToString(UserSettings.DateFormat));
                    }
                    else
                        caption += "No Data";
                }

                barCurrentView.Caption = caption + ")";

                Graphics graphics = this.CreateGraphics();
                SizeF textSize = graphics.MeasureString(barCurrentView.Caption, barCurrentView.Font);

                barCurrentView.LeftIndent = int.Parse(Math.Round((Width / 2) - (textSize.Width / 2), 0).ToString());
            }
        }
Exemplo n.º 34
0
 private void barSetup_ItemClick(object sender, ItemClickEventArgs e)
 {
     using (frmSetup frm = new frmSetup(_currentPage))
     {
         frm.ShowDialog();
         PlayerListing pl = new PlayerListing(_message);
     }
     PlayerRefresh();
 }
Exemplo n.º 35
0
        public frmMain()
        {
            _message.Add("frmMain loaded");

            SetTextOnSplashScreen("Initializing Components");

            WOTHelper.SetInternetZone();
            InitializeComponent();
            repositoryItemRadioGroup2.SelectedIndexChanged += new EventHandler(repositoryItemRadioGroup2_SelectedIndexChanged);
            repositoryItemRecentBattlesDisplayList.SelectedIndexChanged += new EventHandler(repositoryItemRecentBattlesDisplayList_SelectedIndexChanged);

            _chart.ObjectHotTracked += new HotTrackEventHandler(_chart_ObjectHotTracked);
            _browser.ObjectForScripting = this;

            _message = new MessageQueue();
            _message.ItemAdded += new MessageQueue_OnAdd(NewMessage);

            #if DEBUG
            _browser.IsWebBrowserContextMenuEnabled = true;
            #else
            _browser.IsWebBrowserContextMenuEnabled = false;
            #endif

            //dockPanel3.Visibility = DockVisibility.Hidden;
            //dockPanel4.Visibility = DockVisibility.Hidden;
            //dockPanelGraph.Visibility = DockVisibility.Hidden;
            //dockPanel2.Visibility = DockVisibility.Hidden;

            bar6.Visible = false;
            bar6.Offset = 0;
            barLastPlayedGames.Visible = false;
            barLastPlayedGames.Offset = 0;
            helpProvider1.HelpNamespace = Path.Combine(WOTHelper.GetEXEPath(), "Help", "WoT_Stats.chm");
            //ScriptWrapper.Initialise(WOTHelper.GetCustomScript());
            using (PlayerListing players = new PlayerListing(_message))
            {
                if (players.Count() > 0)
                {

                    string errorMessage = "";
                    foreach (KeyValuePair<string, Player> player in players)
                    {
                        SetTextOnSplashScreen("Initializing Dossier of " + player.Value.PlayerID);
                        if (!File.Exists(player.Value.WatchFile))
                        {
                            string dir = player.Value.WatchFile.Remove(player.Value.WatchFile.LastIndexOf('\\'));
                            if (Directory.Exists(dir))
                            {
                                foreach (FileInfo item in new DirectoryInfo(dir).GetFiles().Where(x => x.Extension.ToLower() == ".dat"))
                                {
                                    if (WOTHelper.PlayerIdFromDatFile(item.Name) == player.Value.PlayerID)
                                    {
                                        player.Value.WatchFile = item.FullName;
                                        players.SetPlayerWatchFile(player.Value.PlayerID, item.FullName);
                                        players.Save();
                                        break;
                                    }
                                }
                            }
                        }

                        if (File.Exists(player.Value.WatchFile))
                        {
                            DossierManager dm = new DossierManager(player.Value.PlayerID, player.Value.WatchFile, player.Value.Monitor, _message, this);
                            dm.CurrentFileChange += DossierFileChanged;
                            dictPlayers.Add(player.Value.PlayerID.Replace("_", "*"), dm);

                            //try
                            //{
                                _currentStatsFile.Add(player.Value.PlayerID.Replace("_", "*"), new WOTCompare(new Dossier(dm.GetFileB(), dm.GetPlayerName, _message).GetStats(), new Dossier(dm.GetFileA(), dm.GetPlayerName, _message).GetStats()));
                                dm.RefreshDossier();
                            //}
                            //catch (Exception ex)
                            //{

                            //    _message.Add("Error: cannot refresh dossier file. - " + ex.Message);
                            //}

                            //BarButtonItem buttonOpen = new BarButtonItem(barManager1, player.Value.PlayerID);
                            //buttonOpen.ItemClick += new ItemClickEventHandler(buttonOpen_ItemClick);
                            //buttonOpen.Name = player.Value.PlayerID;
                            //barCompare.AddItem(buttonOpen);

                            CreatePlayerMenu(player.Value.PlayerID);

                            SetTextOnSplashScreen("Initializing Monitor");

                            if (UserSettings.StartMonOnStartUp == true)
                            {
                                dm.StartDossierWatch();
                                barStaticItem1.Glyph = WOTStatistics.Stats.Properties.Resources.bullet_square_green;
                                barStaticItem1.Caption = "Monitor Status : Running";
                            }
                            else
                            {
                                barStaticItem1.Glyph = WOTStatistics.Stats.Properties.Resources.bullet_square_red;
                                barStaticItem1.Caption = "Monitor Status : Stopped";
                            }
                        }
                        else
                        {

                           // _HasPlayerError = true;
                            if (errorMessage.Length > 1)
                                errorMessage += Environment.NewLine + Environment.NewLine;

                            errorMessage += Translations.TranslationGet("STR_PLAYERERROR", "DE", "Dossier file not found for player : " + player.Value.PlayerID + Environment.NewLine + "Please check the dossier file location on the edit player screen in setup." + Environment.NewLine + "Player not loaded.").Replace("{playerid}", player.Value.PlayerID);
                        }

                        if (errorMessage.Length > 1)
                            DevExpress.XtraEditors.XtraMessageBox.Show(errorMessage, "WOT Statistics", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            try
            {
                if (splashScreenManagerWaitForm.IsSplashFormVisible)
                {
                    splashScreenManagerWaitForm.CloseWaitForm();
                }
            }
            catch {}

               // if (splashScreenManagerWaitForm.IsSplashFormVisible)
                //splashScreenManagerWaitForm.CloseWaitForm();
             _message.Add("frmMain DONE");

             try
             {
                 DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
             }
             catch { }
        }
Exemplo n.º 36
0
 private void barButtonItem1_ItemClick_1(object sender, ItemClickEventArgs e)
 {
     using (PlayerListing pl = new PlayerListing(_message))
     {
         try
         {
             Player p = pl.GetPlayer(_currentPlayer);
             System.Diagnostics.Process.Start(p.OnlineURL);
         }
         catch { }
     }
 }
Exemplo n.º 37
0
        private void PlayerRefresh()
        {
            try
            {
                splashScreenManagerWaitForm.ShowWaitForm();
            }
            catch { }
            using (PlayerListing pl = new PlayerListing(_message))
            {
                if (pl.Count() == dictPlayers.Count)
                {
                    foreach (DossierManager item in dictPlayers.Values)
                    {
                        Player player = pl.GetPlayer(item.GetPlayerName);
                        if (item.WatchPath != player.WatchFile || item.FTPFileFetch != (player.Monitor.ToUpper() == "YES" ? true : false))
                        {
                            item.SetValues(player.WatchFile, player.Monitor.ToUpper() == "YES" ? true : false);
                            _currentStatsFile[player.PlayerID.Replace("_", "*")] = new WOTCompare(new Dossier(item.GetFileB(), item.GetPlayerName, _message).GetStats(), new Dossier(item.GetFileA(), item.GetPlayerName, _message).GetStats());
                            item.RefreshDossier();
                        }
                    }
                }
                else
                {
                    if (pl.Count() > dictPlayers.Count)
                    {
                        foreach (KeyValuePair<string, Player> player in pl)
                        {
                            if (!dictPlayers.ContainsKey(player.Value.PlayerID.Replace("_", "*")))
                            {
                                DossierManager dm = new DossierManager(player.Value.PlayerID, player.Value.WatchFile, player.Value.Monitor, _message, this);
                                dm.CurrentFileChange += new DossierManager_CurrentFileChanged(DossierFileChanged);
                                dm.StartDossierWatch();
                                dictPlayers.Add(player.Value.PlayerID.Replace("_", "*"), dm);

                                _currentStatsFile.Add(player.Value.PlayerID.Replace("_", "*"), new WOTCompare(new Dossier(dm.GetFileB(), dm.GetPlayerName, _message).GetStats(), new Dossier(dm.GetFileA(), dm.GetPlayerName, _message).GetStats()));
                                dm.RefreshDossier();

                                CreatePlayerMenu(player.Value.PlayerID);
                            }
                        }
                    }
                    else
                    {
                        List<string> keysToRemove = new List<string>();
                        foreach (KeyValuePair<string, DossierManager> item in dictPlayers)
                        {
                            if (pl.GetPlayer(item.Value.GetPlayerName).PlayerID == "Unknown")
                            {
                                keysToRemove.Add(item.Key);
                                _currentStatsFile.Remove(item.Key);
                                navBarControl1.Groups.Remove(navBarControl1.Groups[item.Value.GetPlayerName]);
                            }
                        }

                        foreach (string key in keysToRemove)
                        {
                            dictPlayers.Remove(key);
                        }

                        _currentPlayer = "";
                        _currentPage = "";
                    }
                }
            }

            if (_currentPlayer == "")
            {
                try
                {
                    navBarControl1.Groups[0].Expanded = true;
                    navBarControl1.Groups[0].ItemLinks[0].PerformClick();
                    navBarControl1.Groups[0].SelectedLink = navBarControl1.Groups[0].ItemLinks[0];
                }
                catch
                {
                    if (panelControl1.Controls.Contains(_chart))
                    {
                        panelControl1.Controls.Remove(_chart);
                        panelControl1.Controls.Add(_browser);
                        _browser.Dock = DockStyle.Fill;
                    }

                    bar3.Visible = false;
                    bar3.Offset = 0;
                    dockPanel2.Visible = false;
                    bar5.Visible = false;
                    bar5.Offset = 0;
                    dockPanelGraph.Visible = false;
                    barLastPlayedGames.Visible = false;
                    barLastPlayedGames.Offset = 0;
                    _browser.DocumentText = new WOTHtml(_message).Blank();
                }
            }
            else
            {
                if (_currentPage != "Compare")
                    CreateWebPage(_currentPage, _currentPlayer);

            }
            try
            {
                if (splashScreenManagerWaitForm.IsSplashFormVisible)
                {
                    splashScreenManagerWaitForm.CloseWaitForm();
                }
            }
            catch { }
        }
Exemplo n.º 38
0
        private void frmMain_Shown(object sender, EventArgs e)
        {
            if (UserSettings.NewVersionNotify)
            {
                UserSettings.NewVersionNotify = false;
                _message.Add("New update available: v" + UserSettings.NewAppVersion + ". Visit http://www.vbaddict.net/wotstatistics");
                if (DevExpress.XtraEditors.XtraMessageBox.Show(Translations.TranslationGet("STR_VERSIONNOTIFY", "DE", "New update available: v" + UserSettings.NewAppVersion + "  "+ Environment.NewLine + "Would you like to open the web page www.vbaddict.net/wotstatistics").Replace("{version}", UserSettings.NewAppVersion), "WOT Statistics", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                {
                    OpenWebPage("WOTStatsWebLink");
                }
            }

            using (PlayerListing players = new PlayerListing(_message))
            {
                if (players.Count == 0)
                {
                    using (frmSetup setup = new frmSetup("Players"))
                    {
                        setup.ShowDialog();
                    }
                    PlayerRefresh();
                }
            }
            barBattleMode.BeginUpdate();
            barBattleMode.EditValue = UserSettings.BattleMode;
            barBattleMode.EndUpdate();

            //barRatingSystem.BeginUpdate();
            //barRatingSystem.EditValue = UserSettings.RatingSystem;
            //barRatingSystem.EndUpdate();
        }