Esempio n. 1
0
    void Start()
    {
        Instance = this;

        UIRegistPanel = transform.FindChild("UIRegistPanel").GetComponent <UIRegistPanel>();
        UILoginPanel  = transform.FindChild("UILoginPanel").GetComponent <UILoginPanel>();
        UIBuildPanel  = transform.FindChild("UIBuildPanel").GetComponent <UIBuildPanel>();
        UISearchPanel = transform.FindChild("UISearchPanel").GetComponent <UISearchPanel>();
        UIFightPanel  = transform.FindChild("UIFightPanel").GetComponent <UIFightPanel>();

        ScreenAgentMap.Add(EScreen.Regist, new List <MonoBehaviour>()
        {
            UIRegistPanel
        });
        ScreenAgentMap.Add(EScreen.Login, new List <MonoBehaviour>()
        {
            UILoginPanel
        });
        ScreenAgentMap.Add(EScreen.Build, new List <MonoBehaviour>()
        {
            UIBuildPanel
        });
        ScreenAgentMap.Add(EScreen.Search, new List <MonoBehaviour>()
        {
            UISearchPanel
        });
        ScreenAgentMap.Add(EScreen.Fight, new List <MonoBehaviour>()
        {
            UIFightPanel
        });

        ChangeScreen(EScreen.Login);
    }
Esempio n. 2
0
	void Start () {
		Instance = this;

		// 初始化 - Widget
		WidgetYesNo = transform.FindChild("WidgetYesNo").GetComponent<WidgetYesNo>();
		WidgetBuildingControl = transform.FindChild("WidgetBuildingControl").GetComponent<WidgetBuildingControl>();
		WidgetBuildingInfo = transform.FindChild("WidgetBuildingInfo").GetComponent<WidgetBuildingInfo>();
		WidgetBuildingPicker = transform.FindChild("WidgetBuildingPicker").GetComponent<WidgetBuildingPicker>();
		WidgetWaiting = transform.FindChild("WidgetWaiting").GetComponent<WidgetWaiting>();
		WidgetCloud = transform.FindChild("WidgetCloud").GetComponent<WidgetCloud>();
		WidgetCancelMove = transform.FindChild("WidgetCancelMove").GetComponent<WidgetCancelMove>();
		WidgetEventLog = transform.FindChild("WidgetEventLog").GetComponent<WidgetEventLog>();
		
		Action<WidgetBase> initWidget = comp=>{
			comp.Initialize();
			comp.gameObject.SetActive(false);
		};
		
		initWidget(WidgetYesNo);
		initWidget(WidgetBuildingControl);
		initWidget(WidgetBuildingInfo);
		initWidget(WidgetBuildingPicker);
		initWidget(WidgetWaiting);
		initWidget(WidgetCloud);
		initWidget(WidgetCancelMove);
		initWidget(WidgetEventLog);

		// 初始化 - Panel
		UIRegistPanel = transform.FindChild("UIRegistPanel").GetComponent<UIRegistPanel>();
		UILoginPanel = transform.FindChild("UILoginPanel").GetComponent<UILoginPanel>();
		UIBuildPanel = transform.FindChild("UIBuildPanel").GetComponent<UIBuildPanel>();
		UISearchPanel = transform.FindChild("UISearchPanel").GetComponent<UISearchPanel>();
		UIFightPanel = transform.FindChild("UIFightPanel").GetComponent<UIFightPanel>();

		ScreenAgentMap.Add(EScreen.Regist, new List<MonoBehaviour>(){UIRegistPanel});
		ScreenAgentMap.Add(EScreen.Login, new List<MonoBehaviour>(){UILoginPanel});
		ScreenAgentMap.Add(EScreen.Build, new List<MonoBehaviour>(){UIBuildPanel});
		ScreenAgentMap.Add(EScreen.Search, new List<MonoBehaviour>(){UISearchPanel});
		ScreenAgentMap.Add(EScreen.Fight, new List<MonoBehaviour>(){UIFightPanel});

		UIBuildPanel.Initialize();
		UIFightPanel.Initialize();
		
		ChangeScreen(EScreen.Login);
    }