public void show(OutfitRequirement outfitRequirement, CommandsCollection onClose) { _outfitRequirement = outfitRequirement; _onClose = onClose; gameObject.SetActive(true); updateItems(); }
public IEnemyCommand CreateCommand() { MoveCommand instance = CommandsCollection.GetCommandByEnum(_moveType); instance.SetParametrs(_moveCommandData); return(instance); }
public IEnemyCommand CreateCommand() { WeaponCommand instance = CommandsCollection.GetCommandByEnum(_shootType); instance.SetParametrs(_weaponCommandData); return(instance); }
public override void execute(Data data) { int duration = Duration; if (ToTime >= 0) { duration = GameManager.Instance.timeSecondsTils(ToTime); } int timeTilMidnight = GameManager.Instance.timeSecondsTils(0, false); if (OmitInterrupts == false && duration >= timeTilMidnight) { CommandsCollection commands = new CommandsCollection(); CommandTimePass timePassTilMidnight = new CommandTimePass(timeTilMidnight, ActivityID, true); //Interrupts have to be omitted otherwise there will be an infinite loop commands.Add(timePassTilMidnight); CommandInterrupt dayStartInterrupt = new CommandInterrupt("dayStart"); commands.Add(dayStartInterrupt); if (duration > timeTilMidnight) { CommandTimePass timePassAfterMidnight = new CommandTimePass(duration - timeTilMidnight, ActivityID); //Interrupts have to b performed because we don't check for possible further dayStart-intterupts here commands.Add(timePassAfterMidnight); } commands.execute(); } else { GameManager.Instance.timePass(duration, ActivityID); } return; }
private void LoadCommands() { bool isReadOnly; try { ToolbarInfo = m_ConfsProvider.GetToolbar(out isReadOnly, ToolbarSpecificationPath); } catch { isReadOnly = true; m_MsgService.ShowMessage("Failed to load the toolbar from the specification file. Make sure that you have access to the specification file", MessageType_e.Error); } IsEditable = !isReadOnly; if (Groups != null) { Groups.CommandsChanged -= OnGroupsCollectionChanged; Groups.NewCommandCreated -= OnNewCommandCreated; } Groups = new CommandsCollection <CommandGroupVM>( (ToolbarInfo.Groups ?? new CommandGroupInfo[0]) .Select(g => new CommandGroupVM(g))); HandleCommandGroupCommandCreation(Groups.Commands); Groups.NewCommandCreated += OnNewCommandCreated; Groups.CommandsChanged += OnGroupsCollectionChanged; }
public CommandGroupVM(CommandGroupInfo cmdGrp, IIconsProvider[] providers) : base(cmdGrp, providers) { m_CmdGrp = cmdGrp; m_Commands = new CommandsCollection <CommandMacroVM>( (cmdGrp.Commands ?? new CommandMacroInfo[0]) .Select(c => new CommandMacroVM(c, providers))); m_Commands.CommandsChanged += OnCommandsCollectionChanged; }
public CommandsControl() { Commands = new CommandsCollection(); Commands.Changed += FreezableCollectionChanged; _dict = new Dictionary <ICommand, CommandBinding>(); CommandManager.AddCanExecuteHandler(this, CanExecute); CommandManager.AddExecutedHandler(this, OnExecute); }
public CommandGroupVM(CommandGroupInfo cmdGrp) : base(cmdGrp) { m_CmdGrp = cmdGrp; m_Commands = new CommandsCollection <CommandMacroVM>( (cmdGrp.Commands ?? new CommandMacroInfo[0]) .Select(c => new CommandMacroVM(c))); m_Commands.CommandsChanged += OnCommandsCollectionChanged; }
public CommandGroupVM(CommandGroupInfo cmdGrp, IIconsProvider[] providers, IFilePathResolver filePathResolver, Func <CommandMacroInfo, CommandMacroVM> cmdMacroFact) : base(cmdGrp, providers, filePathResolver) { m_CmdGrp = cmdGrp; Commands = new CommandsCollection <CommandMacroVM>( (cmdGrp.Commands ?? new CommandMacroInfo[0]) .Select(c => cmdMacroFact.Invoke(c))); Commands.CommandsChanged += OnCommandsCollectionChanged; }
protected ViewModelBase(Guid id = default) { if (id == Guid.Empty) { id = Guid.NewGuid(); } _id = id; Commands = new CommandsCollection(); CommandCollectionFactory <T> .Wire(this, Commands); }
static void Main(string[] args) { IConsole console = new ConsoleEx("cl-mickaj console task manager"); ITaskManager taskManager = new TaskManager(); ITaskBuilder taskBuilder = new TaskBuilder(); IConverter converter = new CsvConverter(taskBuilder); ICommandsCollection commandsCollection = new CommandsCollection(console, taskManager, taskBuilder, converter); AppRunner app = new AppRunner(console, commandsCollection); app.Start(); }
public override void execute(Data data) { int duration = Duration; int currentSleepStat; if (data is GameData) { currentSleepStat = ((GameData)data).CharacterData.PC.statSleep; } else { currentSleepStat = data["PC.statSleep"]; } Activity sleepActivity = GameManager.Instance.ActivityLibrary["sleep"]; //https://stackoverflow.com/questions/17944/how-to-round-up-the-result-of-integer-division int requiredSleepSeconds = (1000000 - currentSleepStat - 1) / sleepActivity.statSleep + 1; int maximumSleepSeconds = Mathf.CeilToInt(requiredSleepSeconds * MaxSleepFactor); if (!String.IsNullOrEmpty(AlarmTimeRef)) { int alarmTime = data[AlarmTimeRef]; duration = GameManager.Instance.timeSecondsTils(alarmTime); if (!String.IsNullOrEmpty(AlarmActivatedRef)) { bool alarmActivated = data[AlarmActivatedRef]; if (!alarmActivated) { duration = -1; } } } if (duration > maximumSleepSeconds) { duration = UnityEngine.Random.Range(requiredSleepSeconds, maximumSleepSeconds); } if (duration < 0) { duration = requiredSleepSeconds;//= 3600; // TODO: calculate required sleep } CommandsCollection sleepCommands = SleepCommandList(duration); sleepCommands.execute(); return; }
public static CommandsCollection GotoCommandsList(LocationConnection locationConnection) { var result = new CommandsCollection(); if (locationConnection.interruptible) { result.Add(new CommandInterrupt(locationConnection.Type)); } result.Add(new CommandTimePass(locationConnection.Duration.GetValueOrDefault(0))); result.Add(new CommandGotoLocation(locationConnection.TargetLocation)); return(result); }
private void LoadToolbar(CustomToolbarInfo toolbarInfo) { if (Groups != null) { Groups.CommandsChanged -= OnGroupsCollectionChanged; Groups.NewCommandCreated -= OnNewCommandCreated; } Groups = new CommandsCollection <CommandGroupVM>( (toolbarInfo.Groups ?? new CommandGroupInfo[0]) .Select(g => m_CmdGrpFact.Invoke(g))); HandleCommandGroupCommandCreation(Groups.Commands); Groups.NewCommandCreated += OnNewCommandCreated; Groups.CommandsChanged += OnGroupsCollectionChanged; }
protected override async Task OnActivate(bool isFromReload) { Logger.LogInformation("Hello World!"); #if GenerateCommands var commandsCollection = new CommandsCollection(_userManager); RegisterCommands(commandsCollection); #endif #if GenerateConfiguration var config = ConfigurationInstance; Logger.LogInformation("Last start time: " + (config.LastStartTime == null ? "None (first start)" : config.LastStartTime.Value.ToString(CultureInfo.CurrentCulture))); // do something with config config.LastStartTime = DateTime.UtcNow; await SaveConfigurationAsync(); #endif }
public static CommandsCollection SleepCommandList(int duration) { CommandsCollection result = new CommandsCollection(); int duration25 = duration / 4; int duration75 = duration * 3 / 4; int middleDuration = UnityEngine.Random.Range(duration25, duration75); result.Add(new CommandInterrupt("SleepStart")); result.Add(new CommandTimePass(middleDuration, "sleep")); result.Add(new CommandInterrupt("SleepMiddle")); result.Add(new CommandTimePass(duration - middleDuration, "sleep")); result.Add(new CommandInterrupt("SleepEnd")); return(result); }
private void mod(CommandOutfit original, CommandOutfit mod) { OutfitRequirement = Modable.mod(original.OutfitRequirement, mod.OutfitRequirement); onClose = Modable.mod(original.onClose, mod.onClose); }
static void SetInternalItems(DependencyObject obj, CommandsCollection value) { obj.SetValue(InternalItemsProperty, value); }
public CompositeCommandBehavior() { CompositeCommand = new DelegateCommand <object>(CompositeCommandExecute, CompositeCommandCanExecute, false); Commands = new CommandsCollection(); ((INotifyCollectionChanged)Commands).CollectionChanged += OnCommandsChanged; }
private void SetActiveTab(Workspace_ViewModel tab) { CommandsCollection.MoveCurrentTo(tab); }
public WebHookController(CommandsCollection commands, ILogger <WebHookController> logger) { this.commands = commands; this.logger = logger; }
public OutfitWindow(PC character, OutfitRequirement outfitRequirement, CommandsCollection onClose) : this(character) { _outfitRequirement = outfitRequirement; _onClose = onClose; }