Exemplo n.º 1
0
        private void SetPrimaryAndDeputyGameObject(UnityObject obj)
        {
            if (null == obj || null == obj.AsGameObject ||
                !SingletonManager.Get <WeaponAvatarConfigManager>().HaveLeftWeapon(obj.AsGameObject.name))
            {
                _deputyGameObject  = null;
                _primaryGameObject = null != obj ? obj.AsGameObject : null;
                _needAssemble      = false;
                return;
            }

            _primaryGameObject = SingletonManager.Get <WeaponAvatarConfigManager>().GetRightWeaponGameObject(obj);
            _deputyGameObject  = SingletonManager.Get <WeaponAvatarConfigManager>().GetLeftWeaponGameObject(obj);

            SplitPrimaryAndDeputyGameObject();
        }
Exemplo n.º 2
0
        public void SetToWorldCompositionLevel(WorldCompositionParam param, IStreamingGoManager streamingGo)
        {
            _fixedSceneNames = param.FixedScenes;
            StreamingLevelStructure streamingLevel = SingletonManager.Get <StreamingLevelStructure>();
            ScenesLightmapStructure lightmap       = SingletonManager.Get <ScenesLightmapStructure>();

            lightmap.ListToDict();
            ScenesIndoorCullStructure indoor = SingletonManager.Get <ScenesIndoorCullStructure>();

            indoor.ListToDict();
            _sceneManager = new StreamingManager(this, streamingGo, streamingLevel.Data,
                                                 lightmap.Data, indoor.Data, param, _fixedSceneNames.Count);

            //RequestForFixedScenes(param.AssetBundleName);
            RequestForFixedScenes(param.PreMapName + "/scene");
        }
Exemplo n.º 3
0
        public void Init()
        {
            TotalPlayerCount = 0;
            var type = SingletonManager.Get <GameModeConfigManager>().GetBagTypeById(ModeId);

            switch (type)
            {
            case XmlConfig.EBagType.Chicken:
                _gameStatisticData = new SurvivalGameStatisticData(_dictTeams, _dictPlayers, _dictLeavedPlayers, _dictGoPlayers, TeamCapacity);
                break;

            case XmlConfig.EBagType.Group:
                _gameStatisticData = new GroupGameStatisticData(_dictTeams, _dictPlayers, _dictLeavedPlayers, _dictGoPlayers, TeamCapacity);
                break;
            }
        }
Exemplo n.º 4
0
        private void CalcSpeedRatio(float maxSpeed, float curSpeed, float buff)
        {
            var   scale       = maxSpeed > curSpeed ? curSpeed / maxSpeed:1.0f;
            float weaponSpeed = GetWeaponSpeed(_currentPosture, _currentMovement, _player.WeaponController().HeldWeaponAgent.BaseSpeed,
                                               _player.WeaponController().HeldWeaponAgent.DefaultSpeed);
            var newSpeedRatio = scale * weaponSpeed * (1.0f + buff) / SingletonManager.Get <CharacterStateConfigManager>().GetStandardAnimationSpeed();

            _player.playerMove.SpeedRatio = newSpeedRatio < FullbodySpeedRatioMin? FullbodySpeedRatioMin: newSpeedRatio;
            if (float.IsNaN(newSpeedRatio) || float.IsInfinity(newSpeedRatio))
            {
                _logger.ErrorFormat("curspeed:{0}, maxSpeed:{1}, weaponSpeed:{2}, standAnimationSpeed:{3}, buff:{4}, scale:{5}",
                                    curSpeed, maxSpeed, weaponSpeed, SingletonManager.Get <CharacterStateConfigManager>().GetStandardAnimationSpeed(), buff,
                                    scale
                                    );
            }
        }
Exemplo n.º 5
0
        public DefaultConfigInitSystem(IUnityAssetManager assetManager, ISessionCondition sessionState, AssetInfo asset, IConfigParser parser, bool reload = false)
        {
            _assetManager = assetManager;
            _sessionState = sessionState;
            _assetInfo    = asset;
            _sessionState.CreateExitCondition(GetConditionId());
            _parser = parser;
            if (reload)
            {
                SingletonManager.Get <T>().IsInitialized = false;
                _isDone = false;
                _isExit = false;
            }

            SingletonManager.Get <SubProgressBlackBoard>().Add();
        }
Exemplo n.º 6
0
        protected static bool IsAboveGround(PlayerEntity player, Vector3 position, float height)
        {
            Vector3 p1, p2;
            float   radius;

            PlayerEntityUtility.GetCapsule(player, position, out p1, out p2, out radius);

            var end = position - Vector3.up * height;

            if (SingletonManager.Get <MapConfigManager>().InWater(end))
            {
                return(false);
            }

            return(!Physics.CapsuleCast(p1, p2, radius, -Vector3.up, height, UnityLayers.SceneCollidableLayerMask));
        }
Exemplo n.º 7
0
        private void Swim(PlayerEntity player)
        {
            var syncTransform = player.RootGo().transform;

            syncTransform.position = new Vector3(player.position.Value.x,
                                                 SingletonManager.Get <MapConfigManager>().WaterSurfaceHeight(player.position.Value) - (AnimatorParametersHash.FirstPersonStandCameraHeight + HeightOffset),
                                                 player.position.Value.z);
            player.position.Value = syncTransform.position;

            PlayerMoveSystem.SyncUpdateComponentPos(player, syncTransform.position);
            player.stateInterface.State.Swim();
            player.triggerEvent.NeedUnmountWeapon = true;
            //   player.ModeController().CallBeforeAction(player.WeaponController(),EPlayerActionType.Swim);

            //_logger.InfoFormat("swim ashore pos:{0}",player.position.Value.ToStringExt());
        }
Exemplo n.º 8
0
 public void Execute()
 {
     try
     {
         SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.FreeRule);
         _room.RunFreeGameRule();
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("FreeGameRuleSystem error executing {0}", e);
     }
     finally
     {
         SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.FreeRule);
     }
 }
Exemplo n.º 9
0
        public void Handle(SimpleProto data)
        {
            int ani      = data.Ins[0];
            var contexts = SingletonManager.Get <FreeUiManager>().Contexts1;

            switch (ani)
            {
            case PlayerAnimationAction.SuccessPose:
                contexts.player.flagSelfEntity.stateInterface.State.StartSuccessPose(data.Ins[1]);
                break;

            default:
                PlayerAnimationAction.DoAnimation(contexts, ani, contexts.player.flagSelfEntity, false);
                break;
            }
        }
Exemplo n.º 10
0
        public void OnRender()
        {
            SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.OC);
            _ocController.DoCulling(Camera.main.transform.position.WorldPosition());
            SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.OC);

            var umbraTime1 = _dynamicObjectsUmbraSampler.GetRecorder().elapsedNanoseconds * 10e-6f;

            _dynamicObjectsUmbraProfileInfo.Total += umbraTime1;
            _dynamicObjectsUmbraProfileInfo.Times += 1;

            var umbraTime2 = _objectsWithoutUmbraSampler.GetRecorder().elapsedNanoseconds * 10e-6f;

            _objectsWithoutUmbraProfileInfo.Total += umbraTime2;
            _objectsWithoutUmbraProfileInfo.Times += 1;
        }
Exemplo n.º 11
0
    public void Effect()
    {
        actor.GetComponent <Character>().Mana -= cost;

        _ReduceDamageBuff.BaseValue = _Intensity.Levels[IntensityLevel - 1].IDatas.First();

        foreach (var item in SingletonManager.Get <FieldManager>().SpawnedAllies)
        {
            BuffReciever bReceiver = item.GetComponent <BuffReciever>();

            if (bReceiver.FindBuff(_ReduceDamageBuff) == false)
            {
                bReceiver.AddBuff(_ReduceDamageBuff);
            }
        }
    }
Exemplo n.º 12
0
        private void InitEntityFactorySession(EntityIdGenerator entityIdGenerator,
                                              EntityIdGenerator equipmentEntityIdGenerator)
        {
            _contexts.session.SetEntityFactoryObject();
            var entityFactoryObject = _contexts.session.entityFactoryObject;

            entityFactoryObject.SoundEntityFactory = new ServerSoundEntityFactory(_contexts.sound,
                                                                                  _contexts.player,
                                                                                  entityIdGenerator,
                                                                                  _contexts.session.currentTimeObject,
                                                                                  SingletonManager.Get <SoundConfigManager>());
            entityFactoryObject.SceneObjectEntityFactory = new ServerSceneObjectEntityFactory(_contexts.sceneObject, _contexts.player,
                                                                                              entityIdGenerator, equipmentEntityIdGenerator, _contexts.session.currentTimeObject);
            entityFactoryObject.MapObjectEntityFactory =
                new ServerMapObjectEntityFactory(_contexts.mapObject, entityIdGenerator);
        }
 protected override void InternalExecute()
 {
     try
     {
         SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.LoadRequestManager);
         _driver.Execute();
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("LoadRequestManagerSystem Exception:{0}", e);
     }
     finally
     {
         SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.LoadRequestManager);
     }
 }
Exemplo n.º 14
0
        private bool NeedPlayChangeRoleAnimation(PlayerEntity player)
        {
            if (!player.hasPlayerInfo)
            {
                return(false);
            }

            var item = SingletonManager.Get <RoleConfigManager>().GetRoleItemById(player.playerInfo.RoleModelId);

            if (null == item)
            {
                return(false);
            }

            return(item.Unique);
        }
Exemplo n.º 15
0
        private void CalcSpeedRatio(float maxSpeed, float curSpeed, float buff)
        {
            var   scale       = Math.Max(0.01f, maxSpeed != 0 ? curSpeed / maxSpeed : 1);
            float weaponSpeed = GetWeaponSpeed(_currentPosture, _currentMovement, _speedProvider.GetBaseSpeed(),
                                               _speedProvider.GetDefaultSpeed());
            var newSpeedRatio = scale * weaponSpeed * (1.0f + buff) / SingletonManager.Get <CharacterStateConfigManager>().GetStandardAnimationSpeed();

            _player.playerMove.SpeedRatio = newSpeedRatio;
            if (float.IsNaN(newSpeedRatio) || float.IsInfinity(newSpeedRatio))
            {
                _logger.ErrorFormat("curspeed:{0}, maxSpeed:{1}, weaponSpeed:{2}, standAnimationSpeed:{3}, buff:{4}, scale:{5}",
                                    curSpeed, maxSpeed, weaponSpeed, SingletonManager.Get <CharacterStateConfigManager>().GetStandardAnimationSpeed(), buff,
                                    scale
                                    );
            }
        }
Exemplo n.º 16
0
        internal static void PlayMeleeAttack(int weaponId, AudioGrp_MeleeAttack op, AkGameObj target,
                                             ref int audioEventId)
        {
            AudioEventItem evtConfig = SingletonManager.Get <AudioWeaponManager>().FindById(weaponId, FilterLeft1);

            if (evtConfig != null)
            {
                AudioEntry.Dispatcher.SetSwitch(target, op);
                AudioEntry.Dispatcher.PostEvent(evtConfig, target, true);
                audioEventId = evtConfig.Id;
            }
            else
            {
                AudioEntry.Logger.ErrorFormat("Audio Post event failed,target:{0},evtCfg:{1}", target, weaponId);
            }
        }
Exemplo n.º 17
0
        public static void Load(object source, string assetBuddle, string assetName)
        {
            var assetManager = SingletonManager.Get <FreeUiManager>().Contexts1.session.commonSession.AssetManager;

            if (cache.ContainsKey(assetBuddle) && cache[assetBuddle].ContainsKey(assetName) && cache[assetBuddle][assetName].Count > 0)
            {
                Queue <UnityEngine.Object> queue = cache[assetBuddle][assetName];
                SetTexture(source, queue.Dequeue());
                Debug.LogFormat("asset {0}/{1} cache count {2}", assetBuddle, assetName, queue.Count);
            }
            else
            {
                assetManager.LoadAssetAsync(source, new AssetInfo(assetBuddle, assetName), freeHandler.OnLoadSucc);
                Debug.LogFormat("asset {0}/{1} cache count 0", assetBuddle, assetName);
            }
        }
Exemplo n.º 18
0
        private void ShowWeaponIcon(int weaponId)
        {
            var config = SingletonManager.Get <ItemBaseConfigManager>().GetConfigById((int)ECategory.Weapon, weaponId);

            if (null != config)
            {
                Loader.RetriveSpriteAsync(config.IconBundle, config.Icon,
                                          (sprite) => { _viewModel.DeathTypeIconSprite = sprite; });
                SetDeathIconView(true);
            }
            else
            {
                Logger.Error("Not found config with weaponId:" + weaponId);
                SetDeathIconView(false);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 添加装备默认配件信息
        /// </summary>
        /// <param name="result"></param>
        /// <param name="weaponId"></param>
        public static void CombineDefaultParts(ref WeaponPartsStruct result, int weaponId)
        {
            var defaultParts = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(weaponId).DefaultParts;

            result.LowerRail = result.LowerRail > 0 ? result.LowerRail : defaultParts.LowerRail;
            result.UpperRail = result.UpperRail > 0 ? result.UpperRail : defaultParts.UpperRail;
            result.Muzzle    = result.Muzzle > 0 ? result.Muzzle : defaultParts.Muzzle;
            result.Magazine  = result.Magazine > 0 ? result.Magazine : defaultParts.Magazine;
            result.Stock     = result.Stock > 0 ? result.Stock : defaultParts.Stock;
            result.SideRail  = result.SideRail > 0 ? result.SideRail : defaultParts.SideRail;
            result.Bore      = result.Bore > 0 ? result.Bore : defaultParts.Bore;
            result.Brake     = result.Brake > 0 ? result.Brake : defaultParts.Brake;
            result.Feed      = result.Feed > 0 ? result.Feed : defaultParts.Feed;
            result.Interlock = result.Interlock > 0 ? result.Interlock : defaultParts.Interlock;
            result.Trigger   = result.Trigger > 0 ? result.Trigger : defaultParts.Trigger;
        }
Exemplo n.º 20
0
        public override void SingleExecute(FreeMoveEntity freeMove)
        {
            SimpleProto data = SingletonManager.Get <FreeEffectManager>().GetEffectData(freeMove.freeData.Key);

            if (data != null)
            {
                data.Ss[0] = "freemove_" + freeMove.entityKey.Value.EntityId;
                SimpleMessageManager.Instance.DoHandle(FreeMessageConstant.MSG_EFFECT_CREATE, data);

                FreeRenderObject effect = SingletonManager.Get <FreeEffectManager>().GetEffect(data.Ss[0]);
                if (effect != null)
                {
                    effect.Move(freeMove.position.Value.x, freeMove.position.Value.y, freeMove.position.Value.z);
                }
            }
        }
Exemplo n.º 21
0
        private float CalcTransitionSpeedScale(float deltaTime)
        {
            var ret = 1.0f;

            if (_movementInConfig.InTransition())
            {
                var normalizeTime = 1 - _movementInConfig.TransitionRemainTime() / _movementInConfig.TransitionTime();
                var target        = Mathf.Clamp01(normalizeTime + deltaTime * 1000f / _movementInConfig.TransitionTime());
                ret = SingletonManager.Get <CharacterStateConfigManager>()
                      .GetMovementTransitionSpeedScale(_movementInConfig.CurrentMovement(),
                                                       _movement.GetNextMovementState(), normalizeTime, target);
                //_logger.InfoFormat("current:{0}, next:{1}, normalize time:{2},target:{3} ret:{4}",_movementInConfig.CurrentMovement(),
                //    _movement.GetNextMovementState(), 1 - _movementInConfig.TransitionRemainTime()/_movementInConfig.TransitionTime(),target,ret);
            }
            return(ret);
        }
Exemplo n.º 22
0
 protected override void InternalExecute()
 {
     try
     {
         SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.SyncLatest);
         _netSyncManager.SyncLatest();
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("FreeGameRuleSystem error executing {0}", e);
     }
     finally
     {
         SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.SyncLatest);
     }
 }
Exemplo n.º 23
0
 private void ChangeThirdPersonAnimation(Sex sex, int weaponId)
 {
     if (weaponId <= 0)
     {
         var assetInfo = SingletonManager.Get <WeaponAvatarConfigManager>().GetEmptyHandedThirdPersonAnim(sex);
         ProcessAsset(assetInfo);
     }
     else
     {
         var assetAddr = SingletonManager.Get <WeaponAvatarConfigManager>().GetThirdPersonAnimation(weaponId, sex);
         if (!string.IsNullOrEmpty(assetAddr.BundleName) && !string.IsNullOrEmpty(assetAddr.AssetName))
         {
             ProcessAsset(assetAddr);
         }
     }
 }
Exemplo n.º 24
0
        public AssetInfo GetAssetInfoById(int weaponId)
        {
            if (weaponId < 1)
            {
                return(new AssetInfo());
            }
            var weaponCfg = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(weaponId);

            if (null == weaponCfg)
            {
                return(new AssetInfo());
            }
            var icon = SingletonManager.Get <WeaponAvatarConfigManager>().GetKillIcon(weaponCfg.AvatorId);

            return(icon);
        }
Exemplo n.º 25
0
        //private static int testVehicleCount = 0;
        public static VehicleEntity CreateNewVehicle(VehicleContext context, int vehicleId, int entityId, Vector3 position)
        {
            var configItem = SingletonManager.Get <VehicleAssetConfigManager>().GetConfigItem(vehicleId);

            if (configItem != null)
            {
                //if (testVehicleCount < 40)
                //    position = new Vector3(5, -100, 5);
                var vehicle = CreateNewVehicle(context, entityId, configItem, position, Vector3.zero);

                //testVehicleCount++;
                return(vehicle);
            }

            return(null);
        }
Exemplo n.º 26
0
        private void HandleTest(IEventArgs args)
        {
            if ("test" == code)
            {
                ItemDrop id = new ItemDrop();
                id.cat = 2;
                id.id  = 1;
                List <ItemDrop> ids = SingletonManager.Get <FreeItemDrop>().GetExtraItems(id);

                foreach (ItemDrop item in ids)
                {
                    args.GameContext.session.entityFactoryObject.SceneObjectEntityFactory.
                    CreateSimpleObjectEntity((ECategory)item.cat, item.id, item.count, new Vector3(2, 1, 2));
                }
            }
        }
Exemplo n.º 27
0
 public void OnEntityCleanUp()
 {
     foreach (FreeMoveEntity entity in _group)
     {
         var effect = SingletonManager.Get <FreeEffectManager>().GetEffect("freemove_" + entity.entityKey.Value.EntityId);
         if (null != effect)
         {
             SingletonManager.Get <FreeEffectManager>().RemoveEffect(effect);
             //FreeGlobalVars.Loader.AddToGameObjectPool(effect.gameObject);
             foreach (IFreeEffect e in effect.GetEffects())
             {
                 e.Recycle();
             }
         }
     }
 }
Exemplo n.º 28
0
 public float GetGameFov(bool InShiftState)
 {
     if (entity == null || IsFovModified)
     {
         return(BaseFov);
     }
     if (InShiftState)
     {
         var weaponCfg = SingletonManager.Get <WeaponConfigManager>().GetConfigById(ConfigId.Value);
         if (weaponCfg != null)
         {
             return(weaponCfg.ShiftFov);
         }
     }
     return(BaseFov);
 }
Exemplo n.º 29
0
        //base property end

        void Awake()
        {
            //        super();
            autos = new List <AutoField>();

            effects  = new List <IFreeEffect>();
            boundMin = new Vector3(-10, -10, -10);
            boundMax = new Vector3(10, 10, 10);

            _min = new Vector3();
            _max = new Vector3();

            model3D           = new UnityObject3D(new GameObject("FreeRenderObject"));
            effectModel3DList = new List <IEffectModel3D>();
            SingletonManager.Get <SimpleUIUpdater>().Add(this);
        }
Exemplo n.º 30
0
 protected override void InternalExecute()
 {
     try
     {
         SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.UnityAssetManager);
         _assetManager.Update();
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("UnityAssetManangerSystem Exception:{0}", e);
     }
     finally
     {
         SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.UnityAssetManager);
     }
 }