-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetViewGallery.cs
46 lines (39 loc) · 1.27 KB
/
SetViewGallery.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
namespace MWM.Gallery {
public class SetViewGallery : MonoBehaviour {
public GameObject panelViews;
public string folderPath = "Views";
PhotoGallery viewGallery;
List<string> imageNameList = new List<string>();
void Start (){
viewGallery = panelViews.GetComponentInChildren<PhotoGallery>();
ApartmentManager.instance.SelectedApartmentAction += HandleSelectedApartment;
}
void HandleSelectedApartment (bool value){
DisableButtonIfApartmentHasNoViews(value);
}
void DisableButtonIfApartmentHasNoViews(bool hasSelected){
if(hasSelected){
if(string.IsNullOrEmpty(ApartmentManager.instance.selectedApartment.GetComponent<ApartmentBlock>().unitInfo.unit_view)){
GetComponent<Button>().interactable = false;
}
else{
GetComponent<Button>().interactable = true;
}
}
}
void CreateNameList(){
imageNameList.Clear();
foreach (string imageName in ApartmentManager.instance.selectedApartment.GetComponent<ApartmentBlock>().unitInfo.unitViewsArray)
imageNameList.Add(folderPath + imageName);
}
public void _OpenViews(){
panelViews.SetActive(true);
CreateNameList();
viewGallery.InitializeGallery(imageNameList);
}
}
}