示例#1
0
 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);
    }
示例#3
0
    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;
    }
示例#5
0
        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;
        }
示例#6
0
        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;
        }
示例#7
0
        public CommandsControl()
        {
            Commands          = new CommandsCollection();
            Commands.Changed += FreezableCollectionChanged;
            _dict             = new Dictionary <ICommand, CommandBinding>();

            CommandManager.AddCanExecuteHandler(this, CanExecute);
            CommandManager.AddExecutedHandler(this, OnExecute);
        }
示例#8
0
        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;
        }
示例#9
0
        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;
        }
示例#10
0
        protected ViewModelBase(Guid id = default)
        {
            if (id == Guid.Empty)
            {
                id = Guid.NewGuid();
            }

            _id      = id;
            Commands = new CommandsCollection();
            CommandCollectionFactory <T> .Wire(this, Commands);
        }
示例#11
0
        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();
        }
示例#12
0
    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);
    }
示例#14
0
        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;
        }
示例#15
0
        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
        }
示例#16
0
    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);
    }
示例#17
0
 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;
 }
示例#20
0
 private void SetActiveTab(Workspace_ViewModel tab)
 {
     CommandsCollection.MoveCurrentTo(tab);
 }
示例#21
0
 public WebHookController(CommandsCollection commands, ILogger <WebHookController> logger)
 {
     this.commands = commands;
     this.logger   = logger;
 }
示例#22
0
 public OutfitWindow(PC character, OutfitRequirement outfitRequirement, CommandsCollection onClose) : this(character)
 {
     _outfitRequirement = outfitRequirement;
     _onClose           = onClose;
 }