private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1) { if (card.Id != 0 && type == ExecutorType.Activate) { if (_activatedCards.ContainsKey(card.Id) && _activatedCards[card.Id] >= 9) { return(false); } if (!Executor.OnPreActivate(card)) { return(false); } } Executor.SetCard(type, card, desc); bool result = card != null && exec.Type == type && (exec.CardId == -1 || exec.CardId == card.Id) && (exec.Func == null || exec.Func()); if (card.Id != 0 && type == ExecutorType.Activate && result) { int count = card.IsDisabled() ? 3 : 1; if (!_activatedCards.ContainsKey(card.Id)) { _activatedCards.Add(card.Id, count); } else { _activatedCards[card.Id] += count; } } return(result); }
public ToAddElement(string[] buts, string element, ExecType type, ExecutorType executorType, bool tag = true) { this.buts = buts; this.element = element; this.type = type; this.executorType = executorType; this.tag = tag; }
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, long desc = -1) { Executor.SetCard(type, card, desc); return(card != null && exec.Type == type && (exec.CardId == -1 || exec.CardId == card.Id) && (exec.Func == null || exec.Func())); }
private void OnGUI() { _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("リリースタイプ"); _executorType = (ExecutorType)EditorGUILayout.EnumPopup(_executorType); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("ブランチ名"); _releaseParameter.BranchName = EditorGUILayout.TextArea(_releaseParameter.BranchName); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("タグ名"); _releaseParameter.TagName = EditorGUILayout.TextArea(_releaseParameter.TagName); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Githubユーザー名"); _releaseParameter.UserName = EditorGUILayout.TextArea(_releaseParameter.UserName); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Githubトークン"); _releaseParameter.TokenValue = EditorGUILayout.TextArea(_releaseParameter.TokenValue); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("リリース設定"); var setting = EditorGUILayout.ObjectField(_releaseSetting, typeof(ReleaseExecutorSetting), false) as ReleaseExecutorSetting; if (setting != _releaseSetting) { _releaseSetting = setting; } } _releaseSettingEditor = Editor.CreateEditor(_releaseSetting); if (_releaseSettingEditor) { _releaseSettingEditor.OnInspectorGUI(); } EditorGUILayout.EndScrollView(); if (GUILayout.Button("リリース")) { Release(); } }
private IReleaseExecutor CreateExecutor(ExecutorType type) { switch (type) { case ExecutorType.GitHub: return(new GitHubReleaseExecutor()); } return(null); }
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1) { Executor.SetCard(type, card, desc); if (card != null && exec.Type == type && (exec.CardId == -1 || exec.CardId == card.Id) && (exec.Func == null || exec.Func())) { return(true); } return(false); }
public Executor(Executable e, GameObject active, GameObject nonActive, ExecutorType type, bool tag = true) { this.active = active; this.nonActive = nonActive; this.executable = e; this.activate = false; this.type = type; this.tag = tag; //this.Push(); UpdateColors(); }
/// <summary> /// Инициализировать Аrduino-датчик. /// </summary> /// <param name="isEnabled"> /// Использовать ли этого исполнителя или нет. Если этот /// параметр отключить, то на исполнителя невозможно будет отдавать /// какие-либо команды, а также частично или полностью перестанут /// работать правила, в действиях которых фигурирует данный исполнитель. /// </param> /// <param name="atPin">Адрес пина Arduino-исполнителя, к которому подключён подчинённый</param> /// <param name="deviceId">Индентификатор исполнителя</param> /// <param name="driverId">Индентификатор драйвера исполнителя</param> /// <param name="type">Подтип датчика</param> /// <param name="parent">Объект Arduino-исполнителя, к которому подключён подчинённый</param> /// <param name="displayData">Информация для отображения в вершителях</param> public ArduinoExecutor( string atPin, bool isEnabled, string driverId, ExecutorType type, ArduinoDevice parent, DeviceDisplayData displayData = default) : base(isEnabled, false, false, "Arduino", $"{parent.DeviceAddress}:{atPin}", driverId, ConnectionType.WireGeneric, displayData) { IsFertile = false; Type = type; }
/// <summary> /// Do the action for the card if available. /// </summary> public void AddExecutor(ExecutorType type, int cardId) { Executors.Add(new CardExecutor(type, cardId, null)); }
/// <summary> /// Do the action for every card if func return true. /// </summary> public void AddExecutor(ExecutorType type, Func <bool> func) { Executors.Add(new CardExecutor(type, -1, func)); }
/// <summary> /// Set global variables Type, Card, ActivateDescription for Executor /// </summary> public void SetCard(ExecutorType type, ClientCard card, int description) { Type = type; Card = card; ActivateDescription = description; }
/// <summary> /// Do the action for the card if func return true. /// </summary> public void AddExecutor(ExecutorType type, int cardId, Func <bool> func) { Executors.Add(new CardExecutor(type, cardId, func)); }
public void AddExecutor(ExecutorType type) { Executors.Add(new CardExecutor(type, -1, DefaultNoExecutor)); }
public void SetCard(ExecutorType type, ClientCard card, int description) { Type = type; Card = card; ActivateDescription = description; }
public void AddExecutor(ExecutorType type, int cardId) { Executors.Add(new CardExecutor(type, cardId, null)); }
public IProgramInvoke CreateProgramInvoke(TransactionType tx_type, ExecutorType executor_type, Transaction tx, long token_value, long token_id, Block block, IDeposit deposit, long vm_start, long vm_should_end, long energy_limit) { byte[] data = null; byte[] last_hash = null; byte[] coinbase = null; byte[] contract_address = null; byte[] owner_address = null; long balance = 0; long number = -1; long timestamp = 0; if (tx_type == TransactionType.TX_CONTRACT_CREATION_TYPE) { CreateSmartContract contract = ContractCapsule.GetSmartContractFromTransaction(tx); contract_address = Wallet.GenerateContractAddress(tx); owner_address = contract.OwnerAddress.ToByteArray(); balance = deposit.GetBalance(owner_address); data = new byte[0]; long call_value = contract.NewContract.CallValue; switch (executor_type) { case ExecutorType.ET_NORMAL_TYPE: case ExecutorType.ET_PRE_TYPE: { if (null != block) { last_hash = block.BlockHeader.RawData.ParentHash.ToByteArray(); coinbase = block.BlockHeader.RawData.WitnessAddress.ToByteArray(); timestamp = block.BlockHeader.RawData.Timestamp / 1000; number = block.BlockHeader.RawData.Number; } } break; default: break; } return(new ProgramInvoke(contract_address, owner_address, owner_address, balance, call_value, token_value, token_id, data, last_hash, coinbase, timestamp, number, deposit, vm_start, vm_should_end, energy_limit)); } else if (tx_type == TransactionType.TX_CONTRACT_CALL_TYPE) { TriggerSmartContract contract = ContractCapsule.GetTriggerContractFromTransaction(tx); byte[] address = contract.ContractAddress.ToByteArray(); byte[] origin = contract.OwnerAddress.ToByteArray(); byte[] caller = contract.OwnerAddress.ToByteArray(); balance = deposit.GetBalance(caller); long call_value = contract.CallValue; data = contract.Data.ToByteArray(); switch (executor_type) { case ExecutorType.ET_CONSTANT_TYPE: break; case ExecutorType.ET_PRE_TYPE: case ExecutorType.ET_NORMAL_TYPE: if (null != block) { last_hash = block.BlockHeader.RawData.ParentHash.ToByteArray(); coinbase = block.BlockHeader.RawData.WitnessAddress.ToByteArray(); timestamp = block.BlockHeader.RawData.Timestamp / 1000; number = block.BlockHeader.RawData.Number; } break; default: break; } return(new ProgramInvoke(address, origin, caller, balance, call_value, token_value, token_id, data, last_hash, coinbase, timestamp, number, deposit, vm_start, vm_should_end, energy_limit)); } throw new ContractValidateException("Unknown contract type"); }
public CardExecutor(ExecutorType type, int cardId, Func<bool> func) { CardId = cardId; Type = type; Func = func; }
public void AddExecutor(ExecutorType type, int cardId, Func<bool> func) { Executors.Add(new CardExecutor(type, cardId, func)); }
/// <summary> /// Set global variables Type, Card, ActivateDescription for Executor /// </summary> public void SetCard(ExecutorType type, ClientCard card, int description) { this.ExecType = type; this.Card = card; this.ActivateDescription = description; }
public CardExecutor(ExecutorType type, int cardId, Func <bool> func) { this.CardId = cardId; this.Type = type; this.Func = func; }
/// <summary> /// Do the action for every card if no other Executor is added to it. /// </summary> public void AddExecutor(ExecutorType type) { Executors.Add(new CardExecutor(type, -1, DefaultNoExecutor)); }
public void AddExecutor(ExecutorType type, Func<bool> func) { Executors.Add(new CardExecutor(type, -1, func)); }
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1) { Executor.SetCard(type, card, desc); if (card != null && exec.Type == type && (exec.CardId == -1 || exec.CardId == card.Id) && (exec.Func == null || exec.Func())) return true; return false; }
AddExecutor(ExecutorType.Activate, (int)CardId.MirrorForce, DefaultTrap);