protected void OnGetItemStar(int itemID, Config.itemCell itemCell) { int star = 0; if (!int.TryParse(itemCell.itemval, out star)) { #if UNITY_EDITOR string e = string.Format("Star 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } ItemUse eItemUse = (ItemUse)(itemCell.use); switch (eItemUse) { case ItemUse.Get_Effective: SetValueOfPlayerData.Send((int)GameMessageDefine.SetStarOfPlayerData, star, 0, 0); break; case ItemUse.Use_Effective: //var item = ItemCellToItem(itemID, itemCell); playerData.playerZoo.itemList.Add(itemID); break; default: #if UNITY_EDITOR string e = string.Format("没有这种道具使用类型 {0}, {1}", itemID, itemCell.use); throw new System.Exception(e); #endif return; } }
public static Item ItemCellToItem(int itemID, Config.itemCell cellCell) { var item = new Item(); item.itemID = itemID; item.itemType = cellCell.itemtype; item.itemVal = cellCell.itemval; item.itemUse = cellCell.use; return(item); }
protected void OnUseItemStar(int itemID, Config.itemCell itemCell) { int star = 0; if (!int.TryParse(itemCell.itemval, out star)) { #if UNITY_EDITOR string e = string.Format("Star 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } SetValueOfPlayerData.Send((int)GameMessageDefine.SetStarOfPlayerData, star, 0, 0); }
protected void OnUseItemBuff(int itemID, Config.itemCell itemCell) { int buffID = 0; if (!int.TryParse(itemCell.itemval, out buffID)) { #if UNITY_EDITOR string e = string.Format("buffID 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } BroadcastNum.Send((int)GameMessageDefine.AddBuff, buffID, 0, 0); }
protected void OnUseItemCoin(int itemID, Config.itemCell itemCell) { BigInteger coin = 0; if (!BigInteger.TryParse(itemCell.itemval, out coin)) { #if UNITY_EDITOR string e = string.Format("Coin 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, coin, 0); }