public bool IsLocked(EnumTattooPart part, int playerLevel, out int unlockLevel) { TattooUnlockData data = dataList.Find(delegate(TattooUnlockData tud) { return(tud.part == part); }); unlockLevel = data.playerLevel; return(unlockLevel > playerLevel); }
public override void Parse(System.IO.BinaryReader reader) { tattooDict = new Dictionary <EnumTattooPart, ItemInventory>(); int count = reader.ReadByte(); for (int i = 0; i < count; i++) { EnumTattooPart part = (EnumTattooPart)reader.ReadByte(); ItemInventory ii = new ItemInventory(); ii.Parse(reader); tattooDict.Add(part, ii); } }
//called when clicking on a slot public void OnClickOnSlot(TattooBodySlot slot) { _selectedPart = slot.part; if (slot.IsLocked) { UIMessageBoxManager.Instance.ShowMessageBox(string.Format(Localization.instance.Get("IDS_TATTOO_WILL_UNLOCK_AT_LEVEL"), Localization.instance.Get(Utils.k_tattoo_part_names[(int)slot.part]), slot.UnlockLevel), null, MB_TYPE.MB_OK, null); } else if (slot.item == null) //empty slot { _uiTattoo.OpenTattooSelectionWindow(slot); } else //occupied { _uiTattoo.ShowTattooDetailWindow(slot, null); } }
public UpdateInforResponseData UpdateOperation(BinaryReader reader) { List <PlayerProp> playerPropsList = new List <PlayerProp>(); List <ItemInventory> newItemsList = new List <ItemInventory>(); List <ItemMoveVo> itemMoveOps = new List <ItemMoveVo>(); List <ItemCountVo> itemCountOps = new List <ItemCountVo>(); List <ItemAttributeUpdateVoList> itemAttributeOps = new List <ItemAttributeUpdateVoList>(); List <TattooEquipVo> tattooOpList = new List <TattooEquipVo>(); List <ItemInventory> updateItemList = new List <ItemInventory>(); //parse and save first,update later. int changeCount = reader.ReadInt16(); for (int index = 0; index < changeCount; index++) { UpdateKey uk = (UpdateKey)reader.ReadByte(); switch (uk) { case UpdateKey.RoleProp: //section 1 int propmask = reader.ReadInt32(); for (int key = 0; key < 32; key++) { if ((propmask & (1 << key)) != 0) { playerPropsList.Add(new PlayerProp((PlayerPropKey)key, reader.ReadInt32())); } } break; case UpdateKey.RolePropBattle: //section 2 int propmaskBattle = reader.ReadInt32(); for (int key = 0; key < 32; key++) { if ((propmaskBattle & (1 << key)) != 0) { playerPropsList.Add(new PlayerProp((PlayerPropKey)key + 32, reader.ReadInt32())); } } break; case UpdateKey.ItemMove: itemMoveOps.Add(new ItemMoveVo(reader.ReadInt64(), (ItemMoveType)reader.ReadByte())); break; case UpdateKey.ItemCount: ItemCountVo iv = new ItemCountVo(reader.ReadInt64(), reader.ReadInt16()); itemCountOps.Add(iv); if (iv.ItemCount > 0) { ItemInventory ii = PlayerInfo.Instance.PlayerInventory.GetItem(iv.ItemGuid); updateItemList.Add(ii); } break; case UpdateKey.ItemNew: ItemInventory itemInventory = new ItemInventory(); itemInventory.Parse(reader); itemInventory.IsNew = true; newItemsList.Add(itemInventory); updateItemList.Add(itemInventory); break; case UpdateKey.ItemPropUpdate: Int64 itemGUID = reader.ReadInt64(); List <ItemAttributeUpdateVo> list = new List <ItemAttributeUpdateVo>(); byte changeAttributesCount = reader.ReadByte(); for (int i = 0; i < changeAttributesCount; i++) { list.Add(new ItemAttributeUpdateVo((FC_EQUIP_EXTEND_ATTRIBUTE)reader.ReadInt32(), reader.ReadInt32())); } itemAttributeOps.Add(new ItemAttributeUpdateVoList(itemGUID, list.ToArray())); break; case UpdateKey.Tattoo: EnumTattooPart part = (EnumTattooPart)reader.ReadByte(); long itemGUID2 = reader.ReadInt64(); byte op = reader.ReadByte(); tattooOpList.Add(new TattooEquipVo(itemGUID2, part, op)); break; } } UpdateInforResponseData data = new UpdateInforResponseData(); data.itemCountOps = itemCountOps; data.itemMoveOps = itemMoveOps; data.newItemsList = newItemsList; data.playerPropsList = playerPropsList; data.itemAttributeOps = itemAttributeOps; data.tattooOpList = tattooOpList; data.itemUpdateList = updateItemList; return(data); }
//if a body slot has been unlocked private bool IsAvailable(EnumTattooPart part) { return(false); }
//if a tattoo exists on the boday part public bool IsEuipped(EnumTattooPart part) { return(tattooDict.ContainsKey(part)); }
public void Initialize(EnumTattooPart part, UITattoo uiTattoo) { OnDisable(); _selectedPart = part; _uiTattoo = uiTattoo; //list all tattoos, including those equipped on body _ttList = new List <UITattooChooseItem>(); //tattoos in bag List <ItemInventory> bagTTList = PlayerInfo.Instance.PlayerInventory.itemList.FindAll( delegate(ItemInventory ii) { return(ii.ItemData.type == ItemType.tattoo); }); foreach (ItemInventory ii in bagTTList) { TattooData td = DataManager.Instance.GetTattooData(ii.ItemID); if (td.applicableParts.Contains(part)) { GameObject go = NGUITools.AddChild(ttGrid.gameObject, itemPrefab); UITattooChooseItem uiItem = go.GetComponent <UITattooChooseItem>(); uiItem.SetData(td, ii, false, this); _ttList.Add(uiItem); } } //tattoos burnt on body foreach (KeyValuePair <EnumTattooPart, ItemInventory> kvp in PlayerInfo.Instance.playerTattoos.tattooDict) { if (kvp.Key != _selectedPart) { TattooData td = DataManager.Instance.GetTattooData(kvp.Value.ItemID); if (td.applicableParts.Contains(part)) { GameObject go = NGUITools.AddChild(ttGrid.gameObject, itemPrefab); UITattooChooseItem uiItem = go.GetComponent <UITattooChooseItem>(); uiItem.SetData(td, kvp.Value, true, this); _ttList.Add(uiItem); } } } NGUITools.FindInParents <UIDraggablePanel>(ttGrid.gameObject).ResetPosition(); ttGrid.repositionNow = true; labelTitle.text = string.Format("{0} ({1})", Localization.instance.Get("IDS_BUTTON_GLOBAL_EQUIP"), Localization.instance.Get(Utils.k_tattoo_part_names[(int)_selectedPart])); if (_ttList.Count > 0) { SetFocus(_ttList[0]); } else { buttonOK.gameObject.SetActive(false); } }
private byte _op; //1: burn on 2: remove public TattooEquipRequest(EnumTattooPart part, long guid, byte op) { _part = part; _guid = guid; _op = op; }
public TattooEquipVo(Int64 guid, EnumTattooPart part, byte op) { this.ItemGuid = guid; this.part = part; this.op = op; }