-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerBox.cs
More file actions
73 lines (56 loc) · 1.91 KB
/
PlayerBox.cs
File metadata and controls
73 lines (56 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Net;
namespace DiceGame {
public partial class PlayerBox : UserControl {
public string id;
private bool hasClickEvent = false;
private Action clickEvent;
public PlayerBox() {
InitializeComponent();
setImage();
Show();
}
//public PlayerBox(string _id) {
// InitializeComponent();
// id = _id;
// setImage();
//}
public void UpdateScale(float _width, float _height) {
Width = (int)(200f / 1592f * _width);
Height = (int)(80f / 850f * _height);
FixProfilePicSize();
}
public void FixProfilePicSize() {
tableLayoutPanel1.ColumnStyles[0].Width = Height;
}
public void setPosition(int x, int y) {
Location = new Point(x - Width / 2, y - Height / 2);
}
public void setClickForName(Action a) {
hasClickEvent = true;
clickEvent = a;
}
public void setName(string name) {
this.name.Text = name;
}
public void setMoney(int money) {
this.money.Text = "$" + money;
}
public void setMoney(string money) {
this.money.Text = money;
}
public void setStatus(string status) {
this.status.Text = status;
}
public void setImage(string imageUrl = "https://concretegames.net/uploads/DefaultUser.png") {
pictureBox1.Image = new Bitmap(new WebClient().OpenRead(imageUrl != null ? imageUrl : "https://concretegames.net/uploads/DefaultUser.png"));
}
private void name_Click(object sender, EventArgs e) {
if (hasClickEvent) Invoke(clickEvent);
}
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) {
}
}
}