66 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| using AData;
 | ||
| using System.Collections;
 | ||
| using System.Collections.Generic;
 | ||
| using UnityEngine;
 | ||
| using UnityEngine.UI;
 | ||
| using Newtonsoft.Json;
 | ||
| //============================================================
 | ||
| //支持中文,文件使用UTF-8编码
 | ||
| //@author	YangHua
 | ||
| //@create	20230913
 | ||
| //@company	Adam
 | ||
| //
 | ||
| //@description:
 | ||
| //============================================================
 | ||
| namespace Adam
 | ||
| {
 | ||
|     public class AssignmentController : MonoBehaviour
 | ||
|     {
 | ||
|         public GameObject RWPanel;
 | ||
|         public RectTransform rws;
 | ||
|         public Text rwsTip;
 | ||
|         public Button loadBtn;
 | ||
|         public Button closeBtn;
 | ||
|         public Vector2 originPos = new Vector2();
 | ||
|         private string url;
 | ||
| 
 | ||
| 
 | ||
|         public void Init()
 | ||
|         {
 | ||
|             //url = WebIPAdress.Instance.dicAdresses["任务书"];
 | ||
|             //AssignmentDatas aData = await AsyncWebReq.Get<AssignmentDatas>(url);
 | ||
| 
 | ||
|             string json = FileUtil.ReadFromLocal("Local/任务书.json");
 | ||
|             AssignmentDatas aData = JsonConvert.DeserializeObject<AssignmentDatas>(json);
 | ||
|             rwsTip.text = aData.message;
 | ||
|             originPos = rws.anchoredPosition;
 | ||
|             loadBtn.onClick.AddListener(OnLoad);
 | ||
|             closeBtn.onClick.AddListener(() => { SwitchPanel(false); });
 | ||
|             SwitchPanel(false);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         public void SwitchPanel(bool isActive)
 | ||
|         {
 | ||
|             RWPanel.SetActive(isActive);
 | ||
|         }
 | ||
| 
 | ||
|         public void ChangeRWPanelPos()
 | ||
|         {
 | ||
|             rws.anchoredPosition = originPos;
 | ||
|         }
 | ||
| 
 | ||
|         public void OnLoad()
 | ||
|         {
 | ||
|             UIManager.Instance.bottomCotroller.SwitchPanel(true);
 | ||
|             UIManager.Instance.exitBtn.gameObject.SetActive(true);
 | ||
|             rws.anchoredPosition = Vector2.zero;
 | ||
|             loadBtn.gameObject.SetActive(false);
 | ||
|             closeBtn.gameObject.SetActive(true);
 | ||
|             SwitchPanel(false);
 | ||
| 
 | ||
|             SceneLoad.Instance.SceneChange("工具间场景");
 | ||
|         }
 | ||
|     }
 | ||
| }
 |