|
@@ -6,6 +6,7 @@ using UnityAsync;
|
|
|
using WaitUntil = UnityAsync.WaitUntil;
|
|
|
using System.Threading.Tasks;
|
|
|
using UnityEngine.UI;
|
|
|
+
|
|
|
public class GCZLLayer : MonoBehaviour
|
|
|
{
|
|
|
public GameObject classPrefab;
|
|
@@ -17,8 +18,6 @@ public class GCZLLayer : MonoBehaviour
|
|
|
|
|
|
public Sprite[] sprites;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private List<GameObject> informations = new List<GameObject>();
|
|
|
|
|
|
private GameObject lastClassBtn;
|
|
@@ -38,25 +37,47 @@ public class GCZLLayer : MonoBehaviour
|
|
|
private Text DetailTitleText;
|
|
|
|
|
|
private LayerUnitData currentData;
|
|
|
+
|
|
|
+ private Button OpenAniButton;
|
|
|
+ private Button CloseAniButton;
|
|
|
+
|
|
|
+ private Button detail_modelButton;
|
|
|
+ private Button detail_designButton;
|
|
|
+ private Button detail_photoButton;
|
|
|
+ private Button detail_videoButton;
|
|
|
+ private CanvasGroup detail_modelCG;
|
|
|
+ private CanvasGroup detail_designCG;
|
|
|
+ private CanvasGroup detail_photoCG;
|
|
|
+ private CanvasGroup detail_videoCG;
|
|
|
+ private RawImage showFrame;
|
|
|
+ private Button lastPhotoButton;
|
|
|
+ private Button nextPhotoButton;
|
|
|
+ public RenderTexture modelRT;
|
|
|
+
|
|
|
+ public string[] BY_PhotoUrl;
|
|
|
+ public string[] TK_PhotoUrl;
|
|
|
+ public int photoIndex;
|
|
|
|
|
|
private void Awake()
|
|
|
{
|
|
|
InfoPanel = this.transform.Find("InfoPanel").gameObject;
|
|
|
InfoTitleText = InfoPanel.transform.Find("Title").GetComponent<Text>();
|
|
|
- InfoClassText= InfoPanel.transform.Find("Class").GetComponent<Text>();
|
|
|
- InfoNoText= InfoPanel.transform.Find("No").GetComponent<Text>();
|
|
|
- InfoDayText= InfoPanel.transform.Find("Day").GetComponent<Text>();
|
|
|
+ InfoClassText = InfoPanel.transform.Find("Class").GetComponent<Text>();
|
|
|
+ InfoNoText = InfoPanel.transform.Find("No").GetComponent<Text>();
|
|
|
+ InfoDayText = InfoPanel.transform.Find("Day").GetComponent<Text>();
|
|
|
InfoFM = InfoPanel.transform.Find("fm").GetComponent<RawImage>();
|
|
|
InfoExitButton = InfoPanel.transform.Find("CloseButton").GetComponent<Button>();
|
|
|
- InfoExitButton.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- InfoPanel.SetActive(false);
|
|
|
- });
|
|
|
+ InfoExitButton.onClick.AddListener(() => { InfoPanel.SetActive(false); });
|
|
|
Info_DetailButton = InfoPanel.transform.Find("MoreButton").GetComponent<Button>();
|
|
|
Info_DetailButton.onClick.AddListener(() =>
|
|
|
{
|
|
|
DetailTitleText.text = currentData.name;
|
|
|
+ OpenAniButton.gameObject.SetActive(currentData.name_pri.Equals("BuYuan") ||
|
|
|
+ currentData.name_pri.Equals("TaoKou"));
|
|
|
+ CloseAniButton.gameObject.SetActive(currentData.name_pri.Equals("BuYuan") ||
|
|
|
+ currentData.name_pri.Equals("TaoKou"));
|
|
|
ModelCameraCtrl._Instance.SetCameraActive(true);
|
|
|
+ ResetDetailPanel();
|
|
|
DetailPanel.SetActive(true);
|
|
|
});
|
|
|
|
|
@@ -69,9 +90,35 @@ public class GCZLLayer : MonoBehaviour
|
|
|
ModelCameraCtrl._Instance.SetCameraActive(false);
|
|
|
});
|
|
|
|
|
|
+ detail_modelButton = DetailPanel.transform.Find("ModelButton").GetComponent<Button>();
|
|
|
+ detail_designButton = DetailPanel.transform.Find("DesignButton").GetComponent<Button>();
|
|
|
+ detail_photoButton = DetailPanel.transform.Find("PhotoButton").GetComponent<Button>();
|
|
|
+ detail_videoButton = DetailPanel.transform.Find("VideoButton").GetComponent<Button>();
|
|
|
+ detail_modelCG = detail_modelButton.GetComponent<CanvasGroup>();
|
|
|
+ detail_designCG = detail_designButton.GetComponent<CanvasGroup>();
|
|
|
+ detail_photoCG = detail_photoButton.GetComponent<CanvasGroup>();
|
|
|
+ detail_videoCG = detail_videoButton.GetComponent<CanvasGroup>();
|
|
|
+
|
|
|
+ detail_modelButton.onClick.AddListener(() => { DetailShowType(0); });
|
|
|
+ detail_designButton.onClick.AddListener(() => { DetailShowType(1); });
|
|
|
+ detail_photoButton.onClick.AddListener(() => { DetailShowType(2); });
|
|
|
+ detail_videoButton.onClick.AddListener(() => { DetailShowType(3); });
|
|
|
+
|
|
|
+ showFrame = DetailPanel.transform.Find("ShowFrame").GetComponent<RawImage>();
|
|
|
+ showFrame.texture = modelRT;
|
|
|
+
|
|
|
+ lastPhotoButton = DetailPanel.transform.Find("LastPhotoButton").GetComponent<Button>();
|
|
|
+ lastPhotoButton.onClick.AddListener(()=>ChangePhoto(-1));
|
|
|
+ nextPhotoButton = DetailPanel.transform.Find("NextPhotoButton").GetComponent<Button>();
|
|
|
+ nextPhotoButton.onClick.AddListener(()=>ChangePhoto(1));
|
|
|
+
|
|
|
+ OpenAniButton = DetailPanel.transform.Find("OpenAniButton").GetComponent<Button>();
|
|
|
+ OpenAniButton.onClick.AddListener(() => { ActionInstance._Instance.ModelAni_On?.Invoke(); });
|
|
|
+ CloseAniButton = DetailPanel.transform.Find("CloseAniButton").GetComponent<Button>();
|
|
|
+ CloseAniButton.onClick.AddListener(() => { ActionInstance._Instance.ModelAni_Off?.Invoke(); });
|
|
|
+
|
|
|
InfoPanel.SetActive(false);
|
|
|
DetailPanel.SetActive(false);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// Start is called before the first frame update
|
|
@@ -84,8 +131,10 @@ public class GCZLLayer : MonoBehaviour
|
|
|
InitInformation(0);
|
|
|
}
|
|
|
|
|
|
- void InitButton() {
|
|
|
- for (int i = 0; i < zTLayer.layerDatas.Length; i++) {
|
|
|
+ void InitButton()
|
|
|
+ {
|
|
|
+ for (int i = 0; i < zTLayer.layerDatas.Length; i++)
|
|
|
+ {
|
|
|
string name = zTLayer.layerDatas[i].layerName;
|
|
|
int temp = i;
|
|
|
GameObject obj = Instantiate(classPrefab);
|
|
@@ -101,7 +150,9 @@ public class GCZLLayer : MonoBehaviour
|
|
|
{
|
|
|
obj.GetComponent<Image>().sprite = sprites[1];
|
|
|
}
|
|
|
- obj.GetComponent<Button>().onClick.AddListener(()=> {
|
|
|
+
|
|
|
+ obj.GetComponent<Button>().onClick.AddListener(() =>
|
|
|
+ {
|
|
|
InitInformation(temp);
|
|
|
lastClassBtn.GetComponent<Image>().sprite = sprites[1];
|
|
|
obj.GetComponent<Image>().sprite = sprites[0];
|
|
@@ -110,11 +161,14 @@ public class GCZLLayer : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void InitInformation(int index) {
|
|
|
+ void InitInformation(int index)
|
|
|
+ {
|
|
|
if (currentClass == index) return;
|
|
|
- for (int i = informations.Count - 1; i >= 0; i--) {
|
|
|
- Destroy(informations[i]);
|
|
|
+ for (int i = informations.Count - 1; i >= 0; i--)
|
|
|
+ {
|
|
|
+ Destroy(informations[i]);
|
|
|
}
|
|
|
+
|
|
|
informations.Clear();
|
|
|
currentClass = index;
|
|
|
if (currentClass == 0)
|
|
@@ -142,10 +196,9 @@ public class GCZLLayer : MonoBehaviour
|
|
|
|
|
|
obj.GetComponent<Button>().onClick.AddListener(() =>
|
|
|
{
|
|
|
-
|
|
|
currentData = GlobalData.layerUnitDatas[dataIndex];
|
|
|
StaticLod.instance.OnFoucusStatic(priName);
|
|
|
- if (objType == LayerUnitType.ZZ|| objType==LayerUnitType.BZ)
|
|
|
+ if (objType == LayerUnitType.ZZ || objType == LayerUnitType.BZ)
|
|
|
{
|
|
|
Info_DetailButton.gameObject.SetActive(true);
|
|
|
}
|
|
@@ -153,12 +206,14 @@ public class GCZLLayer : MonoBehaviour
|
|
|
{
|
|
|
Info_DetailButton.gameObject.SetActive(false);
|
|
|
}
|
|
|
+
|
|
|
ShowInfoPanelData();
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++)
|
|
|
{
|
|
|
if (GlobalData.layerUnitDatas[i].type == (LayerUnitType)currentClass)
|
|
@@ -183,7 +238,7 @@ public class GCZLLayer : MonoBehaviour
|
|
|
{
|
|
|
currentData = GlobalData.layerUnitDatas[dataIndex];
|
|
|
StaticLod.instance.OnFoucusStatic(priName);
|
|
|
- if (objType == LayerUnitType.ZZ|| objType==LayerUnitType.BZ)
|
|
|
+ if (objType == LayerUnitType.ZZ || objType == LayerUnitType.BZ)
|
|
|
{
|
|
|
Info_DetailButton.gameObject.SetActive(true);
|
|
|
}
|
|
@@ -191,6 +246,7 @@ public class GCZLLayer : MonoBehaviour
|
|
|
{
|
|
|
Info_DetailButton.gameObject.SetActive(false);
|
|
|
}
|
|
|
+
|
|
|
ShowInfoPanelData();
|
|
|
});
|
|
|
}
|
|
@@ -201,10 +257,7 @@ public class GCZLLayer : MonoBehaviour
|
|
|
|
|
|
async Task InitData()
|
|
|
{
|
|
|
- await new WaitUntil(() =>
|
|
|
- {
|
|
|
- return GlobalData.layerUnitDatas.Count > 0;
|
|
|
- });
|
|
|
+ await new WaitUntil(() => { return GlobalData.layerUnitDatas.Count > 0; });
|
|
|
}
|
|
|
|
|
|
public void ShowInfoPanelData()
|
|
@@ -216,5 +269,119 @@ public class GCZLLayer : MonoBehaviour
|
|
|
InfoNoText.text = "未知";
|
|
|
InfoDayText.text = "近期";
|
|
|
InfoPanel.SetActive(true);
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ResetDetailPanel()
|
|
|
+ {
|
|
|
+ photoIndex = 0;
|
|
|
+ lastPhotoButton.gameObject.SetActive(false);
|
|
|
+ nextPhotoButton.gameObject.SetActive(false);
|
|
|
+ DetailShowType(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void DetailShowType(int index)
|
|
|
+ {
|
|
|
+ switch (index)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ detail_modelCG.alpha = 1;
|
|
|
+ detail_designCG.alpha = 0.6f;
|
|
|
+ detail_photoCG.alpha = 0.6f;
|
|
|
+ detail_videoCG.alpha = 0.6f;
|
|
|
+ showFrame.texture = modelRT;
|
|
|
+ lastPhotoButton.gameObject.SetActive(false);
|
|
|
+ nextPhotoButton.gameObject.SetActive(false);
|
|
|
+ OpenAniButton.gameObject.SetActive(currentData.name_pri.Equals("BuYuan") ||
|
|
|
+ currentData.name_pri.Equals("TaoKou"));
|
|
|
+ CloseAniButton.gameObject.SetActive(currentData.name_pri.Equals("BuYuan") ||
|
|
|
+ currentData.name_pri.Equals("TaoKou"));
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ detail_modelCG.alpha = 0.6f;
|
|
|
+ detail_designCG.alpha = 1f;
|
|
|
+ detail_photoCG.alpha = 0.6f;
|
|
|
+ detail_videoCG.alpha = 0.6f;
|
|
|
+ showFrame.texture = null;
|
|
|
+ lastPhotoButton.gameObject.SetActive(false);
|
|
|
+ nextPhotoButton.gameObject.SetActive(false);
|
|
|
+ OpenAniButton.gameObject.SetActive(false);
|
|
|
+ CloseAniButton.gameObject.SetActive(false);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ detail_modelCG.alpha = 0.6f;
|
|
|
+ detail_designCG.alpha = 0.6f;
|
|
|
+ detail_photoCG.alpha = 1f;
|
|
|
+ detail_videoCG.alpha = 0.6f;
|
|
|
+ showFrame.texture = null;
|
|
|
+ lastPhotoButton.gameObject.SetActive(true);
|
|
|
+ nextPhotoButton.gameObject.SetActive(true);
|
|
|
+ OpenAniButton.gameObject.SetActive(false);
|
|
|
+ CloseAniButton.gameObject.SetActive(false);
|
|
|
+ ChangePhoto(0);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ detail_modelCG.alpha = 0.6f;
|
|
|
+ detail_designCG.alpha = 0.6f;
|
|
|
+ detail_photoCG.alpha = 0.6f;
|
|
|
+ detail_videoCG.alpha = 1f;
|
|
|
+ showFrame.texture = null;
|
|
|
+ lastPhotoButton.gameObject.SetActive(false);
|
|
|
+ nextPhotoButton.gameObject.SetActive(false);
|
|
|
+ OpenAniButton.gameObject.SetActive(false);
|
|
|
+ CloseAniButton.gameObject.SetActive(false);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ChangePhoto(int moveIndex)
|
|
|
+ {
|
|
|
+ if (currentData.name_pri.Equals("BuYuan"))
|
|
|
+ {
|
|
|
+ switch (moveIndex)
|
|
|
+ {
|
|
|
+ case -1:
|
|
|
+ if (photoIndex - 1 >= 0)
|
|
|
+ {
|
|
|
+ photoIndex--;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(BY_PhotoUrl[photoIndex], showFrame);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ photoIndex = 0;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(BY_PhotoUrl[photoIndex], showFrame);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (photoIndex + 1 <= BY_PhotoUrl.Length-1)
|
|
|
+ {
|
|
|
+ photoIndex++;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(BY_PhotoUrl[photoIndex], showFrame);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentData.name_pri.Equals("TaoKou"))
|
|
|
+ {
|
|
|
+ switch (moveIndex)
|
|
|
+ {
|
|
|
+ case -1:
|
|
|
+ if (photoIndex - 1 >= 0)
|
|
|
+ {
|
|
|
+ photoIndex--;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(TK_PhotoUrl[photoIndex], showFrame);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ photoIndex = 0;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(TK_PhotoUrl[photoIndex], showFrame);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (photoIndex + 1 <= TK_PhotoUrl.Length-1)
|
|
|
+ {
|
|
|
+ photoIndex++;
|
|
|
+ TextureLoadHelp._Instance.LoadTexFromUrl(TK_PhotoUrl[photoIndex], showFrame);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|