Esempio n. 1
0
    // 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;
    }
Esempio n. 2
0
 public void ShowUI(bool jsonload)
 {
     view = GameObject.FindObjectOfType <LoadingUI>();
     view.InitUI();
     this.jsonLoad = jsonload;
     LoadAreaResource();
 }
Esempio n. 3
0
    //=======呼叫餐廳列表介面==========
    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();
    }
Esempio n. 4
0
    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);
        }
    }
Esempio n. 5
0
    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);
    }
Esempio n. 6
0
    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);
        }
    }
Esempio n. 7
0
        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
        }
Esempio n. 8
0
    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);
            };
        };
    }
Esempio n. 9
0
        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);
            }
        }
Esempio n. 10
0
    //初始化游戏 加载起始界面
    protected void LoadingGame()
    {
        //添加监听
        EventCenter.Instance.AddEventListenerPermanently((int)EHGameProcessEventID.Process_Loading_Event, FinishLoadingGame);

        _loadingUI = ResourcesManager.Instance.GetIniPrefabResourceByName("LoadingUI").AddComponent <LoadingUI>();
        _loadingUI.Initialization(null, false);
    }
Esempio n. 11
0
        private async CTask ShowHomeUI(ProcedureOwner procedureOwner)
        {
            homeUi           = Mgr.UI.Show <HomeUI>();
            homeUi.procedure = this;
            await homeUi.Await();

            LoadingUI.Hide();
        }
Esempio n. 12
0
        private async CTask ShowWarUI(ProcedureOwner procedureOwner)
        {
            warUi           = Mgr.UI.Show <WarUI>();
            warUi.procedure = this;
            await warUi.Await();

            LoadingUI.Hide();
        }
Esempio n. 13
0
        /// <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);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// 资源初始化结束
 /// </summary>
 void OnResInitOK()
 {
     LoadingUI.Instance().Close();
     resMgr.Initialize();
     resMgr.InitResManifest(AppConst.ResIndexFile, delegate()
     {
         Debug.Log("Initialize OK!!!");
         this.OnInitializeOK();
     });
 }
Esempio n. 15
0
 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!");
 }
Esempio n. 16
0
        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
        }
Esempio n. 17
0
        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")}'.");
        }
Esempio n. 18
0
 public static void Show()
 {
     if (instance != null)
     {
         instance.gameObject.SetActive(true);
     }
     else
     {
         instance = UISystem.InstantiateUI("loading").GetComponent <LoadingUI>();
     }
     isLoading = true;
 }
Esempio n. 19
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 20
0
 public void Init()
 {
     if (Global.GetInstance() != null)
     {
         mLoading = UIManager.GetInstance().GetNewUI <LoadingUI>();
         this.transform.SetParent(Global.GetInstance().transform);
     }
     else
     {
         Debug.LogWarning("Global对象为空!");
     }
 }
Esempio n. 21
0
        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();
        }
Esempio n. 22
0
    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();
            }
        }
    }
Esempio n. 23
0
 void Awake()
 {
     if (!_exists)
     {
         _exists  = true;
         Instance = this;                         //temp
         DontDestroyOnLoad(transform.gameObject); //使物件切換場景時不消失
     }
     else
     {
         Destroy(gameObject); //破壞場景切換後重複產生的物件
         return;
     }
 }
Esempio n. 24
0
    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();
        }
    }
Esempio n. 25
0
    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>());
        }
    }
Esempio n. 26
0
        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>();
        }
Esempio n. 27
0
    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);
    }
Esempio n. 28
0
 /// <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();
     }
 }
Esempio n. 29
0
    //加载游戏完成
    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);
    }
Esempio n. 30
0
        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;
        }