| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711 |
- using Client.MirControls;
- using Client.MirGraphics;
- using Client.MirObjects;
- using Client.MirSounds;
- namespace Client.MirScenes.Dialogs
- {
- public sealed class CharacterDialog : MirImageControl
- {
- public MirButton CloseButton, CharacterButton, StatusButton, StateButton, SkillButton;
- public MirImageControl CharacterPage, StatusPage, StatePage, SkillPage, ClassImage;
- public MirLabel NameLabel, GuildLabel, LoverLabel;
- public MirLabel ACLabel, MACLabel, DCLabel, MCLabel, SCLabel, HealthLabel, ManaLabel;
- public MirLabel CritRLabel, CritDLabel, LuckLabel, AttkSpdLabel, AccLabel, AgilLabel;
- public MirLabel ExpPLabel, BagWLabel, WearWLabel, HandWLabel, MagicRLabel, PoisonRecLabel, HealthRLabel, ManaRLabel, PoisonResLabel, HolyTLabel, FreezeLabel, PoisonAtkLabel;
- public MirLabel HeadingLabel, StatLabel;
- public MirButton NextButton, BackButton;
- public MirItemCell[] Grid;
- private MirGridType GridType;
- public MagicButton[] Magics;
- public int StartIndex;
- private UserObject Actor;
- public CharacterDialog(MirGridType gridType, UserObject actor)
- {
- Actor = actor;
- GridType = gridType;
- Index = 504;
- Library = Libraries.Title;
- Location = new Point(Settings.ScreenWidth - 264, 0);
- Movable = true;
- Sort = true;
- BeforeDraw += (o, e) => RefreshInterface();
- CharacterPage = new MirImageControl
- {
- Index = 340,
- Parent = this,
- Library = Libraries.Prguse,
- Location = new Point(8, 90),
- };
- CharacterPage.AfterDraw += (o, e) =>
- {
- if (Libraries.StateItems == null) return;
- ItemInfo RealItem = null;
- if (Grid[(int)EquipmentSlot.Armour].Item != null)
- {
- if (actor.WingEffect == 1 || actor.WingEffect == 2)
- {
- int wingOffset = actor.WingEffect == 1 ? 2 : 4;
- int genderOffset = actor.Gender == MirGender.Male ? 0 : 1;
- Libraries.Prguse2.DrawBlend(1200 + wingOffset + genderOffset, DisplayLocation, Color.White, true, 1F);
- }
- RealItem = Functions.GetRealItem(Grid[(int)EquipmentSlot.Armour].Item.Info, actor.Level, actor.Class, GameScene.ItemInfoList);
- Libraries.StateItems.Draw(RealItem.Image, DisplayLocation, Color.White, true, 1F);
- }
- if (Grid[(int)EquipmentSlot.Weapon].Item != null)
- {
- RealItem = Functions.GetRealItem(Grid[(int)EquipmentSlot.Weapon].Item.Info, actor.Level, actor.Class, GameScene.ItemInfoList);
- Libraries.StateItems.Draw(RealItem.Image, DisplayLocation, Color.White, true, 1F);
- }
- if (Grid[(int)EquipmentSlot.Helmet].Item != null)
- Libraries.StateItems.Draw(Grid[(int)EquipmentSlot.Helmet].Item.Info.Image, DisplayLocation, Color.White, true, 1F);
- else
- {
- int hair = 441 + actor.Hair + (actor.Class == MirClass.Assassin ? 20 : 0) + (actor.Gender == MirGender.Male ? 0 : 40);
- int offSetX = actor.Class == MirClass.Assassin ? (actor.Gender == MirGender.Male ? 6 : 4) : 0;
- int offSetY = actor.Class == MirClass.Assassin ? (actor.Gender == MirGender.Male ? 25 : 18) : 0;
- Libraries.Prguse.Draw(hair, new Point(DisplayLocation.X + offSetX, DisplayLocation.Y + offSetY), Color.White, true, 1F);
- }
- };
- StatusPage = new MirImageControl
- {
- Index = 506,
- Parent = this,
- Library = Libraries.Title,
- Location = new Point(8, 90),
- Visible = false,
- };
- StatusPage.BeforeDraw += (o, e) =>
- {
- ACLabel.Text = string.Format("{0}-{1}", actor.Stats[Stat.MinAC], actor.Stats[Stat.MaxAC]);
- MACLabel.Text = string.Format("{0}-{1}", actor.Stats[Stat.MinMAC], actor.Stats[Stat.MaxMAC]);
- DCLabel.Text = string.Format("{0}-{1}", actor.Stats[Stat.MinDC], actor.Stats[Stat.MaxDC]);
- MCLabel.Text = string.Format("{0}-{1}", actor.Stats[Stat.MinMC], actor.Stats[Stat.MaxMC]);
- SCLabel.Text = string.Format("{0}-{1}", actor.Stats[Stat.MinSC], actor.Stats[Stat.MaxSC]);
- HealthLabel.Text = string.Format("{0}/{1}", actor.HP, actor.Stats[Stat.HP]);
- ManaLabel.Text = string.Format("{0}/{1}", actor.MP, actor.Stats[Stat.MP]);
- CritRLabel.Text = string.Format("{0}%", actor.Stats[Stat.CriticalRate]);
- CritDLabel.Text = string.Format("{0}", actor.Stats[Stat.CriticalDamage]);
- AttkSpdLabel.Text = string.Format("{0}", actor.Stats[Stat.AttackSpeed]);
- AccLabel.Text = string.Format("+{0}", actor.Stats[Stat.Accuracy]);
- AgilLabel.Text = string.Format("+{0}", actor.Stats[Stat.Agility]);
- LuckLabel.Text = string.Format("{0}", actor.Stats[Stat.Luck]);
- };
- StatePage = new MirImageControl
- {
- Index = 507,
- Parent = this,
- Library = Libraries.Title,
- Location = new Point(8, 90),
- Visible = false
- };
- StatePage.BeforeDraw += (o, e) =>
- {
- ExpPLabel.Text = string.Format("{0:0.##%}", actor.Experience / (double)actor.MaxExperience);
- BagWLabel.Text = string.Format("{0}/{1}", actor.CurrentBagWeight, actor.Stats[Stat.BagWeight]);
- WearWLabel.Text = string.Format("{0}/{1}", actor.CurrentWearWeight, actor.Stats[Stat.WearWeight]);
- HandWLabel.Text = string.Format("{0}/{1}", actor.CurrentHandWeight, actor.Stats[Stat.HandWeight]);
- MagicRLabel.Text = string.Format("+{0}", actor.Stats[Stat.MagicResist]);
- PoisonResLabel.Text = string.Format("+{0}", actor.Stats[Stat.PoisonResist]);
- HealthRLabel.Text = string.Format("+{0}", actor.Stats[Stat.HealthRecovery]);
- ManaRLabel.Text = string.Format("+{0}", actor.Stats[Stat.SpellRecovery]);
- PoisonRecLabel.Text = string.Format("+{0}", actor.Stats[Stat.PoisonRecovery]);
- HolyTLabel.Text = string.Format("+{0}", actor.Stats[Stat.Holy]);
- FreezeLabel.Text = string.Format("+{0}", actor.Stats[Stat.Freezing]);
- PoisonAtkLabel.Text = string.Format("+{0}", actor.Stats[Stat.PoisonAttack]);
- };
- SkillPage = new MirImageControl
- {
- Index = 508,
- Parent = this,
- Library = Libraries.Title,
- Location = new Point(8, 90),
- Visible = false
- };
- CharacterButton = new MirButton
- {
- Index = 500,
- Library = Libraries.Title,
- Location = new Point(8, 70),
- Parent = this,
- PressedIndex = 500,
- Size = new Size(64, 20),
- Sound = SoundList.ButtonA,
- };
- CharacterButton.Click += (o, e) => ShowCharacterPage();
- StatusButton = new MirButton
- {
- Library = Libraries.Title,
- Location = new Point(70, 70),
- Parent = this,
- PressedIndex = 501,
- Size = new Size(64, 20),
- Sound = SoundList.ButtonA
- };
- StatusButton.Click += (o, e) => ShowStatusPage();
- StateButton = new MirButton
- {
- Library = Libraries.Title,
- Location = new Point(132, 70),
- Parent = this,
- PressedIndex = 502,
- Size = new Size(64, 20),
- Sound = SoundList.ButtonA
- };
- StateButton.Click += (o, e) => ShowStatePage();
- SkillButton = new MirButton
- {
- Library = Libraries.Title,
- Location = new Point(194, 70),
- Parent = this,
- PressedIndex = 503,
- Size = new Size(64, 20),
- Sound = SoundList.ButtonA
- };
- SkillButton.Click += (o, e) => ShowSkillPage();
- CloseButton = new MirButton
- {
- HoverIndex = 361,
- Index = 360,
- Location = new Point(241, 3),
- Library = Libraries.Prguse2,
- Parent = this,
- PressedIndex = 362,
- Sound = SoundList.ButtonA,
- };
- CloseButton.Click += (o, e) => Hide();
- NameLabel = new MirLabel
- {
- DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
- Parent = this,
- Location = new Point(0, 12),
- Size = new Size(264, 20),
- NotControl = true,
- };
- GuildLabel = new MirLabel
- {
- DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
- Parent = this,
- Location = new Point(0, 33),
- Size = new Size(264, 30),
- NotControl = true,
- };
- ClassImage = new MirImageControl
- {
- Index = 100,
- Library = Libraries.Prguse,
- Location = new Point(15, 33),
- Parent = this,
- NotControl = true,
- };
- Grid = new MirItemCell[Enum.GetNames(typeof(EquipmentSlot)).Length];
- Grid[(int)EquipmentSlot.Weapon] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Weapon,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(123, 7),
- };
- Grid[(int)EquipmentSlot.Armour] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Armour,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(163, 7),
- };
- Grid[(int)EquipmentSlot.Helmet] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Helmet,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 7),
- };
- Grid[(int)EquipmentSlot.Torch] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Torch,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 134),
- };
- Grid[(int)EquipmentSlot.Necklace] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Necklace,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 98),
- };
- Grid[(int)EquipmentSlot.BraceletL] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.BraceletL,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(8, 170),
- };
- Grid[(int)EquipmentSlot.BraceletR] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.BraceletR,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 170),
- };
- Grid[(int)EquipmentSlot.RingL] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.RingL,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(8, 206),
- };
- Grid[(int)EquipmentSlot.RingR] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.RingR,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 206),
- };
- Grid[(int)EquipmentSlot.Amulet] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Amulet,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(8, 242),
- };
- Grid[(int)EquipmentSlot.Boots] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Boots,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(48, 242),
- };
- Grid[(int)EquipmentSlot.Belt] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Belt,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(88, 242),
- };
- Grid[(int)EquipmentSlot.Stone] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Stone,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(128, 242),
- };
- Grid[(int)EquipmentSlot.Mount] = new MirItemCell
- {
- ItemSlot = (int)EquipmentSlot.Mount,
- GridType = gridType,
- Parent = CharacterPage,
- Location = new Point(203, 62),
- };
- // STATS I
- HealthLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 20),
- NotControl = true,
- Text = "0-0",
- };
- ManaLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 38),
- NotControl = true,
- Text = "0-0",
- };
- ACLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 56),
- NotControl = true,
- Text = "0-0",
- };
- MACLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 74),
- NotControl = true,
- Text = "0-0",
- };
- DCLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 92),
- NotControl = true,
- Text = "0-0"
- };
- MCLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 110),
- NotControl = true,
- Text = "0/0"
- };
- SCLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 128),
- NotControl = true,
- Text = "0/0"
- };
- //Breezer - New Labels
- CritRLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 146),
- NotControl = true
- };
- CritDLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 164),
- NotControl = true
- };
- AttkSpdLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 182),
- NotControl = true
- };
- AccLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 200),
- NotControl = true
- };
- AgilLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 218),
- NotControl = true
- };
- LuckLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatusPage,
- Location = new Point(126, 236),
- NotControl = true
- };
- // STATS II
- ExpPLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 20),
- NotControl = true,
- Text = "0-0",
- };
- BagWLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 38),
- NotControl = true,
- Text = "0-0",
- };
- WearWLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 56),
- NotControl = true,
- Text = "0-0",
- };
- HandWLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 74),
- NotControl = true,
- Text = "0-0",
- };
- MagicRLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 92),
- NotControl = true,
- Text = "0-0"
- };
- PoisonResLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 110),
- NotControl = true,
- Text = "0/0"
- };
- HealthRLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 128),
- NotControl = true,
- Text = "0/0"
- };
- //Breezer
- ManaRLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 146),
- NotControl = true
- };
- PoisonRecLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 164),
- NotControl = true
- };
- HolyTLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 182),
- NotControl = true
- };
- FreezeLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 200),
- NotControl = true
- };
- PoisonAtkLabel = new MirLabel
- {
- AutoSize = true,
- Parent = StatePage,
- Location = new Point(126, 218),
- NotControl = true
- };
- Magics = new MagicButton[7];
- for (int i = 0; i < Magics.Length; i++)
- Magics[i] = new MagicButton
- {
- Parent = SkillPage,
- Visible = false,
- Location = new Point(8, 8 + i * 33),
- HeroMagic = gridType == MirGridType.HeroEquipment
- };
- NextButton = new MirButton
- {
- Index = 396,
- Location = new Point(140, 250),
- Library = Libraries.Prguse,
- Parent = SkillPage,
- PressedIndex = 397,
- Sound = SoundList.ButtonA,
- };
- NextButton.Click += (o, e) =>
- {
- if (StartIndex + 7 >= actor.Magics.Count) return;
- StartIndex += 7;
- RefreshInterface();
- };
- BackButton = new MirButton
- {
- Index = 398,
- Location = new Point(90, 250),
- Library = Libraries.Prguse,
- Parent = SkillPage,
- PressedIndex = 399,
- Sound = SoundList.ButtonA,
- };
- BackButton.Click += (o, e) =>
- {
- if (StartIndex - 7 < 0) return;
- StartIndex -= 7;
- RefreshInterface();
- };
- }
- public override void Show()
- {
- if (Visible) return;
- Visible = true;
- }
- public override void Hide()
- {
- GameScene.Scene.SocketDialog.Hide();
- base.Hide();
- }
- public void ShowCharacterPage()
- {
- CharacterPage.Visible = true;
- StatusPage.Visible = false;
- StatePage.Visible = false;
- SkillPage.Visible = false;
- CharacterButton.Index = 500;
- StatusButton.Index = -1;
- StateButton.Index = -1;
- SkillButton.Index = -1;
- }
- private void ShowStatusPage()
- {
- CharacterPage.Visible = false;
- StatusPage.Visible = true;
- StatePage.Visible = false;
- SkillPage.Visible = false;
- CharacterButton.Index = -1;
- StatusButton.Index = 501;
- StateButton.Index = -1;
- SkillButton.Index = -1;
- }
- private void ShowStatePage()
- {
- CharacterPage.Visible = false;
- StatusPage.Visible = false;
- StatePage.Visible = true;
- SkillPage.Visible = false;
- CharacterButton.Index = -1;
- StatusButton.Index = -1;
- StateButton.Index = 502;
- SkillButton.Index = -1;
- }
- public void ShowSkillPage()
- {
- CharacterPage.Visible = false;
- StatusPage.Visible = false;
- StatePage.Visible = false;
- SkillPage.Visible = true;
- CharacterButton.Index = -1;
- StatusButton.Index = -1;
- StateButton.Index = -1;
- SkillButton.Index = 503;
- //StartIndex = 0;
- }
- private void RefreshInterface()
- {
- int offSet = Actor.Gender == MirGender.Male ? 0 : 1;
- Index = 504;// +offSet;
- CharacterPage.Index = 340 + offSet;
- switch (Actor.Class)
- {
- case MirClass.Warrior:
- ClassImage.Index = 100;// + offSet * 5;
- break;
- case MirClass.Wizard:
- ClassImage.Index = 101;// + offSet * 5;
- break;
- case MirClass.Taoist:
- ClassImage.Index = 102;// + offSet * 5;
- break;
- case MirClass.Assassin:
- ClassImage.Index = 103;// + offSet * 5;
- break;
- case MirClass.Archer:
- ClassImage.Index = 104;// + offSet * 5;
- break;
- }
- NameLabel.Text = Actor.Name;
- GuildLabel.Text = Actor.GuildName + " " + Actor.GuildRankName;
- for (int i = 0; i < Magics.Length; i++)
- {
- if (i + StartIndex >= Actor.Magics.Count)
- {
- Magics[i].Visible = false;
- continue;
- }
- Magics[i].Visible = true;
- Magics[i].Update(Actor.Magics[i + StartIndex]);
- }
- }
- public MirItemCell GetCell(ulong id)
- {
- for (int i = 0; i < Grid.Length; i++)
- {
- if (Grid[i].Item == null || Grid[i].Item.UniqueID != id) continue;
- return Grid[i];
- }
- return null;
- }
- }
- }
|