public void UseItemByPos(int pos, HItemUseTypes type) { var pickItem = Items[pos]; if (pickItem.Value <= 0) { return; } var rate = UserProfile.InfoBag.GetCdTimeRate(pickItem.Type); if (rate > 0) { return; //cd中 } if (Consumer.UseItemsById(pickItem.Type, type)) { //var consumerConfig = ConfigData.GetItemConsumerConfig(pickItem.Type); //if (consumerConfig.CdGroup > 0) //{ // CdGroupStartTime[consumerConfig.CdGroup - 1] = TimeTool.GetNowUnixTime(); // CdGroupTime[consumerConfig.CdGroup - 1] = TimeTool.GetNowUnixTime() + consumerConfig.CdTime; //} DeleteItemByPos(pos, 1); MainForm.Instance.RefreshView(); } //todo 需要提示下错误类型 }
public static bool UseItemsById(int id, HItemUseTypes useMethod) { HItemConfig itemConfig = ConfigData.GetHItemConfig(id); //ItemConsumerConfig consumerConfig = ConfigData.GetItemConsumerConfig(id); //if (useMethod == HItemUseTypes.Common) //{ // if (itemConfig.SubType == (int)HItemTypes.Item) // return UseItem(consumerConfig); //} return(false); }