// Use this for initialization void Start() { Cursor.lockState = CursorLockMode.Locked; camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); cc = GetComponent <CharacterController>(); handCam = camera.transform.Find("Camera").GetComponent <Camera>(); handAnimator = camera.transform.Find("hand").GetComponent <Animator>(); m_HeadBob.Setup(camera, 5); transform.position = DataCenter.spawnPosition; transform.localEulerAngles = new Vector3(0, DataCenter.spawnRotation.y, 0); camera.transform.localEulerAngles = new Vector3(DataCenter.spawnRotation.z, 0, 0); NetworkManager.Register(ENUM_CMD.CS_ADD_BLOCK_NOTIFY, OnAddBlockNotify); NetworkManager.Register(ENUM_CMD.CS_DELETE_BLOCK_NOTIFY, OnDeleteBlockNotify); LoadingUI.Close(); CrossHair.Show(); Hand.Show(); blockMeshFilter = camera.transform.Find("hand/block").GetComponent <MeshFilter>(); blockMeshRenderer = camera.transform.Find("hand/block").GetComponent <MeshRenderer>(); handMeshRenderer = camera.transform.Find("hand").GetComponent <MeshRenderer>(); position = transform.position; forward = transform.forward; isInitialized = true; }
public void ShowUI(bool jsonload) { view = GameObject.FindObjectOfType <LoadingUI>(); view.InitUI(); this.jsonLoad = jsonload; LoadAreaResource(); }
//=======呼叫餐廳列表介面========== public void buttonEat() { if (GetRes.isLoadingLoc) { return; // 如果正在讀裝置位置,則這個按鈕不回應 } if (UIswitcher.GetBool("eat")) // 如果原本是開的,就關掉 { UIswitcher.SetBool("eat", false); LoadingUI.Hide(); //loadingIndicatorAnimator.SetBool("Enabled", false); // used for loading animator } else // 如果原本是關的,就打開 { UIswitcher.SetBool("eat", true); //LoadingUI.Show(); //loadingIndicatorAnimator.SetBool("Enabled", true); // used for loading animator if (FoodLis.resList == null || FoodLis.resList.Count == 0) { if (FoodLis.ins != null) { FoodLis.ins.GetResNames(); } } } ResSelecteOK(); Sounds.PlayButton(); }
IEnumerator LoadScene(string scene) { Debug.Log("scene: " + scene); if (scene == "") { yield break; } async = SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive); if (async == null) { yield break; } //instantiate the loading screen, with progress bar. loadingUIinstance = Instantiate(loadingUIPrefab) as LoadingUI; //update progress bar as scene loads. while (!async.isDone) { loadingUIinstance.setPercentage(async.progress); yield return(null); } loadingUIinstance.Destroy(); loadingUIinstance = null; async = SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene()); while (!async.isDone) { yield return(null); } }
public static GameObject InstantiateUI(GameObject uiobj) { if (canvas == null) { canvas = GameObject.Find("Canvas"); if (canvas == null) { InitializeCanvas(); } } uiobj.transform.SetParent(canvas.transform); uiobj.transform.localScale = Vector3.one; if (LoadingUI.isLoading) { LoadingUI.SetOnTop(); } RectTransform rt = uiobj.GetComponent <RectTransform>(); rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0); rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, 0, 0); rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0); rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, 0, 0); rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; return(uiobj); }
static void OnLoginRes(object data) { CSLoginRes rsp = NetworkManager.Deserialize <CSLoginRes>(data); Debug.Log("OnLoginRes,retcode=" + rsp.RetCode); if (rsp.RetCode == 0) { DataCenter.playerID = rsp.PlayerData.PlayerID; DataCenter.name = rsp.PlayerData.Name; DataCenter.spawnPosition = rsp.PlayerData.Position.ToVector3(); DataCenter.spawnRotation = rsp.PlayerData.Rotation.ToVector3(); ItemSelectPanel.Init(rsp.PlayerData.SelectIndex, rsp.PlayerData.SelectItems); DataCenter.state = ClientState.InRoom; ChunkManager.blockAttrs = rsp.BlockAttrs; LoginPanel.Close(); MainMenu.Close(); LoadingUI.Show(); SceneManager.LoadScene("GameScene"); ChatPanel.AddLine(DataCenter.name + ", welcome!"); } else { FastTips.Show(rsp.RetCode); } }
protected override void _Init() { // 读取存储数据 InitFilePath(); LoadLoginData(); LoadRegionData(); clientId = SystemInfo.deviceUniqueIdentifier; Debug.Log("client=" + clientId); clientId = MD5Hash.Hash(Encoding.UTF8.GetBytes(clientId)); Debug.Log("client=" + clientId); loginUI.Init(); loginUI.callbackLogin = OnLoginInput; regionList.AddCallbackChangePage(OnRegionChangePage); regionList.AddCallbackClick(OnClickRegion); regionList.Init(); GameObject obj = Instantiate(loadingPrefab) as GameObject; obj.transform.SetParent(this.transform); obj.transform.localPosition = new Vector3(0, 0, 2); obj.transform.localRotation = Quaternion.identity; loadingUI = obj.GetComponent <LoadingUI>(); loadingUI.Init(); #if UNITY_EDITOR || UNITY_STANDALONE_WIN ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; #endif }
public void OpenScene(List <int> uiList, Action completedFunc, string sceneName) { GameObject loading = Instantiate(LoadingPrefab); LoadingUI uiScript = loading.GetComponent <LoadingUI>(); loading.transform.parent = GameRoot.GetInstance().LoadingUI.transform; loading.transform.localPosition = Vector3.zero; //loading.GetComponent<RectTransform>().position = new Vector3(Screen.width/2, Screen.height, 0); loading.transform.localScale = Vector3.one; loadingCache.Insert(0, loading); GameObject loadingImage = uiScript.loadingImage; loadingImage.transform.localScale = Vector3.one * ((float)Screen.height / (float)Screen.width) / (1334f / 750f); GameObject siteBand = uiScript.siteBand; Text siteName = uiScript.siteName; loadingImage.SetActive(true); siteBand.SetActive(false); loadingImage.GetComponent <Image>().sprite = loadingSprite; siteName.text = StrUtil.GetText(sceneName); loadingImage.GetComponent <Image>().color = new Color(0, 0, 0, 0); loadingImage.GetComponent <Image>().DOColor(new Color(1, 1, 1, 1), 0.8f).onComplete += () => { //loading at here HideUI(true); sceneFuncList.Add(completedFunc); loadingImage.GetComponent <Image>().DOColor(new Color(0, 0, 0, 0), 0.8f).onComplete += () => { siteBand.SetActive(true); siteBand.GetComponent <Image>().color = new Color(1, 1, 1, 0); siteBand.GetComponent <Image>().DOColor(new Color(1, 1, 1, 1), 0.5f).onComplete += () => { siteBand.GetComponent <Image>().DOColor(new Color(1, 1, 1, 1), 2f).onComplete += () => { siteBand.GetComponent <Image>().DOColor(new Color(1, 1, 1, 0), 0.5f).onComplete += () => { siteBand.SetActive(false); }; }; }; siteName.GetComponent <Text>().color = new Color(1, 0.9f, 0.65f, 0); siteName.GetComponent <Text>().DOColor(new Color(1, 0.9f, 0.65f, 1), 0.5f).onComplete += () => { siteName.GetComponent <Text>().DOColor(new Color(1, 0.9f, 0.65f, 1), 2f).onComplete += () => { siteName.GetComponent <Text>().DOColor(new Color(1, 0.9f, 0.65f, 0), 0.5f).onComplete += () => { loadingCache.Remove(loading); Destroy(loading); }; }; }; foreach (var ui in uiList) { OpenUI(ui); ++sceneCache; } loadingImage.SetActive(false); }; }; }
private void onItemDownloaded(DownloadItemResult_t callback) { if (this.installing == null || this.installing.Count == 0) { return; } this.installing.Remove(callback.m_nPublishedFileId); LoadingUI.updateProgress((float)(this.installed - this.installing.Count) / (float)this.installed); ulong num; string text; uint num2; if (SteamUGC.GetItemInstallInfo(callback.m_nPublishedFileId, ref num, ref text, 1024u, ref num2) && ReadWrite.folderExists(text, false)) { if (WorkshopTool.checkMapMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.MAP)); if (ReadWrite.folderExists(text + "/Bundles", false)) { Assets.load(text + "/Bundles", false, false, EAssetOrigin.WORKSHOP); } } else if (WorkshopTool.checkLocalizationMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.LOCALIZATION)); } else if (WorkshopTool.checkObjectMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.OBJECT)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkItemMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.ITEM)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkVehicleMeta(text, false)) { this.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.VEHICLE)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } if (Directory.Exists(text + "/Translations")) { Translator.registerTranslationDirectory(text + "/Translations"); } if (Directory.Exists(text + "/Content")) { Assets.searchForAndLoadContent(text + "/Content"); } } if (this.installing.Count == 0) { Provider.launch(); } else { SteamUGC.DownloadItem(this.installing[0], true); } }
//初始化游戏 加载起始界面 protected void LoadingGame() { //添加监听 EventCenter.Instance.AddEventListenerPermanently((int)EHGameProcessEventID.Process_Loading_Event, FinishLoadingGame); _loadingUI = ResourcesManager.Instance.GetIniPrefabResourceByName("LoadingUI").AddComponent <LoadingUI>(); _loadingUI.Initialization(null, false); }
private async CTask ShowHomeUI(ProcedureOwner procedureOwner) { homeUi = Mgr.UI.Show <HomeUI>(); homeUi.procedure = this; await homeUi.Await(); LoadingUI.Hide(); }
private async CTask ShowWarUI(ProcedureOwner procedureOwner) { warUi = Mgr.UI.Show <WarUI>(); warUi.procedure = this; await warUi.Await(); LoadingUI.Hide(); }
/// <summary> /// 更新LOADING进度 /// </summary> public static void UpdateLoadingProgress(string text, float curr, float max) { var loadingUi = LoadingUI.Instance(); if (loadingUi != null) { loadingUi.UpdateLoadingText(text); loadingUi.UpdateLoadingProgress(curr, max); } }
/// <summary> /// 资源初始化结束 /// </summary> void OnResInitOK() { LoadingUI.Instance().Close(); resMgr.Initialize(); resMgr.InitResManifest(AppConst.ResIndexFile, delegate() { Debug.Log("Initialize OK!!!"); this.OnInitializeOK(); }); }
void OnClickSingle() { DataCenter.name = "Steve"; DataCenter.spawnPosition = NBTHelper.GetPlayerPos(); DataCenter.spawnRotation = NBTHelper.GetPlayerRot(); MainMenu.Close(); LoadingUI.Show(); SceneManager.LoadScene("GameScene"); //ChatPanel.AddLine(DataCenter.name + ", welcome!"); }
public override void Initialize() { QualitySettings.vSyncCount = 2; //Screen.SetResolution(640, 1136, false); DOTween.Init(true, true, LogBehaviour.Default); Screen.sleepTimeout = SleepTimeout.NeverSleep; Util.SetDebugState(AppConst.LogMode); //设置日志 Application.targetFrameRate = AppConst.GameFrameRate; LoadingUI.Instance().Open(ResInitialize); //创建LoadingUI }
private void OnLoadSceneUpdate(object sender, GameEventArgs e) { LoadSceneUpdateEventArgs ne = (LoadSceneUpdateEventArgs)e; if (ne.UserData != this) { return; } LoadingUI.SetValue(0.8f * ne.Progress); Log.Info($"Load scene '{ne.SceneAssetName}' update, progress '{ne.Progress.ToString("P2")}'."); }
public static void Show() { if (instance != null) { instance.gameObject.SetActive(true); } else { instance = UISystem.InstantiateUI("loading").GetComponent <LoadingUI>(); } isLoading = true; }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public void Init() { if (Global.GetInstance() != null) { mLoading = UIManager.GetInstance().GetNewUI <LoadingUI>(); this.transform.SetParent(Global.GetInstance().transform); } else { Debug.LogWarning("Global对象为空!"); } }
private void SplashPage_Loaded(object sender, RoutedEventArgs e) { PositionImage(); Window.Current.SizeChanged += Current_SizeChanged; LogoEffectAnim = LogoImage.Offset(0, -64, 250, 100); LogoEffectAnim.Completed += (_, s) => { LoadingUI.Fade(1.0f, 250).Start(); }; LogoEffectAnim.Start(); }
public static void ForceActiveProgress() { WindowNode tNode = WindowManager.Instance.FindWindowNodeByName(LoadingUI.UIAssetName); if (tNode != null) { LoadingUI tMonoBehaviour = tNode.WindowMonoBehaviour as LoadingUI; if (tMonoBehaviour != null) { tMonoBehaviour.ForceProgressSetActive(); } } }
void Awake() { if (!_exists) { _exists = true; Instance = this; //temp DontDestroyOnLoad(transform.gameObject); //使物件切換場景時不消失 } else { Destroy(gameObject); //破壞場景切換後重複產生的物件 return; } }
public IEnumerator ReGenerateMap() { LoadingUI loadingUI = GlobalUImanager.Instance.LoadingUI.GetComponent <LoadingUI>(); loadingUI.PlayAnimation(); float time = loadingUI.GetAnimationTime(); yield return(new WaitForSeconds(time)); BattleMap.ReMakeMap(); if (BattleReSelectMap != null) { BattleReSelectMap(); } }
void UISort() { resButtons = new List <Button>(); LoadingUI.Hide(); //loadingIndicatorAnimator.SetBool("Enabled", false); // used for loading animator for (int i = 0; i < resList.Count; i++) { GameObject newButton = Instantiate(resButtonPrefab, buttonsParent); FoodListButton f = newButton.GetComponent <FoodListButton>(); f.UItext.text = resList[i]; f.buttonIndex = i; resButtons.Add(newButton.GetComponent <Button>()); } }
public static async CTask ChangeScene <TState>(this IFsm fsm, string sceneName) where TState : FsmState { await LoadingUI.Show(); Mgr.UI.CloseAllOpenUi(); fsm.SetData <VarString>("SceneName", sceneName); fsm.SetData <VarString>("TargetProcedure", typeof(TState).Name); Fsm fsmImplement = (Fsm)fsm; if (fsmImplement == null) { throw new GameFrameworkException("FSM is invalid."); } fsmImplement.ChangeState <ProcedureChangeScene>(); }
public void StartChangeScene(string SceneName) //로딩창이 필요한 씬 이동들 { if (SceneName.CompareTo(eStateScene.TitleScene.ToString()) == 0) { currentScene = eStateScene.TitleScene; } else { currentScene = eStateScene.InGame; } GameObject go = Instantiate(goLoadingWindow, transform); wndLoad = go.GetComponent <LoadingUI>(); wndLoad.OpenWindow(); _asyncOpr = SceneManager.LoadSceneAsync(SceneName); }
/// <summary> /// 更新完成 /// </summary> /// <param name="verfile"></param> /// <param name="remoteVerStr"></param> /// <param name="updateOK"></param> void OnUpdateOK(string verfile, string remoteVerStr, Action updateOK) { LoadingUI.Instance().Close(); if (string.IsNullOrEmpty(remoteVerStr)) { Debug.LogWarning("没有发现可更新资源,更新完成!"); } else { File.WriteAllText(verfile, remoteVerStr); Debug.LogWarning("更新完成!更新版本号:" + remoteVerStr); } if (updateOK != null) { updateOK(); } }
//加载游戏完成 protected void FinishLoadingGame(IEvent evt) { EHLoadingEvent e = evt as EHLoadingEvent; if (!e._state) { //游戏加载失败 } Destroy(_loadingUI.gameObject); _loadingUI = null; _loginUI = ResourcesManager.Instance.GetIniPrefabResourceByName("LoginUI").AddComponent <LoginUI>(); _loginUI.Initialization(null, false); EventCenter.Instance.RemoveEventListenerPermanently((int)EHGameProcessEventID.Process_Loading_Event, FinishLoadingGame); }
private void OnLoadSceneSuccess(object sender, GameEventArgs e) { LoadSceneSuccessEventArgs ne = (LoadSceneSuccessEventArgs)e; if (ne.UserData != this) { return; } Log.Info($"Load scene '{ne.SceneAssetName}' OK."); // if (m_BackgroundMusicId > 0) // { // GameEntry.Sound.PlaySound() .PlayMusic(m_BackgroundMusicId); // } LoadingUI.SetValue(0.8f); m_IsChangeSceneComplete = true; }