public static IconGenerator Instance() { if(IconGenerator.sm_instance == null) { IconGenerator.sm_instance = GameObject.Find ("AssetGenerator").GetComponent<IconGenerator>(); } return IconGenerator.sm_instance; }
public void ShowCoffee(CoffeeShop coffee) { var coord = new LatLng(coffee.Coordinates.Latitude, coffee.Coordinates.Longitude); var markerOpt1 = new MarkerOptions(); markerOpt1.SetPosition(coord); markerOpt1.SetTitle(coffee.Name); var iconFactory = new IconGenerator(this.context); addIcon(iconFactory, coffee.Name, coord); var maker = map.AddMarker(markerOpt1); maker.ShowInfoWindow(); var builder = CameraPosition.InvokeBuilder(); builder.Target(coord); builder.Zoom(18); builder.Bearing(155); builder.Tilt(65); var cameraPosition = builder.Build(); var cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); map.MoveCamera(cameraUpdate); }
protected override void StartMap() { googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(-33.8696, 151.2094), 10)); IconGenerator iconFactory = new IconGenerator(this); AddIcon(iconFactory, "Default", new LatLng(-33.8696, 151.2094)); iconFactory.SetColor(Color.Cyan); AddIcon(iconFactory, "Custom color", new LatLng(-33.9360, 151.2070)); iconFactory.SetRotation(90); iconFactory.SetStyle(IconGenerator.StyleRed); AddIcon(iconFactory, "Rotated 90 degrees", new LatLng(-33.8858, 151.096)); iconFactory.SetContentRotation(-90); iconFactory.SetStyle(IconGenerator.StylePurple); AddIcon(iconFactory, "Rotate=90, ContentRotate=-90", new LatLng(-33.9992, 151.098)); iconFactory.SetRotation(0); iconFactory.SetContentRotation(90); iconFactory.SetStyle(IconGenerator.StyleGreen); AddIcon(iconFactory, "ContentRotate=90", new LatLng(-33.7677, 151.244)); iconFactory.SetRotation(0); iconFactory.SetContentRotation(0); iconFactory.SetStyle(IconGenerator.StyleOrange); AddIcon(iconFactory, MakeCharSequence(), new LatLng(-33.77720, 151.12412)); }
private void UCSystrayIconEditor_Load(object sender, EventArgs e) { btnSystrayIconFast.Image = IconGenerator.GetImage(SIZE_ICON, Settings.Default.SystrayIconFast); btnSystrayIconGood.Image = IconGenerator.GetImage(SIZE_ICON, Settings.Default.SystrayIconGood); btnSystrayIconSlow.Image = IconGenerator.GetImage(SIZE_ICON, Settings.Default.SystrayIconSlow); btnSystrayIconBad.Image = IconGenerator.GetImage(SIZE_ICON, Settings.Default.SystrayIconBad); btnSystrayIconDefault.Image = IconGenerator.GetImage(SIZE_ICON, Settings.Default.SystrayIconDefault); }
public TKMarkerRenderer(Context context, GoogleMap googleMap, ClusterManager clusterManager, TKCustomMapRenderer mapRenderer) : base(context, googleMap, clusterManager) { _context = context; _googleMap = googleMap; _mapRenderer = mapRenderer; _iconGenerator = new IconGenerator(context); }
public ActionResult Index(FormCollection formCollection, string Option) { foreach (string item in Request.Files) { HttpPostedFileBase file = Request.Files[item] as HttpPostedFileBase; if (file.ContentLength == 0) { continue; } if (file.ContentLength > 0) { var upload = new UploadImage(); var rename = upload.RenameUploadFile(file); var imageResult = upload.UploadFile(rename.File, rename.FileName); if (imageResult.Success) { var iconGenerator = new IconGenerator(); if (!Option.IsNullOrWhiteSpace() && Option == "multiple") { var sizes = new List <int> { 57, 60, 72, 76, 114, 120, 114, 150, 152, 180, 192, 32, 96, 115 }; foreach (var size in sizes) { iconGenerator.CreateIcon(imageResult.FullPath, size, size, "_android.png"); } foreach (var size in sizes) { iconGenerator.CreateIcon(imageResult.FullPath, size, size, "_apple.png"); } } else { iconGenerator.CreateIcon(imageResult.FullPath, 16, 16, ".ico"); } } if (imageResult.Success) { //TODO: write the filename to the db Console.WriteLine(imageResult.ImageName); ViewBag.Success = "Image Successfully uploaded"; ViewBag.FileName = imageResult.ImageName; } else { //TODO: show view error // use imageResult.ErrorMessage to show the error ViewBag.Error = imageResult.ErrorMessage; } } } return(View()); }
private void addIcon(IconGenerator iconFactory, string text, LatLng position) { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.SetIcon(BitmapDescriptorFactory.FromBitmap(iconFactory.MakeIcon(text))); markerOptions.SetPosition(position); markerOptions.Anchor(iconFactory.AnchorU, iconFactory.AnchorV); getMap().AddMarker(markerOptions); }
private void AddItems() { // Create list var items = new List <WindowListItem> { new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb1), ProcessId = 1001, ProcessPath = @"nope.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA1), ProcessId = 101, ProcessPath = @"nope.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA2), ProcessId = 102, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA3), ProcessId = 103, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb2), ProcessId = 1002, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb3), ProcessId = 1003, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb1), ProcessId = 1001, ProcessPath = @"nope.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA1), ProcessId = 101, ProcessPath = @"nope.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA2), ProcessId = 102, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { Handle = new System.IntPtr(0xA3), ProcessId = 103, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb2), ProcessId = 1002, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, new WindowListItem { IsMinimized = true, Handle = new System.IntPtr(0xb3), ProcessId = 1003, ProcessPath = @"c:\windows\system32\notepad.exe", Title = "This is a test title", Width = 1920, Height = 1280 }, }; foreach (var item in items) { item.ShortPath = Path.GetFileName(item.ProcessPath); item.ProcessIcon = IconGenerator.GetIcon(item.ProcessPath); } // Set model WindowListItems = new ObservableCollection <IWindowListItem>(items); // Set selected item SelectedWindow = WindowListItems[2]; }
static void Init() { bool saveScene = EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); if (saveScene) { // Get existing open window or if none, make a new one: IconGenerator window = (IconGenerator)EditorWindow.GetWindow(typeof(IconGenerator)); window.Show(); } }
public void GenerateIcon_ReturnsExpectedImage(string solutionName, string solutionPath) { var actualPath = ResolveTestPath(solutionName + ".actual.png"); var generator = new IconGenerator(new TinyIdGenerator()); using (var image = generator.GenerateIcon(solutionName, solutionPath, new Size(32, 32))) { image.Save(actualPath, ImageFormat.Png); } AssertImages.Equal(ResolveTestPath(solutionName + ".expected.png"), actualPath); }
void addIcon(IconGenerator iconFactory, string text, LatLng position) { return; var markerOptions = new MarkerOptions(); markerOptions.SetIcon(BitmapDescriptorFactory.FromBitmap(iconFactory.MakeIcon(text))); markerOptions.SetPosition(position); markerOptions.Anchor(iconFactory.AnchorU, iconFactory.AnchorV); this.map.AddMarker(markerOptions); }
public FrmBootstrap() { this.BackColor = Color.LightGray; this.TransparencyKey = Color.LightGray; InitializeComponent(); this.BackgroundImageLayout = ImageLayout.Zoom; this.BackgroundImage = IconGenerator.GetImage(Settings.Default.SystrayIconDefault); this.notifyIcon.Icon = IconCache.Default; }
public DefaultClusterRenderer(Context context, GoogleMap map, ClusterManager <T> clusterManager) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } mMap = map; mDensity = context.Resources.DisplayMetrics.Density; mIconGenerator = new IconGenerator(context); mIconGenerator.SetContentView(makeSquareTextView(context)); //ContentView = makeSquareTextView(context); mIconGenerator.SetTextAppearance(Resource.Styleable.ClusterIcon.TextAppearance); //TextAppearance = R.style.ClusterIcon_TextAppearance; mIconGenerator.SetBackground(makeClusterBackground()); // Background = makeClusterBackground(); mClusterManager = clusterManager; }
public Application(string title = "Tetris", Styles style = Styles.Close) { window = new RenderWindow(new VideoMode(WindowWidth, WindowHeight), title, style); sceneManager = new SceneManager(); window.KeyPressed += inputManager.OnKeyPressed; eventSystem.Subscribe(EventType.InputEscape, OnQuit); window.Closed += OnWindowClosed; window.SetKeyRepeatEnabled(false); window.SetMouseCursorVisible(false); window.SetIcon(48, 48, IconGenerator.IconToBytes("Art/icon.png")); }
private void btnSystrayIcon_Click(object sender, EventArgs e) { Button btn = sender as Button; var name = btn.Tag.ToString(); colorDialog1.Color = (Color)Settings.Default.PropertyValues[name].PropertyValue; if (DialogResult.OK == colorDialog1.ShowDialog()) { Color newColor = colorDialog1.Color; btn.Image = IconGenerator.GetImage(SIZE_ICON, newColor); Settings.Default.PropertyValues[name].PropertyValue = newColor; //Settings.Default.Save(); IconCache.Reload(); } }
protected override void OnLoad(EventArgs e) { IsLoadingDone = false; AssetDatabase.SetPack(AssetDatabase.DEFAULTPACK); GameBlocks.Init(); GameItems.Init(); CraftingRecipeDatabase.Init(); VSync = VSyncMode.Off; GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); GL.Enable(EnableCap.FramebufferSrgb); GL.Enable(EnableCap.DepthTest); GL.ClearColor(CLEAR_COLOUR.X, CLEAR_COLOUR.Y, CLEAR_COLOUR.Z, CLEAR_COLOUR.Z); AssetDatabase.GetAsset <Material>("Resources/Materials/Fallback.mat"); MainMenu = new MainMenu(); MainMenu.Show(); Program.Settings.UpdateAll(); //Load texture pack before generating icons AssetDatabase.GetAsset <TexturePack>(""); IconGenerator.GenerateBlockItemIcons(); WindowWidth = Program.Settings.WindowWidth; WindowHeight = Program.Settings.WindowHeight; PostProcessingEffects.RegisterEffect(new Bloom()); PostProcessingEffects.RegisterEffect(new ACESTonemapEffect()); IsLoadingDone = true; OnResize(null); base.OnLoad(e); }
public PersonRenderer(Context context, GoogleMap googleMap, ClusterManager clusterManager) : base(context, googleMap, clusterManager) { this.context = context; iconGenerator = new IconGenerator(context); clusterIconGenerator = new IconGenerator(context); View multiProfile = LayoutInflater.From(context).Inflate(Resource.Layout.MultiProfileView, null); clusterIconGenerator.SetContentView(multiProfile); clusterImageView = multiProfile.FindViewById <ImageView>(Resource.Id.image); imageView = new ImageView(context); dimension = (int)context.Resources.GetDimension(Resource.Dimension.custom_profile_image); imageView.LayoutParameters = new ViewGroup.LayoutParams(dimension, dimension); int padding = (int)context.Resources.GetDimension(Resource.Dimension.custom_profile_padding); imageView.SetPadding(padding, padding, padding, padding); iconGenerator.SetContentView(imageView); }
public PersonRenderer(CustomMarkerClusteringDemoActivity activity) : base(activity.ApplicationContext, activity.getMap(), activity.mClusterManager) { context = activity; mIconGenerator = new IconGenerator(activity.ApplicationContext); mClusterIconGenerator = new IconGenerator(activity.ApplicationContext); View multiProfile = LayoutInflater.From(activity).Inflate(Resource.Layout.multi_profile, null); mClusterIconGenerator.SetContentView(multiProfile); mClusterImageView = multiProfile.FindViewById <ImageView>(Resource.Id.image); mImageView = new ImageView(activity.ApplicationContext); mDimension = (int)activity.Resources.GetDimension(Resource.Dimension.custom_profile_image); mImageView.LayoutParameters = new ViewGroup.LayoutParams(mDimension, mDimension); int padding = (int)activity.Resources.GetDimension(Resource.Dimension.custom_profile_padding); mImageView.SetPadding(padding, padding, padding, padding); mIconGenerator.SetContentView(mImageView); }
public StationRenderer(Context context, GoogleMap map, ClusterManager clusterManager) : base(context, map, clusterManager) { _context = context; _map = map; _clusterManager = clusterManager; _contractService = SimpleIoc.Default.GetInstance <IContractService>(); _settingsService = SimpleIoc.Default.GetInstance <ISettingsService>(); _iconGenRed = new IconGenerator(_context); _iconGenGreen = new IconGenerator(_context); _iconGenOrange = new IconGenerator(_context); _iconGenGrey = new IconGenerator(_context); _iconGenGreyLowAlpha = new IconGenerator(_context); //// Define the size you want from dimensions file //var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null); //iconGen.SetBackground(shapeDrawable); ////// Create a view container to set the size _iconGenRed.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationRed, null)); _iconGenOrange.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationOrange, null)); _iconGenGreen.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreen, null)); _iconGenGrey.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGrey, null)); _iconGenGreyLowAlpha.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreyAlpha, null)); _iconRed = _iconGenRed.MakeIcon(); _iconGreen = _iconGenGreen.MakeIcon(); _iconOrange = _iconGenOrange.MakeIcon(); _iconGrey = _iconGenGrey.MakeIcon(); _iconGreyLowAlpha = _iconGenGreyLowAlpha.MakeIcon(); var textView = new TextView(context); textView.SetTextAppearance(_context, Resource.Style.iconGenText); _textPaint.AntiAlias = true; _textPaint.SetARGB(255, 0, 0, 0); _textPaint.TextSize = textView.TextSize; _textPaint.TextAlign = Paint.Align.Center; //_textPaint.SetTypeface(textView.Typeface); _textPaint.SetTypeface(Typeface.CreateFromAsset(_context.Assets, "fonts/Roboto-Bold.ttf")); }
public StationRenderer(Context context, GoogleMap map, ClusterManager clusterManager) : base(context, map, clusterManager) { _context = context; _map = map; _clusterManager = clusterManager; _contractService = SimpleIoc.Default.GetInstance<IContractService>(); _settingsService = SimpleIoc.Default.GetInstance<ISettingsService>(); _iconGenRed = new IconGenerator(_context); _iconGenGreen = new IconGenerator(_context); _iconGenOrange = new IconGenerator(_context); _iconGenGrey = new IconGenerator(_context); _iconGenGreyLowAlpha = new IconGenerator(_context); //// Define the size you want from dimensions file //var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null); //iconGen.SetBackground(shapeDrawable); ////// Create a view container to set the size _iconGenRed.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationRed, null)); _iconGenOrange.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationOrange, null)); _iconGenGreen.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreen, null)); _iconGenGrey.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGrey, null)); _iconGenGreyLowAlpha.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreyAlpha, null)); _iconRed = _iconGenRed.MakeIcon(); _iconGreen = _iconGenGreen.MakeIcon(); _iconOrange = _iconGenOrange.MakeIcon(); _iconGrey = _iconGenGrey.MakeIcon(); _iconGreyLowAlpha = _iconGenGreyLowAlpha.MakeIcon(); var textView = new TextView(context); textView.SetTextAppearance(_context, Resource.Style.iconGenText); _textPaint.AntiAlias = true; _textPaint.SetARGB(255, 0, 0, 0); _textPaint.TextSize = textView.TextSize; _textPaint.TextAlign = Paint.Align.Center; //_textPaint.SetTypeface(textView.Typeface); _textPaint.SetTypeface(Typeface.CreateFromAsset(_context.Assets, "fonts/Roboto-Bold.ttf")); }
//private string _parameterText; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); _locator = CrossGeolocator.Current; // New in iOS 9 allowsBackgroundLocationUpdates must be set if you are running a background agent to track location. I have exposed this on the Geolocator via: // disable because it drill down the battery very quickly _locator.AllowsBackgroundUpdates = false; _locator.DesiredAccuracy = 50; _locator.PositionChanged -= Locator_PositionChanged; _locator.PositionChanged += Locator_PositionChanged; // parse params to show any shared location if it exists ParseIntent(); var tintManager = new SystemBarTintManager(this); // set the transparent color of the status bar, 30% darker tintManager.SetTintColor(Color.ParseColor("#30000000")); tintManager.SetNavigationBarTintEnabled(true); tintManager.StatusBarTintEnabled = true; // prevent the soft keyboard from pushing the view up Window.SetSoftInputMode(SoftInput.AdjustNothing); // prepare icons for location / compass button var iconGenerator = new IconGenerator(this); iconGenerator.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_location, null)); _iconUserLocation = iconGenerator.MakeIcon(); iconGenerator.SetBackground(ResourcesCompat.GetDrawable(Resources, Resource.Drawable.ic_compass, null)); _iconCompass = iconGenerator.MakeIcon(); //var uiOptions = (int)this.Window.DecorView.SystemUiVisibility; //var newUiOptions = (int)uiOptions; //newUiOptions &= ~(int)SystemUiFlags.LowProfile; //newUiOptions &= ~(int)SystemUiFlags.Fullscreen; //newUiOptions &= ~(int)SystemUiFlags.HideNavigation; //newUiOptions &= ~(int)SystemUiFlags.Immersive; //newUiOptions |= (int)SystemUiFlags.ImmersiveSticky; //this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions; //Window.SetFlags(WindowManagerFlags.LayoutNoLimits, WindowManagerFlags.LayoutNoLimits); var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); //toolbar.Background.SetAlpha(200); ViewCompat.SetElevation(toolbar, 6f); SetSupportActionBar(toolbar); //Enable support action bar to display hamburger and back arrow // http://stackoverflow.com/questions/28071763/toolbar-navigation-hamburger-icon-missing _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); //_drawerToggle = new CustomActionBarDrawerToggle(this, _drawerLayout, toolbar, Resource.String.ApplicationName, Resource.String.ApplicationName); //_drawerToggle.DrawerIndicatorEnabled = true; _drawerLayout.SetDrawerListener(new CustomDrawerToggle(this)); //Enable support action bar to display hamburger var burgerImage = FindViewById<ImageButton>(Resource.Id.burgerImage); burgerImage.SetOnClickListener(new HomeButtonClickListener(this)); // SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); SupportActionBar.SetHomeButtonEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetDisplayShowCustomEnabled(false); navigationView = FindViewById<NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(new NavigationItemSelectedListener(this)); _bikesButton = FindViewById<FloatingActionButton>(Resource.Id.bikesButton); _bikesButton.BackgroundTintList = ColorStateList.ValueOf(Resources.GetColor(Resource.Color.primary_light)); _bikesButton.Click += BikesButton_Click; _parkingButton = FindViewById<FloatingActionButton>(Resource.Id.parkingButton); _parkingButton.BackgroundTintList = ColorStateList.ValueOf(Resources.GetColor(Resource.Color.primary_light)); _parkingButton.Click += ParkingButton_Click; _locationButton = FindViewById<FloatingActionButton>(Resource.Id.locationButton); _locationButton.BackgroundTintList = ColorStateList.ValueOf(Color.White); _locationButton.SetColorFilter(Color.Gray); _searchProgressBar = FindViewById<ProgressBar>(Resource.Id.searchProgressBar); // Doesn't work on Kitkat 4.4, use SetColorFilter instead //_locationButton.ImageTintList = ColorStateList.ValueOf(Color.Black); _locationButton.Click += LocationButton_Click; _tileButton = FindViewById<FloatingActionButton>(Resource.Id.tileButton); _tileButton.BackgroundTintList = ColorStateList.ValueOf(Color.White); _tileButton.SetColorFilter(Color.DarkGray); _tileButton.Click += TileButton_Click; var parent = (View)_tileButton.Parent; // Gets the parent view and posts a Runnable on the UI thread. // This ensures that the parent lays out its children before calling the getHitRect() method. // The getHitRect() method gets the child's hit rectangle (touchable area) in the parent's coordinates. parent.Post(() => { var touchRect = new Rect(); _tileButton.GetHitRect(touchRect); touchRect.Top -= 200; touchRect.Left -= 200; touchRect.Bottom += 200; touchRect.Right += 200; parent.TouchDelegate = new TouchDelegate(touchRect, _tileButton); }); _currentTileName = FindViewById<TextView>(Resource.Id.currentTileName); _currentTileNameAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.placeholder); _disappearTileNameAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.disappearAnimation); _currentTileNameAnimation.AnimationEnd += _currentTileNameAnimation_AnimationEnd; UnStickUserLocation(); AutoCompleteSearchPlaceTextView = FindViewById<AutoCompleteTextView>(Resource.Id.autoCompleteSearchPlaceTextView); AutoCompleteSearchPlaceTextView.ItemClick += AutoCompleteSearchPlaceTextView_ItemClick; googlePlacesAutocompleteAdapter = new GooglePlacesAutocompleteAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line); AutoCompleteSearchPlaceTextView.Adapter = googlePlacesAutocompleteAdapter; Observable.FromEventPattern(AutoCompleteSearchPlaceTextView, "TextChanged") .Throttle(TimeSpan.FromMilliseconds(300)) .Where(x => AutoCompleteSearchPlaceTextView.Text.Length >= 2) .Subscribe(async x => { try { RunOnUiThread(() => { _searchProgressBar.Visibility = ViewStates.Visible; }); using (var client = new HttpClient(new NativeMessageHandler())) { var response = await client.GetAsync(strAutoCompleteGoogleApi + AutoCompleteSearchPlaceTextView.Text + "&key=" + strGoogleApiKey).ConfigureAwait(false); var responseBodyAsText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var predictions = JsonConvert.DeserializeObject<PlaceApiModel>(responseBodyAsText).predictions.ToList(); googlePlacesAutocompleteAdapter.Results = predictions; if (AutoCompleteSearchPlaceTextView.Text.Length >= 2) { RunOnUiThread(() => { googlePlacesAutocompleteAdapter.NotifyDataSetChanged(); EndPlacesSearch(); }); } } } catch { RunOnUiThread(() => { EndPlacesSearch(); }); } }); //navigationView.NavigationItemSelected += (sender, e) => //{ // e.MenuItem.SetChecked(true); // //react to click here and swap fragments or navigate // drawerLayout.CloseDrawers(); //}; // trigger the creation of the injected dependencies _settingsService = SimpleIoc.Default.GetInstance<ISettingsService>(); _favoritesService = SimpleIoc.Default.GetInstance<IFavoritesService>(); }
private async void initializeScene(string sceneName) //test stuff inside! will need to be rewritten for actual game { running = true; saveDataThread = new Thread(saveData); saveDataThread.Start(); if (currentSettings == "") { currentSettings = SettingsManager.DEFAULT_SETTINGS; } SettingPairs settingPairs = settingsManager.getSettingPairs(currentSettings); settingList = settingsManager.getSettingList(currentSettings); fieldSize = Field.getFieldSize(settingPairs.field_size); foreach (PartData partData in partsData) { Part part = partManager.partDataToPart(partData); if (part.GAME_OBJECT != null) { part.toggleGameObject(false); } parts.Add(part); } if (currentTest == TESTS.BUILD_HUB) { IconGenerator iconGenerator = new IconGenerator(); Camera camera = null; foreach (Camera currCam in Camera.allCameras) { if (currCam.name == "IconCamera") { camera = currCam; camera.forceIntoRenderTexture = true; break; } } iconGenerator.camera = camera; Camera.main.targetDisplay = 1; foreach (Part part in parts) { if (part.GAME_OBJECT == null) { continue; } part.toggleGameObject(true); part.GAME_OBJECT.transform.Rotate(new Vector3(9, 120, -15)); iconGenerator.gameObjectOfIcon = part.GAME_OBJECT; while (part.getIcon() == null) { if (part.GAME_OBJECT.GetComponent <Renderer>().isVisible) { iconGenerator.initialize(); if (iconGenerator.getIcon() != null) { part.setIcon(iconGenerator.getIcon()); } } if (part.getIcon() == null) { await Task.Delay(25); } } part.toggleGameObject(false); part.destroyGameObject(); } Camera.main.targetDisplay = 0; } else { foreach (Part part in parts) { if (part.GAME_OBJECT != null) { part.destroyGameObject(); } } } experience = playerData.experience; credits = playerData.credits; previousRoundDamageDifference = playerData.previousRoundDamageDifference; previousRoundMaxDamageDifference = playerData.previousRoundMaxDamageDifference; previousRoundTimeElapsed = playerData.previousRoundTimeElapsed; ObstacleGenerator obstacleGenerator = new ObstacleGenerator(experience, settingPairs.max_obstacles, fieldSize); humanRobotParts = new List <Part>(); obstaclesData = new List <ObstacleData>(); List <int> badIndices = new List <int>(); PerformanceMetricCalculator performanceMetricCalculator = new PerformanceMetricCalculator(); Head cheapestHead = null; Body cheapestBody = null; Mobility cheapestMobility = null; Blaster cheapestBlaster = null; foreach (Part part in parts) { if (part is Head && (cheapestHead == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestHead))) { cheapestHead = (Head)part; } else if (part is Body && (cheapestBody == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBody))) { cheapestBody = (Body)part; } else if (part is Mobility && (cheapestMobility == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestMobility))) { cheapestMobility = (Mobility)part; } else if (part is Blaster && (cheapestBlaster == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBlaster))) { cheapestBlaster = (Blaster)part; } } if (playerData.humanRobotParts != default) { for (int partIndex = 0; partIndex < playerData.humanRobotParts.Length; ++partIndex) { PlayerPartData playerPartData = playerData.humanRobotParts[partIndex]; if (parts.Exists(p => p.getID() == playerPartData.id)) { Part part = parts.Find(p => p.getID() == playerPartData.id); part.damage(part.getDurability() - playerPartData.remainingDurability); if (part is Head) { humanRobotParts.Add((Head)part.clone(true)); } else if (part is Body) { humanRobotParts.Add((Body)part.clone(true)); } else if (part is Mobility) { humanRobotParts.Add((Mobility)part.clone(true)); } else if (part is Attachment) { humanRobotParts.Add((Attachment)part.clone(true)); } } else { humanRobotParts.Add(null); badIndices.Add(partIndex); } } } else { humanRobotParts.AddRange(new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }); } myRobots = new List <Robot>(); if (playerData.myRobots != default) { foreach (RobotData robotData in playerData.myRobots) { List <Part> robotPartList = new List <Part>(); foreach (int partIndex in robotData.partIndices) { if (!badIndices.Contains(partIndex)) { robotPartList.Add(humanRobotParts[partIndex]); } } try { Robot robot = new Robot(robotData.name, true, robotData.human, robotPartList.ToArray()); myRobots.Add(robot); } catch {} } } foreach (int index in badIndices) { humanRobotParts.RemoveAt(index); } if (!humanRobotParts.Exists(part => part is Head)) { humanRobotParts.Add(cheapestHead); } if (!humanRobotParts.Exists(part => part is Body)) { humanRobotParts.Add(cheapestBody); } if (!humanRobotParts.Exists(part => part is Mobility)) { humanRobotParts.Add(cheapestMobility); } if (!humanRobotParts.Exists(part => part is Attachment && ((Attachment)part).isWeapon())) { humanRobotParts.Add(cheapestBlaster); } if (humanRobotParts.Contains(null)) { throw new Exception("There are missing part files. There neeeds to be at least one part file each of types Head, Body, Mobility, and a weapon Attachment."); } if (playerData.obstacles != default) { obstaclesData.AddRange(playerData.obstacles); } else { obstaclesData.AddRange(obstacleGenerator.getObstaclesData()); } if (currentSettingValueList.Count == 0) { foreach (Setting setting in settingList) { currentSettingValueList.Add(setting.currentValue); } } Head head1 = null; Head head2 = null; Body body1 = null; Body body2 = null; Mobility mobility = null; Attachment attachment1 = null; Attachment attachment2 = null; Attachment attachment3 = null; foreach (Part part in parts) { if (part is Head) { if (head1 == null) { head1 = (Head)part.clone(true); head1.damage(2); } else if (head2 == null) { head2 = (Head)part.clone(true); head2.damage(3); } } else if (part is Body) { if (body1 == null) { body1 = (Body)part.clone(true); body1.damage(3); } else if (body2 == null) { body2 = (Body)part.clone(true); body2.damage(4); } } else if (part is Mobility) { if (mobility == null) { mobility = (Mobility)part.clone(true); mobility.damage(1); } } else if (part is Attachment) { if (attachment1 == null) { attachment1 = (Attachment)part.clone(true); attachment1.damage(1); } else if (attachment2 == null) { attachment2 = (Attachment)part.clone(true); attachment2.damage(1); } else if (attachment3 == null) { attachment3 = (Attachment)part.clone(true); attachment3.damage(3); } } } List <Robot> robots = new List <Robot>(); int numberOfNonHumanRobots = 0; int numberOfHumanRobots = 0; Obstacle[] obstacles = null; List <BuildHubState> buildHubStates = default; if (buildHubStatesData != default && buildHubStatesData.Count > 0) { buildHubStates = new List <BuildHubState>(); foreach (BuildHubStateData buildHubStateData in buildHubStatesData) { buildHubStates.Add(buildHubStateDataManager.stateDataToState(buildHubStateData)); } } List <FieldState> fieldStates = default; if (fieldStatesData != default && fieldStatesData.Count > 0) { fieldStates = new List <FieldState>(); foreach (FieldStateData fieldStateData in fieldStatesData) { fieldStates.Add(fieldStateDataManager.stateDataToState(fieldStateData, parts)); } } BuildHub.MODES mode; switch (currentTest) { case TESTS.FIELD: case TESTS.HUMAN_V_VOID_ROBOT: List <Part> humanParts = new List <Part>(); foreach (Part part in humanRobot.getParts()) { Part clonePart = part.clone(false); if (clonePart is Head) { clonePart = (Head)clonePart; } else if (clonePart is Body) { clonePart = (Body)clonePart; } else if (clonePart is Mobility) { clonePart = (Mobility)clonePart; } else if (clonePart is Attachment) { clonePart = (Attachment)clonePart; } humanParts.Add(clonePart); } humanRobot = new Robot(humanRobot.getName(), humanRobot.isHuman(), humanParts.ToArray()); currentHumanRobotHealth = humanRobot.getRemainingDurability(); Attachment[] nonHumanAttachments = { (Attachment)attachment1.clone(true) }; numberOfNonHumanRobots = RANDOM.Next(1, settingPairs.max_ai_robots + 1); numberOfHumanRobots = 1; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, new Robot[] { humanRobot }, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); robots.Add(humanRobot); robots.AddRange(aiManager.getAgentRobots()); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.AI_AGENT_TRAINING: numberOfNonHumanRobots = NUMBER_OF_AGENTS; numberOfHumanRobots = 0; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, null, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); Robot[] agentRobots = aiManager.getAgentRobots(); for (int agentIndex = 0; agentIndex < NUMBER_OF_AGENTS; ++agentIndex) { FIELD_AGENT_ROBOTS[agentIndex] = agentRobots[agentIndex]; } robots.AddRange(FIELD_AGENT_ROBOTS); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.BUILD_HUB: mode = BuildHub.MODES.MY_ROBOTS; setScreen(new BuildHub(settingList, obstaclesData, myRobots, humanRobotParts, parts.ToArray(), credits, mode)); break; } }
private void MainForm_Load(object sender, EventArgs e) { if (Environment.OSVersion.Version < new Version(10, 0, 18362)) { MessageBox.Show(this, "This program only works on Windows 10 19H1 or later. Please upgrade to the latest OS version.", Text, MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1); Close(); return; } DistroListView.Columns.Clear(); foreach (var eachProperty in typeof(DistroProperties).GetProperties()) { var browsableAttr = eachProperty.GetCustomAttribute <BrowsableAttribute>(); if (browsableAttr != null && !browsableAttr.Browsable) { continue; } var colItem = new ColumnHeader(); var displayNameAttr = eachProperty.GetCustomAttribute <DisplayNameAttribute>(); if (displayNameAttr != null) { colItem.Text = displayNameAttr.DisplayName; } else { colItem.Text = eachProperty.Name; } DistroListView.Columns.Add(colItem); } if (!SharedRoutines.IsWsl2SupportedOS()) { shutdownAllDistrosToolStripMenuItem.Visible = false; } if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "wsl.exe"))) { MessageBox.Show(this, "This program is only available when Windows Subsystem for Linux is enabled. Check the system settings.", Text, MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1); Close(); return; } this.emptyLabel = new Label() { Parent = this, Text = "No WSL distro installed.", TextAlign = ContentAlignment.MiddleCenter, Font = new Font(this.Font.FontFamily, 18f, FontStyle.Bold), Dock = DockStyle.Fill, UseMnemonic = false, Visible = false, }; refreshToolStripMenuItem.PerformClick(); if (!IconGenerator.IsBusy) { IconGenerator.RunWorkerAsync(); } }
protected void LayerAutomaticIconGenerate(UnityEngine.Object obj) { layerAutomaticIcon = IconGenerator.GetIcon(obj); }
public void Start() { IconGenerator.sm_instance = this; }
static void Init() { IconGenerator window = (IconGenerator)GetWindow(typeof(IconGenerator)); window.Show(); }
public override void ExportProject( Dictionary <string, FileOutput> output, IList <VariableDeclaration> globals, IList <StructDefinition> structDefinitions, IList <FunctionDefinition> functionDefinitions, IList <LibraryForExport> libraries, ResourceDatabase resourceDatabase, Options options, ILibraryNativeInvocationTranslatorProvider libraryNativeInvocationTranslatorProviderForPlatform) { Dictionary <string, string> replacements = this.GenerateReplacementDictionary(options, resourceDatabase); string projectId = options.GetString(ExportOptionKey.PROJECT_ID); string baseDir = projectId + "/"; this.CopyTemplatedFiles(baseDir, output, replacements, false); List <LangCSharp.DllFile> dlls = new List <LangCSharp.DllFile>(); HashSet <string> dotNetLibs = new HashSet <string>(); foreach (LibraryForExport library in libraries) { foreach (string dotNetLib in library.DotNetLibs) { dotNetLibs.Add(dotNetLib); } this.GetLibraryCode(baseDir, library, dlls, output, libraryNativeInvocationTranslatorProviderForPlatform); } LangCSharp.DllReferenceHelper.AddDllReferencesToProjectBasedReplacements(replacements, dlls, new Dictionary <string, string>()); replacements["DLL_REFERENCES"] += Util.JoinLines( dotNetLibs .OrderBy(v => v.ToLower()) .Select( dotNetLib => " <Reference Include=\"" + dotNetLib + "\" />") .ToArray()); this.ExportInterpreter(baseDir, output, globals, structDefinitions, functionDefinitions); output[baseDir + "Resources/ByteCode.txt"] = resourceDatabase.ByteCodeFile; output[baseDir + "Resources/ResourceManifest.txt"] = resourceDatabase.ResourceManifestFile; if (resourceDatabase.ImageSheetManifestFile != null) { output[baseDir + "Resources/ImageSheetManifest.txt"] = resourceDatabase.ImageSheetManifestFile; } foreach (FileOutput imageFile in resourceDatabase.ImageResources.Where(img => img.CanonicalFileName != null)) { output[baseDir + "Resources/" + imageFile.CanonicalFileName] = imageFile; } foreach (string imageSheetFileName in resourceDatabase.ImageSheetFiles.Keys) { output[baseDir + "Resources/" + imageSheetFileName] = resourceDatabase.ImageSheetFiles[imageSheetFileName]; } foreach (FileOutput textFile in resourceDatabase.TextResources.Where(img => img.CanonicalFileName != null)) { output[baseDir + "Resources/" + textFile.CanonicalFileName] = textFile; } foreach (FileOutput audioFile in resourceDatabase.AudioResources.Where(file => file.CanonicalFileName != null)) { output[baseDir + "Resources/" + audioFile.CanonicalFileName] = audioFile; } foreach (FileOutput fontFile in resourceDatabase.FontResources.Where(file => file.CanonicalFileName != null)) { output[baseDir + "Resources/" + fontFile.CanonicalFileName] = fontFile; } foreach (LangCSharp.DllFile dll in dlls) { output[baseDir + dll.HintPath] = dll.FileOutput; } if (options.GetBool(ExportOptionKey.HAS_ICON)) { string iconPath = options.GetString(ExportOptionKey.ICON_PATH); IconGenerator iconGen = new IconGenerator(); foreach (string path in iconPath.Split(',')) { iconGen.AddImage(new SystemBitmap(path.Trim())); } output[baseDir + "icon.ico"] = new FileOutput() { Type = FileOutputType.Binary, BinaryContent = iconGen.GenerateIconFile(), }; } this.ExportProjectFiles(baseDir, output, replacements, new Dictionary <string, string>(), false); }
public override void ExportProject( Dictionary <string, FileOutput> output, IList <LibraryForExport> libraries, ResourceDatabase resourceDatabase, Options options) { TemplateReader templateReader = new TemplateReader(new PkgAwareFileUtil(), this); Dictionary <string, string> replacements = this.GenerateReplacementDictionary(options, resourceDatabase); string projectId = options.GetString(ExportOptionKey.PROJECT_ID); string baseDir = projectId + "/"; this.CopyTemplatedFiles(baseDir, output, replacements, false); List <LangCSharp.DllFile> dlls = new List <LangCSharp.DllFile>(); HashSet <string> dotNetRefs = new HashSet <string>(); foreach (LibraryForExport library in libraries.Where(lib => lib.HasNativeCode)) { this.GetLibraryCode(templateReader, baseDir, library, dlls, dotNetRefs, output); } LangCSharp.DllReferenceHelper.AddDllReferencesToProjectBasedReplacements(replacements, dlls); replacements["DLL_REFERENCES"] += GetFrameworkReferencesCsProjCode(dotNetRefs); this.ExportInterpreter(templateReader, baseDir, output); output[baseDir + "Resources/ByteCode.txt"] = resourceDatabase.ByteCodeFile; output[baseDir + "Resources/ResourceManifest.txt"] = resourceDatabase.ResourceManifestFile; if (resourceDatabase.ImageSheetManifestFile != null) { output[baseDir + "Resources/ImageSheetManifest.txt"] = resourceDatabase.ImageSheetManifestFile; } foreach (FileOutput imageFile in resourceDatabase.ImageResources.Where(img => img.CanonicalFileName != null)) { output[baseDir + "Resources/" + imageFile.CanonicalFileName] = imageFile; } foreach (string imageSheetFileName in resourceDatabase.ImageSheetFiles.Keys) { output[baseDir + "Resources/" + imageSheetFileName] = resourceDatabase.ImageSheetFiles[imageSheetFileName]; } foreach (FileOutput textFile in resourceDatabase.TextResources.Where(img => img.CanonicalFileName != null)) { output[baseDir + "Resources/" + textFile.CanonicalFileName] = textFile; } foreach (FileOutput audioFile in resourceDatabase.AudioResources.Where(file => file.CanonicalFileName != null)) { output[baseDir + "Resources/" + audioFile.CanonicalFileName] = audioFile; } foreach (FileOutput fontFile in resourceDatabase.FontResources.Where(file => file.CanonicalFileName != null)) { output[baseDir + "Resources/" + fontFile.CanonicalFileName] = fontFile; } foreach (LangCSharp.DllFile dll in dlls) { output[baseDir + dll.HintPath] = dll.FileOutput; } if (options.GetBool(ExportOptionKey.HAS_ICON)) { string[] iconPaths = options.GetStringArray(ExportOptionKey.ICON_PATH); IconGenerator iconGen = new IconGenerator(); foreach (string path in iconPaths) { iconGen.AddImage(new Bitmap(path.Trim())); } output[baseDir + "icon.ico"] = new FileOutput() { Type = FileOutputType.Binary, BinaryContent = iconGen.GenerateIconFile(), }; } this.ExportProjectFiles(baseDir, output, replacements, new Dictionary <string, string>(), false); }
void SceneChange(string path, OpenSceneMode mode) { IconGenerator window = (IconGenerator)EditorWindow.GetWindow(typeof(IconGenerator)); window.Close(); }