//private MovementModel SetMovementModelAnimationName(MovementModel movementModel, string animationName) //{ // if (!string.IsNullOrEmpty(animationName)) // { // movementModel.AnimationName = animationName; // } // return movementModel; //} internal void MoveSprites(SpriteModel movementModel) { //movementModel.SpriteRenderM.transform.position = new Vector3(movementModel.CurrentX + 1f, movementModel.CurrentY + 1f); //spriteRenderM.material.SetFloat(spriteRenderM.name + switchmodel.X.ToString(), switchmodel.X); //GameObject. //movementModel.SpriteRenderM. }
public PickerModel(int Width, int Height, SpriteModel model) { this.model = model; this.Width = Width; this.Height = Height; colors = new Color[Width, Height]; }
public static SpriteVM Create(SpriteModel spriteModel) { var newSprite = new SpriteVM(); newSprite.FromModel(spriteModel); return(newSprite); }
public PaletteMenu(int width, int height, SpriteModel spriteModel, PaletteModel paletteModel, Action brushChanged) : base(width, height) { this.spriteModel = spriteModel; this.mouse = new MouseWatch(); this.paletteModel = paletteModel; this.brushChanged = brushChanged; }
private void Canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (!Keyboard.IsKeyDown(Key.N)) { return; } startPoint = e.GetPosition(canvas); rect = new Rectangle { Stroke = Brushes.LightBlue, StrokeThickness = 1 }; Canvas.SetLeft(rect, startPoint.X); Canvas.SetTop(rect, startPoint.X); // canvas.Children.Add(rect); // var dc = (this.DataContext as AtlasModel); mNewDropElement = new SpriteModel(); mNewDropElement.Name = "NewDroppedEle"; mNewDropElement.Rectangle = rect; ((AtlasModel)this.DataContext).Rectangles.Add(rect); ((AtlasModel)this.DataContext).Items.Add(mNewDropElement); }
public SpriteCursor(SpriteModel sprite, int snapWidth = 1, int snapHeight = 1) : base(sprite.HotSpot) { _sprite = sprite; _snapWidth = snapWidth; _snapHeight = snapHeight; DrawOutline = false; }
public void Handle(string file, ILoadResult result) { switch (result) { case LoadBusy: Log($"[{file}]\nLoading..."); hoveredFile = null; break; case LoadFailure f: Log($"[{file}]\n{f.message}"); hoveredFile = null; break; case LoadSuccess s: Log($"[{file}]\nLoaded successfully"); hoveredFile = s.preview; break; case LoadNonexistent s: Log($"[{file}]\nDoes not exist"); hoveredFile = null; break; } }
public SpriteModelViewModel(SpriteModel spriteModel, SpriteModelsViewModel spriteModelsViewModel) : base() { SpriteModels = spriteModelsViewModel; if (spriteModel != null) { SpriteModel = spriteModel; Id = spriteModel.Id; FrameWidth = spriteModel.FrameSize.X; FrameHeight = spriteModel.FrameSize.Y; CollisionBoxX = spriteModel.CollisionBox.X; CollisionBoxY = spriteModel.CollisionBox.Y; CollisionBoxWidth = spriteModel.CollisionBox.Width; CollisionBoxHeight = spriteModel.CollisionBox.Height; SpriteSheet = SpriteModels.MainViewModel.Textures.Items.FirstOrDefault(texture => texture.Id == spriteModel.SpriteSheet.Id); ReloadItems(); } else { Items = new ObservableCollection <AnimationViewModel>(); } SaveSpriteModel = new RelayCommand <Window>(ExecuteSaveSpriteModelCommand); ReloadItems(); }
public PickerMenu(int width, int height, SpriteModel model, PickerModel colorGrid, Action colorPicked) : base(width, height) { this.model = model; this.mouse = new MouseWatch(); this.colorPicker = colorGrid; this.colorPicked = colorPicked; }
public static void LoadSprites(GorillaModel gorilla, StreamReader sr, string line) { while ((line = sr.ReadLine()) != null) { if (line.Contains("[Texture]") || line.Contains("[Font.")) { return; } if (string.IsNullOrEmpty(line)) { continue; } var spriteTextData = line.Split(' '); SpriteModel newSprite = new SpriteModel(); newSprite.Name = spriteTextData[0]; newSprite.posX = convertToInt(spriteTextData[1]); newSprite.posY = convertToInt(spriteTextData[2]); newSprite.width = convertToInt(spriteTextData[3]); newSprite.height = convertToInt(spriteTextData[4]); gorilla.Sprites.Add(newSprite); } }
public ItemDefinition(ItemDefinition definition) { Id = definition.Id; DisplayName = definition.DisplayName; Description = definition.Description; Icon = definition.Icon; Rarity = definition.Rarity; }
public static SpriteFromImageVM Create(SpriteModel spriteModel, Rectangle sourceRectangle) { var vm = new SpriteFromImageVM(); vm.FromModel(spriteModel); vm.SourceRectangle = sourceRectangle; return(vm); }
protected void SetSprite(SpriteModel s) { _sprite = s; _image.Width = s.Width * Zoom; _image.Height = s.Height * Zoom; this.Width = _image.Width; this.Height = _image.Height; }
void IMovement.MoveSprites(SpriteModel spriteModel) { _movementHelper.SetMovementModelKeyCode(spriteModel); if (spriteModel.SpriteRenderM != null) { //Movement of all sprites connected to SpritesMovingScript. _movementHelper.MoveSprites(spriteModel); } }
public static void GenAtlas(MaxRectsBinPack binPack, ObservableCollection <System.Windows.UIElement> list, ObservableCollection <SpriteModel> oc, string pathToImageFolder, string searchFilext, SquareSize width, SquareSize height) { // MaxRectsBinPack test = new MaxRectsBinPack((int)width, (int)height, false); foreach (String imageFile in Directory.GetFiles(pathToImageFolder, searchFilext)) { System.Drawing.Image image = System.Drawing.Image.FromFile(imageFile); Rect newPos = binPack.Insert(image.Width, image.Height, MaxRectsBinPack.FreeRectChoiceHeuristic.RectBestLongSideFit); Rectangle testRect = new Rectangle { Stroke = Brushes.LightBlue, StrokeThickness = 0 }; ImageBrush ib = new ImageBrush(); BitmapImage bmi = new BitmapImage(new Uri(imageFile, UriKind.Absolute)); ib.ImageSource = bmi; testRect.Fill = ib; testRect.Width = newPos.Width; testRect.Height = newPos.Height; Canvas.SetLeft(testRect, newPos.Left); Canvas.SetTop(testRect, newPos.Top); list.Add(testRect); // canvas.Children.Add(testRect); SpriteModel newSprite = new SpriteModel() { Path = imageFile, Rectangle = testRect, Name = System.IO.Path.GetFileName(imageFile), posX = (int)Math.Ceiling(newPos.Left), posY = (int)Math.Ceiling(newPos.Top), width = (int)Math.Ceiling(newPos.Width), height = (int)Math.Ceiling(newPos.Height) }; //newSprite.Path = imageFile; //newSprite.Rectangle = testRect; oc.Add(newSprite); //pictureBox.Width = image.Width; //pictureBox.Height = image.Height; //pictureBox.Image = image; } }
private void ClearState() { scope = new Scope(); errors = new List <Error>(); buildBreedOnly = false; currentAnimation = null; currentBreed = null; currentInstance = null; currentModel = null; currentRegion = null; }
private void StageChanged(object sender, StageChangedEventArgs e) { _currentStage = e.Stage; if (_currentStage != null) { var player = _currentStage.Project.EntityByName("Player"); if (player != null) { _playerSprite = SpriteModel.ForEntity(player, _currentStage.Project); } } OnPropertyChanged("HasStage"); }
public void UpdateIndexes(SpriteModel spriteModel) { var p = palette; foregroundIndex = p.IndexOf(spriteModel.brush.foreground); if (foregroundIndex == -1) { foregroundIndex = null; } backgroundIndex = p.IndexOf(spriteModel.brush.background); if (backgroundIndex == -1) { backgroundIndex = null; } }
public HistoryMenu(int width, int height, SpriteModel model) : base(width, height) { this.model = model; buttons = new List <LabelButton>(); scroll = new ScrollVertical(height, historyLength, Scrolled) { Position = new Point(width - 1, 0) }; this.Children.Add(scroll); mouse = new MouseWatch(); void Scrolled() { lastScroll = DateTime.Now; } }
public Player(NetConnection netConn, Game gameInstance) { this.gameInstance = gameInstance; this.NetConn = netConn; this.ID = Player.GetUniqueId(); if (netConn != null) { this.IP = netConn.RemoteEndpoint.Address.ToString(); } if (gameInstance != null) { this.SpriteModel = new SpriteModel(gameInstance, 4); UpdateSpriteTexture(); this.IdleAnimation = true; } }
public void Enter(Console console, string filepath) { var Width = console.Width; var Height = console.Height; if (File.Exists(filepath)) { try { var sprite = ASECIILoader.DeserializeObject <SpriteModel>(File.ReadAllText(filepath)); if (sprite.filepath != filepath) { sprite.filepath = filepath; File.WriteAllText($"{filepath}", ASECIILoader.SerializeObject(sprite)); } sprite.OnLoad(); Game.Instance.Screen = new EditorMain(Width, Height, sprite); Program.SaveState(new EditorState(filepath)); } catch { throw; } } else { var model = new SpriteModel(Width, Height) { filepath = filepath }; model.sprite.layers.Add(new Layer()); File.WriteAllText(filepath, ASECIILoader.SerializeObject(model)); console.Children.Add(new EditorMain(Width, Height, model)); } }
public void UpdateIndexes(SpriteModel spriteModel) { var cell = spriteModel.brush.cell; brushIndex = tiles.FindIndex(t => t.cg.Matches(cell.cg)); }
public TileMenu(int width, int height, SpriteModel spriteModel, TileModel tileModel, Action brushChanged) : base(width, height) { this.spriteModel = spriteModel; this.tileModel = tileModel; this.brushChanged = brushChanged; }
// Use this for initialization void Start() { fields = transform.Find("Fields/Viewport/Content/Text").GetComponent<Text>(); background = transform.Find("Background").gameObject; spriteModel = GameObject.Find("StaticSpriteModel-Mono").GetComponent<SpriteModel>(); billBoardRenderer = GameObject.Find("StaticSpriteModel-Mono/BillboardRenderer").GetComponent<BillBoardRenderer>(); progressBar = transform.Find("ProgressBar").GetComponent<Slider>(); frameSelector = transform.Find("FrameSelector").gameObject; frameButtons = new List<Button>(); frameButtons.Add(frameSelector.transform.Find("Button").GetComponent<Button>()); frameButtons[0].GetComponent<FrameButton>().Index = 0; Enable(false); isTestMode = GameObject.Find("TestMode") != null; }
public SpriteModelResourceContainer(SpriteModel spriteModel) { SpriteModel = spriteModel ?? throw new ArgumentNullException(nameof(spriteModel)); }
public SpriteModelResourceContainer(Scene scene, SpriteModel spriteModel) : base(scene) { SpriteModel = spriteModel ?? throw new ArgumentNullException(nameof(spriteModel)); }
public void ExecuteSaveSpriteModelCommand(Window window) { try { if (SpriteModel == null) { if (World.Instance.Models.ContainsKey(Id)) { throw new ArgumentException(); } foreach (var animationVM in Items) { animationVM.Save(); } var modelToAdd = new SpriteModel() { Id = Id, SpriteSheet = SpriteSheet.Texture, FrameSize = new Microsoft.Xna.Framework.Vector2(FrameWidth, FrameHeight), CollisionBox = new Microsoft.Xna.Framework.Rectangle(CollisionBoxX, CollisionBoxY, CollisionBoxWidth, CollisionBoxHeight), Animations = Items.Select(animation => animation.Animation).ToList() }; SpriteModel = modelToAdd; World.Instance.Models.Add(id, modelToAdd); SpriteModels.Items.Add(this); } else { if (SpriteModel.Id != Id && World.Instance.Models.ContainsKey(Id)) { throw new ArgumentException(); } World.Instance.Models.Remove(SpriteModel.Id); var originalViewModel = SpriteModels.Items.First(item => item.Id == SpriteModel.Id); SpriteModel.Id = Id; originalViewModel.Id = Id; SpriteModel.FrameSize = new Microsoft.Xna.Framework.Vector2(FrameWidth, FrameHeight); originalViewModel.FrameHeight = FrameHeight; originalViewModel.FrameWidth = FrameWidth; SpriteModel.CollisionBox = new Microsoft.Xna.Framework.Rectangle(CollisionBoxX, CollisionBoxY, CollisionBoxWidth, CollisionBoxHeight); originalViewModel.CollisionBoxHeight = CollisionBoxHeight; originalViewModel.CollisionBoxWidth = CollisionBoxWidth; originalViewModel.CollisionBoxX = CollisionBoxX; originalViewModel.CollisionBoxY = CollisionBoxY; SpriteModel.SpriteSheet = SpriteSheet.Texture; originalViewModel.SpriteSheet = SpriteSheet; originalViewModel.Items = Items; foreach (var animationVM in Items) { animationVM.Save(); } SpriteModel.Animations = Items.Select(animation => animation.Animation).ToList(); originalViewModel.NotifyReferencesOfChange(); World.Instance.Models.Add(id, SpriteModel); } window.Close(); } catch { MessageBox.Show("Failed to add Sprite Model! A Sprite Model with the same id already exists!"); } }
void Awake() { model = transform.parent.GetComponent<SpriteModel> (); movie = GetComponent<AVProQuickTimeMovie> (); billboardRenderer = GetComponent<Renderer>(); movie._folder = model.videoFolderPath; movie._filename = model.videoFileName; currentVideoType = VideoType.None; fullscreenSelectionUI = GameObject.Find("FullscreenSelectionUI").GetComponent<FullscreenSelectionUI>(); prevFrameCount = 0; isPlaying = false; nextFrameTimer = new Timer(1f / 20f); }
// Start is called before the first frame update // Used like contructor. void Start() { _movement = new Movement(); _spriteModel = new SpriteModel(); _spriteModel.SpriteRenderM = GetComponent <SpriteRenderer>(); }
public SaveMode(SpriteModel model, Console renderer) { this.model = model; this.renderer = renderer; }
public LoadSuccess(SpriteModel preview) => this.preview = preview;
public void MoveSprites(SpriteModel spriteModel) { _movement.MoveSprites(spriteModel); }