12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class JobCardManager : MonoBehaviour
- {
- [Serializable]
- public struct IconTypeSet
- {
- public DataTools.GigType type;
- public Sprite icon;
- }
- [Header("Gig attributes")]
- [SerializeField] private Text typeText;
- [SerializeField] private Text descriptionText;
- [SerializeField] private Image typeIcon;
- [Header("Requirements and reward")]
- [SerializeField] private Text hoursText;
- [SerializeField] private Text starsText;
- [SerializeField] private Text coinsText;
- [SerializeField] private Text experienceText;
- [Header("Icons Set")]
- [SerializeField] private List<IconTypeSet> icons;
- [Header("Job board")]
- [SerializeField] private JobBoardBehaviour parentJobBoard;
- private DataTools.Gig attachedGig;
- [Header("Accept Button")]
- [SerializeField] private Button acceptButton;
- public void OnButtonAcceptClick()
- {
- parentJobBoard.StartGig(attachedGig, this);
- }
- public void AddGig(DataTools.Gig gig)
- {
- attachedGig = gig;
- typeText.text = GigTypeRename(gig.Type);
- descriptionText.text = gig.Description;
- typeIcon.sprite = icons.Find(i => i.type == gig.Type).icon;
- hoursText.text = (gig.Duration / 60).ToString();
- starsText.text = gig.StarsNeeded.ToString();
- coinsText.text = gig.Currency.Dollars.ToString();
- experienceText.text = gig.Currency.Experience.ToString();
- }
- public string GigTypeRename(DataTools.GigType type)
- {
- switch(type)
- {
- case DataTools.GigType.FashionShow:
- return "Runway";
-
- case DataTools.GigType.Commerical:
- return "Film / TV Show";
- default:
- return type.ToString();
- }
- }
- public void UpdateButton(bool flag)
- {
- acceptButton.interactable = flag;
- }
- }
|