6-13 Switching Login Window And Signup Window
今天要接著製作登入頁面跟註冊頁面的跳轉,註冊頁面的製作方式與前幾章介紹得差不多,請大家舉一反三自己做看看吧。不會做的話請參考以下兩章: 6-11 Decorating Login User Interface https://3dactionrpg.blogspot.tw/2018/05/6-11-decorating-login-user-interface.html 6-12 Finishing Login User Interface https://3dactionrpg.blogspot.tw/2018/05/6-12-finishing-login-user-interface.html 做完以後大致如下圖,登入畫面多了一顆按鈕,按下去後切換到註冊畫面。 然後註冊畫面也差不多,按下去會回到登入畫面。註冊畫面請根據自己的需求做調整,因為我的遊戲範例只用到帳號跟密碼兩種資料,不需要再輸入姓名等其它個資。 接著在Login Window新增一個Script名為LoginWindow.cs。 同理在Signup Window也新增一個SignupWindow.cs。 接著來撰寫程式吧,由於我過去已經針對視窗類型寫了一個共用類別Panel.cs,所以就直接繼承Panel便能使用他的Hide與Show方法。如果不知道Panel.cs寫了哪些內容,可以先參考這篇文章: 5-14 Discard Item And Control Panel Display https://3dactionrpg.blogspot.tw/2018/01/5-14-discard-item-and-control-panel.html 不過我還是提供本次會用到的完整原始碼: LoginWindow.cs: using System.Collections; using System.Collections.Generic; using UnityEngine; public class LoginWindow : Panel { [SerializeField] SignupWindow signupWindow; public void OnLoginButton(){ } public vo...