public EquipGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel7.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width, 0f); _items[0] = _head = new DragDropItem(this,//Head new Vector2(47, 66), 60, 75, null, new GoodsGui.GoodItemData(201)); _items[1] = _neck = new DragDropItem(this, //Neck new Vector2(193, 66), 60, 75, null, new GoodsGui.GoodItemData(202)); _items[2] = _body = new DragDropItem(this, //Body new Vector2(121, 168), 60, 75, null, new GoodsGui.GoodItemData(203)); _items[3] = _back = new DragDropItem(this, //Back new Vector2(193, 267), 60, 75, null, new GoodsGui.GoodItemData(204)); _items[4] = _hand = new DragDropItem(this, //Hand new Vector2(193, 168), 60, 75, null, new GoodsGui.GoodItemData(205)); _items[5] = _wrist = new DragDropItem(this, //Wrist new Vector2(47, 168), 60, 75, null, new GoodsGui.GoodItemData(206)); _items[6] = _foot = new DragDropItem(this, //Foot new Vector2(47, 267), 60, 75, null, new GoodsGui.GoodItemData(207)); RegisterEventHandler(); IsShow = false; }
public XiuLianGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel6.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width, 0f); _infoItem = new DragDropItem(this, new Vector2(115, 75), 60, 75, null, new MagicGui.MagicItemData(ItemIndex)); _infoItem.Drop += MagicGui.DropHandler; _infoItem.Drop += (arg1, arg2) => _isItemChange = true; _infoItem.MouseStayOver += MagicGui.MouseStayOverHandler; _infoItem.MouseLeave += MagicGui.MouseLeaveHandler; _levelText = new TextGui(this, new Vector2(126, 224), 80, 12, Globals.FontSize7, 0, 0, "", Color.Black * 0.8f); _expText = new TextGui(this, new Vector2(126, 243), 80, 12, Globals.FontSize7, 0, 0, "", Color.Black * 0.8f); _nameText = new TextGui(this, new Vector2(105, 256), 200, 20, Globals.FontSize12, 0, 0, "", new Color(88, 32, 32) * 0.9f); _introText = new TextGui(this, new Vector2(75, 275), 145, 120, Globals.FontSize10, 2, 0, "", new Color(47, 32, 88) * 0.9f); }
private void InitializeItems() { _items[0] = new DragDropItem(this, new Vector2(7, 20), 30, 40, null, new GoodsGui.GoodItemData(221)); _items[1] = new DragDropItem(this, new Vector2(44, 20), 30, 40, null, new GoodsGui.GoodItemData(222)); _items[2] = new DragDropItem(this, new Vector2(82, 20), 30, 40, null, new GoodsGui.GoodItemData(223)); _items[3] = new DragDropItem(this, new Vector2(199, 20), 30, 40, null, new MagicGui.MagicItemData(40)); _items[4] = new DragDropItem(this, new Vector2(238, 20), 30, 40, null, new MagicGui.MagicItemData(41)); _items[5] = new DragDropItem(this, new Vector2(277, 20), 30, 40, null, new MagicGui.MagicItemData(42)); _items[6] = new DragDropItem(this, new Vector2(316, 20), 30, 40, null, new MagicGui.MagicItemData(43)); _items[7] = new DragDropItem(this, new Vector2(354, 20), 30, 40, null, new MagicGui.MagicItemData(44)); for (var i = 0; i < 3; i++) { _items[i].Drag += (arg1, arg2) => { }; _items[i].Drop += GoodsGui.DropHandler; _items[i].RightClick += GoodsGui.RightClickHandler; _items[i].MouseStayOver += GoodsGui.MouseStayOverHandler; _items[i].MouseLeave += GoodsGui.MouseLeaveHandler; } for (var i = 3; i < 8; i++) { _items[i].Drag += (arg1, arg2) => { }; _items[i].Drop += MagicGui.DropHandler; _items[i].RightClick += (arg1, arg2) => { var data = (MagicGui.MagicItemData)(((DragDropItem)arg1).Data); var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { Globals.ThePlayer.CurrentMagicInUse = info; } }; _items[i].MouseStayOver += MagicGui.MouseStayOverHandler; _items[i].MouseLeave += MagicGui.MouseLeaveHandler; _items[i].OnUpdate += (arg1, arg2) => { var data = (MagicGui.MagicItemData)(((DragDropItem)arg1).Data); var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { var gameTime = (GameTime)arg2; info.RemainColdMilliseconds -= (float)gameTime.ElapsedGameTime.TotalMilliseconds; } }; } }
public static void Update(GameTime gameTime) { var keyboardState = Keyboard.GetState(); var mouseState = Mouse.GetState(); MouseInterface.Update(gameTime); ColumnInterface.Update(gameTime); //check mouse state if ( IsMouseStateEated && ( mouseState.LeftButton == ButtonState.Pressed || mouseState.RightButton == ButtonState.Pressed || mouseState.MiddleButton == ButtonState.Pressed ) ) { IsMouseStateEated = true; } else { IsMouseStateEated = false; } if (SaveLoadInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); SaveLoadInterface.Update(gameTime); if (IsKeyPressedAndCanInput(keyboardState, Keys.Escape)) { ShowSaveLoad(false); } //Restore input Globals.RestoreInputDisableState(); } else if (TitleInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); TitleInterface.Update(gameTime); //Restore input Globals.RestoreInputDisableState(); } else if (SystemInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); SystemInterface.Update(gameTime); if (IsKeyPressedAndCanInput(keyboardState, Keys.Escape)) { ShowSystem(false); } //Restore input Globals.RestoreInputDisableState(); } else if (LittleMapInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); LittleMapInterface.Update(gameTime); if (IsShowLittleMapKeyPressed(keyboardState) || IsKeyPressedAndCanInput(keyboardState, Keys.Escape)) { LittleMapInterface.IsShow = false; } //Restore input Globals.RestoreInputDisableState(); } else if (SelectionInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); IsMouseStateEated = true; SelectionInterface.Update(gameTime); //Restore input Globals.RestoreInputDisableState(); } else if (DialogInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); IsMouseStateEated = true; if (DialogInterface.IsInSelecting) { DialogInterface.Update(gameTime); //Check wheathe selection ended after updated if (!DialogInterface.IsInSelecting) { DialogInterface.IsShow = false; } } else { DialogInterface.Update(gameTime); if (IsTalkNext()) { if (!DialogInterface.NextPage()) { DialogInterface.IsShow = false; } } } //Restore input Globals.RestoreInputDisableState(); } else { if (BuyInterface.IsShow) { //Temporaty enable input Globals.EnableInputTemporary(); BuyInterface.Update(gameTime); GoodsInterface.Update(gameTime); BottomInterface.Update(gameTime); IsMouseStateEated = true; if (IsKeyPressedAndCanInput(keyboardState, Keys.Escape)) { EndBuyGoods(); } //Restore input Globals.RestoreInputDisableState(); } else { if (IsShowLittleMapKeyPressed(keyboardState)) { ShowAllPanels(false); LittleMapInterface.IsShow = true; } else if (IsKeyPressedAndCanInput(keyboardState, Keys.Escape)) { if (HasPanelsShow()) { ShowAllPanels(false); } else { ShowSystem(); } } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F1)) { ToggleStateGuiShow(); } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F2)) { ToggleEquipGuiShow(); } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F3)) { ToggleXiuLianGuiShow(); } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F5)) { ToggleGoodsGuiShow(); } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F6)) { ToggleMagicGuiShow(); } else if (IsKeyPressedAndCanInput(keyboardState, Keys.F7)) { ToggleMemoGuiShow(); } TopInterface.Update(gameTime); BottomInterface.Update(gameTime); MagicInterface.Update(gameTime); XiuLianInterface.Update(gameTime); GoodsInterface.Update(gameTime); MemoInterface.Update(gameTime); StateInterface.Update(gameTime); EquipInterface.Update(gameTime); ToolTipInterface.Update(gameTime); } if (!Globals.TheGame.IsGamePlayPaused) { TimerInterface.Update(gameTime); } if (IsDropped) { IsDropped = false; if (DragDropSourceItem != null) { DragDropSourceItem.IsShow = true; } if (DragDropSourceTexture != null && DragDropSourceTexture.Data != null) { _dropSound.Play(); } DragDropSourceItem = null; DragDropSourceTexture = null; } } MessageInterface.Update(gameTime); _lastMouseState = mouseState; _lastKeyboardState = keyboardState; }
public EquipGui() { var cfg = GuiManager.Setttings.Sections["Equip"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); cfg = GuiManager.Setttings.Sections["Equip_Head"]; var hasCount = GoodsListManager.Type != GoodsListManager.ListType.TypeByGoodItem; _items[0] = _head = new DragDropItem(this,//Head new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Neck"]; _items[1] = _neck = new DragDropItem(this, //Neck new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 1), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Body"]; _items[2] = _body = new DragDropItem(this, //Body new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 2), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Back"]; _items[3] = _back = new DragDropItem(this, //Back new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 3), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Hand"]; _items[4] = _hand = new DragDropItem(this, //Hand new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 4), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Wrist"]; _items[5] = _wrist = new DragDropItem(this, //Wrist new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 5), hasCount); cfg = GuiManager.Setttings.Sections["Equip_Foot"]; _items[6] = _foot = new DragDropItem(this, //Foot new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new GoodsGui.GoodItemData(GoodsListManager.EquipIndexBegin + 6), hasCount); RegisterEventHandler(); IsShow = false; }
public DropEvent(Vector2 mouseScreenPosition, DragDropItem source) : base(mouseScreenPosition) { Source = source; }
private void InitializeItems() { var cfg = GuiManager.Setttings.Sections["Bottom_Items"]; var hasCount = GoodsListManager.Type != GoodsListManager.ListType.TypeByGoodItem; _items[0] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_1"]), int.Parse(cfg["Item_Top_1"])), int.Parse(cfg["Item_Width_1"]), int.Parse(cfg["Item_Height_1"]), null, new GoodsGui.GoodItemData(GoodsListManager.BottomIndexBegin), hasCount); _items[1] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_2"]), int.Parse(cfg["Item_Top_2"])), int.Parse(cfg["Item_Width_2"]), int.Parse(cfg["Item_Height_2"]), null, new GoodsGui.GoodItemData(GoodsListManager.BottomIndexBegin + 1), hasCount); _items[2] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_3"]), int.Parse(cfg["Item_Top_3"])), int.Parse(cfg["Item_Width_3"]), int.Parse(cfg["Item_Height_3"]), null, new GoodsGui.GoodItemData(GoodsListManager.BottomIndexBegin + 2), hasCount); _items[3] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_4"]), int.Parse(cfg["Item_Top_4"])), int.Parse(cfg["Item_Width_4"]), int.Parse(cfg["Item_Height_4"]), null, new MagicGui.MagicItemData(MagicListManager.BottomIndexBegin)); _items[4] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_5"]), int.Parse(cfg["Item_Top_5"])), int.Parse(cfg["Item_Width_5"]), int.Parse(cfg["Item_Height_5"]), null, new MagicGui.MagicItemData(MagicListManager.BottomIndexBegin + 1)); _items[5] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_6"]), int.Parse(cfg["Item_Top_6"])), int.Parse(cfg["Item_Width_6"]), int.Parse(cfg["Item_Height_6"]), null, new MagicGui.MagicItemData(MagicListManager.BottomIndexBegin + 2)); _items[6] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_7"]), int.Parse(cfg["Item_Top_7"])), int.Parse(cfg["Item_Width_7"]), int.Parse(cfg["Item_Height_7"]), null, new MagicGui.MagicItemData(MagicListManager.BottomIndexBegin + 3)); _items[7] = new DragDropItem(this, new Vector2(int.Parse(cfg["Item_Left_8"]), int.Parse(cfg["Item_Top_8"])), int.Parse(cfg["Item_Width_8"]), int.Parse(cfg["Item_Height_8"]), null, new MagicGui.MagicItemData(MagicListManager.BottomIndexBegin + 4)); for (var i = 0; i < 3; i++) { _items[i].Drag += (arg1, arg2) => { }; _items[i].Drop += GoodsGui.DropHandler; _items[i].RightClick += GoodsGui.RightClickHandler; _items[i].MouseStayOver += GoodsGui.MouseStayOverHandler; _items[i].MouseLeave += GoodsGui.MouseLeaveHandler; _items[i].OnUpdate += (arg1, arg2) => { var data = (GoodsGui.GoodItemData)(((DragDropItem)arg1).Data); var info = GoodsListManager.GetItemInfo(data.Index); if (info != null) { var gameTime = (GameTime)arg2; info.RemainColdMilliseconds -= (float)gameTime.ElapsedGameTime.TotalMilliseconds; } }; } for (var i = 3; i < 8; i++) { _items[i].Drag += (arg1, arg2) => { }; _items[i].Drop += MagicGui.DropHandler; _items[i].RightClick += (arg1, arg2) => { var data = (MagicGui.MagicItemData)(((DragDropItem)arg1).Data); var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { Globals.ThePlayer.CurrentMagicInUse = info; } }; _items[i].MouseStayOver += MagicGui.MouseStayOverHandler; _items[i].MouseLeave += MagicGui.MouseLeaveHandler; _items[i].OnUpdate += (arg1, arg2) => { var data = (MagicGui.MagicItemData)(((DragDropItem)arg1).Data); var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { var gameTime = (GameTime)arg2; info.RemainColdMilliseconds -= (float)gameTime.ElapsedGameTime.TotalMilliseconds; } }; } }
public XiuLianGui() { ItemIndex = MagicListManager.XiuLianIndex; var cfg = GuiManager.Setttings.Sections["XiuLian"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); cfg = GuiManager.Setttings.Sections["XiuLian_Magic_Image"]; _infoItem = new DragDropItem(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, new MagicGui.MagicItemData(ItemIndex)); _infoItem.Drop += MagicGui.DropHandler; _infoItem.Drop += (arg1, arg2) => _isItemChange = true; _infoItem.MouseStayOver += MagicGui.MouseStayOverHandler; _infoItem.MouseLeave += MagicGui.MouseLeaveHandler; cfg = GuiManager.Setttings.Sections["XiuLian_Level_Text"]; _levelText = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize7, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); cfg = GuiManager.Setttings.Sections["XiuLian_Exp_Text"]; _expText = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize7, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); cfg = GuiManager.Setttings.Sections["XiuLian_Name_Text"]; _nameText = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize12, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); cfg = GuiManager.Setttings.Sections["XiuLian_Intro_Text"]; _introText = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize10, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); }