コード例 #1
0
 public void Initialize()
 {
     if (SharedConfig.IsOffline)
     {
         _sessionState.FullfillExitCondition(typeof(RequestSnapshotSystem));
     }
 }
コード例 #2
0
        public void Execute()
        {
            if (SharedConfig.IsOffline)
            {
                if (!_loginSended)
                {
                    _loginSended = true;
                    var sessionObjects             = _contexts.session.commonSession;
                    IEntityIdGenerator idGenerator = sessionObjects.EntityIdGenerator;
                    var id = idGenerator.GetNextEntityId();
                    var _offlineSelector = new OfflineSnapshotSelector(new EntityKey(id, (int)EEntityType.Player),
                                                                       _contexts.session.commonSession.GameContexts);
                    _contexts.session.clientSessionObjects.SnapshotSelectorContainer.SnapshotSelector =
                        _offlineSelector;

                    _contexts.session.clientSessionObjects.SimulationTimer.CurrentTime = 0;
                    _contexts.session.entityFactoryObject.SceneObjectEntityFactory     = new ServerSceneObjectEntityFactory(
                        _contexts.sceneObject, _contexts.player, sessionObjects.EntityIdGenerator, sessionObjects.EntityIdGenerator,
                        _contexts.session.currentTimeObject);
                    _contexts.session.entityFactoryObject.MapObjectEntityFactory =
                        new ServerMapObjectEntityFactory(_contexts.mapObject, sessionObjects.EntityIdGenerator);

                    IPlayerInfo playerInfo = TestUtility.CreateTestPlayer();
                    playerInfo.EntityId = id;
                    var player = PlayerEntityFactory.CreateNewPlayerEntity(_contexts.player,
                                                                           SingletonManager.Get <MapsDescription>().SceneParameters.PlayerBirthPosition, playerInfo, true, false);
                    _offlineSelector.Init();
                    _sessionState.FullfillExitCondition(typeof(RequestPlayerInfoSystem));
                    SingletonManager.Get <SubProgressBlackBoard>().Step();
                }
            }
            else
            {
                var channel = _contexts.session.clientSessionObjects.NetworkChannel;
                var token   = _contexts.session.clientSessionObjects.LoginToken;
                if (channel != null && channel.IsConnected)
                {
                    if (!_loginSended)
                    {
                        _loginSended = true;
                        var message = LoginMessage.Allocate();
                        message.Token      = token;
                        message.LoginStage = ELoginStage.GetPlayerInfo;
                        message.ComponentSerializerVersion = ComponentSerializerManager.HashMd5;
                        channel.SendReliable((int)EClient2ServerMessage.Login, message);

                        _logger.InfoFormat("Sending Login Message {0}", message);
                        message.ReleaseReference();
                    }

                    if (_loginSuccReceived)
                    {
                        _sessionState.FullfillExitCondition(typeof(RequestPlayerInfoSystem));
                        SingletonManager.Get <SubProgressBlackBoard>().Step();
                    }
                }
            }
        }
コード例 #3
0
 public void Handle(INetworkChannel networkChannel, int messageType, object messageBody)
 {
     _logger.InfoFormat("Handle:{0}", messageBody);
     switch (messageType)
     {
     case (int)EServer2ClientMessage.SceneInfo:
         LoginSuccMessage msg = (LoginSuccMessage)messageBody;
         _contexts.session.clientSessionObjects.GameRule = msg.GameRule;
         _contexts.session.commonSession.RoomInfo.FromLoginSuccMsg(msg);
         _contexts.session.commonSession.SessionMode = ModeUtil.CreateClientMode(_contexts, _contexts.session.commonSession.RoomInfo.ModeId);
         _sessionState.FullfillExitCondition(typeof(RequestSceneInfoSystem));
         break;
     }
 }
コード例 #4
0
        public void OnLoadSucc(string source, UnityObject unityObj)
        {
            SingletonManager.Get <SubProgressBlackBoard>().Step();
            var manager = new InputManager();

            if (!_inputContext.hasUserInputManager)
            {
                var helper = new UserInputHelper(manager);
                _inputContext.SetUserInputManager(manager, helper);
            }
            {
                var cfg = unityObj.As <TextAsset>();
                if (null != cfg)
                {
                    var content  = cfg.text;
                    var inputCfg = InputConfigLoader <InputConfig> .Load(content);

                    _inputContext.userInputManager.Instance.SetConfig(inputCfg);
                }
                else
                {
                    Logger.Error("Cfg is null or not text asset");
                }
            }
            _sessionState.FullfillExitCondition(typeof(InputConfigInitSystem));
        }
コード例 #5
0
ファイル: UiLoadSystem.cs プロジェクト: yangfan111/CsharpCode
 private void CheckExit()
 {
     if (_uiCount == 0)
     {
         _sessionState.FullfillExitCondition(typeof(UiLoadSystem));
     }
 }
コード例 #6
0
        public void Handle(INetworkChannel networkChannel, int messageType, object messageBody)
        {
            if (messageType == (int)EServer2ClientMessage.LoginSucc)
            {
                LoginSuccMessage msg = (LoginSuccMessage)messageBody;

                _contexts.session.clientSessionObjects.GameRule = msg.GameRule;
                _contexts.session.commonSession.RoomInfo.FromLoginSuccMsg(msg);
                _contexts.session.commonSession.SessionMode = ModeUtil.CreateClientMode(_contexts, _contexts.session.commonSession.RoomInfo.ModeId);
                //_contexts.session.commonSession.WeaponModeLogic =  ClientGameModeLogicFactoryManager.GetModeLogicFactory(_contexts, _contexts.session.commonSession.RoomInfo.ModeId).CreateWeaponModeLogic();

                _loginSuccReceived = true;
            }
            if (_loginSuccReceived)
            {
                _sessionState.FullfillExitCondition(typeof(RequestRoomInfoSystem));
            }
        }
コード例 #7
0
 private void ReduceFinishTimes()
 {
     if (--_finishedTimes == 0)
     {
         LoadTerrainConfig();
         LoadSpecialZoneTriggers();
         _sessionState.FullfillExitCondition(typeof(SceneConfigInitSystem));
     }
 }
コード例 #8
0
        public void OnLoadSucc(string s, UnityObject unityObj)
        {
            var        assetInfo = unityObj.Address;
            GameObject go        = unityObj.AsGameObject;

            //UnityEngine.Object.DontDestroyOnLoad(go);
            I18nStarter.LoadTxt();
            _sessionState.FullfillExitCondition(typeof(LocalizeSessionSystem));
        }
コード例 #9
0
        public void OnLoadResources(IUnityAssetManager assetManager)
        {
            RequestForResource(assetManager);

            if (_levelManager.NotFinishedRequests <= 0)
            {
                _levelManager.SetAsapMode(AsapMode);
                _sessionState.FullfillExitCondition(typeof(InitialSceneLoadingSystem));
            }
        }
コード例 #10
0
        private void OnOCDataLoaded(string source, UnityObject unityObj)
        {
            var ocData = unityObj.As <TextAsset>();

            _ocParam.OCData = ocData == null ? null : ocData.bytes;

            var ocController = OcclisionCullingControllerFactory.CreateController(_levelType, _ocParam);

            _contexts.session.clientSessionObjects.OCController = ocController;

            _sessionState.FullfillExitCondition(typeof(InitOcclusionCullingControllerSystem));
        }
コード例 #11
0
        public void Execute()
        {
            var player = _contexts.player.flagSelfEntity;

            if (player != null)
            {
                if (player.hasThirdPersonModel && player.thirdPersonModel.Value != null &&
                    player.hasFirstPersonModel && player.firstPersonModel.Value != null
                    )
                {
                    _sessionState.FullfillExitCondition(typeof(CheckPreparingPlayerSystem));
                }
            }
        }
コード例 #12
0
ファイル: PreLoadState.cs プロジェクト: zuojiashun/CsharpCode
        public void OnLoadResources(ILoadRequestManager loadRequestManager)
        {
            if (!_isLoading)
            {
                _loadRequestManager = loadRequestManager;

                var assetInfos = _assetInfoProvider.AssetInfos;
                foreach (var assetInfo in assetInfos)
                {
                    loadRequestManager.AppendLoadRequest(null, assetInfo, OnLoadSucc);
                }

                _loadingCount = assetInfos.Count;
                _isLoading    = true;

                if (_loadingCount == 0)
                {
                    _sessionState.FullfillExitCondition(typeof(PreLoadSystem));
                }

                _logger.InfoFormat("Loading count {0}", _loadingCount);
            }
        }
コード例 #13
0
        public void OnLoadResources(ILoadRequestManager loadRequestManager)
        {
            if (!_isLoding)
            {
                _isLoding = true;
                loadRequestManager.AppendLoadRequest(null, _assetInfo, OnLoadSucc);
            }

            if (IsDone && !_isExit)
            {
                _sessionState.FullfillExitCondition(GetConditionId());
                _isExit = true;
                Logger.InfoFormat("Exit  {0}", GetConditionId());
            }
        }
コード例 #14
0
        public void OnLoadResources(IUnityAssetManager assetManager)
        {
            if (SingletonManager.Get <T>().IsInitialized)
            {
                IsDone = true;
            }
            else if (!_isLoding)
            {
                _isLoding = true;
                assetManager.LoadAssetAsync(typeof(T).ToString(), _assetInfo, OnLoadSucc);
            }

            if (IsDone && !_isExit)
            {
                _sessionState.FullfillExitCondition(GetConditionId());
                _isExit = true;
                Logger.InfoFormat("Exit  {0}", GetConditionId());
            }
        }
コード例 #15
0
        public void OnLoadResources(IUnityAssetManager assetManager)
        {
            _terrainRenderer.GetTerrainDataNames(_terrainName);
            if (_terrainName.Count > 0)
            {
                for (int i = 0; i < _terrainName.Count; ++i)
                {
                    AssetInfo addr = new AssetInfo("tablesfrombuilding", _terrainName[i]);

                    _logger.InfoFormat("´òËãÔØÈë _terrainName£¬BundleName={0}, AssetName={1}", addr.BundleName, addr.AssetName);

                    assetManager.LoadAssetAsync((UnityEngine.Object)null, addr, _terrainRenderer.LoadedTerrainData);
                }

                _terrainName.Clear();
            }

            if (_sessionState != null)
            {
                if (_levelManager.NotFinishedRequests <= 0 &&
                    _terrainRenderer.IsLoadingEnd)
                {
                    _sessionState.FullfillExitCondition(typeof(TerrainDataLoadSystem));
                }
                else
                {
                    if ((System.DateTime.Now - _lastPrintTime).TotalMilliseconds > _logInterval)
                    {
                        _lastPrintTime = System.DateTime.Now;

                        _logger.InfoFormat("NotFinishedRequests =={0}, IsLoadingEnd =={1}", _levelManager.NotFinishedRequests, _terrainRenderer.IsLoadingEnd);
                        _logger.InfoFormat(_levelManager.GetRequestString());

                        //if (_logInterval < 60000)
                        //    _logInterval *= 2;
                    }
                }
            }
        }
コード例 #16
0
 public void OnLoadSucc(string source, UnityObject unityObj)
 {
     SingletonManager.Get <SubProgressBlackBoard>().Step();
     if (!Luminosity.IO.InputManager.Exists)
     {
         Logger.ErrorFormat("No Luminosity.IO.InputManager exist");
     }
     else
     {
         var cfg = unityObj.As <TextAsset>();
         if (null != cfg)
         {
             var content = cfg.bytes;
             Luminosity.IO.InputManager.Load(content);
         }
         else
         {
             Logger.Error("Cfg is null or not text asset");
         }
     }
     _sessionState.FullfillExitCondition(typeof(InputManagerConfigInitSystem));
 }
コード例 #17
0
        public void OnLoadResources(IUnityAssetManager assetManager)
        {
            _terrainRenderer.GetTerrainDataNames(_terrainName);
            if (_terrainName.Count > 0)
            {
                for (int i = 0; i < _terrainName.Count; ++i)
                {
                    AssetInfo addr = new AssetInfo("tablesfrombuilding", _terrainName[i]);
                    assetManager.LoadAssetAsync((UnityEngine.Object)null, addr, _terrainRenderer.LoadedTerrainData);
                }

                _terrainName.Clear();
            }

            if (_sessionState != null)
            {
                if (_levelManager.NotFinishedRequests <= 0 &&
                    _terrainRenderer.IsLoadingEnd)
                {
                    _sessionState.FullfillExitCondition(typeof(TerrainDataLoadSystem));
                }
            }
        }
コード例 #18
0
        public void OnLoadSucc(object source, AssetInfo assetInfo, Object obj)
        {
            var ta = obj as TextAsset;

            _sessionState.FullfillExitCondition(typeof(ClientWeaponConfigInitSystem));
        }
コード例 #19
0
 private void AllLoadSucc()
 {
     _sessionState.FullfillExitCondition(typeof(GlobalEffectManagerInitSystem));
 }
コード例 #20
0
 private void ParseComplete()
 {
     _sessionState.FullfillExitCondition(typeof(AnimationConfigInitSystem));
 }
コード例 #21
0
 private void Done()
 {
     _sessionState.FullfillExitCondition(ConditionString);
     SingletonManager.Get <SubProgressBlackBoard>().Step();
 }