Пример #1
0
 protected virtual void Awake()
 {
     this._gameSettings          = CDependencyResolver.Get <CGameSettings>();
     this._blockingEventsManager = CDependencyResolver.Get <CBlockingEventsManager>();
     this._canvas            = this.GetComponent <Canvas>();
     this._fader             = CDependencyResolver.Get <CFader>();
     this._navigationManager = CDependencyResolver.Get <CUINavigationManager>();
 }
Пример #2
0
    void OnGameSettingsInit()
    {
        CGameSettings _ = CGameSettings.Instance;

        CBase.Log("Begin Load tab file...");
        _.LoadTab <CTestTabInfo>("setting/test_tab.bytes");
        CBase.Log("Output the tab file...");
        foreach (CTestTabInfo info in _.GetInfos <CTestTabInfo>())
        {
            CBase.Log("Id:{0}, Name: {1}", info.Id, info.Name);
        }
    }
Пример #3
0
        /// <summary>
        /// Used to update the camera frame-per-frame
        /// </summary>
        /// <param name="gametime">GameTime snapshot</param>
        /// <param name="keyState">Current KeyboardState</param>
        /// <param name="mouseState">Current mouseState</param>
        public void Update(GameTime gametime, float camVelocity = 0.3f, bool isUnderWater = false, float waterLevel = 0f, KeyboardState keyState = default(KeyboardState), MouseState mouseState = default(MouseState),
                           KeyboardState oldKeyState            = default(KeyboardState))
        {
            if (shouldUpdateMiddleScreen)
            {
                _middleScreen            = new Point(mouseState.X, mouseState.Y);
                shouldUpdateMiddleScreen = false;
            }

            if (_Viewport.Bounds != Display2D.C2DEffect.softwareViewport.Bounds)
            {
                // Window size have changed
                _Viewport = Display2D.C2DEffect.softwareViewport;

                _aspectRatio    = _Viewport.AspectRatio;
                _projection     = Matrix.CreatePerspectiveFieldOfView(fieldOfView, _aspectRatio, _nearClip, _farClip);
                _nearProjection = Matrix.CreatePerspectiveFieldOfView(fieldOfView, _aspectRatio, 0.02f, 1f);
                generateFrustum();
            }

            if (!isCamFrozen)
            {
                CameraUpdates(gametime, keyState, oldKeyState, mouseState, camVelocity, isUnderWater, waterLevel);
                CGameSettings.reloadGamepadState();
                _oldKeyState = keyState;
            }

            _view = Matrix.CreateLookAt(_cameraPos, _cameraTarget, _up);

            if (Display2D.C2DEffect.isSoftwareEmbedded)
            {
                _middleScreen = new Point(mouseState.X, mouseState.Y);
            }
            else if (_isMoving && !isUnderWater && !_physicsMap._isOnWaterSurface && (_physicsMap._fallingVelocity >= 0f) && _elapsedStepTime > 350 * (14 / camVelocity))
            {
                if (!_isPitchShiftedStepSound)
                {
                    Game.CSoundManager.PlayInstance("GRASSSTEP", 0.75f);
                }
                else
                {
                    Game.CSoundManager.PlayInstance("GRASSSTEP", 0.75f, 0.65f, 0.8f);
                }

                _isPitchShiftedStepSound = !_isPitchShiftedStepSound;
                _elapsedStepTime         = 0;
            }

            _elapsedStepTime += gametime.ElapsedGameTime.Milliseconds;

            generateFrustum();
        }
Пример #4
0
    void OnGameSettingsInit()
    {
        CGameSettings _ = CGameSettings.Instance;

        CDebug.Log("Begin Load tab file...");

        //var tabContent = File.ReadAllText("Assets/" + CCosmosEngine.GetConfig("ProductRelPath") + "/setting/test_tab.bytes");
        //var path = CResourceModule.GetResourceFullPath("/setting/test_tab.bytes");
        var tabContent = File.ReadAllText(Application.dataPath + "/" + CCosmosEngine.GetConfig("ProductRelPath") + "/setting/test_tab.bytes");

        _.LoadTab <CTestTabInfo>(tabContent);
        CDebug.Log("Output the tab file...");
        foreach (CTestTabInfo info in _.GetInfos <CTestTabInfo>())
        {
            CDebug.Log("Id:{0}, Name: {1}", info.Id, info.Name);
        }
    }
Пример #5
0
 private void Awake()
 {
     this._gameSettings      = CDependencyResolver.Get <CGameSettings>();
     this._navigationManager = CDependencyResolver.Get <CUINavigationManager>();
 }