コード例 #1
0
        /// <summary>
        /// ����Ҫ��Դ���صij�ʼ��
        /// </summary>
        /// <param name="player"></param>
        /// <param name="vehicleContext"></param>
        public static void PostCreateNewPlayerEntity(
            PlayerEntity player,
            Contexts contexts)
        {
            var sessionObjects = contexts.session.commonSession;

            var sceneObjectFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory;

            player.AddModeLogic();
            player.modeLogic.ModeLogic = sessionObjects.WeaponModeLogic;

            var stateManager             = new CharacterStateManager();
            var playerWeaponStateAdapter = new PlayerWeaponStateAdapter(player, stateManager, stateManager, contexts.ui);

            if (!player.hasStatisticsData)
            {
                player.AddStatisticsData(false, new BattleData(), new StatisticsData());
            }
            player.AddWeaponFactory(new WeaponLogic.WeaponFactory(playerWeaponStateAdapter, stateManager,
                                                                  contexts.session.entityFactoryObject.WeaponLogicFactory,
                                                                  contexts.session.commonSession.FreeArgs));

            var speed = new SpeedManager(player, stateManager, stateManager, stateManager.GetIPostureInConfig(),
                                         stateManager.GetIMovementInConfig(), playerWeaponStateAdapter);

            stateManager.SetSpeedInterface(speed);
            player.AddStateInterface(stateManager);

            var oxygen = new OxygenEnergy(100, 0);

            player.AddOxygenEnergyInterface(oxygen);

            var genericAction = new GenericAction();

            player.AddGenericActionInterface(genericAction);

            var clipManager = new AnimatorClipManager();

            player.AddAnimatorClip(clipManager);

            player.RefreshPlayerWeaponLogic(-1);

            if (!player.hasPlayerRotateLimit)
            {
                player.AddPlayerRotateLimit(false);
            }

            if (!player.hasFirePosition)
            {
                player.AddFirePosition();
            }

            if (!player.hasState)
            {
                player.AddState();
            }
            if (!player.hasStateInterVar)
            {
                player.AddStateInterVar(new StateInterCommands(), new StateInterCommands(), new StateInterCommands(), new StateInterCommands());
            }
            if (!player.hasStateBefore)
            {
                player.AddStateBefore();
            }
            if (!player.hasStateInterVarBefore)
            {
                player.AddStateInterVarBefore();
            }
            ComponentSynchronizer.SyncToStateComponent(player.state, player.stateInterface.State);

            if (!player.hasVehicleCmdSeq)
            {
                player.AddVehicleCmdSeq(0);
            }
            if (!player.hasUserCmd)
            {
                player.AddUserCmd();
            }

            if (!player.hasControlledVehicle)
            {
                player.AddControlledVehicle();
            }

            if (!player.hasPlayerSkyMove)
            {
                player.AddPlayerSkyMove(true, -1);
            }

            if (!player.hasPlayerSkyMoveInterVar)
            {
                player.AddPlayerSkyMoveInterVar();
            }

            if (!player.hasCharacterBone)
            {
                player.AddCharacterBone(0);
            }

            if (!player.hasNetworkWeaponAnimation)
            {
                player.AddNetworkWeaponAnimation(string.Empty, 0, string.Empty, 0);
            }

            AddCameraStateNew(player);
            var bagLogic = new WeaponBagLogic(
                player,
                SingletonManager.Get <WeaponConfigManager>());

            player.AddBag(bagLogic);
            var grenadeInventory = new GrenadeBagCacheAgent(player.grenadeInventoryData);

            player.AddGrenadeInventoryHolder(grenadeInventory);
            player.AddLocalEvents(new PlayerEvents());
            InitFiltedInput(player, sessionObjects.GameStateProcessorFactory);

/*
 *          player.AddSoundManager(new PlayerSoundManager(player,
 *              soundContext,
 *              PlayerSoundConfigManager.Instance,
 *              SoundConfigManager.Instance,
 *              sessionObjects.SoundEntityFactory,
 *              SingletonManager.Get<TerrainManager>(),
 *              SingletonManager.Get<MapConfigManager>()));
 */
            player.AddSoundManager(new DummyPlayerSoundManager());
            player.AddPlayerAction(new PlayerWeaponActionLogic(player,
                                                               bagLogic,
                                                               sceneObjectFactory,
                                                               player.modeLogic.ModeLogic,
                                                               grenadeInventory,
                                                               player.modeLogic.ModeLogic,
                                                               player.modeLogic.ModeLogic));

            if (!player.hasPingStatistics)
            {
                player.AddPingStatistics();
            }

            if (!player.hasFreeData)
            {
                FreeData fd = new FreeData(player);
                if (player.hasStatisticsData)
                {
                    fd.AddFields(new ObjectFields(player.statisticsData.Statistics));
                }
                player.AddFreeData(fd);
            }
            player.AddPlayerHitMaskController(new CommonHitMaskController(contexts.player, player));
            player.AddTip();
            player.AddThrowingUpdate(false);
        }
コード例 #2
0
        /// <summary>
        /// ����Ҫ��Դ���صij�ʼ��
        /// </summary>
        /// <param name="player"></param>
        /// <param name="vehicleContext"></param>
        public static void PostCreateNewPlayerEntity(
            PlayerEntity player,
            Contexts contexts)
        {
            Logger.Info("PostCreateNewPlayerEntity");
            var sessionObjects = contexts.session.commonSession;

            var sceneObjectFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory;

            player.AttachModeController(sessionObjects.SessionMode);

            var characterInfo = new CharacterInfoProviderContext();

            if (!player.hasCharacterInfo)
            {
                player.AddCharacterInfo(characterInfo);
            }

            var stateManager = new CharacterStateManager(characterInfo);

            if (!player.hasStatisticsData)
            {
                player.AddStatisticsData(false, new BattleData(), new StatisticsData());
            }

            if (!player.hasAutoMoveInterface)
            {
                player.AddAutoMoveInterface(new GameModules.Player.Move.PlayerAutoMove(player));
            }

            var speed = new SpeedManager(player, contexts, stateManager, stateManager,
                                         stateManager.GetIPostureInConfig(),
                                         stateManager.GetIMovementInConfig(), characterInfo);

            stateManager.SetSpeedInterface(speed);
            player.AddStateInterface(stateManager);

            var oxygen = new OxygenEnergy(100, 0);

            player.AddOxygenEnergyInterface(oxygen);

            var genericAction = new GenericAction();

            player.AddGenericActionInterface(genericAction);
            player.AddLadderActionInterface(new LadderAction());

            var clipManager = new AnimatorClipManager();

            player.AddAnimatorClip(clipManager);

            if (!player.hasPlayerRotateLimit)
            {
                player.AddPlayerRotateLimit(false);
            }

            if (!player.hasFirePosition)
            {
                player.AddFirePosition();
            }

            if (!player.hasState)
            {
                player.AddState();
            }
            if (!player.hasStateInterVar)
            {
                player.AddStateInterVar(new StateInterCommands(), new StateInterCommands(),
                                        new UnityAnimationEventCommands(), new UnityAnimationEventCommands());
            }
            if (!player.hasStateBefore)
            {
                player.AddStateBefore();
            }
            if (!player.hasStateInterVarBefore)
            {
                player.AddStateInterVarBefore();
            }
            ComponentSynchronizer.SyncToStateComponent(player.state, player.stateInterface.State);

            if (!player.hasVehicleCmdSeq)
            {
                player.AddVehicleCmdSeq(0);
            }
            if (!player.hasUserCmd)
            {
                player.AddUserCmd();
            }

            if (!player.hasControlledVehicle)
            {
                player.AddControlledVehicle();
            }

            if (!player.hasPlayerSkyMove)
            {
                player.AddPlayerSkyMove(false, -1);
            }

            if (!player.hasPlayerSkyMoveInterVar)
            {
                player.AddPlayerSkyMoveInterVar();
            }

            if (!player.hasCharacterBone)
            {
                player.AddCharacterBone(0, 0, false, 0, -1, true);
            }

            if (!player.hasNetworkWeaponAnimation)
            {
                player.AddNetworkWeaponAnimation(string.Empty, 0, string.Empty, 0);
            }

            if (!player.hasOverrideNetworkAnimator)
            {
                player.AddOverrideNetworkAnimator();
            }

            AddCameraStateNew(player);
            player.AddLocalEvents(new PlayerEvents());


            if (!player.hasPingStatistics)
            {
                player.AddPingStatistics();
            }

            if (!player.hasFreeData)
            {
                FreeData fd = new FreeData(contexts, player);
                if (player.hasStatisticsData)
                {
                    fd.AddFields(new ObjectFields(player.statisticsData.Statistics));
                }

                player.AddFreeData(fd);
            }

            player.AddTip();
            AttachAudioComponents(contexts, player);
            AttachWeaponComponents(contexts, player);
            AttachStateInteract(player);
            player.AddPlayerHitMaskController(new CommonHitMaskController(contexts.player, player));
            player.AddThrowingUpdate(false);
            player.AddThrowingAction();
            player.throwingAction.ActionInfo = new ThrowingActionInfo();
            Logger.Info("posted player initialize finish!!!!!!!!!!!!!!");
            DebugUtil.MyLog("posted player initialize finish", DebugUtil.DebugColor.Green);
            contexts.session.entityFactoryObject.SceneObjectEntityFactory.CreateSimpleEquipmentEntity(ECategory.GameRes,
                                                                                                      1004, 1, Vector3.zero);
        }
コード例 #3
0
        /// <summary>
        /// ����Ҫ��Դ���صij�ʼ��
        /// </summary>
        /// <param name="player"></param>
        /// <param name="vehicleContext"></param>
        public static void PostCreateNewPlayerEntity(
            PlayerEntity player,
            Contexts contexts)
        {
            Logger.Info("PostCreateNewPlayerEntity");
            var sessionObjects = contexts.session.commonSession;

            var sceneObjectFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory;

            player.AttachModeController(sessionObjects.SessionMode);

            var characterInfo = new CharacterInfoProviderContext();

            if (!player.hasCharacterInfo)
            {
                player.AddCharacterInfo(characterInfo);
            }

            var stateManager = new CharacterStateManager(characterInfo);

            if (!player.hasStatisticsData)
            {
                player.AddStatisticsData(new BattleData(), false, new StatisticsData());
            }

            if (!player.hasAutoMoveInterface)
            {
                player.AddAutoMoveInterface(new GameModules.Player.Move.PlayerAutoMove(player));
            }

            var speed = new SpeedManager(player, contexts, stateManager, stateManager,
                                         stateManager.GetIPostureInConfig(),
                                         stateManager.GetIMovementInConfig(), characterInfo);

            stateManager.SetSpeedInterface(speed);
            player.AddStateInterface(stateManager);

            player.AddFsmInputRelateInterface(new FsmInputRelate());

            var oxygen = new OxygenEnergy(100, 0);

            player.AddOxygenEnergyInterface(oxygen);

            var genericAction = new GenericAction();

            player.AddGenericActionInterface(genericAction);
            player.AddLadderActionInterface(new LadderAction());

            var clipManager = new AnimatorClipManager();

            player.AddAnimatorClip(clipManager);

            if (!player.hasPlayerRotateLimit)
            {
                player.AddPlayerRotateLimit(false);
            }

            if (!player.hasFirePosition)
            {
                player.AddFirePosition();
            }

            if (!player.hasState)
            {
                player.AddState();
            }
            if (!player.hasStateInterVar)
            {
                player.AddStateInterVar(new StateInterCommands(), new StateInterCommands(),
                                        new UnityAnimationEventCommands(), new UnityAnimationEventCommands());
            }
            if (!player.hasStateBefore)
            {
                player.AddStateBefore();
            }
            if (!player.hasStateInterVarBefore)
            {
                player.AddStateInterVarBefore();
            }
            ComponentSynchronizer.SyncToStateComponent(player.state, player.stateInterface.State);

            if (!player.hasVehicleCmdSeq)
            {
                player.AddVehicleCmdSeq(0);
            }
            if (!player.hasControlledVehicle)
            {
                player.AddControlledVehicle();
            }

            if (!player.hasPlayerSkyMove)
            {
                player.AddPlayerSkyMove(false, -1);
            }

            if (!player.hasPlayerSkyMoveInterVar)
            {
                player.AddPlayerSkyMoveInterVar();
            }

            if (!player.hasCharacterBone)
            {
                player.AddCharacterBone(0, 0, false, 0, -1, true);
            }

            if (!player.hasNetworkWeaponAnimation)
            {
                player.AddNetworkWeaponAnimation(string.Empty, 0, string.Empty, 0);
            }

            if (!player.hasOverrideNetworkAnimator)
            {
                player.AddOverrideNetworkAnimator();
            }

            AddCameraStateNew(player);
            player.AddLocalEvents(new PlayerEvents());


            if (!player.hasPingStatistics)
            {
                player.AddPingStatistics();
            }

            player.AddTip();
            AttachAudio(contexts, player);
            AttachWeaponComponents(contexts, player);
            AttachStateInteract(player);
            AttachStatistics(player);

            if (!player.hasFreeData)
            {
                FreeData fd = new FreeData(contexts, player);
                if (player.hasStatisticsData)
                {
                    fd.AddFields(new ObjectFields(player.statisticsData.Statistics));
                }

                if (player.hasStatisticsServerData)
                {
                    fd.AddFields(new ObjectFields(player.statisticsServerData));
                }

                if (player.hasOxygenEnergy)
                {
                    fd.AddFields(new ObjectFields(player.oxygenEnergy));
                }
                player.AddFreeData(fd);
            }

            player.AddPlayerHitMaskController(new CommonHitMaskController(contexts.player, player));
            player.AddThrowingUpdate(false);
            player.AddThrowingAction();
            player.throwingAction.ActionData = new ThrowingActionData();
            Logger.Info("*********posted player initialize finish*********");
            DebugUtil.MyLog("posted player initialize finish", DebugUtil.DebugColor.Green);
            if (!SharedConfig.IsServer)
            {
                DebugUtil.InitShootArchiveC(player.entityKey.Value.ToString(), contexts.session.commonSession.RoomInfo.RoomDisplayId);
            }
            else
            {
                IEventArgs args = contexts.session.commonSession.FreeArgs as IEventArgs;
                if (null != args)
                {
                    args.Trigger(FreeTriggerConstant.POST_PLAYER_INI, new TempUnit("current", (FreeData)player.freeData.FreeData));
                }
            }
//            contexts.session.entityFactoryObject.SceneObjectEntityFactory.CreateSimpleEquipmentEntity(ECategory.GameRes,
//                1004, 1, Vector3.zero);
        }