示例#1
0
        private FmvClickableFacade CreateItem(ClickableModel itemModel, RectTransform parent)
        {
            FmvClickableFacade itemFacade = CreateItemFacade(parent);

            itemFacade.SetItemData(itemModel);
            return(itemFacade);
        }
示例#2
0
 private void ItemFromInventoryToUsed(ClickableModel model)
 {
     if (fmvVideos.CheckCurrentItemsForItemToUse(model))
     {
         TriggerUseageNavigationTarget(model);
         RemoveItemFromItemList(allInventoryItems, model);
         SetItemToAlreadyUsed(model);
     }
 }
示例#3
0
        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);
            }
        }
示例#4
0
        public bool CheckCurrentItemsForItemToUse(ClickableModel itemModel)
        {
            if (currentVideoElement.ItemsToUse == null)
            {
                return(false);
            }

            return(currentVideoElement.ItemsToUse
                   .Any((item) => item.Name.ToLower().Equals(itemModel.Name.ToLower())));
        }
示例#5
0
        private void AddItemToInventory(ClickableModel model)
        {
            FmvClickableFacade itemFacade = CreateItem(model, inventoryElementsPanel);

            SetEventsForInventoryItem(itemFacade);

            allInventoryItems.Add(itemFacade);

            SetItemToIsInInventory(model);
        }
示例#6
0
 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);
         }
     }
 }
示例#7
0
 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;
         }
     }
 }
示例#8
0
 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;
         }
     }
 }
示例#9
0
        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));
        }
示例#10
0
        public ClickableModel GetNavigationItemModelByName(string navigationName)
        {
            ClickableModel navigationItem = allItems.SingleOrDefault(navigation => navigation.Name.ToLower().Equals(navigationName.ToLower()));

            return(navigationItem);
        }
示例#11
0
 private void TriggerUseageNavigationTarget(ClickableModel model)
 {
     fmvVideos.PlayVideoFromNavigationTarget(model.UseageVideo);
 }
示例#12
0
 private void TriggerPickUpNavigationTarget(ClickableModel model)
 {
     fmvVideos.PlayVideoFromNavigationTarget(model.PickUpVideo);
 }
示例#13
0
 private void ItemFromFindableToInventory(ClickableModel model)
 {
     RemoveItemFromItemList(allFindableItems, model);
     AddItemToInventory(model);
 }