54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System.Collections; | |||
|  | using System.Collections.Generic; | |||
|  | using UnityEngine; | |||
|  | using UnityEngine.UI; | |||
|  | 
 | |||
|  | public class PanelShop : BasePanel | |||
|  | { | |||
|  |     [SerializeField] Button mBtnClose; | |||
|  |     [SerializeField] Transform mCtnTabs; | |||
|  |     [SerializeField] List<IListView> mLists; | |||
|  | 
 | |||
|  |     private List<TabButton> mTabs; | |||
|  |     private int mCurIndex = -1; | |||
|  | 
 | |||
|  |     private void Awake() | |||
|  |     { | |||
|  |         UIUtils.BindBtn(mBtnClose, Close); | |||
|  | 
 | |||
|  |         mTabs = Utils.GetChildListFirstLayer<TabButton>(mCtnTabs); | |||
|  | 
 | |||
|  |         for (int i = 0; i < mTabs.Count; i++) | |||
|  |         { | |||
|  |             mTabs[i].DelClick = OnClickTab; | |||
|  |         } | |||
|  |     } | |||
|  | 
 | |||
|  |     public override void OnOpen() | |||
|  |     { | |||
|  |         base.OnOpen(); | |||
|  | 
 | |||
|  |         mTabs[0].gameObject.SetActive(GameConfig.Instance.UseDiamond); | |||
|  |         mTabs[2].gameObject.SetActive(TKGSDKManager.Instance.GetConfigBool(TKGParamKey.UseBoard.ToString())); | |||
|  | 
 | |||
|  |         if (mCurIndex < 0) | |||
|  |         { | |||
|  |             OnClickTab(GameConfig.Instance.UseDiamond ? 0 : 1); | |||
|  |         } | |||
|  |     } | |||
|  | 
 | |||
|  |     private void OnClickTab(int pIndex) | |||
|  |     { | |||
|  |         mCurIndex = pIndex; | |||
|  | 
 | |||
|  |         for (int i = 0; i < mTabs.Count; i++) | |||
|  |         { | |||
|  |             mTabs[i].SetOn(i == mCurIndex); | |||
|  |             mLists[i].Show(i == mCurIndex); | |||
|  |             if (i == mCurIndex) | |||
|  |             { | |||
|  |                 mLists[i].LoadData(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |