internal static DS.StrategyParams ToDsStrategyParams(StrategyParams parameters) { if (parameters == null) { return(null); } return(new DS.StrategyParams() { StrategyID = parameters.StrategyID, ExposedBalance = parameters.ExposedBalance }); }
public void UpdateSignalStrategyParams(string login, string signalName, StrategyParams parameters) { lock (_userWorkingSignals) { foreach (var signal in _userWorkingSignals) { if (signal.Name == signalName && signal.Owner == login) { signal.SetStrategyParameters(parameters); } } } }
/// <summary> /// Sets strategy parameters /// </summary> /// <param name="parameters">Parameters to use for this signal</param> public void SetStrategyParameters(StrategyParams parameters) { if (parameters == null) { return; } if (StrategyParameters == null) { StrategyParameters = new StrategyParams(parameters.StrategyID); } StrategyParameters.StrategyID = parameters.StrategyID; StrategyParameters.ExposedBalance = parameters.ExposedBalance; }
/// <summary> /// Calls scripting inner parameters Initialization using cross-thread lock's /// </summary> /// <param name="broker">Data broker</param> /// <param name="selections">Data descriptions on which code will be run</param> /// <param name="dataProvider">Object which provide access to historical and real time data</param> /// <returns>True if case of succeeded initialization</returns> public bool Init(IBroker broker, IDataProvider dataProvider, IEnumerable <Selection> selections, SignalState state, StrategyParams strategyParameters, ISimulationBroker simulationBroker = null) { Broker = broker; SimulationBroker = simulationBroker ?? new SimulationBroker(broker.AvailableAccounts, broker.Portfolios); DataProvider = dataProvider; State = state; SetStrategyParameters(strategyParameters); lock (_locker) { try { return(InternalInit(selections)); } catch { return(false); } } }
public override void Init() { m_SpellManager = selfGameObject.GetComponent <EnemySpellsManager>(); m_SelfController = selfGameObject.GetComponent <EnemyCharacterController>(); m_Params = selfGameObject.GetComponent <StrategyParams>(); m_SelfStats = selfGameObject.GetComponent <CharacterStatsController>(); m_PlayerController = playerGameObject.GetComponent <PlayerCharacterController>(); m_PlayerStats = playerGameObject.GetComponent <PlayerStatsController>(); m_SelfStats.onHealthChanged += UpdateDamageTime; m_DelayBetweenAttacks = m_SelfController.delayBetweenAttacks; m_cdr = m_SelfStats.cdr.GetValue(); m_GFX = selfGameObject.transform.Find("GFX").gameObject; m_MobileHealthBar = m_GFX.transform.Find("MobileHealthBar").gameObject; m_EnemyGraphic = m_GFX.transform.Find("EnemyGraphic").gameObject; m_TheHangingGraphic = m_EnemyGraphic.transform.Find("Rope").gameObject; m_Level = LevelsManager.instance.level; m_Animator = selfGameObject.GetComponent <EnemyAnimator>(); m_PlayerInteractable = playerGameObject.GetComponent <InteractableBase>(); PlayerManager.instance.playerDamageTaken += (dmg) => { m_DamageBalanced += dmg; }; EnemyManager.instance.enemyDamageTaken += (dmg) => { m_DamageBalanced -= dmg; }; }
void Start() { strategyParams = new StrategyParams { me = GetComponent <Player>(), opponent = GameController.Instance.GetPlayer(0), ground = GameObject.Find("FinalDest"), }; var strategyList = GetStrategyList(strategyListIndex); Func <StrategyType, StrategyInfo> makeStrategyInfo = (type) => { return(new StrategyInfo { strategyPicker = new StrategyPicker(GetStrategiesOfType(strategyList, type)), }); }; // Important: These must be in the same order as the StrategyType enum. strategyInfos = new [] { makeStrategyInfo(StrategyType.Movement), makeStrategyInfo(StrategyType.Jump), makeStrategyInfo(StrategyType.Attack), makeStrategyInfo(StrategyType.Block), }; }
private void UpdateSignalStrategyParams(string login, string signalName, StrategyParams parameters) => UpdateStrategyParams?.Invoke(null, login, signalName, parameters);