public override void Execute(int eventcode, object message) { //string str; switch (eventcode) { case SceneCode.LOAD_SCENE: //str = message as string; //loadMsg.Change(1, "02_Main", SceneManager.sceneLoaded); loadMsg = message as SceneLoadMsg; loadMsg.Change(loadMsg.Index, loadMsg.Name, loadMsg.LoadAction); StartCoroutine(loadScene(loadMsg)); //MsgCenter.Instance.Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "切换场景成功"); break; } }
private IEnumerator loadScene(SceneLoadMsg loadMsg) { //登陆成功切换场景 if (loadMsg.Index != -1) { yield return(new WaitForSeconds(1f)); SceneManager.LoadScene(loadMsg.Index); } else if (loadMsg.Name != null) { yield return(new WaitForSeconds(1f)); SceneManager.LoadScene(loadMsg.Name); } }
void Start() { sceneLoadMsg = new SceneLoadMsg(); socketMsg = new SocketMsg(); Bind(UIEvent.SHOW_ROOM_ENTER_BUTTON); Button_Match = transform.Find("Button_Match").GetComponent <Button>(); Button_Cancel = transform.Find("Button_Cancel").GetComponent <Button>(); Button_Enter = transform.Find("Button_Enter").GetComponent <Button>(); Text_Matching = transform.Find("Text_Matching").GetComponent <Text>(); Image_Logo = transform.Find("Image_Logo").GetComponent <Image>(); Button_Match.onClick.AddListener(matchBtnClicker); Button_Cancel.onClick.AddListener(cancelBtnClicker); Button_Enter.onClick.AddListener(enterBtnClicker); defaultstr = Text_Matching.text; setObjectActive(false); Button_Enter.gameObject.SetActive(false); }