public Location(City _city, uint location, TcpClient client, Character _character, long _timeDifference, Map _map) { InitializeComponent(); city = _city; currentLocation = location; socket = client.Client; character = _character; timeDifference = _timeDifference; map = _map; if (character.Level < city.AccessLevel) { BtnTravel.IsEnabled = false; } CityTag.Text = city.Id.ToString(); CityName.Text = city.Name; AccessLevel.Text = city.AccessLevel.ToString(); _travelTime = GetShortestPath(); travelTime.Text = _travelTime.ToString(); }
public Interface(ulong id, TcpClient userClient, long diff) { InitializeComponent(); code = new UTF8Encoding(); //MessageBox.Show(CurrentTime().ToString()); timeDifference = diff; client = userClient; player = new Player(id, client); character = new Character(id, client); map = new Map(client); skills = new Skills(client); foreach (Skill skill in skills.SkillList) { MessageBox.Show("Dostęp: " + skill.AccessLevel); } foreach (Button btn in map.CityButtons) { btn.Click += new RoutedEventHandler(showCityForm); mapContainer.Children.Add(btn); //Canvas.SetLeft(btn, 50); //Canvas.SetTop(btn, 50); } host = Properties.Settings.Default.Host; port = Properties.Settings.Default.Port; idText.Text = player.Login + " (ID " + player.Id.ToString() + ")"; //wypełnie informacji o postaci characterNameTop.Text = character.Name; characterLvlTop.Text = character.Level.ToString(); goldTop.Text = character.Gold.ToString(); characterStrength.Text = character.Strength.ToString(); characterStamina.Text = character.Stamina.ToString(); characterDexterity.Text = character.Dexterity.ToString(); characterLuck.Text = character.Luck.ToString(); characterStrengthBonus.Text = "0"; characterStaminaBonus.Text = "0"; characterDexterityBonus.Text = "0"; characterLuckBonus.Text = "0"; //zmiana właściwości buttonów mapy w zależności o lokalizacji postaci ChangeLocationButtonsState(); //zainicjalizowanie pasków stanu HP, Kondycja HPStatus.Text = "HP: " + character.GetHP(CurrentTime()) + "/" + character.GetMaxHP(); HPBar.Width = Convert.ToInt32(Math.Round(200 * (double)character.GetHP(CurrentTime()) / (double)character.GetMaxHP(), 0)); ConditionStatus.Text = "Kon: " + character.GetStamina(CurrentTime()) + "/" + character.GetMaxStamina(); ConBar.Width = Convert.ToInt32(Math.Round(200 * (double)character.GetStamina(CurrentTime()) / (double)character.GetMaxStamina(), 0)); //czas serwera do celów testowych serverTimeStamp.Text = CurrentTime().ToString(); switchIncreaseButtons(); remainingPoints.Text = "Pozostałe ("+character.RemainingPoints()+"): "; headId.Text = character.Equipment.Head.ToString(); DispatcherTimer barsUpdater = new DispatcherTimer(); barsUpdater.Tick += new EventHandler(UpdateBars); barsUpdater.Interval = TimeSpan.FromSeconds(1); barsUpdater.Start(); DispatcherTimer statusUpdater = new DispatcherTimer(); statusUpdater.Tick += new EventHandler(UpdateStatus); statusUpdater.Interval = TimeSpan.FromSeconds(1); statusUpdater.Start(); DispatcherTimer expLevelUpdater = new DispatcherTimer(); expLevelUpdater.Tick += new EventHandler(UpdateExpLevel); expLevelUpdater.Interval = TimeSpan.FromMilliseconds(30); expLevelUpdater.Start(); }