public void AddNewGem(int instanceId, int id) { int newPos = GetNewPos(EBagType.GEM); if (newPos == 0) { return; } XItem item = new XItem(); item.Instance = instanceId; item.Pos = newPos; item.Id = id; item.Num = 1; item.PosType = (int)EPosType.BagGem; DataBagGem.Insert(newPos, item); XGem gem = new XGem(); gem.Instance = instanceId; gem.Id = id; gem.StrengthenLevel = 0; gem.StrengthenExp = 0; DataGem.Insert(instanceId, gem); }
public bool DelBagGem(int pos) { if (!DataManager.Instance.BagGems.ContainsKey(pos)) { return(false); } XItem xp = DataManager.Instance.BagGems[pos]; if (!DataManager.Instance.Gems.ContainsKey(xp.Instance)) { return(false); } DataBagGem.Delete(pos); DataGem.Delete(xp.Instance); return(true); }