public void Dispose() { if (logics.ContainsKey(cookie)) { logics.Remove(cookie); } if (s_Default == this) { s_Default = null; } GameModuleManagement.UnCache(this); }
/// <summary> /// 添加武器组件控制器相关 /// </summary> /// <param name="player"></param> public static void AttachWeaponComponentBehavior(this PlayerEntity player, Contexts contexts, List <int> greandeIds) { // GameModuleManagement.Dispose(); GameModuleManagement.ForceAllocate(player.entityKey.Value.EntityId, (PlayerWeaponController controller) => { var greandeHelper = new GrenadeCacheHandler(() => { return(FindGrenadeCacheData(player)); }, () => { return(FindGrenadeWeaponEntity(player)); }, greandeIds, contexts.session.commonSession.FreeArgs); controller.Initialize(player, greandeHelper); //controller.SetWeaponContext(contexts.weapon); // controller.SetConfigManager(contexts.session.commonSession.PlayerWeaponResourceConfigManager); controller.SetProcessListener(player.ModeController().ProcessListener) ; controller.ResetAllComponents(); //#if UNITY_EDITOR // if (!player.hasPlayerDebug) // player.AddPlayerDebug(controller.Bag1DebugInfo,controller.Bag2DebugInfo,controller.Bag3DebugInfo,controller.Bag4DebugInfo); //#endif }); }
/// <summary> /// 添加武器组件控制器相关 /// </summary> /// <param name="player"></param> public static void AttachWeaponComponentBehavior(this PlayerEntity player, Contexts contexts, List <int> greandeIds) { int cookie = player.entityKey.Value.GetHashCode(); GameModuleManagement.Dispose(); GameModuleManagement.Allocate(cookie, (PlayerWeaponController controller) => { var playerWeaponAgent = new PlayerWeaponComponentsAgent(player.FindWeaponBagSetComponent, player.FindOverrideBagComponent, player.FindWeaponAuxiliaryComponent); var weaponInteract = new PlayerEntityWeaponInteract(controller, player); controller.SetOwner(player.entityKey.Value); controller.SetPlayerWeaponAgent(playerWeaponAgent); controller.SetInteract(weaponInteract); controller.SetWeaponContext(contexts.weapon); controller.SetConfigManager(contexts.session.commonSession.PlayerWeaponConfigManager); controller.SetProcessListener(player.modeLogic.ModeLogic); var helper = new GrenadeBagCacheHelper(() => { return(FindGrenadeCacheData(player)); }, greandeIds); controller.SetBagCacheHelper(EWeaponSlotType.ThrowingWeapon, helper); playerWeaponAgent.SetController(controller); controller.ResetAllComponents(); }); }
public static PlayerAudioControllerBase AudioController(this PlayerEntity playerEntity) { return(GameModuleManagement.Get <PlayerAudioControllerBase>(playerEntity.entityKey.Value.EntityId)); }
public static ISharedPlayerWeaponComponentGetter WeaponAPI(this PlayerEntity player) { return(GameModuleManagement.Get <PlayerWeaponController>(player.entityKey.Value.EntityId).Getter); }
public static PlayerWeaponController WeaponController(this PlayerEntity player) { return(GameModuleManagement.Get <PlayerWeaponController>(player.entityKey.Value.EntityId)); }
public static T GetController <T>(this PlayerEntity player) where T : ModuleLogicActivator <T>, new() { return(GameModuleManagement.Get <T>(player.entityKey.Value.EntityId)); }
public static GameModeControllerBase ModeController(this EntityKey owner) { return(GameModuleManagement.Get <GameModeControllerBase>(owner.EntityId)); }
public static PlayerAudioControllerBase AudioController(this EntityKey owner) { return(GameModuleManagement.Get <PlayerAudioControllerBase>(owner.EntityId)); }
public static PlayerStateInteractController InteractController(this EntityKey owner) { return(GameModuleManagement.Get <PlayerStateInteractController>(owner.EntityId)); }
public static PlayerWeaponController WeaponController(this EntityKey owner) { return(GameModuleManagement.Get <PlayerWeaponController>(owner.EntityId)); }
/// <summary> /// 添加武器组件控制器相关 /// </summary> /// <param name="player"></param> public static void AttachModeController(this PlayerEntity player, ISessionMode playerMode) { GameModuleManagement.ForceCache(player.entityKey.Value.EntityId, (GameModeControllerBase)playerMode); }
public static GameModeControllerBase ModeController(this PlayerEntity player) { return(GameModuleManagement.Get <GameModeControllerBase>(player.entityKey.Value.EntityId)); }