111 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			111 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BX; | |||
|  | using System.Collections; | |||
|  | using System.Collections.Generic; | |||
|  | using UnityEngine; | |||
|  | using UnityEngine.UI; | |||
|  | 
 | |||
|  | /// <summary> | |||
|  | /// <20><><EFBFBD><EFBFBD>UI | |||
|  | /// </summary> | |||
|  | public class ScoreUI : UIBaseClass | |||
|  | { | |||
|  |     public Button score1Btn; | |||
|  |     public Button score2Btn; | |||
|  |     public Button score3Btn; | |||
|  |     public Button score4Btn; | |||
|  |     public Button score5Btn; | |||
|  | 
 | |||
|  |     public Button cloesBtn; | |||
|  | 
 | |||
|  |     public List<Image> scoreIcon=new List<Image>(); | |||
|  | 
 | |||
|  |     private void Start() | |||
|  |     { | |||
|  |         Score1BtnLogic(); | |||
|  |         Score2BtnLogic(); | |||
|  |         Score3BtnLogic(); | |||
|  |         Score4BtnLogic(); | |||
|  |         Score5BtnLogic(); | |||
|  |         CloesBtnListener(); | |||
|  |     } | |||
|  | 
 | |||
|  |     public override void OnShow() | |||
|  |     { | |||
|  |         base.OnShow(); | |||
|  |         BXSdk.Instance.LogEvent("Rate_Show"); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void SetScore(int number) | |||
|  |     { | |||
|  |         BXSdk.Instance.LogEvent("Rate_Click"); | |||
|  |         BXSdk.Instance.LogEvent("Rate_Click_"+number); | |||
|  |         for (int i = 0; i < scoreIcon.Count; i++) | |||
|  |         { | |||
|  |             scoreIcon[i].gameObject.SetActive(false); | |||
|  |         } | |||
|  |         for (int i = 0; i < number; i++) | |||
|  |         { | |||
|  |             scoreIcon[i].gameObject.SetActive(true); | |||
|  |         } | |||
|  |         if(number<=4) | |||
|  |         { | |||
|  |             UIManager.Instance.GetUI<TopmostLayerUI>().SetTips("Thanks for your feedback."); | |||
|  |             BXSdk.Instance.LogEvent("Rate_Close"); | |||
|  |         } | |||
|  |         if(number==5) | |||
|  |         { | |||
|  |             BXSdk.Instance.Review(); | |||
|  |         } | |||
|  |         DeleteMe(); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void Score1BtnLogic() | |||
|  |     { | |||
|  |         score1Btn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             SetScore(1); | |||
|  |         }); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void Score2BtnLogic() | |||
|  |     { | |||
|  |         score2Btn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             SetScore(2); | |||
|  |         }); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void Score3BtnLogic() | |||
|  |     { | |||
|  |         score3Btn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             SetScore(3); | |||
|  |         }); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void Score4BtnLogic() | |||
|  |     { | |||
|  |         score4Btn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             SetScore(4); | |||
|  |         }); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void Score5BtnLogic() | |||
|  |     { | |||
|  |         score5Btn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             SetScore(5); | |||
|  |         }); | |||
|  |     } | |||
|  | 
 | |||
|  |     private void CloesBtnListener() | |||
|  |     { | |||
|  |         cloesBtn.onClick.AddListener(() => | |||
|  |         { | |||
|  |             DeleteMe(); | |||
|  |             BXSdk.Instance.LogEvent("Rate_Close"); | |||
|  |         }); | |||
|  |     } | |||
|  | } |