| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- using Client.MirControls;
- using Client.MirGraphics;
- using Client.MirNetwork;
- using Client.MirSounds;
- using C = ClientPackets;
- namespace Client.MirScenes.Dialogs
- {
- public sealed class MentorDialog : MirImageControl
- {
- public MirImageControl TitleLabel;
- public MirButton CloseButton, AllowButton, AddButton, RemoveButton;
- public MirLabel MentorNameLabel, MentorLevelLabel, MentorOnlineLabel, StudentNameLabel, StudentLevelLabel, StudentOnlineLabel, MentorLabel, StudentLabel, MenteeEXPLabel;
- public string MentorName;
- public ushort MentorLevel;
- public bool MentorOnline;
- public long MenteeEXP;
- public MentorDialog()
- {
- Index = 170;
- Library = Libraries.Prguse;
- Movable = true;
- Sort = true;
- Location = Center;
- TitleLabel = new MirImageControl
- {
- Index = 51,
- Library = Libraries.Title,
- Location = new Point(18, 8),
- Parent = this
- };
- CloseButton = new MirButton
- {
- HoverIndex = 361,
- Index = 360,
- Location = new Point(219, 3),
- Library = Libraries.Prguse2,
- Parent = this,
- PressedIndex = 362,
- Sound = SoundList.ButtonA,
- };
- CloseButton.Click += (o, e) => Hide();
- AllowButton = new MirButton
- {
- HoverIndex = 115,
- Index = 114,
- Location = new Point(30, 178),
- Library = Libraries.Prguse,
- Parent = this,
- PressedIndex = 116,
- Sound = SoundList.ButtonA,
- Hint = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.MentorRequests)
- };
- AllowButton.Click += (o, e) =>
- {
- if (AllowButton.Index == 116)
- {
- AllowButton.Index = 117;
- AllowButton.HoverIndex = 118;
- AllowButton.PressedIndex = 119;
- }
- else
- {
- AllowButton.Index = 114;
- AllowButton.HoverIndex = 115;
- AllowButton.PressedIndex = 116;
- }
- Network.Enqueue(new C.AllowMentor());
- };
- AddButton = new MirButton
- {
- HoverIndex = 214,
- Index = 213,
- Location = new Point(60, 178),
- Library = Libraries.Title,
- Parent = this,
- PressedIndex = 215,
- Sound = SoundList.ButtonA,
- Hint = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.AddMentor)
- };
- AddButton.Click += (o, e) =>
- {
- if (MentorLevel != 0)
- {
- GameScene.Scene.ChatDialog.ReceiveChat(GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.YouAlreadyHaveMentor), ChatType.System);
- return;
- }
- string message = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.MentorEnterName);
- MirInputBox inputBox = new MirInputBox(message);
- inputBox.OKButton.Click += (o1, e1) =>
- {
- Network.Enqueue(new C.AddMentor { Name = inputBox.InputTextBox.Text });
- inputBox.Dispose();
- };
- inputBox.Show();
- };
- RemoveButton = new MirButton
- {
- HoverIndex = 217,
- Index = 216,
- Location = new Point(135, 178),
- Library = Libraries.Title,
- Parent = this,
- PressedIndex = 218,
- Sound = SoundList.ButtonA,
- Hint = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.RemoveMentorMentee)
- };
- RemoveButton.Click += (o, e) =>
- {
- if (MentorName == "")
- {
- GameScene.Scene.ChatDialog.ReceiveChat(GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.NoMentorship), ChatType.System);
- return;
- }
- MirMessageBox messageBox = new MirMessageBox(GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.CancellingMentorshipCausesCooldown), MirMessageBoxButtons.YesNo);
- messageBox.YesButton.Click += (oo, ee) => Network.Enqueue(new C.CancelMentor { });
- messageBox.NoButton.Click += (oo, ee) => { messageBox.Dispose(); };
- messageBox.Show();
- };
- MentorNameLabel = new MirLabel
- {
- Location = new Point(20, 58),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.LightGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 10F),
- };
- MentorLevelLabel = new MirLabel
- {
- Location = new Point(170, 58),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.LightGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 10F),
- };
- MentorOnlineLabel = new MirLabel
- {
- Location = new Point(125, 58),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.Green,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 7F),
- Visible = false,
- Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.ONLINE),
- };
- StudentNameLabel = new MirLabel
- {
- Location = new Point(20, 112),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.LightGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 10F),
- };
- StudentLevelLabel = new MirLabel
- {
- Location = new Point(170, 111),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.LightGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 10F),
- };
- StudentOnlineLabel = new MirLabel
- {
- Location = new Point(125, 112),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.Green,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 7F),
- Visible = false,
- Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.ONLINE),
- };
- MentorLabel = new MirLabel
- {
- Location = new Point(15, 41),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.DimGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 7F),
- Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.MENTOR),
- };
- StudentLabel = new MirLabel
- {
- Location = new Point(15, 94),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.DimGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 7F),
- Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.MENTEE),
- };
- MenteeEXPLabel = new MirLabel
- {
- Location = new Point(15, 147),
- Size = new Size(200, 30),
- BackColour = Color.Empty,
- ForeColour = Color.DimGray,
- DrawFormat = TextFormatFlags.VerticalCenter,
- Parent = this,
- NotControl = true,
- Font = new Font(Settings.FontName, 7F),
- };
- }
- public void UpdateInterface()
- {
- if (MentorLevel == 0)
- {
- MentorNameLabel.Visible = false;
- MentorLevelLabel.Visible = false;
- MentorOnlineLabel.Visible = false;
- StudentNameLabel.Visible = false;
- StudentLevelLabel.Visible = false;
- StudentOnlineLabel.Visible = false;
- MenteeEXPLabel.Visible = false;
- return;
- }
- MentorNameLabel.Visible = true;
- MentorLevelLabel.Visible = true;
- MentorOnlineLabel.Visible = true;
- StudentNameLabel.Visible = true;
- StudentLevelLabel.Visible = true;
- StudentOnlineLabel.Visible = true;
- if (GameScene.User.Level > MentorLevel)
- {
- MentorNameLabel.Text = GameScene.User.Name;
- MentorLevelLabel.Text = "Lv " + GameScene.User.Level.ToString();
- MentorOnlineLabel.Visible = false;
- StudentNameLabel.Text = MentorName;
- StudentLevelLabel.Text = "Lv " + MentorLevel.ToString();
- if (MentorOnline)
- StudentOnlineLabel.Visible = true;
- else
- StudentOnlineLabel.Visible = false;
- MenteeEXPLabel.Visible = true;
- MenteeEXPLabel.Text = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.MenteeExp) + MenteeEXP;
- }
- else
- {
- MentorNameLabel.Text = MentorName;
- MentorLevelLabel.Text = "Lv " + MentorLevel.ToString();
- if (MentorOnline)
- MentorOnlineLabel.Visible = true;
- else
- MentorOnlineLabel.Visible = false;
- StudentNameLabel.Text = GameScene.User.Name;
- StudentLevelLabel.Text = "Lv " + GameScene.User.Level.ToString();
- StudentOnlineLabel.Visible = false;
- }
- }
- }
- }
|