public static void MouseRightClickdHandler(object arg1, MouseEvent arg2) { var item = (DragDropItem)arg1; var data = item.Data as MagicItemData; if (data != null) { var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { for (var i = MagicListManager.BottomMagicIndexStart; i <= MagicListManager.BottomMagicIndexEnd; i++) { var binfo = MagicListManager.GetItemInfo(i); if (binfo == null) { MagicListManager.ExchangeListItem(data.Index, i); GuiManager.UpdateMagicView(); break; } } } } }
/// <summary> /// Load game from "save/game" directory /// GuiManager must started first /// </summary> public static void LoadGame(bool isInitlizeGame) { if (isInitlizeGame) { //Clear ScriptManager.Clear(); ScriptExecuter.Init(); MagicManager.Clear(); NpcManager.ClearAllNpc(); ObjManager.ClearAllObjAndFileName(); Globals.TheMap.Free(); GuiManager.CloseTimeLimit(); GuiManager.EndDialog(); BackgroundMusic.Stop(); Globals.IsInputDisabled = false; } LoadGameFile(); LoadMagicGoodMemoList(); LoadPlayer(); //Apply xiulian magic to player Globals.ThePlayer.XiuLianMagic = MagicListManager.GetItemInfo( MagicListManager.XiuLianIndex); LoadPartner(); LoadTraps(); LoadTrapIgnoreList(); Globals.TheCarmera.CenterPlayerInCamera(); GameState.State = GameState.StateType.Playing; Globals.TheGame.IsGamePlayPaused = false; GuiManager.ShowAllPanels(false); }
public void UpdateItem(int itemIndex) { if (itemIndex >= 0 && itemIndex < 3)//Goods { var index = ToGoodsListIndex(itemIndex); var info = GoodsListManager.GetItemInfo(index); Good good = null; var text = ""; if (info != null) { good = info.TheGood; text = info.Count.ToString(); } var icon = good == null ? null : good.Icon; SetItem(itemIndex, new Texture(icon), text); } if (itemIndex >= 3 && itemIndex < 8)//Magic { var index = ToMagicListIndex(itemIndex); var magic = MagicListManager.Get(index); var icon = magic == null ? null : magic.Icon; SetItem(itemIndex, new Texture(icon)); } }
public void UpdateItem() { var info = MagicListManager.GetItemInfo(ItemIndex); if (info != null) { _levelText.Text = info.Level + "/10"; _expText.Text = info.Exp + "/" + info.TheMagic.LevelupExp; _nameText.Text = info.TheMagic == null ? "无" : info.TheMagic.Name; _introText.Text = info.TheMagic == null ? "无" : info.TheMagic.Intro; if (_isItemChange || _infoItem.BaseTexture == null) { //Change texture only item changed or base texture is null. //Because this method is called in Update() if change base texture every update, //texture won't update it's frame index and will always stay at frame 0. _isItemChange = false; _infoItem.BaseTexture = MagicListManager.GetTexture(ItemIndex); } } else { _levelText.Text = "1/10"; _expText.Text = "0/0"; _nameText.Text = ""; _introText.Text = ""; _infoItem.BaseTexture = null; } }
public override void AddMagic(string magicFileName) { if (string.IsNullOrEmpty(magicFileName)) { return; } int index; Magic magic; var result = MagicListManager.AddMagicToList( magicFileName, out index, out magic); if (result) { GuiManager.ShowMessage("你学会了" + magic.Name); GuiManager.UpdateMagicView(); } else { if (magic != null) { GuiManager.ShowMessage("你已经学会了" + magic.Name); } else { GuiManager.ShowMessage("错误"); } } }
public override void Draw(SpriteBatch spriteBatch) { if (!IsShow) { return; } base.Draw(spriteBatch); foreach (var dragDropItem in _items) { dragDropItem.Draw(spriteBatch); } for (var i = 0; i < 8; i++) //Magic { float remainColdMilliseconds = 0; var item = _items[i]; if (i >= 0 && i < 3) { var data = (GoodsGui.GoodItemData)item.Data; var info = GoodsListManager.GetItemInfo(data.Index); if (info != null) { remainColdMilliseconds = info.RemainColdMilliseconds; } } else { var data = (MagicGui.MagicItemData)item.Data; var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { remainColdMilliseconds = info.RemainColdMilliseconds; } } if (remainColdMilliseconds > 0) { if (_coldTimeBackground == null) { _coldTimeBackground = TextureGenerator.GetColorTexture(new Color(0, 0, 0, 180), item.Width, item.Height); } var timeTxt = (remainColdMilliseconds / 1000f).ToString("0.0"); var font = Globals.FontSize10; spriteBatch.Draw( _coldTimeBackground, item.ScreenPosition, Color.White); spriteBatch.DrawString(font, timeTxt, item.CenterScreenPosition - font.MeasureString(timeTxt) / 2, _colodTimeFontColor); } } }
public void UpdateItems() { for (var i = 0; i < 9; i++) { var index = _listView.ToListIndex(i); var magic = MagicListManager.Get(index); var image = (magic == null ? null : magic.Image); _listView.SetListItem(i, new Texture(image), new MagicItemData(index)); } }
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; } }; } }
private void _reloadCurrentMagicMenuItem_Click(object sender, EventArgs e) { if (Globals.ThePlayer == null) { return; } var index = Globals.ThePlayer.CurrentUseMagicIndex; MagicListManager.SaveList(StorageBase.MagicListFilePath); MagicListManager.LoadList(StorageBase.MagicListFilePath); Globals.ThePlayer.CurrentUseMagicIndex = index; Globals.ThePlayer.XiuLianMagic = MagicListManager.GetItemInfo( MagicListManager.XiuLianIndex); }
public static void MouseStayOverHandler(object arg1, GuiItem.MouseEvent arg2) { var item = (DragDropItem)arg1; var data = item.Data as MagicItemData; if (data != null) { var info = MagicListManager.GetItemInfo(data.Index); if (info != null) { GuiManager.ToolTipInterface.ShowMagic(info.TheMagic); } } }
public static void DropHandler(object arg1, DragDropItem.DropEvent arg2) { var item = (DragDropItem)arg1; var sourceItem = arg2.Source; var data = item.Data as MagicItemData; var sourceData = sourceItem.Data as MagicItemData; if (data != null && sourceData != null) { MagicListManager.ExchangeListItem(data.Index, sourceData.Index); item.BaseTexture = MagicListManager.GetTexture(data.Index); sourceItem.BaseTexture = MagicListManager.GetTexture(sourceData.Index); } }
public static void Starting() { IsShow = true; _dropSound = Utils.GetSoundEffect("界-拖放.wav"); _interfaceShow = Utils.GetSoundEffect("界-弹出菜单.wav"); _interfaceMiss = Utils.GetSoundEffect("界-缩回菜单.wav"); TitleInterface = new TitleGui(); _allGuiItems.AddLast(TitleInterface); SaveLoadInterface = new SaveLoadGui(); _allGuiItems.AddLast(SaveLoadInterface); SystemInterface = new SystemGui(); _allGuiItems.AddLast(SystemInterface); _panels.AddLast(SystemInterface); TopInterface = new TopGui(); _allGuiItems.AddLast(TopInterface); BottomInterface = new BottomGui(); _allGuiItems.AddLast(BottomInterface); ColumnInterface = new ColumnGui(); _allGuiItems.AddLast(ColumnInterface); MagicInterface = new MagicGui(); _allGuiItems.AddLast(MagicInterface); _panels.AddLast(MagicInterface); XiuLianInterface = new XiuLianGui(); _allGuiItems.AddLast(XiuLianInterface); _panels.AddLast(XiuLianInterface); GoodsInterface = new GoodsGui(); _allGuiItems.AddLast(GoodsInterface); _panels.AddLast(GoodsInterface); BuyInterface = new BuyGui(); _allGuiItems.AddLast(BuyInterface); _panels.AddLast(BuyInterface); TimerInterface = new TimerGui(); _allGuiItems.AddLast(TimerInterface); LittleMapInterface = new LittleMapGui(); _allGuiItems.AddLast(LittleMapInterface); MemoInterface = new MemoGui(); _allGuiItems.AddLast(MemoInterface); _panels.AddLast(MemoInterface); StateInterface = new StateGui(); _allGuiItems.AddLast(StateInterface); _panels.AddLast(StateInterface); EquipInterface = new EquipGui(); _allGuiItems.AddLast(EquipInterface); _panels.AddLast(EquipInterface); ToolTipInterface = new ToolTipGui(); _allGuiItems.AddLast(ToolTipInterface); _panels.AddLast(ToolTipInterface); MouseInterface = new MouseGui(); MessageInterface = new MessageGui(); _allGuiItems.AddLast(MessageInterface); _panels.AddLast(MessageInterface); DialogInterface = new DialogGui(); _allGuiItems.AddLast(DialogInterface); LittleHeadInterface = new LittleHeadGui(); _allGuiItems.AddLast(LittleHeadInterface); SelectionInterface = new SelectionGui(); _allGuiItems.AddLast(SelectionInterface); MagicListManager.RenewList(); GoodsListManager.RenewList(); }
/// <summary> /// Get magic item info at bottom gui. /// </summary> /// <param name="index">0-4</param> /// <returns>Magic item info.Return null if not found.</returns> public static MagicListManager.MagicItemInfo GetBottomMagicItemInfo(int index) { return(MagicListManager.GetItemInfo(index + MagicListManager.BottomMagicIndexStart)); }
public static void Save(string magicListPath, string goodsListPath, string memoListPath) { MagicListManager.SaveList(magicListPath); GoodsListManager.SaveList(goodsListPath); MemoListManager.SaveList(memoListPath); }
public static void Load(string magicListPath, string goodsListPath, string memoListPath) { MagicListManager.LoadList(magicListPath); GoodsListManager.LoadList(goodsListPath); MemoListManager.LoadList(memoListPath); }
private static void LoadMagicGoodList() { MagicListManager.LoadList(StorageBase.MagicListFilePath); GoodsListManager.LoadList(StorageBase.GoodsListFilePath); }
public static void Starting() { Setttings = new FileIniDataParser().ReadFile(@"Content\ui\UI_Settings.ini", Globals.LocalEncoding); GoodsListManager.InitIndex(Setttings); MagicListManager.InitIndex(Setttings); IsShow = true; _dropSound = Utils.GetSoundEffect("界-拖放.wav"); _interfaceShow = Utils.GetSoundEffect("界-弹出菜单.wav"); _interfaceMiss = Utils.GetSoundEffect("界-缩回菜单.wav"); TitleInterface = new TitleGui(); _allGuiItems.AddLast(TitleInterface); SaveLoadInterface = new SaveLoadGui(); _allGuiItems.AddLast(SaveLoadInterface); SystemInterface = new SystemGui(); _allGuiItems.AddLast(SystemInterface); _panels.AddLast(SystemInterface); TopInterface = new TopGui(); _allGuiItems.AddLast(TopInterface); BottomInterface = new BottomGui(); _allGuiItems.AddLast(BottomInterface); ColumnInterface = new ColumnGui(); _allGuiItems.AddLast(ColumnInterface); MagicInterface = new MagicGui(); _allGuiItems.AddLast(MagicInterface); _panels.AddLast(MagicInterface); XiuLianInterface = new XiuLianGui(); _allGuiItems.AddLast(XiuLianInterface); _panels.AddLast(XiuLianInterface); GoodsInterface = new GoodsGui(); _allGuiItems.AddLast(GoodsInterface); _panels.AddLast(GoodsInterface); BuyInterface = new BuyGui(); _allGuiItems.AddLast(BuyInterface); _panels.AddLast(BuyInterface); TimerInterface = new TimerGui(); _allGuiItems.AddLast(TimerInterface); LittleMapInterface = new LittleMapGui(); _allGuiItems.AddLast(LittleMapInterface); MemoInterface = new MemoGui(); _allGuiItems.AddLast(MemoInterface); _panels.AddLast(MemoInterface); StateInterface = new StateGui(); _allGuiItems.AddLast(StateInterface); _panels.AddLast(StateInterface); EquipInterface = new EquipGui(); _allGuiItems.AddLast(EquipInterface); _panels.AddLast(EquipInterface); var toolTipUseType = int.Parse(Setttings.Sections["ToolTip_Use_Type"]["UseType"]); if (toolTipUseType == 1) { ToolTipInterface = new ToolTipGuiType1(); } else { ToolTipInterface = new ToolTipGuiType2(); } _allGuiItems.AddLast(ToolTipInterface); _panels.AddLast(ToolTipInterface); MouseInterface = new MouseGui(); MessageInterface = new MessageGui(); _allGuiItems.AddLast(MessageInterface); _panels.AddLast(MessageInterface); DialogInterface = new DialogGui(); _allGuiItems.AddLast(DialogInterface); LittleHeadInterface = new LittleHeadGui(); _allGuiItems.AddLast(LittleHeadInterface); SelectionInterface = new SelectionGui(); _allGuiItems.AddLast(SelectionInterface); MagicListManager.RenewList(); GoodsListManager.RenewList(); }
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; } }; } }