123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System.Collections.Generic;
- using Excel2Json;
- using UnityEngine;
- using UnityEngine.UI;
- namespace Mono
- {
- [UIBinding(prefab = "CSGPanel")]
- public class CSGPanel : UIPanel
- {
- public Button Btn_DQ;
- public Button Btn_SR;
- public Button Btn_Return;
- public Button Btn_OnClick;
- public Button Btn_OnClick01;
- public RectTransform RegionScrollView;
- public RectTransform PoetScrollView;
- public RectTransform PoetContent;
- public RectTransform RegionContent;
- public RectTransform DQ;
- public RectTransform SR;
- public override void GetUIData()
- {
- Btn_DQ = UIData.Get<Button>("Btn_DQ");
- Btn_SR = UIData.Get<Button>("Btn_SR");
- Btn_Return = UIData.Get<Button>("Btn_Return");
- Btn_OnClick = UIData.Get<Button>("Btn_OnClick");
- Btn_OnClick01 = UIData.Get<Button>("Btn_OnClick01");
- RegionScrollView = UIData.Get<RectTransform>("RegionScrollView");
- PoetScrollView = UIData.Get<RectTransform>("PoetScrollView");
- PoetContent = UIData.Get<RectTransform>("PoetContent");
- RegionContent = UIData.Get<RectTransform>("RegionContent");
- DQ = UIData.Get<RectTransform>("DQ");
- SR = UIData.Get<RectTransform>("SR");
- }
- public override void AddButtonEvent()
- {
- Btn_DQ.onClick.AddListener(() =>
- {
- DQ.gameObject.SetActive(true);
- SR.gameObject.SetActive(false);
- UIManager.Instance.PlayAudioClip("UI_OpenPage");
- });
- Btn_SR.onClick.AddListener(() =>
- {
- DQ.gameObject.SetActive(false);
- SR.gameObject.SetActive(true);
- UIManager.Instance.PlayAudioClip("UI_OpenPage");
- });
- Btn_Return.onClick.AddListener(() =>
- {
- UIManager.Instance.HideUIPanel<CSGPanel>();
- UIManager.Instance.LoadAndOpenPanel<MainScenePanel>(UIManager.UILayer.Middle);
- UIManager.Instance.PlayAudioClip("UI_Close");
- });
- Btn_OnClick.onClick.AddListener(() =>
- {
- UIManager.Instance.HideUIPanel<CSGPanel>();
- UIManager.Instance.LoadAndOpenPanel<ChatPanel>(UIManager.UILayer.Middle);
- });
- Btn_OnClick01.onClick.AddListener(() =>
- {
- UIManager.Instance.HideUIPanel<CSGPanel>();
- UIManager.Instance.LoadAndOpenPanel<ChatPanel>(UIManager.UILayer.Middle);
- });
- }
- public override void Show()
- {
- base.Show();
- //CustomInit();
- }
- public List<RegionItem> RegionItems = new List<RegionItem>();
- public void CustomInit()
- {
- for (var i = 0; i < RegionItems.Count; i++)
- {
- UIManager.Instance.RecUICom(this, RegionItems[i]);
- }
- RegionItems.Clear();
- RegionConfig[] regionConfigs = ConfigComponent.Instance.GetAll<RegionConfig>();
- for (var i = 0; i < regionConfigs.Length; i++)
- {
- RegionItem regionItem = UIManager.Instance.CreatUICom<RegionItem>(this, RegionContent);
- regionItem.CustomInit(regionConfigs[i]);
- RegionItems.Add(regionItem);
- }
- // RegionItem regionItem = UIManager.Instance.CreatUICom<RegionItem>(this, RegionContent);
- // regionItem.CustomInit("江津");
- //
- // RegionItem regionItem1 = UIManager.Instance.CreatUICom<RegionItem>(this, RegionContent);
- // regionItem1.CustomInit("北碚");
- //
- // RegionItem regionItem2 = UIManager.Instance.CreatUICom<RegionItem>(this, RegionContent);
- // regionItem2.CustomInit("合川");
- }
- }
- }
|