private FmvClickableFacade CreateItem(ClickableModel itemModel, RectTransform parent) { FmvClickableFacade itemFacade = CreateItemFacade(parent); itemFacade.SetItemData(itemModel); return(itemFacade); }
private void ItemFromInventoryToUsed(ClickableModel model) { if (fmvVideos.CheckCurrentItemsForItemToUse(model)) { TriggerUseageNavigationTarget(model); RemoveItemFromItemList(allInventoryItems, model); SetItemToAlreadyUsed(model); } }
private void RemoveItemFromItemList(List <FmvClickableFacade> items, ClickableModel model) { FmvClickableFacade itemToRemove = items.Find((item) => item.name.Equals(model.Name)); if (itemToRemove && items.Remove(itemToRemove)) { Destroy(itemToRemove.gameObject); } }
public bool CheckCurrentItemsForItemToUse(ClickableModel itemModel) { if (currentVideoElement.ItemsToUse == null) { return(false); } return(currentVideoElement.ItemsToUse .Any((item) => item.Name.ToLower().Equals(itemModel.Name.ToLower()))); }
private void AddItemToInventory(ClickableModel model) { FmvClickableFacade itemFacade = CreateItem(model, inventoryElementsPanel); SetEventsForInventoryItem(itemFacade); allInventoryItems.Add(itemFacade); SetItemToIsInInventory(model); }
private void CheckForInstantNextVideo(VideoModel video) { if (video.NavigationTargets.Length == 1) { ClickableModel navigationTargetItem = clickableObjects.GetNavigationItemModelByName(video.NavigationTargets[0].Name); if ((navigationTargetItem != null) && string.IsNullOrEmpty(navigationTargetItem.Description)) { PlayVideoFromNavigationTarget(navigationTargetItem.PickUpVideo); } } }
private void SetItemToIsInInventory(ClickableModel model) { for (int i = 0; i < allItems.Count; i++) { if (allItems[i].Name.Equals(model.Name)) { allItems[i].IsInInventory = true; break; } } }
private void ShowCurrentNavigationTargets(VideoModel video) { if (!navigationsLoaded && (video.NavigationTargets?.Length > 0)) { ClickableModel navigationTargetItem = clickableObjects.GetNavigationItemModelByName(video.NavigationTargets[0].Name); if ((navigationTargetItem != null) && !string.IsNullOrEmpty(navigationTargetItem.Description)) { clickableObjects.SetNavigationTargetsActive(video.NavigationTargets); navigationsLoaded = true; } } }
public void SetItemData(ClickableModel model) { //LoadImageSprite(model.Name); clickableModel = model; gameObject.name = model.Name; itemImage.sprite = Resources.Load <Sprite>($"FmvMakerTextures/{model.Name}"); itemText.text = model.DisplayText; itemText.enabled = !string.IsNullOrEmpty(model.DisplayText); // set default sprite if necessary if (!itemImage.sprite) { itemImage.sprite = Resources.Load <Sprite>($"FmvMakerTextures/default"); itemText.text = model.Name; itemText.enabled = true; } rectTransform.anchoredPosition = DynamicVideoResolution.GetRelativeScreenPosition(model.RelativeScreenPosition); itemButton.onClick.AddListener(() => OnItemClicked?.Invoke(model)); }
public ClickableModel GetNavigationItemModelByName(string navigationName) { ClickableModel navigationItem = allItems.SingleOrDefault(navigation => navigation.Name.ToLower().Equals(navigationName.ToLower())); return(navigationItem); }
private void TriggerUseageNavigationTarget(ClickableModel model) { fmvVideos.PlayVideoFromNavigationTarget(model.UseageVideo); }
private void TriggerPickUpNavigationTarget(ClickableModel model) { fmvVideos.PlayVideoFromNavigationTarget(model.PickUpVideo); }
private void ItemFromFindableToInventory(ClickableModel model) { RemoveItemFromItemList(allFindableItems, model); AddItemToInventory(model); }