浏览代码

[Bot] Automated dotnet-format update

/main
Chema Damak 4 年前
当前提交
9bfb88e2
共有 26 个文件被更改,包括 152 次插入136 次删除
  1. 2
      UOP1_Project/Assets/Scripts/Cutscenes/CutsceneManager.cs
  2. 4
      UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs
  3. 14
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/DialogueLineEvent.cs
  4. 14
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/ItemEvent.cs
  5. 14
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/ItemTypeEvent.cs
  6. 14
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/TabTypeEvent.cs
  7. 12
      UOP1_Project/Assets/Scripts/Inventory/CollectibleItem.cs
  8. 78
      UOP1_Project/Assets/Scripts/Inventory/InventoryFiller.cs
  9. 22
      UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs
  10. 15
      UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs
  11. 4
      UOP1_Project/Assets/Scripts/Inventory/ItemPicker.cs
  12. 2
      UOP1_Project/Assets/Scripts/Inventory/ItemStack.cs
  13. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventoryTabType.cs
  14. 6
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/Item.cs
  15. 2
      UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemType.cs
  16. 2
      UOP1_Project/Assets/Scripts/UI/CookingInventoryInspectorFiller.cs
  17. 2
      UOP1_Project/Assets/Scripts/UI/IngredientFiller.cs
  18. 6
      UOP1_Project/Assets/Scripts/UI/InspectorDescriptionFiller.cs
  19. 9
      UOP1_Project/Assets/Scripts/UI/InspectorFiller.cs
  20. 9
      UOP1_Project/Assets/Scripts/UI/InspectorPreviewFiller.cs
  21. 15
      UOP1_Project/Assets/Scripts/UI/InventoryButtonFiller.cs
  22. 4
      UOP1_Project/Assets/Scripts/UI/InventoryTypeTabFiller.cs
  23. 4
      UOP1_Project/Assets/Scripts/UI/InventoryTypeTabsFiller.cs
  24. 13
      UOP1_Project/Assets/Scripts/UI/RecipeIngredientsFiller.cs
  25. 10
      UOP1_Project/Assets/Scripts/UI/SimpleInventoryInspectorFiller.cs
  26. 9
      UOP1_Project/Assets/Scripts/UI/UIManager.cs

2
UOP1_Project/Assets/Scripts/Cutscenes/CutsceneManager.cs


_isPaused = false;
_activePlayableDirector.playableGraph.GetRootPlayable(0).SetSpeed(1);
}
}
}

4
UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs


public class DialogueManager : MonoBehaviour
{
[SerializeField] private InputReader _inputReader = default;
[SerializeField] DialogueLineEvent dialogueLineEvent;
[SerializeField] DialogueLineEvent dialogueLineEvent;
/// <summary>
/// Called to begin a dialogue, i.e. a sequence of lines that require the player's input to move forward.
/// </summary>

{
//TODO: Interface with a UIManager to allow displayal of the line of dialogue in the UI
//Debug.Log("A line of dialogue has been spoken: \"" + dialogueLine.Sentence + "\" by " + dialogueLine.Actor.ActorName);
dialogueLineEvent.Raise(dialogueLine);
dialogueLineEvent.Raise(dialogueLine);
}
}

14
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/DialogueLineEvent.cs


public class DialogueLineEvent : ScriptableObject
{
public UnityAction<DialogueLineSO> eventRaised;
public void Raise(DialogueLineSO dialogueLine)
{
if (eventRaised != null)
eventRaised.Invoke(dialogueLine);
}
public UnityAction<DialogueLineSO> eventRaised;
public void Raise(DialogueLineSO dialogueLine)
{
if (eventRaised != null)
eventRaised.Invoke(dialogueLine);
}
}

14
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/ItemEvent.cs


public class ItemEvent : ScriptableObject
{
public UnityAction<Item> eventRaised;
public void Raise(Item item)
{
if (eventRaised != null)
eventRaised.Invoke(item);
}
public UnityAction<Item> eventRaised;
public void Raise(Item item)
{
if (eventRaised != null)
eventRaised.Invoke(item);
}
}

14
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/ItemTypeEvent.cs


public class ItemTypeEvent : ScriptableObject
{
public UnityAction<ItemType> eventRaised;
public void Raise(ItemType itemType)
{
if (eventRaised != null)
eventRaised.Invoke(itemType);
}
public UnityAction<ItemType> eventRaised;
public void Raise(ItemType itemType)
{
if (eventRaised != null)
eventRaised.Invoke(itemType);
}
}

14
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/UI/TabTypeEvent.cs


public class TabTypeEvent : ScriptableObject
{
public UnityAction<InventoryTabType> eventRaised;
public void Raise(InventoryTabType tabType)
{
if (eventRaised != null)
eventRaised.Invoke(tabType);
}
public UnityAction<InventoryTabType> eventRaised;
public void Raise(InventoryTabType tabType)
{
if (eventRaised != null)
eventRaised.Invoke(tabType);
}
}

12
UOP1_Project/Assets/Scripts/Inventory/CollectibleItem.cs


private SpriteRenderer[] itemImages;
private void Start()
{
SetItem();
SetItem();
public void PickedItem() {
public void PickedItem()
{
public void SetItem() {
public void SetItem()
{
itemImages[i].sprite = currentItem.PreviewImage;
itemImages[i].sprite = currentItem.PreviewImage;
}
}

if (other.gameObject.GetComponent<ItemPicker>())
{
other.gameObject.GetComponent<ItemPicker>().PickItem(currentItem);
other.gameObject.GetComponent<ItemPicker>().PickItem(currentItem);
}

78
UOP1_Project/Assets/Scripts/Inventory/InventoryFiller.cs


[SerializeField]
List<InventoryTabType> tabTypesList = new List<InventoryTabType>();
private int selectedItemId = -1;
private int selectedItemId = -1;
private List<InventoryItemFiller> instantiatedGameObjects;

}
if (SelectItemEvent != null)
{
SelectItemEvent.eventRaised += InspectItem ;
SelectItemEvent.eventRaised += InspectItem;
}
}

}
}
public void FillInventory(InventoryTabType _selectedTabType = null) {
public void FillInventory(InventoryTabType _selectedTabType = null)
{
if (_selectedTabType != null)
{
selectedTabType = _selectedTabType;

}
Debug.Log("Is changing tab");
Debug.Log("Is changing tab");
List<ItemStack> listItemsToShow = currentInventory.Items.FindAll(o => o.Item.ItemType.TabType == selectedTabType);
FillItems(listItemsToShow);
}

Debug.Log("There's no item tab type ");
Debug.Log("There's no item tab type ");
void FillTypeTabs(List<InventoryTabType> typesList, InventoryTabType selectedType) {
void FillTypeTabs(List<InventoryTabType> typesList, InventoryTabType selectedType)
{
tabFiller.FillTabs(typesList, selectedType, ChangeTabEvent);
tabFiller.FillTabs(typesList, selectedType, ChangeTabEvent);
void FillItems(List<ItemStack> listItemsToShow)
void FillItems(List<ItemStack> listItemsToShow)
{
if (instantiatedGameObjects == null)

if (selectedItemId >= 0)
{
UnselectItem(selectedItemId);
selectedItemId = -1;
selectedItemId = -1;
}
}
public void UpdateOnItemInInventory(ItemStack itemToUpdate, bool removeItem)

if (removeItem)
{
if( instantiatedGameObjects.Exists(o=>o.currentItem==itemToUpdate))
{
if (instantiatedGameObjects.Exists(o => o.currentItem == itemToUpdate))
{
int index= instantiatedGameObjects.FindIndex(o => o.currentItem == itemToUpdate);
instantiatedGameObjects[index].gameObject.SetActive(false);
int index = instantiatedGameObjects.FindIndex(o => o.currentItem == itemToUpdate);
instantiatedGameObjects[index].gameObject.SetActive(false);
}

{
index = instantiatedGameObjects.FindIndex(o => o.currentItem == itemToUpdate);
}
//if the item needs to be created

}
//set item
bool isSelected = selectedItemId==index;
bool isSelected = selectedItemId == index;
instantiatedGameObjects[index].SetItem(itemToUpdate, isSelected, SelectItemEvent);
instantiatedGameObjects[index].gameObject.SetActive(true);

}
if(instantiatedGameObjects.Exists(o => o.currentItem.Item == itemToInspect))
if (instantiatedGameObjects.Exists(o => o.currentItem.Item == itemToInspect))
int itemIndex = instantiatedGameObjects.FindIndex(o => o.currentItem.Item == itemToInspect);
int itemIndex = instantiatedGameObjects.FindIndex(o => o.currentItem.Item == itemToInspect);
if (selectedItemId >= 0 && selectedItemId!=itemIndex)
if (selectedItemId >= 0 && selectedItemId != itemIndex)
UnselectItem(selectedItemId);
//change Selected ID

}
else if (itemToInspect.ItemType.ActionType == ItemInventoryActionType.doNothing)
{
isInteractable = false;
isInteractable = false;
}

}
void ShowItemInformation(Item item) {
void ShowItemInformation(Item item)
{
bool[] availabilityArray = currentInventory.IngredietsAvailability(item.IngredientsList);
bool[] availabilityArray = currentInventory.IngredietsAvailability(item.IngredientsList);
void HideItemInformation() {
void HideItemInformation()
{
inspectorFiller.HideItemInspector();
inspectorFiller.HideItemInspector();
void UnselectItem(int itemIndex) {
void UnselectItem(int itemIndex)
{
instantiatedGameObjects[itemIndex].UnselectItem();
instantiatedGameObjects[itemIndex].UnselectItem();
void ActionButtonEventRaised()
void ActionButtonEventRaised()
{
if (ActionButtonClicked != null)
{

}
void ChangeTabEventRaised(InventoryTabType tabType) {
void ChangeTabEventRaised(InventoryTabType tabType)
{
FillInventory(tabType);
FillInventory(tabType);
}

22
UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs


using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.Localization.Components;
using UnityEngine.Localization.Components;
{[SerializeField]
{
[SerializeField]
private Image itemPreviewImage;
[SerializeField]

[SerializeField]
private Button itemButton;
public void SetItem(ItemStack itemStack, bool isSelected, ItemEvent selectItemEvent) {
public void SetItem(ItemStack itemStack, bool isSelected, ItemEvent selectItemEvent)
{
UnhoverItem();
UnhoverItem();
imgSelected.gameObject.SetActive(isSelected);
imgSelected.gameObject.SetActive(isSelected);
itemPreviewImage.sprite = itemStack.Item.PreviewImage;
itemTitle.StringReference = itemStack.Item.Name;

itemButton.onClick.RemoveAllListeners();
selectItemEvent.Raise(currentItem.Item);
selectItemEvent.Raise(currentItem.Item);
});
});
imgHover.gameObject.SetActive(true);
imgHover.gameObject.SetActive(true);
}

15
UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs


void AddItemWithUIUpdate(Item item) {
void AddItemWithUIUpdate(Item item)
{
// UIManager.Instance.UpdateInventoryScreen(itemToUpdate, false);
// UIManager.Instance.UpdateInventoryScreen(itemToUpdate, false);
}
}

currentInventory.Remove(item);
bool removeItem = currentInventory.Contains(item);
// UIManager.Instance.UpdateInventoryScreen(itemToUpdate, removeItem);
// UIManager.Instance.UpdateInventoryScreen(itemToUpdate, removeItem);
void AddItem(Item item)
void AddItem(Item item)
void RemoveItem(Item item)
void RemoveItem(Item item)
{
currentInventory.Remove(item);

4
UOP1_Project/Assets/Scripts/Inventory/ItemPicker.cs


public void PickItem(Item item)
{
if(AddItemEvent!=null)
AddItemEvent.Raise(item);
if (AddItemEvent != null)
AddItemEvent.Raise(item);
}
}

2
UOP1_Project/Assets/Scripts/Inventory/ItemStack.cs


_item = item;
Amount = amount;
}
}
}

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/InventoryTabType.cs


[SerializeField]
private LocalizedString _tabName;
[Tooltip("The tab type used to reference the item")]
[SerializeField] private TabType _tabType;

6
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/Item.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization;
// Created with collaboration from:
// https://forum.unity.com/threads/inventory-system.980646/
[CreateAssetMenu(fileName = "Item", menuName = "Inventory/Item", order = 51)]

[Tooltip("The resulting dish to the recipe")]
[SerializeField]
private Item _resultingDish;
private Item _resultingDish;
public LocalizedString Name => _name;
public Sprite PreviewImage => _previewImage;

2
UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/ItemType.cs


utensil,
ingredient,
customisation,
dish,
dish,
}
public enum ItemInventoryActionType

2
UOP1_Project/Assets/Scripts/UI/CookingInventoryInspectorFiller.cs


private InspectorDescriptionFiller inspectorDescriptionFiller;
[SerializeField]
private RecipeIngredientsFiller recipeIngredientsFiller;
private RecipeIngredientsFiller recipeIngredientsFiller;

2
UOP1_Project/Assets/Scripts/UI/IngredientFiller.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Localization.Components;
using TMPro;
using TMPro;
public class IngredientFiller : MonoBehaviour
{

6
UOP1_Project/Assets/Scripts/UI/InspectorDescriptionFiller.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Localization.Components;
using UnityEngine.Localization.Components;
public class InspectorDescriptionFiller : MonoBehaviour
{

public void FillDescription(Item itemToInspect)
{
textName.gameObject.SetActive(true);
textName.gameObject.SetActive(true);
}
}

9
UOP1_Project/Assets/Scripts/UI/InspectorFiller.cs


[SerializeField]
private CookingInventoryInspectorFiller cookingInventoryInspector;
public void FillItemInspector(Item itemToInspect, bool[] availabilityArray =null)
public void FillItemInspector(Item itemToInspect, bool[] availabilityArray = null)
{
bool isForCooking = (itemToInspect.ItemType.ActionType == ItemInventoryActionType.cook);

if (!isForCooking)
{
simpleInventoryInspector.FillItemInspector(itemToInspect);
simpleInventoryInspector.FillItemInspector(itemToInspect);
cookingInventoryInspector.FillItemInspector(itemToInspect, availabilityArray);
cookingInventoryInspector.FillItemInspector(itemToInspect, availabilityArray);
public void HideItemInspector() {
public void HideItemInspector()
{
simpleInventoryInspector.gameObject.SetActive(false);
cookingInventoryInspector.gameObject.SetActive(false);

9
UOP1_Project/Assets/Scripts/UI/InspectorPreviewFiller.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI;
public class InspectorPreviewFiller : MonoBehaviour
{

public void FillPreview(Item ItemToInspect) {
public void FillPreview(Item ItemToInspect)
{
previewImage.gameObject.SetActive(true);
previewImage.sprite = ItemToInspect.PreviewImage;
previewImage.gameObject.SetActive(true);
previewImage.sprite = ItemToInspect.PreviewImage;
}

15
UOP1_Project/Assets/Scripts/UI/InventoryButtonFiller.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Localization.Components;
using UnityEngine.Localization.Components;
private LocalizeStringEvent buttonActionText ;
private LocalizeStringEvent buttonActionText;
public void FillInventoryButtons(ItemType itemType, bool isInteractable=true) {
public void FillInventoryButtons(ItemType itemType, bool isInteractable = true)
{

}

4
UOP1_Project/Assets/Scripts/UI/InventoryTypeTabFiller.cs


tabName.StringReference = tabType.TabName;
actionButton.interactable = !isSelected;
actionButton.onClick.RemoveAllListeners();
actionButton.onClick.RemoveAllListeners();
}

4
UOP1_Project/Assets/Scripts/UI/InventoryTypeTabsFiller.cs


{
Debug.Log("Maximum tabs reached");
}
bool isSelected = typesList[i] == selectedType;
bool isSelected = typesList[i] == selectedType;
instantiatedGameObjects[i].fillTab(typesList[i], isSelected, changeTabEvent);
instantiatedGameObjects[i].fillTab(typesList[i], isSelected, changeTabEvent);
instantiatedGameObjects[i].gameObject.SetActive(true);
}

13
UOP1_Project/Assets/Scripts/UI/RecipeIngredientsFiller.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI;
public class RecipeIngredientsFiller : MonoBehaviour
{

public void FillIngredients(List<ItemStack> listofIngredients , bool[] availabilityArray)
public void FillIngredients(List<ItemStack> listofIngredients, bool[] availabilityArray)
{
if (gameObject.GetComponent<VerticalLayoutGroup>() != null)

{
//fill
bool isAvailable = availabilityArray[i];
instantiatedGameObjects[i].FillIngredient(listofIngredients[i], isAvailable);
instantiatedGameObjects[i].FillIngredient(listofIngredients[i], isAvailable);
instantiatedGameObjects[i].gameObject.SetActive(true);
}

}
StartCoroutine(waitBeforeDesactiveLayout());
StartCoroutine(waitBeforeDesactiveLayout());
IEnumerator waitBeforeDesactiveLayout() {
IEnumerator waitBeforeDesactiveLayout()
{
yield return new WaitForSeconds(1);
yield return new WaitForSeconds(1);
//disable layout group after layout calculation
if (gameObject.GetComponent<VerticalLayoutGroup>() != null)
gameObject.GetComponent<VerticalLayoutGroup>().enabled = false;

10
UOP1_Project/Assets/Scripts/UI/SimpleInventoryInspectorFiller.cs


[SerializeField]
private InspectorDescriptionFiller inspectorDescriptionFiller;
inspectorPreviewFiller.FillPreview(itemToInspect);
inspectorDescriptionFiller.FillDescription(itemToInspect);
inspectorPreviewFiller.FillPreview(itemToInspect);
inspectorDescriptionFiller.FillDescription(itemToInspect);
}

9
UOP1_Project/Assets/Scripts/UI/UIManager.cs


public void OpenInventoryScreen() {
public void OpenInventoryScreen()
{
}
}
正在加载...
取消
保存