Untitled
unknown
csharp
2 years ago
2.9 kB
15
Indexable
private IEnumerator IEGoToCity(string sceneCityName)
{
//- hide main menu
UIDialogController.Instance.HideDialog<DialogMainMenu>();
Debug.Log($"[IEGoToCity] 1");
// if(SceneCurrentCity == ListSceneCity[sceneCity.buildIndex - 3])
HideScene(SceneEnum.MainMenu);
Debug.Log($"[IEGoToCity] 2");
Scene sceneCity = SceneManager.GetSceneByName(sceneCityName);
if (!(sceneCity.IsValid() && sceneCity.isLoaded))
{
// await TaskGoToCity();
SceneManager.LoadScene(sceneCityName, LoadSceneMode.Additive);
// SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene());
}
Debug.Log($"[IEGoToCity] 3");
EventDispatch.Ins.Dispatch(null, Defines.Events.ShowAllHintBuyHouse);
Debug.Log($"[IEGoToCity] 4");
yield return null;
Debug.Log($"[IEGoToCity] 5");
sceneCity = SceneManager.GetSceneByName(sceneCityName);
Debug.Log($"[IEGoToCity] 6");
if (sceneCity.isLoaded)
{
SceneGame currentScene = sceneCity.GetRootGameObjects()[0].GetComponentInChildren<SceneGame>();
UnityLog.LogC(string.Format("@VinD: currentScene.name = {0}", currentScene.name));
Debug.Log($"[IEGoToCity] 7");
if (!(ListSceneCity.Contains(currentScene) && currentScene != null))
ListSceneCity.Add(currentScene);
}
Debug.Log($"[IEGoToCity] 8");
// SetCurrentSceneCity(sceneCity.buildIndex - 3);
SceneCurrentCity = ListSceneCity[sceneCity.buildIndex - 2];
SceneManager.SetActiveScene(SceneManager.GetSceneByName(sceneCityName));
ShowScene(SceneEnum.City);
BuildCityManager.Ins.OnEnterCityScene();
Debug.Log($"[IEGoToCity] 9");
if (CameraTouchMovement.Ins != null)
CameraTouchMovement.Ins.Camera.orthographicSize = CameraTouchMovement.ZOOM_OUT_LIMIT;
MoveCloudOut();
//- hide UI city
BuildCityManager.Ins.IsInteractable = true;
GameUIController.Ins.changingScene = false;
SetCameraForUIDialogManager(SceneEnum.City);
// EventDispatch.RaiseEvent(Defines.Events.CoinChange);
Input.multiTouchEnabled = true;
EventDispatch.RaiseEventWithData(sceneCityName, Defines.Events.SetCityAccessible);
UserProfileData.Ins.currentCity = SceneManager.GetSceneByName(sceneCityName).name;
UnityLog.LogC(string.Format("@VinD: UserProfileData.Ins.currentCity = {0}", UserProfileData.Ins.currentCity));
Debug.Log($"[IEGoToCity] 10");
}Editor is loading...