public ItemJewel(ItemJewelInstance _instanceData) { this.instanceData = _instanceData; jewelInstanceData = _instanceData; //Debug.Log("ItemJewel(id=" + _instanceData.templeId+")"); if (!ItemJewelData.dataMap.ContainsKey(_instanceData.templeId)) { Debug.LogError("can not find jewel: " + _instanceData.templeId); return; } templateData = ItemJewelData.dataMap[_instanceData.templeId]; jewelTemplateData = (ItemJewelData)templateData; }
public ItemJewel(ItemJewelInstance _instanceData) { this.instanceData = _instanceData; jewelInstanceData = _instanceData; LoggerHelper.Debug("id:" + _instanceData.templeId); if (!ItemJewelData.dataMap.ContainsKey(_instanceData.templeId)) { LoggerHelper.Error("can not find jewel: " + _instanceData.templeId); return; } templateData = ItemJewelData.dataMap[_instanceData.templeId]; jewelTemplateData = (ItemJewelData)templateData; }
private void InitData() { //通知服务器,客户端需要初始化数据 List<ItemParentInstance> list = new List<ItemParentInstance>(); if (ServerProxy.Instance.GetType() == typeof(LocalProxy)) { //4个宝石,2个已插,2个放背包 ItemParentInstance item7 = new ItemJewelInstance() { templeId = 1411031, gridIndex = 0, stack = 2, bagType = ITEM_TYPE_JEWEL }; ItemParentInstance item8 = new ItemJewelInstance() { templeId = 1411041, gridIndex = 3, stack = 3, bagType = ITEM_TYPE_JEWEL }; List<int> jewelSlots = new List<int>(); jewelSlots.Add(-1); ItemParentInstance item1; ItemParentInstance item2; // 为去除警告暂时屏蔽以下代码 //ItemParentInstance item3; //ItemParentInstance item4; ItemParentInstance item5; //4个装备 switch (myself.vocation) { case Vocation.Warrior: item1 = new ItemEquipmentInstance() { templeId = 1311015, gridIndex = 0, jewelSlots = jewelSlots, bagType = ITEM_TYPE_EQUIPMENT }; //item2 = new ItemEquipmentInstance() { templeId = 12101102, gridIndex = 1, bagType = ITEM_TYPE_EQUIPMENT }; //item3 = new ItemEquipmentInstance() { templeId = 12101103, gridIndex = 2, bagType = ITEM_TYPE_EQUIPMENT }; //item4 = new ItemEquipmentInstance() { templeId = 12101104, gridIndex = 3, bagType = ITEM_TYPE_EQUIPMENT }; item5 = new ItemEquipmentInstance() { templeId = 1321015, gridIndex = 4, bagType = ITEM_TYPE_EQUIPMENT }; list.Add(item1); //list.Add(item2); //list.Add(item3); //list.Add(item4); list.Add(item5); break; case Vocation.Assassin: item1 = new ItemEquipmentInstance() { templeId = 1331015, gridIndex = 0, jewelSlots = jewelSlots, bagType = ITEM_TYPE_EQUIPMENT }; item2 = new ItemEquipmentInstance() { templeId = 1341015, gridIndex = 1, bagType = ITEM_TYPE_EQUIPMENT }; list.Add(item1); list.Add(item2); break; case Vocation.Archer: item1 = new ItemEquipmentInstance() { templeId = 1371015, gridIndex = 0, jewelSlots = jewelSlots, bagType = ITEM_TYPE_EQUIPMENT }; item2 = new ItemEquipmentInstance() { templeId = 1381015, gridIndex = 1, jewelSlots = jewelSlots, bagType = ITEM_TYPE_EQUIPMENT }; list.Add(item1); list.Add(item2); break; } list.Add(item7); list.Add(item8); } _InitData(list); LoggerHelper.Debug("InventoryReq"); myself.RpcCall("InventoryReq"); }
ItemParent AddItem(ItemInstance instance) { ItemParent item = null; LoggerHelper.Debug("AddItem:" + instance.bagType + ",index:" + instance.gridIndex); switch (instance.bagType) { case ITEM_TYPE_EQUIPMENT: if (ItemEquipmentData.dataMap.ContainsKey(instance.templeId)) { item = GetItemEquipmentByInstance(instance); } else { ItemParentInstance toolInstance = new ItemParentInstance() { id = instance.id, bagType = instance.bagType, stack = instance.stack, templeId = instance.templeId, gridIndex = instance.gridIndex, }; item = new ItemMaterial(toolInstance); } m_itemsInBag[ITEM_TYPE_EQUIPMENT][item.gridIndex] = item; break; case ITEM_TYPE_JEWEL: ItemJewelInstance jewelInstance = new ItemJewelInstance() { id = instance.id, bagType = instance.bagType, bindingType = instance.bindingType, stack = instance.stack, templeId = instance.templeId, gridIndex = instance.gridIndex, }; item = new ItemJewel(jewelInstance); m_itemsInBag[ITEM_TYPE_JEWEL][item.gridIndex] = item; break; case ITEM_TYPE_ONEQUIP: item = GetItemEquipmentByInstance(instance); //Mogo.Util.LoggerHelper.Debug("item.gridIndex:" + item.gridIndex + "!!!!!!!!!!!"); m_itemsOnEquip[item.gridIndex + 1] = (ItemEquipment)item; //Mogo.Util.LoggerHelper.Debug("inventroy equip:" + item.templateId); myself.Equip(item.templateId); break; case ITEM_TYPE_MATERIAL: ItemParentInstance materialInstance = new ItemParentInstance() { id = instance.id, bagType = instance.bagType, stack = instance.stack, templeId = instance.templeId, gridIndex = instance.gridIndex, }; item = new ItemMaterial(materialInstance); m_itemsInBag[ITEM_TYPE_MATERIAL][item.gridIndex] = item; break; } return item; }