Example #1
0
        private void updateOpenCout(int value)
        {
            _openCount += value;
            _openCount  = _openCount <= 0 ? 0 : _openCount;
            UIKeyboard.setEnable(true);
            MTBKeyboard.setEnable(false);

            if (_openCount <= 1 && _UIList.ContainsKey(UITypes.MAIN_UI))
            {
                UIKeyboard.setEnable(false);
                MTBKeyboard.setEnable(true);
            }
        }
        //编辑器回放专用
        public void runScript(CameraMoveData data, bool editorMode = false)
        {
            _editorMode  = editorMode;
            _curPathData = data;

            _oraginCamera = CameraManager.Instance.CurCamera;
            if (_oraginCamera.CameraType == MTBCameraType.Third)
            {
                CameraManager.Instance.UseFirstPersonCamera();
            }
            _curControlCamera = CameraManager.Instance.CurCamera;

            _stepSum = _curPathData.steps.ToArray().Length;
            startPosition();
            _workMark = true;
            MTBUserInput.Instance.SetJoyStickActive(false);
            UIManager.Instance.closeUI(UITypes.MAIN_UI);
#if UNITY_EDITOR
            MTBKeyboard.setEnable(false);
#endif
        }
Example #3
0
 private IEnumerator StartServerCoroutine()
 {
     MTBKeyboard.setEnable(false);
     MTBUserInput.Instance.SetJoyStickActive(false);
     //首先确保当前应该加载的所有区块数据都已经产生完(无论是从本地加载还是产生的)
     Debug.Log("等待数据产生中...");
     GUITextDebug.debug("等待数据产生中...");
     World.world.ChangeLoader(NetType.Local);
     while (!World.world.WorldGenerator.HasSingleDataGenerateFinish())
     {
         yield return(new WaitForSeconds(0.5f));
     }
     Debug.Log("数据产生完毕,开始保存当前数据...");
     GUITextDebug.debug("数据产生完毕,开始保存当前数据...");
     foreach (var chunk in World.world.chunks.Values)
     {
         if (chunk.ResetEntity() > 0 || chunk.isUpdate)
         {
             WorldPersistanceManager.Instance.SaveChunk(chunk);
             yield return(null);
         }
     }
     World.world.WorlderLoader.Start();
     Debug.Log("数据保存完毕!开始开启服务器...");
     GUITextDebug.debug("数据保存完毕!开始开启服务器...");
     isServer = true;
     try
     {
         server.StartAcceptClient();
         if (!broadcast.isBroadcast)
         {
             broadcast.StartBroadcast();
         }
     }catch (Exception e)
     {
         GUITextDebug.debug(e.Message + "\n" + e.StackTrace);
     }
     MTBKeyboard.setEnable(true);
     MTBUserInput.Instance.SetJoyStickActive(true);
 }
        public void RecoveryState()
        {
            _workMark = false;
            MTBUserInput.Instance.SetJoyStickActive(true);
            UIManager.Instance.showUI <MainUI>(UITypes.MAIN_UI);
            EventManager.SendEvent(PlotEvent.CAMERAMOVEFINISH, _curTaskId, _curStepId);
            endPosition();

            if (_curControlCamera.CameraType != _oraginCamera.CameraType)
            {
                if (_oraginCamera.CameraType == MTBCameraType.First)
                {
                    CameraManager.Instance.UseFirstPersonCamera();
                }
                else
                {
                    CameraManager.Instance.UseThirdPersonCamera();
                }
            }

#if UNITY_EDITOR
            MTBKeyboard.setEnable(true);
#endif
        }