Example #1
0
 public CategoriesViewModel(IManager manager)
 {
     this.manager = manager;
     Categories = new List<CategoryViewModel>();
     currentCategory = new CategoryViewModel(new Category(), manager);
     currentCategory.NotifyUpdate += () => LoadCategories();
 }
        public static IEnumerable<IActionResult> ExecuteToChildren(
            IManager pManager, 
            IAction pAction,
            bool pCheckSource)
        {
            ArgumentsValidation.NotNull(pManager, "pManager");
            ArgumentsValidation.NotNull(pAction, "pAction");

            var result = new List<IActionResult>();

            var children = pManager.GetChildren();
            if (children != null)
            {
                var checkedChildren = children.Where(x => !pCheckSource || !ReferenceEquals(x, pAction.GetSource()));
                foreach (var child in checkedChildren)
                {
                    var r = child.Execute(pManager, pAction);
                    if (r == null || r is NotAvailableActionResult)
                    {
                        continue;
                    }

                    result.Add(r);
                }
            }

            return new ReadOnlyCollection<IActionResult>(result);
        }
Example #3
0
		public FindReplaceDialog(IManager manager)
		{
			InitializeComponent();

			mManager = manager;

			DialogMode = Mode.Find;

			TextPlugin plugin = (TextPlugin)mManager.GetPlugin(typeof(TextPlugin));
			plugin.FindReplaceDialog = this;

			LoadFromRegistry(comboBoxFindWhat);
			LoadFromRegistry(comboBoxReplaceWith);
			LoadFromRegistry(comboBoxSearchIn);
			LoadFromRegistry(comboBoxFileTypes);

			if (comboBoxSearchIn.Items.Count == 0)
				comboBoxSearchIn.Items.AddRange(new string[] { "Current Project", "All Open Documents" });

			comboBoxSearchIn.Text = (string) comboBoxSearchIn.Items[0];

			if (comboBoxFileTypes.Items.Count > 0)
				comboBoxFileTypes.Text = (string) comboBoxFileTypes.Items[0];
			else
				FileTypes = "*.*";

			checkBoxIncludeSubFolders.Checked = true;
		}
Example #4
0
 public SearchManager(IManager pParentManager)
     : base(pParentManager)
 {
     _searchService = new GoodMangaSearchService();
     _searchService.Subscribe(this);
     SearchEngine.Instance.Register(_searchService);
 }
Example #5
0
        public void Add(IManager manager)
        {
            manager.Register(_gameManager);

            _managers.Add(manager);
            _managers.Sort();
        }
Example #6
0
    void Start()
    {
        iManager = GameObject.FindGameObjectWithTag ( "IManager" ).GetComponent<IManager>();

        if(Environment.OSVersion.ToString().Substring (0, 4) == "Unix")
        {

            path = mac;
        } else
        {

            path = windows;
        }

        logPath = path + "Transaction Log.txt";

        if ( File.Exists ( logPath ))
        {

            iManager.transactionHistory = new List<String> ( File.ReadAllText( logPath ).Split( new string[] { "\r\n", "\n" }, StringSplitOptions.None ));
            iManager.ReadLog ();
        } else {

            UnityEngine.Debug.Log ( "No log file could be found." );
        }
    }
Example #7
0
		public DebugManager(IManager manager)
		{
			mManager = manager;
			mPlugin = (LuaPlugin) manager.GetPlugin(typeof(LuaPlugin));
			mTransports = new List<ITransport>();
			mConnectionStatus = ConnectionStatus.NotConnected;
			mTargetStatus = TargetState.Disconnected;
			mConnectedTarget = null;
			mBreakpoints = new List<BreakpointDetails>();
			mWatches = new Dictionary<int, WatchDetails>();
			mValueCache = new ValueCache();

			mMainWindowComponents = new MainWindowComponents(this);

			InitialiseTransports();

			Manager.AddToMenuStrip(mMainWindowComponents.menuStrip.Items);
			Manager.AddToStatusStrip(mMainWindowComponents.statusStrip.Items);
			Manager.AddToolStrip(mMainWindowComponents.toolStrip, DockStyle.Top, 1);

			Manager.ProjectOpened += new ProjectOpenedEventHandler(Manager_ProjectOpened);

			if(Manager.MainWindow != null)
				Manager.MainWindow.FormClosing += new FormClosingEventHandler(MainWindow_FormClosing);
		}
Example #8
0
 public VenuesViewModel(IManager manager)
 {
     this.manager = manager;
     Venues = new List<VenueViewModel>();
     CurrentVenue = new VenueViewModel(new Venue(), manager);
     CurrentVenue.NotifyUpdate += () => LoadVenues();
 }
Example #9
0
 public LocationsViewModel(IManager manager)
 {
     this.manager = manager;
     Locations = new List<LocationViewModel>();
     CurrentLocation = new LocationViewModel(new Location(), manager);
     CurrentLocation.NotifyUpdate += () => LoadLocations();
 }
Example #10
0
 public LocationViewModel(IManager manager)
 {
     this.manager = manager;
     this.location = new Location();
     SaveCommand = new RelayCommand(o => UpdateLocation());
     ConfigureValidation();
 }
 public Item(Item item)
 {
     ID = item.ID;
     Name = item.Name;
     Health = item.Health;
     Armour = item.Armour;
     Speed = item.Speed;
     RotationSpeed = item.RotationSpeed;
     Prefab = item.Prefab;
     Cost = item.Cost;
     BuildTime = item.BuildTime;
     TypeIdentifier = item.TypeIdentifier;
     TeamIdentifier = item.TeamIdentifier;
     PlayerIdentifier = item.PlayerIdentifier;
     BuildingIdentifier = item.BuildingIdentifier;
     m_ItemImage = item.ItemImage;
     m_Button = item.Button;
     ItemImageHover = item.ItemImageHover;
     SortOrder = item.SortOrder;
     RequiredBuildings = item.RequiredBuildings;
     Explosion = item.Explosion;
     m_Manager = ManagerResolver.Resolve<IManager>();
     m_CostPerSecond = ((float)Cost)/BuildTime;
     m_ButtonStyle = item.ButtonStyle;
     ObjectType = item.ObjectType;
 }
 public MainWindow(IManager pManager)
     : base(pManager)
 {
     InitializeComponent();
     var mainManager = new MainManager(GetManager());
     TabControl.Items.Add(new GoodMangaTabController(mainManager));
 }
Example #13
0
        public PerformanceViewModel(VenueViewModel venueVm, ArtistViewModel artistVm, DateTime day, IManager manager)
        {
            this.manager = manager;
            this.performance = new Performance();

            this.performance.Start = day;

            var artist = manager.GetArtistByName(artistVm.Name);
            if (artist != null && artist.Count > 0)
                this.performance.Artist = artist.ElementAt(0);
            else
                this.performance.Artist = new Artist();

            var venue = manager.GetVenueById(venueVm.Id);
            if (venue != null)
                this.performance.Venue = venue;

            this.venueVm = venueVm;
            this.artistVm = artistVm;
            this.day = day;
            this.artists = new List<ArtistViewModel>();
            this.venues = new List<VenueViewModel>();

            SaveCommand = new RelayCommand(o => manager.UpdatePerformance(performance));
            RemoveCommand = new RelayCommand(o => manager.RemovePerformance(performance));
        }
Example #14
0
		public ProjectPanel(IManager manager)
		{
			InitializeComponent();

			m_manager = manager;
			m_mainWindow = (MainWindow) manager.MainWindow;
			m_manager.PropertyChange += new PropertyChangeEventHandler(Manager_PropertyChange);

			manager.ProjectOpened += new ProjectOpenedEventHandler(Manager_ProjectOpened);

			m_systemImageList = new SystemImageList();
			m_systemImageList.SetImageList(projectView);

			m_italicFont = new Font(projectView.Font, FontStyle.Italic);
			m_boldFont = new Font(projectView.Font, FontStyle.Bold);

			UpdateTree();

			foreach (Type docType in m_manager.GetPluginImplementations(typeof(Document)))
			{
				DocumentClassAttribute docAttr = DocumentClassAttribute.ForType(docType);
				if(docAttr != null)
				{
					ToolStripMenuItem item = new ToolStripMenuItem();
					item.Text = "New " + docAttr.Name;
					item.Click += new EventHandler(AddNewDocument_Click);
					item.Tag = docType;
					addToolStripMenuItem.DropDownItems.Insert(0, item);
				}
			}
		}
Example #15
0
 public CategoryViewModel(IManager manager)
 {
     this.manager = manager;
     this.category = new Category();
     this.SaveCommand = new RelayCommand(o => UpdateCategory());
     ConfigureValidation();
 }
Example #16
0
 static Server()
 {
     RemotingConfiguration.Configure(_configFile, false);
     WellKnownClientTypeEntry[] entries = RemotingConfiguration.GetRegisteredWellKnownClientTypes();
     Console.WriteLine(entries[0].TypeName + " " + entries[0].ObjectType + " " + entries[0].ObjectUrl);
     _manager = (IManager)Activator.GetObject(entries[0].ObjectType, entries[0].ObjectUrl);
 }
Example #17
0
		public ConsoleWindow(IManager manager)
		{
			InitializeComponent();

			m_manager = manager;
			m_plugin = (LuaPlugin)m_manager.GetPlugin(typeof(LuaPlugin));
			m_debugger = m_plugin.Debugger;

			m_manager.ProjectOpened += new ProjectOpenedEventHandler(Manager_ProjectOpened);
			m_manager.ProjectClosing += new ProjectClosingEventHandler(Manager_ProjectClosing);

			m_debugger.DebuggerConnected += new DebuggerConnectedEventHandler(Debugger_DebuggerConnected);
			m_debugger.DebuggerDisconnected += new DebuggerDisconnectedEventHandler(Debugger_DebuggerDisconnected);

			m_plugin.Options.OptionsChanged += new OptionsChangedDelegate(Options_OptionsChanged);

			m_autocompletePopup = new AutocompletePopup(m_debugger, this);
			m_autocompletePopup.Selection += new AutocompleteSelectionEventHandler(m_autocompletePopup_Selection);

			SetWaitingForResult(false);

			ConfigureScintillaControl(inputBox);

			ClearBrowser();
		}
        public SearchTabController(IManager pManager)
            : base(pManager)
        {
            InitializeComponent();

            var searchManager = new SearchManager(GetManager());
            Content = new SearchController(searchManager);
        }
Example #19
0
 // if NewsManager is null, create a new NewsManager.
 public IManager<News> GetNewsManager()
 {
     if (_newsManager == null)
     {
         _newsManager = new NewsManager();
     }
     return _newsManager;
 }
Example #20
0
 public IManager<Comment> GetCommentManager()
 {
     if (_commentManager == null)
     {
         _commentManager = new CommentManager();
     }
     return _commentManager;
 }
Example #21
0
        private void ConnectInitializer(IManager manager)
        {
            Console.WriteLine(manager.ManagerType + "Initializer");

            var clientThread = new Thread(HandleClientConnection);

            clientThread.Start(manager.GetClient());
        }
        public MangaReaderManager(IManager pParent, MangaInformation pManga, IEnumerable<ChapterInformation> pChapters)
            : base(pParent)
        {
            ArgumentsValidation.NotNull(pManga, "pManga");

            _manga = pManga;
            _chapters = new List<ChapterInformation>(pChapters ?? new List<ChapterInformation>());
        }
Example #23
0
		public PropertiesPanel(IManager manager)
		{
			InitializeComponent();

			m_manager = manager;

			m_manager.SelectionChanged += new SelectionChangedEventHandler(Manager_SelectionChanged);
		}
 public MenuController(IMenuManager menuManager,
     ICategoryManager categoryManager, IManager<Ingredient> ingredientManager, IDataManager<Restaurant> restaurantManager)
 {
     _menuManager = menuManager;
     _categoryManager = categoryManager;
     _ingredientManager = ingredientManager;
     _restaurantManager = restaurantManager;
 }
Example #25
0
 public ScheduleViewModel(IManager manager)
 {
     this.manager = manager;
     scheduleFirstDay = new ObservableCollection<PerformanceSchedulerViewModel>();
     scheduleSecondDay = new ObservableCollection<PerformanceSchedulerViewModel>();
     scheduleThirdDay = new ObservableCollection<PerformanceSchedulerViewModel>();
     ShareCommand = new RelayCommand(o => manager.NotifiyAllArtists());
 }
Example #26
0
 public MainViewModel(IManager manager)
 {
     locationVm = new LocationsViewModel(manager);
     categoryVm = new CategoriesViewModel(manager);
     venueVm = new VenuesViewModel(manager);
     artistVm = new ArtistsViewModel(manager);
     scheduleVm = new ScheduleViewModel(manager);
 }
Example #27
0
		public ProjectDocument(IManager manager, string fileName, Project project)
			: base(manager, fileName)
		{
			mBaseDirectory = Path.GetDirectoryName(fileName); //System.Windows.Forms.Application.StartupPath;
			mRootItem = new ProjectDocumentItem(this);
			mProject = project;
			mImports = new ListCollection<ProjectDocument>();
		}
 //-----------------------------------------------------------------------------------------------
 /// <summary>
 /// Adds a job to the manager
 /// </summary>
 /// <param name="manager"></param>
 /// <param name="sc">security credentials used to perform this operation</param>
 /// <param name="taskId"></param>
 /// <param name="jobId"></param>
 /// <param name="priority"></param>
 /// <param name="jobXml"></param>
 public static void AddJob(IManager manager, SecurityCredentials sc, string taskId, int jobId, int priority, string jobXml)
 {
     manager.Owner_SetThread(
         sc,
         new ThreadIdentifier(taskId, jobId, priority),
         Utils.SerializeToByteArray(JobFromXml(jobId, jobXml))
         );
 }
        public GridParameters(IManager sis)
        {
            log.Debug("Grid Parameters dialog created.");

            InitializeComponent();
            Bitmap bmp = Icons.grid;
            this.Icon = Icon.FromHandle(bmp.GetHicon());
            this.sis = sis;
        }
Example #30
0
		public void Initialise(IManager manager)
		{
			mManager = manager;

			mOptions = new DebuggerOptions();
			manager.OptionsManager.Options.Add(mOptions);

			mDebugger = new DebugManager(manager);
		}
Example #31
0
        private static void UseItem(UseCommand command, IManager manager)
        {
            // Get the avatar of the related player.
            var avatar = ((AvatarSystem)manager.GetSystem(AvatarSystem.TypeId)).GetAvatar(command.PlayerNumber);

            // Make sure we have the player's avatar.
            if (avatar <= 0)
            {
                return;
            }

            // Get the inventory of the player, containing the item to use.
            var inventory = (Inventory)manager.GetComponent(avatar, Inventory.TypeId);

            // Validate inventory index.
            if (command.InventoryIndex < 0 || command.InventoryIndex >= inventory.Capacity)
            {
                Logger.Warn("Invalid use command, index out of bounds.");
                return;
            }

            // Get the item.
            var id     = inventory[command.InventoryIndex];
            var usable = (Usable <UsableResponse>)manager.GetComponent(id, Usable <UsableResponse> .TypeId);
            var item   = (SpaceItem)manager.GetComponent(id, Item.TypeId);

            // Check if there really is an item there.
            if (id <= 0)
            {
                Logger.Warn("Invalid use command, no item at specified index.");
                return;
            }

            // Is it a usable item? If so use it. Otherwise see if we can equip the item.
            if (usable != null)
            {
                // Usable item, use it.
                ((SpaceUsablesSystem)manager.GetSystem(SpaceUsablesSystem.TypeId)).Use(usable);
            }
            else if (item != null)
            {
                // If we have a free slot for that item type equip it there,
                // otherwise swap with the first item.
                var equipment = (ItemSlot)manager.GetComponent(avatar, ItemSlot.TypeId);

                // Find free slot that can take the item, or failing that, the first
                // slot that can hold the item.
                ItemSlot firstValid = null;
                foreach (var slot in equipment.AllSlots)
                {
                    // Can the item be equipped into this slot?
                    if (slot.Validate(item))
                    {
                        // Is the slot empty?
                        if (slot.Item == 0)
                        {
                            // Found one, so remove it from the inventory.
                            inventory.RemoveAt(command.InventoryIndex);

                            // And equip it.
                            slot.Item = id;

                            // And we're done.
                            return;
                        }
                        if (firstValid == null)
                        {
                            // Already occupied, but remember the first valid one
                            // to force swapping if necessary.
                            firstValid = slot;
                        }
                    }
                }

                // Got here, so we had no empty slot. See if we can swap.
                if (firstValid != null)
                {
                    var oldItem = firstValid.Item;
                    inventory.RemoveAt(command.InventoryIndex);
                    inventory.Insert(command.InventoryIndex, oldItem);
                    firstValid.Item = id;
                }
                else
                {
                    Logger.Warn("Invalid use command, there's slot in which that item can be equipped.");
                }
            }
        }
Example #32
0
 public CommandInterpreter(IManager tankManager)
 {
     this.tankManager = tankManager;
 }
 public ItemCommand(IList <string> args, IManager manager) : base(args, manager)
 {
 }
Example #34
0
 public DocumentController(IManager mng) : base(mng)
 {
 }
Example #35
0
 public TransactionExecutor(IManager manager, string action, string method)
 {
     _manager     = manager;
     _transaction = new Transaction(action, method);
 }
Example #36
0
 public CommandParser(IManager reactorManager)
 {
     this.reactorManager = reactorManager;
 }
Example #37
0
 public VCProjectDocument(IManager manager, string fileName, Project project)
     : base(manager, fileName, project)
 {
 }
 public PaymentMethodManager(IManager <PaymentMethod> paymentMethodManager) => _paymentMethodManager = paymentMethodManager;
Example #39
0
 /// <summary>
 /// 添加管理器
 /// </summary>
 /// <param name="manager"></param>
 public void AddManager(IManager manager)
 {
     _managerDict[manager.GetType()] = manager;
     _managerList.Add(manager);
 }
Example #40
0
 public ValuesController(IManager _mng)
 {
     this.mng = _mng;
 }
Example #41
0
        /// <summary>Samples a new projectile.</summary>
        /// <param name="manager">The manager.</param>
        /// <param name="emitter">The emitter that the projectile comes from.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="angle">The angle.</param>
        /// <param name="weapon">The weapon.</param>
        /// <param name="faction">The faction the projectile belongs to.</param>
        /// <param name="random">The randomizer to use.</param>
        /// <returns>A new projectile.</returns>
        public int SampleProjectile(
            IManager manager,
            int emitter,
            Vector2 offset,
            float angle,
            Weapon weapon,
            Factions faction,
            IUniformRandom random)
        {
            var entity = manager.AddEntity();

            // Get position and velocity of the emitter, to set initial position
            // and additional velocity.
            var emitterTransform = (ITransform)manager.GetComponent(emitter, TransformTypeId);
            var emitterVelocity  = (IVelocity)manager.GetComponent(emitter, VelocityTypeId);

            // Rotate the offset.
            var emitterAngle = emitterTransform.Angle;
            var cosRadians   = (float)Math.Cos(emitterAngle);
            var sinRadians   = (float)Math.Sin(emitterAngle);

            FarPosition rotatedOffset;

            rotatedOffset.X = -offset.X * cosRadians - offset.Y * sinRadians;
            rotatedOffset.Y = -offset.X * sinRadians + offset.Y * cosRadians;

            // Set initial velocity.
            var velocity          = SampleInitialDirectedVelocity(emitterAngle + angle, random);
            var accelerationForce = SampleAccelerationForce(emitterAngle + angle, random);

            // Adjust rotation for projectile based on its own acceleration or speed.
            var emitAngle = emitterAngle;

            if (accelerationForce != Vector2.Zero)
            {
                emitAngle = (float)Math.Atan2(accelerationForce.Y, accelerationForce.X);
            }
            else if (velocity != Vector2.Zero)
            {
                emitAngle = (float)Math.Atan2(velocity.Y, velocity.X);
            }

            // See what we must not bump into.
            var collisionMask = ~faction.ToCollisionGroup();

            // Normally projectiles won't test against each other, but some may be
            // shot down, such as missiles. If that's the case, don't add us to the
            // common projectile group.
            if (!_canBeShot)
            {
                collisionMask &= ~Factions.Projectiles.ToCollisionGroup();
            }

            // Create physical body.
            var body = manager.AddBody(
                entity,
                emitterTransform.Position + rotatedOffset + velocity / Settings.TicksPerSecond,
                emitAngle,
                Body.BodyType.Dynamic,
                isBullet: true,
                allowSleep: false);

            manager.AttachCircle(
                body,
                UnitConversion.ToSimulationUnits(_collisionRadius),
                0,
                restitution: 0.1f,
                collisionCategory: faction.ToCollisionGroup() | Factions.Projectiles.ToCollisionGroup(),
                collisionMask: collisionMask);

            // Add to render system indexes. The padding these perform should be enough for any projectile.
            manager.AddComponent <Indexable>(entity).Initialize(CameraSystem.IndexId);
            manager.AddComponent <Indexable>(entity).Initialize(InterpolationSystem.IndexId);

            // If our emitter was moving, apply its velocity.
            if (emitterVelocity != null)
            {
                velocity += emitterVelocity.LinearVelocity;
            }

            // Then set the initial velocity of our bullet.
            body.LinearVelocity = velocity;

            // Sample an acceleration for this projectile. If there is any, create the
            // component for it, otherwise disregard.
            if (accelerationForce != Vector2.Zero)
            {
                // TODO add motor joint? else teach acceleration system to use ApplyForce
//                manager.AddComponent<Acceleration>(entity).Initialize(accelerationForce);
            }

            // Apply friction to this projectile if so desired.
            if (_friction > 0)
            {
                body.LinearDamping = 1f - _friction;
            }

            // If this projectile should vanish after some time, make it expire.
            if (_timeToLive > 0)
            {
                manager.AddComponent <Expiration>(entity).Initialize((int)(_timeToLive * Settings.TicksPerSecond));
            }

            // Mark as applying damage on collision.
            manager.AddComponent <CollisionDamage>(entity).Initialize(true);

            // Apply attributes of the weapon, modified with emitter attribute values,
            // and emitter attributes to the projectile to allow damage calculation if
            // it hits something.
            var emitterAttributes =
                (Attributes <AttributeType>)manager.GetComponent(emitter, Attributes <AttributeType> .TypeId);
            Attributes <AttributeType> projectileAttributes = null; // Only create if necessary.

            foreach (AttributeType attributeType in Enum.GetValues(typeof(AttributeType)))
            {
                if (attributeType == AttributeType.None)
                {
                    continue;
                }
                // Try to get weapon local attribute as base values.
                var value = 0f;
                if (weapon.Attributes.ContainsKey(attributeType))
                {
                    value = weapon.Attributes[attributeType];
                }
                // Try to modify it with emitter attributes.
                if (emitterAttributes != null)
                {
                    value = emitterAttributes.GetValue(attributeType, value);
                }
                // If we have something, copy it to the projectile.
// ReSharper disable CompareOfFloatsByEqualityOperator
                if (value != 0f)
// ReSharper restore CompareOfFloatsByEqualityOperator
                {
                    if (projectileAttributes == null)
                    {
                        projectileAttributes = manager.AddComponent <Attributes <AttributeType> >(entity);
                    }
                    projectileAttributes.SetBaseValue(attributeType, value);
                }
            }

            // Make us visible!
            if (!string.IsNullOrWhiteSpace(_model))
            {
                manager.AddComponent <SimpleTextureDrawable>(entity).Initialize(_model);
            }

            // And add some particle effects, if so desired.
            if (!string.IsNullOrWhiteSpace(_effect))
            {
                manager.AddComponent <ParticleEffects>(entity)
                .TryAdd(0, _effect, 1f, 0, _effectOffset, ParticleEffects.EffectGroup.None, true);
            }

            // Assign owner, to track original cause when they do something (e.g. kill something).
            manager.AddComponent <Owner>(entity).Initialize(emitter);

            return(entity);
        }
Example #42
0
 public AdminServiceController(IManager manager, ILogger <AdminServiceController> logger)   //Constructor
 {
     _logger  = logger;
     _manager = manager;
 }
Example #43
0
 public ServiceMQTT(ConfigServiceMQTT config, IManager manager) : base(config, manager)
 {
 }
Example #44
0
 public AccountController(IManager manager) : base(manager)
 {
 }
Example #45
0
 public MailController(IManager mng)
     : base(mng)
 {
 }
Example #46
0
 public ServiceMQ(ConfigServiceMQ config, IManager manager) : base(config, manager)
 {
     ILoggerFactory loggerFactory = new LoggerFactory()
                                    .AddConsole();
     //.AddDebug();
 }
Example #47
0
 public Engine(IInputReader reader, IOutputWriter writer, IManager heroManager)
 {
     this.reader      = reader;
     this.writer      = writer;
     this.heroManager = heroManager;
 }
Example #48
0
        public void Initialize(IManager manager, string ipcIdentifier)
        {
            Plugin.Manager       = manager;
            Plugin.IPCIdentifier = ipcIdentifier;
            Instance             = this;
            AutoBehaviour.CreateInstance();
            #region Harmony
            HarmonyInstance Harmony = HarmonyInstance.Create("com.REHERC.TwitchIntegration");
            Harmony.PatchAll(Assembly.GetExecutingAssembly());
            #endregion
            #region Files
            Plugin.Files = new FileSystem();
            #endregion
            #region Plugin Settings
            Settings.Initialize();
            #endregion
            #region Twitch Config
            Plugin.Config = new Configuration.Settings("Twitch");
            foreach (KeyValuePair <string, object> item in new Dictionary <string, object>()
            {
                { "Channel", "" },
                { "Token", "" }
            })
            {
                if (!Plugin.Config.ContainsKey(item.Key))
                {
                    Plugin.Config[item.Key] = item.Value;
                }
            }
            Plugin.Config.Save();
            #endregion
            #region Log
            Plugin.Log = new Logging.Logger("Twitch.log")
            {
                WriteToConsole = true,
                ColorizeLines  = true
            };
            #endregion
            #region Process Initialize
            Channel = Plugin.Config.GetItem <string>("Channel").ToLower();
            Token   = Plugin.Config.GetItem <string>("Token").ToLower();

            ProcessStartInfo info = new ProcessStartInfo
            {
                WorkingDirectory = Plugin.Files.RootDirectory,
                FileName         = Path.Combine(Plugin.Files.RootDirectory, @"Data\TwitchIntegration.Host.exe"),
                Arguments        = $"\"{Channel}\" \"{Token}\"",
                UseShellExecute  = false,

                CreateNoWindow         = true,
                RedirectStandardOutput = true
            };

            Plugin.Log.Success(info.FileName);

            TwitchAPI = Application.Start(info);

            new Thread((data) =>
            {
                string line;
                while (Plugin.AppRunning)
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(line = TwitchAPI.StandardOutput.ReadLine()))
                        {
                            ProcessLine(line);
                        }
                    }
                    catch (Exception e) { Plugin.Log.Exception(e); }
                }
            })
            {
                IsBackground = false
            }.Start();
            #endregion
            #region Create Settings Menu
            manager.Menus.AddMenu(MenuDisplayMode.Both, new MenuTree("twitchintegration.main", "TWITCH CHAT SETTINGS")
            {
                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.maxdisplayedmessages", "DISPLAYED MESSAGES QUANTITY")
                .LimitedByRange(1, 100)
                .WithGetter(() => Settings.MaxdDisplayedMessages)
                .WithSetter((value) => Settings.MaxdDisplayedMessages = value)
                .WithDefaultValue(20)
                .WithDescription("Sets the maximum numbers of messages that can be displaed."),

                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.chatfontsize", "CHAT TEXT FONT SIZE")
                .LimitedByRange(1, 96)
                .WithGetter(() => Settings.ChatFontSize)
                .WithSetter((value) => Settings.ChatFontSize = value)
                .WithDefaultValue(24)
                .WithDescription("Sets the font size of the twitch chat on teh car screen."),

                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.charsperline", "CHARACTERS PER LINE")
                .LimitedByRange(5, 200)
                .WithGetter(() => Settings.CharsPerLine)
                .WithSetter((value) => Settings.CharsPerLine = value)
                .WithDefaultValue(22)
                .WithDescription("Sets the maximum number of characters that can be displayed on a single line."),

                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.cockpitchatfontsize", "CHAT TEXT FONT SIZE (COCKPIT VIEW)")
                .LimitedByRange(1, 48)
                .WithGetter(() => Settings.CockpitChatFontSize)
                .WithSetter((value) => Settings.CockpitChatFontSize = value)
                .WithDefaultValue(18)
                .WithDescription("Sets the font size of the twitch chat on teh car screen when in cockpit view."),

                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.cockpitcharsperline", "CHARACTERS PER LINE (COCKPIT VIEW)")
                .LimitedByRange(5, 200)
                .WithGetter(() => Settings.CockpitCharsPerLine)
                .WithSetter((value) => Settings.CockpitCharsPerLine = value)
                .WithDefaultValue(20)
                .WithDescription("Sets the maximum number of characters that can be displayed on a single line when in cockpit view."),

                new IntegerSlider(MenuDisplayMode.Both, "twitchintegration.main.cockpitchatmargin", "CHAT TEXT MARGIN (COCKPIT VIEW)")
                .LimitedByRange(0, 150)
                .WithGetter(() => Settings.CockpitChatMargin)
                .WithSetter((value) => Settings.CockpitChatMargin = value)
                .WithDefaultValue(0)
                .WithDescription("Sets space added to the left side of the chat to avoid being hidden when in cockpit view."),

                new ActionButton(MenuDisplayMode.Both, "twitchintegration.main.clearchat", "CLEAR CURRENT CHAT")
                .WhenClicked(() => {
                    MessageQueue.Queue.Clear();
                    foreach (CarScreenLogic screen in GameObject.FindObjectsOfType <CarScreenLogic>())
                    {
                        MessageQueue.Reset();
                        screen.RebootAllWidgets();
                    }
                })
                .WithDescription("Clears the currently displayed messages and resets all instantiated car screens.")
            });
            #endregion
        }
Example #49
0
 public static bool Execute(MobileInstance ch, IManager dbManager)
 {
     return(Dragon.Execute(ch, "lightning breath", dbManager));
 }
Example #50
0
        private static bool SelectHeadMasterOption()
        {
            while (true)
            {
                Console.WriteLine("1. CRUD on courses");
                Console.WriteLine("2. CRUD on students");
                Console.WriteLine("3. CRUD on assignments");
                Console.WriteLine("4. CRUD on trainers");
                Console.WriteLine("5. CRUD on students per course");
                Console.WriteLine("6. CRUD on trainers per course");
                Console.WriteLine("7. CRUD on assignments per course");
                Console.WriteLine("8. CRUD on schedule per course");
                Console.WriteLine("9. Logout");
                Console.WriteLine("0. Exit");

                string input = Console.ReadLine();
                Console.Clear();

                bool goodInput = Int32.TryParse(input, out int choice);
                if (!goodInput)
                {
                    continue;
                }

                if (choice == 0)
                {
                    break;
                }

                HeadMasterOptions mainOption = (HeadMasterOptions)choice;

                IManager manager = null;

                switch (mainOption)
                {
                case HeadMasterOptions.crudCourses:
                    manager = new CourseManager();
                    break;

                case HeadMasterOptions.crudStudents:
                    manager = new StudentManager();
                    break;

                case HeadMasterOptions.crudAssignments:
                    manager = new AssignmentManager();
                    break;

                case HeadMasterOptions.crudTrainers:
                    manager = new TrainerManager();
                    break;

                case HeadMasterOptions.crudStudentsPerCourse:
                    manager = new StudentPerCourseManager();
                    break;

                case HeadMasterOptions.crudTrainersPerCourse:
                    manager = new TrainerPerCourseManager();
                    break;

                case HeadMasterOptions.crudAssignmentsPerCourse:
                    manager = new AssignmentPerCourseManager();
                    break;

                case HeadMasterOptions.crudSchedulePerCourse:
                    Console.WriteLine("CRUD ops for 'schedule per course' belongs to CRUD ops for course (start and end date)");
                    break;

                case HeadMasterOptions.logout:
                    Console.WriteLine("logging out");
                    Console.ReadKey();
                    Console.Clear();
                    return(false);

                default:
                    break;
                }

                if (manager != null)
                {
                    SelectHeadMasterCRUDOption(manager);
                }
            }
            return(true);
        }
Example #51
0
 public HeroCommand(List <string> args, IManager manager) : base(args, manager)
 {
 }
Example #52
0
 public IW4MServer(IManager mgr, ServerConfiguration cfg) : base(mgr, cfg)
 {
 }
Example #53
0
 public FileController(IManager manager, IDataModelManager dataModelManager)
 {
     _manager          = manager;
     _dataModelManager = dataModelManager;
 }
Example #54
0
 public RecipeCommand(IList <string> args, IManager manager)
     : base(args, manager)
 {
 }
Example #55
0
        private static void PlayerInput(PlayerInputCommand command, IManager manager)
        {
            // Get the avatar of the related player.
            var avatar = ((AvatarSystem)manager.GetSystem(AvatarSystem.TypeId)).GetAvatar(command.PlayerNumber);

            // Make sure we have the player's avatar.
            if (avatar <= 0)
            {
                return;
            }

            // Get the ship control.
            var control = ((ShipControl)manager.GetComponent(avatar, ShipControl.TypeId));

            // What type of player input should we process?
            switch (command.Input)
            {
            // Accelerating in the given direction (or stop if
            // a zero vector  is given).
            case PlayerInputCommand.PlayerInputCommandType.Accelerate:
                control.SetAcceleration(command.Value);
                break;

            // Begin rotating.
            case PlayerInputCommand.PlayerInputCommandType.Rotate:
                control.SetTargetRotation(command.Value.X);
                break;

            // Begin/stop to stabilize our position.
            case PlayerInputCommand.PlayerInputCommandType.BeginStabilizing:
                control.Stabilizing = true;
                break;

            case PlayerInputCommand.PlayerInputCommandType.StopStabilizing:
                control.Stabilizing = false;
                break;

            // Begin/stop shooting.
            case PlayerInputCommand.PlayerInputCommandType.BeginShooting:
                control.Shooting = true;
                break;

            case PlayerInputCommand.PlayerInputCommandType.StopShooting:
                control.Shooting = false;
                break;

            // Begin/stop shielding.
            case PlayerInputCommand.PlayerInputCommandType.BeginShielding:
                if (!control.ShieldsActive)
                {
                    control.ShieldsActive = true;
                    manager.AddComponent <ShieldEnergyStatusEffect>(avatar);
                }
                break;

            case PlayerInputCommand.PlayerInputCommandType.StopShielding:
                if (control.ShieldsActive)
                {
                    control.ShieldsActive = false;
                    manager.RemoveComponent(manager.GetComponent(avatar, ShieldEnergyStatusEffect.TypeId));
                }
                break;
            }
        }
Example #56
0
 public BaseController(IManager mng)
 {
     this.mng = mng;
 }
Example #57
0
        private static void DropItem(DropCommand command, IManager manager)
        {
            // Get the avatar of the related player.
            var avatar = ((AvatarSystem)manager.GetSystem(AvatarSystem.TypeId)).GetAvatar(command.PlayerNumber);

            // Make sure we have the player's avatar.
            if (avatar <= 0)
            {
                return;
            }

            // Where do we want to drop from.
            switch (command.Source)
            {
            case Source.Inventory:
            {
                // From our inventory, so get it.
                var inventory = ((Inventory)manager.GetComponent(avatar, Inventory.TypeId));

                // Validate the index.
                if (command.InventoryIndex < 0 || command.InventoryIndex >= inventory.Capacity)
                {
                    Logger.Warn("Invalid drop command, index out of bounds.");
                    return;
                }

                // Get the item to drop.
                var item = inventory[command.InventoryIndex];

                // Do we really drop anything?
                if (item > 0)
                {
                    inventory.RemoveAt(command.InventoryIndex);

                    // Position the item to be at the position of the
                    // player that dropped it.
                    var transform = (ITransform)manager.GetComponent(item, TransformTypeId);
                    transform.Position =
                        ((ITransform)manager.GetComponent(avatar, TransformTypeId)).Position;

                    // Enable rendering, if available.
                    foreach (IDrawable drawable in manager.GetComponents(item, DrawableTypeId))
                    {
                        drawable.Enabled = true;
                    }
                }
            }
            break;

            case Source.Equipment:
            {
                //var equipment = ((Equipment)avatar.GetComponent(, Equipment.TypeId));
                //var item = equipment[dropCommand.InventoryIndex];
                //equipment.RemoveAt(dropCommand.InventoryIndex);

                //var transform = ((Transform)item.GetComponent(, Transform.TypeId));
                //if (transform != null)
                //{
                //    transform.Translation = ((Transform)avatar.GetComponent(, Transform.TypeId)).Translation;
                //    var renderer = ((TransformedRenderer)item.GetComponent(, TransformedRenderer.TypeId));
                //    if (renderer != null)
                //    {
                //        renderer.Enabled = true;
                //    }
                //}
            }
            break;
            }
        }
        public void Initialize(IManager manager)
        {
            if (!settings.ContainsKey("category"))
            {
                settings.Add("category", "Adventure");
                settings.Save();
            }
            else
            {
                category = settings.GetItem <string>("category");
            }

            SetCategoryInfo();

            AttemptLivesplitConnection();

            Events.Scene.BeginSceneSwitchFadeOut.Subscribe(data =>
            {
                if (!started)
                {
                    ReloadCategory();
                    if (data.sceneName_ == "GameMode" && G.Sys.GameManager_.NextLevelName_ == firstLevel &&
                        G.Sys.GameManager_.NextGameModeID_ == categoryMode)
                    {
                        if (!livesplitSocket.Connected)
                        {
                            if (AttemptLivesplitConnection() == false)
                            {
                                return;
                            }
                        }
                        SendData("starttimer");
                        SendData("pausegametime");
                        started = true;
                        inLoad  = true;
                    }
                }
            });

            Race.Loaded += (sender, args) =>
            {
                if (livesplitSocket.Connected && started)
                {
                    SendData("getcurrenttimerphase");
                    byte[] responseBytes = new byte[256];
                    livesplitSocket.Receive(responseBytes);
                    string responseString = Encoding.UTF8.GetString(responseBytes);
                    if (responseString.StartsWith("NotRunning"))
                    {
                        totalElapsedTime = new TimeSpan();
                        started          = false;
                    }
                }
            };

            Race.Started += (sender, args) =>
            {
                if (started)
                {
                    SendData("unpausegametime");
                }
                inLoad = false;
            };

            LocalVehicle.Finished += (sender, args) =>
            {
                if (started)
                {
                    TimeSpan segmentTime;
                    if (args.Type == RaceEndType.Finished)
                    {
                        segmentTime = TimeSpan.FromMilliseconds(args.FinalTime);
                    }
                    else
                    {
                        segmentTime = Race.ElapsedTime;
                    }
                    totalElapsedTime += segmentTime;
                    Console.WriteLine($"Completed {Game.LevelName} with a segment time of {segmentTime.ToString()}");
                    Console.WriteLine($"Total time: {totalElapsedTime.ToString()}");
                    Console.WriteLine($"Race End Type: {args.Type.ToString()}");
                    SendData($"setgametime {totalElapsedTime.TotalSeconds}");
                    if (args.Type == RaceEndType.Finished)
                    {
                        SendData("split");
                    }
                    SendData("pausegametime");
                    inLoad = true;
                    if (args.Type == RaceEndType.Finished)
                    {
                        if (Game.LevelName == lastLevel)
                        {
                            totalElapsedTime = new TimeSpan();
                            started          = false;
                            justFinished     = true;
                        }
                        else if (Array.Exists(requiresMenuing, levelName => levelName == Game.LevelName))
                        {
                            justFinished = true;
                        }
                    }
                }
            };

            MainMenu.Loaded += (sender, args) =>
            {
                if (started && !justFinished)
                {
                    Console.WriteLine("Returned to main menu, resetting");
                    totalElapsedTime = new TimeSpan();
                    started          = false;
                    inLoad           = false;
                    SendData("reset");
                }
                else
                {
                    justFinished = false;
                }
            };
        }
Example #59
0
 public InvoicesManager(IRepository db, IManager mng)
 {
     _db       = db;
     _mng      = mng;
     _disposed = false;
 }
Example #60
0
 public ContractorController(IManager mng)
     : base(mng)
 {
 }