public HitBoxBuilder(AllServices allServices) { callbacks = new Dictionary <string, Action <HitInfo> >(); this.hitBoxService = allServices.GetService <IHitBoxService>(); this.fgService = allServices.GetService <IFightingGameService>(); this.hitBoxPrefab = this.hitBoxService.DefaultPrefab(); }
static HotKeyManager() { for (var i = ServiceName.None; i < ServiceName.ServiceCount; ++i) { AllServices.Add(new Service(i)); } }
public BootstrapState(GameStateMachine gameStateMachine, SceneLoader sceneLoader, AllServices services) { _gameStateMachine = gameStateMachine; _sceneLoader = sceneLoader; _services = services; RegisterServices(); }
public IEnumerable <KeyValuePair <string, string> > GetModNamesAndDisplayNames(ModType modType) { switch (modType) { case ModType.SolvableModule: return(AllSolvableModules.Select((x) => new KeyValuePair <string, string>(x.ModuleType, x.ModuleName))); case ModType.NeedyModule: return(AllNeedyModules.Select((x) => new KeyValuePair <string, string>(x.ModuleType, x.ModuleName))); case ModType.Bomb: return(AllBombMods.Select((x) => new KeyValuePair <string, string>(x.name, x.name.Replace("(Clone)", "")))); case ModType.GameplayRoom: return(AllGameplayRoomMods.Select((x) => new KeyValuePair <string, string>(x.name, x.name.Replace("(Clone)", "")))); case ModType.Widget: return(AllWidgetMods.Select((x) => new KeyValuePair <string, string>(x.name, x.name.Replace("(Clone)", "")))); case ModType.Service: return(AllServices.Select((x) => new KeyValuePair <string, string>(x.ServiceName, x.ServiceName.Replace("(Clone)", "")))); default: return(null); } }
public void BuildAttack(AllServices services) { fgService = services.GetService <IFightingGameService>(); projectServ = services.GetService <IProjectileService>(); audioServ = services.GetService <IAudioService>(); fgChar = services.GetService <IBuildService>().GetBuildingFGChar(); AttackBuilder attackBuilder = new AttackBuilder(services); builderCallback(attackBuilder); attackBuilder.BuildAttack(); name = attackBuilder.name; orientation = attackBuilder.orientation; groundRelation = attackBuilder.groundRelation; input = attackBuilder.input; priority = 1; animStateName = attackBuilder.animStateName; frames = attackBuilder.GetFrames(); hitBoxes = attackBuilder.GetHitBoxes(); tracker = new AttackTracker(frames.Count); }
public Controller(StagUser stagUser, ScheduleView scheduleView, MainWindow mainWindow) { Config = new Config(); this.Client = new Client(Debug, stagUser); this.StudentService = new StudentService(Debug, Client); this.ScheduleService = new ScheduleService(Debug, Client); this.TeacherService = new TeacherService(Debug, Client); this.AllServices = new AllServices(StudentService, TeacherService, ScheduleService); this.ComonScheduleActionManager = new ComonScheduleActionManager(Debug, AllServices); this.FillerScheduleActionManager = new FillerScheduleActionManager(Debug, AllServices); if (Config.LoadedStagUser != null) { Debug.AddMessage <object>(new Message <object>("Automatically logged in,(using stored user).", MessageTypeEnum.Indifferent)); Client.StagUser = Config.LoadedStagUser; } else if (stagUser == null) { Debug.AddMessage <object>(new Message <object>("Not logged in (yet) => using guest account", MessageTypeEnum.Indifferent)); } this.ScheduleView = scheduleView; //InitCustmViews(mainWindow); SubscribeEvents(); }
private static Dictionary <T, T2> CacheServices <T, T2>() where T2 : UploaderService <T> { T2[] instances = Helpers.GetInstances <T2>(); AllServices.AddRange(instances.Cast <IUploaderService>()); return(instances.ToDictionary(x => x.EnumValue, x => x)); }
public GameStateMachine(SceneLoader sceneLoader, AllServices services, ICoroutineRunner coroutineRunner) { states = new Dictionary <Type, IExitableState> { [typeof(BootstrapState)] = new BootstrapState(this, sceneLoader, services, coroutineRunner), [typeof(LoadLevelState)] = new LoadLevelState(this, sceneLoader, services.Single <ILevelFactory>()) }; }
public FightingGameCharacter CreateCharacter(AllServices services) { GameObject character = Instantiate <GameObject>(male0Prefab, transform.position, transform.rotation); character.name = male0Prefab.name; fgChar = character.GetComponent <FightingGameCharacter>(); return(fgChar); }
private static Dictionary <T, T2> CacheServices <T, T2>() where T2 : UploaderService <T> { IEnumerable <T2> instances = Helpers.GetInstances <T2>(); AllServices.AddRange(instances.OfType <IUploaderService>()); AllGenericUploaderServices.AddRange(instances.OfType <IGenericUploaderService>()); return(instances.ToDictionary(x => x.EnumValue, x => x)); }
public GameStateMachine(SceneLoader sceneLoader, LogicCurtain curtain, AllServices services) { _states = new Dictionary <Type, IExitableState> { [typeof(BootstrapState)] = new BootstrapState(this, sceneLoader, services), [typeof(LoadLevelState)] = new LoadLevelState(this, sceneLoader, curtain, services.Single <IGameFactory>()), [typeof(GameLoopState)] = new GameLoopState(this), }; }
public BootstrapState(GameStateMachine stateMachine, SceneLoader sceneLoader, AllServices services, ICoroutineRunner coroutineRunner) { _stateMachine = stateMachine; _sceneLoader = sceneLoader; _services = services; _coroutineRunner = coroutineRunner; RegisterServices(); }
protected override INavigatable <MainNavigatableTypes> CreateViewModel(MainNavigatableTypes type, AllServices allServices) { if (type == MainNavigatableTypes.Auth) { var res = new AuthViewModel(() => Navigate(MainNavigatableTypes.Check)); _allServices = new AllServices(res.User); return(res); } else { return(new CheckViewModel(_allServices)); } }
/// <summary> /// 根据用户名获取服务状态 /// </summary> /// <param name="serviceName">服务名</param> /// <returns>服务状态(不存在该服务时,返回停止)</returns> public static ServiceControllerStatus GetServiceStatus(string serviceName) { var status = ServiceControllerStatus.Stopped; AllServices.ForEach(one => { if (one.ServiceName.ToLower() == serviceName.ToLower()) { status = one.Status; } }); return(status); }
public List <PCO.PCOItem> GetSongHistory(string songIDString, DateTime startDate) { int songID = 0; Int32.TryParse(songIDString, out songID); //List<PCO.PCOItem> songsPlayed = AllServices.Where(s => s.Songs.Find(p => p.SongID == songID)); List <PCO.PCOItem> songsPlayed = AllServices.Where(d => d.Date >= startDate).SelectMany(q => q.Songs).Where(a => a.SongID == songID).ToList(); songsPlayed.Reverse(); return(songsPlayed); }
public GameStateMachine( TextureLoader textureLoader, SceneLoader sceneLoader, LoadingCurtain loadingCurtain, AllServices services) { _states = new Dictionary <Type, IExitableState>() { [typeof(BootstrapState)] = new BootstrapState(this, sceneLoader, services), [typeof(LoadTexturesState)] = new LoadTexturesState(this, textureLoader, services.Single <ITexturesProvider>()), [typeof(LoadLevelState)] = new LoadLevelState(this, sceneLoader, loadingCurtain, services.Single <IGameFactory>(), services.Single <ICardDealerService>()), [typeof(DealingState)] = new DealingState(this, services.Single <ICardDealerService>()), [typeof(MatchLoopState)] = new MatchLoopState(this), }; }
public void Build(AllServices services) { Male0Builder charBuilder = new Male0Builder(services); Attacks attacks = new Attacks(services, audioMap.BuildDictionary()); Movement movement = new Movement(services); charBuilder.Version("0.1"); attacks.Init(charBuilder, fgChar); movement.Init(charBuilder, fgChar); charBuilder.SetUpCharacter(fgChar); Destroy(gameObject); }
// Проверяет, изменились ли данные в строке и добавляет новую услугу или меняет существующую. // Если в строке недостаточно данных для услуги(новая строка), ничего не делает, предотвращая создание новой услуги из пустой строки private void ChangeServiceRow(DataGridViewRow row) { if (row.IsNewRow) { return; } var id = AllServices.IndexOfKey((int)row.Cells["ColumnIdService"].Value); // индекс в списке var summ = (decimal)row.Cells["ColumnServiceSumm"].Value; var nw = (string)row.Cells["ColumnNameWork"].Value ?? ""; if (summ == 0 || nw?.Length == 0) { return; // если эти ячейки пусты, значит данных для добавления/изменения услуги недостаточно(false) } var nd = (string)row.Cells["ColumnNameDevice"].Value ?? ""; var sd = CurrentClient.Subdivisions.IndexOfValue((string)row.Cells["ColumnSubdivision"].Value ?? ""); var ai = (string)row.Cells["ColumnAddInfo"].Value ?? ""; var numb = (int)row.Cells["ColumnServiceNumb"].Value; Service sv; if (id == -1) { sv = new Service(nw, nd, sd, numb, summ, -1, ai); // добавляем новую услугу CurrentContract.AddService(sv); // добавляем в список услуг текущего договора row.Cells["ColumnIdService"].Value = sv.Id; } else { sv = AllServices.Values[id]; // извлекаем существующую // Проверяем, изменились ли данные if (summ != sv.Value || numb != sv.Number || nw != sv.Nw.Name || nd != sv.Nd.Name || sd != sv.Sd || ai != sv.Ai.Name) { CurrentContract.SetService(nw, nd, sd, numb, summ, sv.Id, ai); // меняем значения } } }
private void InitAllServices() { if (Sets != null && Sets.Count > 0) { foreach (var key in Sets.Keys) { foreach (var api in Sets[key]) { if (!AllServices.Any(a => a.ID == api.ID)) { AllServices.Add(api); } } } } }
public void Start() { fgService = GetComponent <FightingGameService>(); audioService = GetComponent <AudioService>(); hitBoxService = GetComponent <HitBoxService>(); projectileService = GetComponent <ProjectileService>(); services = new AllServices() .AddServiceAs <IBuildService>(this) .AddServiceAs <IFightingGameService>(fgService) .AddServiceAs <IAudioService>(audioService) .AddServiceAs <IHitBoxService>(hitBoxService) .AddServiceAs <IProjectileService>(projectileService); EventManager.TriggerEvent <Events.ServiceReady, Type>(typeof(BuildService)); }
/// <summary> /// Closing and disposing all underlying resources. It cleans all included objects as well. /// It should be called as soon as the object is not needed anymore. After this call /// object is unusable - any further communication with the same device requires to create /// completely new BleDevice object from scratch. /// </summary> public async Task Close() { foreach (var ch in AllServices) { await ch.Close(); } AllServices.Clear(); if (LEDevice != null) { LEDevice.ConnectionStatusChanged -= ConnectionStatusChanged; } LEDevice?.Dispose(); LEDevice = null; DeviceInfo = null; }
public ComonScheduleActionManager(BaseDebug debug, AllServices allServices) { this._debug = debug; this._allServices = allServices; DoWork(); }
public Male0Builder(AllServices services) : base(services) { // do nothing }
public Attacks(AllServices services, Dictionary <string, AudioClip> audioMap) { audioService = services.GetService <IAudioService>(); projectileService = services.GetService <IProjectileService>(); this.audioMap = audioMap; }
private void worker_DoWork(object sender, DoWorkEventArgs e) { int maxSubmissions = AllServices.Count; List <ServiceSheetViewModel> updatedSubmissions = new List <ServiceSheetViewModel>(); string downloadUrl; string customerSignatureUrl; string image1Url; string image2Url; string image3Url; string image4Url; string image5Url; foreach (ServiceSheetViewModel currentSubmission in AllServices.ToList()) { downloadUrl = currentSubmission.MttEngSignatureUrl; ImageSource imgEngSignature = CanvasDataReader.downloadImage(downloadUrl, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (imgEngSignature == null) { updatedSubmissions = null; return; } currentSubmission.MttEngineerSignature = imgEngSignature; currentSubmission.MttEngineerSignature.Freeze(); //Download the customer signature customerSignatureUrl = currentSubmission.CustomerSignatureUrl; if (!customerSignatureUrl.Equals("")) { ImageSource imgCustSignature = CanvasDataReader.downloadImage(customerSignatureUrl, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (imgCustSignature == null) { updatedSubmissions = null; return; } currentSubmission.CustomerSignature = imgCustSignature; currentSubmission.CustomerSignature.Freeze(); } //Download all the images, if they exist image1Url = currentSubmission.Image1Url; if (!image1Url.Equals("")) { ImageSource img1 = CanvasDataReader.downloadImage(image1Url, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (img1 == null) { updatedSubmissions = null; return; } currentSubmission.Image1 = img1; currentSubmission.Image1.Freeze(); } image2Url = currentSubmission.Image2Url; if (!image2Url.Equals("")) { ImageSource img2 = CanvasDataReader.downloadImage(image2Url, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (img2 == null) { updatedSubmissions = null; return; } currentSubmission.Image2 = img2; currentSubmission.Image2.Freeze(); } image3Url = currentSubmission.Image3Url; if (!image3Url.Equals("")) { ImageSource img3 = CanvasDataReader.downloadImage(image3Url, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (img3 == null) { updatedSubmissions = null; return; } currentSubmission.Image3 = img3; currentSubmission.Image3.Freeze(); } image4Url = currentSubmission.Image4Url; if (!image4Url.Equals("")) { ImageSource img4 = CanvasDataReader.downloadImage(image4Url, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (img4 == null) { updatedSubmissions = null; return; } currentSubmission.Image4 = img4; currentSubmission.Image4.Freeze(); } image5Url = currentSubmission.Image5Url; if (!image5Url.Equals("")) { ImageSource img5 = CanvasDataReader.downloadImage(image5Url, CanvasUser, FullUrl); //If there has been an error with the image download, then return an empty collection if (img5 == null) { updatedSubmissions = null; return; } currentSubmission.Image5 = img5; currentSubmission.Image5.Freeze(); } updatedSubmissions.Add(currentSubmission); CurrentStatus = CurrentStatus + 1; (sender as BackgroundWorker).ReportProgress(CurrentStatus); } //Return the list of submissions with the images e.Result = updatedSubmissions; }
static void Main(string[] args) { Computer musicObj = new Music(); Computer computer = new Computer(); Computer filmsObj = new Films(); AllServices allServices = new AllServices(); bool more = true; while (more) { Console.WriteLine("hello user, What do you want to have fun with today?"); Console.WriteLine("1. Computers"); Console.WriteLine("2. Films"); Console.WriteLine("3. Music"); Console.WriteLine("4. Exit"); int x = Convert.ToInt32(Console.ReadLine()); switch (x) { case 1: bool compMore = true; while (compMore) { Console.WriteLine("Entering to computer"); Console.WriteLine("1. Display all computer files"); Console.WriteLine("2. Add new computer file"); Console.WriteLine("3. Exit"); int compX = Convert.ToInt32(Console.ReadLine()); switch (compX) { case 1: allServices.GetDetails <Computer>(); break; case 2: allServices.AddDetails <Computer>(GettingDetailsFromUser(computer)); break; case 3: Console.WriteLine("Exiting.."); compMore = false; break; } } break; case 2: bool filmsMore = true; while (filmsMore) { Console.WriteLine("Entering to films"); Console.WriteLine("1. Display all films files"); Console.WriteLine("2. Add new films file"); Console.WriteLine("3. Exit"); int filmsX = Convert.ToInt32(Console.ReadLine()); switch (filmsX) { case 1: allServices.GetDetails <Films>(); break; case 2: allServices.AddDetails(GettingDataForFilms(GettingDetailsFromUser(computer))); break; case 3: Console.WriteLine("Exiting.."); filmsMore = false; break; } } break; case 3: bool musicMore = true; while (musicMore) { Console.WriteLine("Entering to music"); Console.WriteLine("1. Display all music files"); Console.WriteLine("2. Add new music file"); Console.WriteLine("3. Exit"); int musicX = Convert.ToInt32(Console.ReadLine()); switch (musicX) { case 1: allServices.GetDetails <Music>(); break; case 2: allServices.AddDetails(GettingDataForMusic(GettingDetailsFromUser(computer))); break; case 3: Console.WriteLine("Exiting.."); musicMore = false; break; } } break; case 4: Console.WriteLine("Exiting.."); more = false; break; } } }
protected override INavigatable <AuthNavigatableTypes> CreateViewModel(AuthNavigatableTypes type, AllServices allServices) { if (type == AuthNavigatableTypes.SignIn) { return(new SignInViewModel(() => Navigate(AuthNavigatableTypes.SignUp), _signInSuccess)); } else { return(new SignUpViewModel(() => Navigate(AuthNavigatableTypes.SignIn))); } }
public CheckViewModel(AllServices allServices) { GotoTransactions = (() => Navigate(CheckNavigatableTypes.ShowTransactions, allServices)); Navigate(CheckNavigatableTypes.ShowWallets, allServices); }
protected override INavigatable <CheckNavigatableTypes> CreateViewModel(CheckNavigatableTypes type, AllServices allServices) { if (type == CheckNavigatableTypes.ShowWallets) { return(new WalletsViewModel(() => Navigate(CheckNavigatableTypes.ShowCategories, allServices), allServices.WalletService, this)); } else if (type == CheckNavigatableTypes.ShowCategories) { return(new CategoriesViewModel(() => Navigate(CheckNavigatableTypes.ShowWallets, allServices), allServices.CategoryService)); } else { return(new TransactionsViewModel(() => Navigate(CheckNavigatableTypes.ShowWallets), () => Navigate(CheckNavigatableTypes.ShowCategories, allServices), allServices.TransactionService)); } }
public IEnumerable <ServiceViewModel> GetServiceTypesByCategory(ServiceCategory cat) { return(AllServices.Where(s => s.Category == cat && s.Selected).ToList()); }