/// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { var dt = gameTime.ElapsedGameTime.TotalMilliseconds; if (Animations.Count == 0) { TimeTipActive += dt; if (!IsGoingForward) { UpdateTip(Tips[SelectRandomTip()]); } if (TimeTipActive >= 10000 && IsGoingForward) { Animations.Add(new Animation(AnimationProperty.Width, Easing.Linear, Width, 0, 400)); TimeTipActive = 0; IsGoingForward = false; } } base.Update(gameTime); }
/// <summary> /// Crea una nueva malla que es una instancia de otra malla original. /// Reutiliza toda la geometría de la malla original sin duplicarla. /// Debe crearse luego de haber cargado todas las animaciones en la malla original /// </summary> /// <param name="name">Nombre de la malla</param> /// <param name="parentInstance">Malla original desde la cual basarse</param> /// <param name="translation">Traslación respecto de la malla original</param> /// <param name="rotation">Rotación respecto de la malla original</param> /// <param name="scale">Escala respecto de la malla original</param> public TgcKeyFrameMesh(string name, TgcKeyFrameMesh parentInstance, TGCVector3 translation, TGCVector3 rotation, TGCVector3 scale) { //Cargar iniciales datos en base al original initData(parentInstance.d3dMesh, name, parentInstance.RenderType, parentInstance.originalData); DiffuseMaps = parentInstance.DiffuseMaps; Materials = parentInstance.Materials; //Almacenar transformación inicial this.translation = translation; this.rotation = rotation; this.scale = scale; //Agregar animaciones del original foreach (var entry in parentInstance.Animations) { Animations.Add(entry.Key, entry.Value); } //almacenar instancia en el padre ParentInstance = parentInstance; parentInstance.MeshInstances.Add(this); }
public SecondWindow(Screen screen) : base(screen) { Width = unit * 10; Height = unit * 10; HorizontalAlignment = HorizontalAlignment.Right; VerticalAlignment = VerticalAlignment.Bottom; Margin = new Thickness(0, 0, unit, unit); BackgroundColor = Color.Green; Padding = new Thickness(16); Content = new TextBlock(screen) { Text = "2nd Window", ForegroundColor = Color.White, BackgroundColor = Color.Black, ShadowOffset = new Vector2(2), TextOutlineWidth = 1, FontStretch = new Vector2(1.5f), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Bottom, TextHorizontalAlignment = HorizontalAlignment.Right }; var opacityAnimation = new FloatLerpAnimation { Action = (current) => { Opacity = current; }, To = 1, Repeat = Repeat.Forever, Duration = TimeSpan.FromSeconds(2), AutoReversed = true, Enabled = true }; Animations.Add(opacityAnimation); }
/// <summary> /// Closes the dialog. /// </summary> public void Close() { if (IsClosing) { return; } IsClosing = true; Animations.Clear(); Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, Alpha, 0f, 200)); ThreadScheduler.RunAfter(() => { lock (DialogManager.Dialogs) DialogManager.Dismiss(this); ButtonManager.Remove(this); IsClosing = false; var game = GameBase.Game as QuaverGame; var screen = game?.CurrentScreen as EditorScreen; var view = screen?.View as EditorScreenView; view.ControlBar.Parent = view.Container; }, 450); }
public void Init(ContentManager content) { // load in all textures and animations Animations.Add("walking_left", new Animation(new Frame (content.Load <Texture2D>("player/player_left1")), new Frame (content.Load <Texture2D>("player/player_left2")), new Frame (content.Load <Texture2D>("player/player_left3")))); Animations.Add("walking_right", new Animation(new Frame(content.Load <Texture2D>("player/player_right1")), new Frame(content.Load <Texture2D>("player/player_right2")), new Frame(content.Load <Texture2D>("player/player_right3")))); Animations.Add("walking_up", new Animation(new Frame (content.Load <Texture2D>("player/player_up1")), new Frame (content.Load <Texture2D>("player/player_up2")), new Frame (content.Load <Texture2D>("player/player_up3")))); Animations.Add("walking_down", new Animation(new Frame (content.Load <Texture2D>("player/player_down1")), new Frame (content.Load <Texture2D>("player/player_down2")), new Frame (content.Load <Texture2D>("player/player_down3")))); // set default animation CurrentAnimation = "walking_down"; // walking sound effects walkingEffect = content.Load <SoundEffect>("sound/footsteps"); walkingSoundEffectInstance = walkingEffect.CreateInstance(); walkingSoundEffectInstance.Volume = 0.25f; // position and collision system Position = new Vector2(256); Physics = new Physics(); Physics.GeneratePoints(this); // init lighting InitLighting(); }
void OnSwitchScreenButtonClick(Control sender, ref RoutedEventContext context) { var overlay = new Overlay(Screen) { Opacity = 0, BackgroundColor = Color.Black }; overlay.Show(); var opacityAnimation = new FloatLerpAnimation { Action = (current) => { overlay.Opacity = current; }, To = 1, Duration = TimeSpan.FromSeconds(0.5d), Enabled = true }; opacityAnimation.Completed += (s, e) => { Screen.ShowScreen("MainMenuDemoScreen"); }; Animations.Add(opacityAnimation); }
/// <summary> /// Add the animation to the list, checking for name collisions. /// </summary> /// <returns>True if the animation was added to the list.</returns> public bool AddAnimation(Animation animation) { if ((animation != null) && (this[animation.Name] == null)) { //set the foreign key of the animation if (Id.HasValue) { animation.AnimatingSpriteId = Id.Value; } //add the animation to the list Animations.Add(animation); //If there is currently not an animation playing, set it to the new one. if (null == _currentAnimation) { _currentAnimation = animation; } return(true); } return(false); }
public void AddAnimation(string fileName, bool loop, float speed, string themeColor, string json) { var fileExtension = Path.GetExtension(fileName); var nakedFileName = Path.GetFileNameWithoutExtension(fileName); Manifest.Animations.Add(new Animation { Id = nakedFileName, Loop = loop, Speed = speed, ThemeColor = themeColor }); var ms = new MemoryStream(); using (var sw = new StreamWriter(ms, Encoding.UTF8, 2048, true)) { sw.Write(json); sw.Flush(); } ms.Position = 0; Animations.Add(fileName, ms); }
/// <summary> /// Loads the file from the specified stream. /// </summary> /// <param name="stream">The stream to read from.</param> public override void Load(Stream stream) { BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR")); int blockCount = reader.ReadInt32(); for (int i = 0; i < blockCount; i++) { MapBlockType type = (MapBlockType)reader.ReadInt32(); if (!Enum.IsDefined(typeof(MapBlockType), type)) { throw new InvalidMapBlockTypeException((int)type); } int offset = reader.ReadInt32(); long nextBlock = stream.Position; stream.Seek(offset, SeekOrigin.Begin); if (type == MapBlockType.MapInformation) { MapPosition = new IntVector2(reader.ReadInt32(), reader.ReadInt32()); ZonePosition = new IntVector2(reader.ReadInt32(), reader.ReadInt32()); World = reader.ReadMatrix(); Name = reader.ReadString(); } else if (type == MapBlockType.WaterPatch) { WaterPatches = new MapWaterPatches(); WaterPatches.Read(reader); } else { if (type == MapBlockType.WaterPlane) { WaterSize = reader.ReadSingle(); } int entryCount = reader.ReadInt32(); Type classType = type.GetAttributeValue <MapBlockTypeAttribute, Type>(x => x.Type); for (int j = 0; j < entryCount; j++) { IMapBlock block = (IMapBlock)Activator.CreateInstance(classType); block.Read(reader); switch (type) { case MapBlockType.Object: Objects.Add((MapObject)block); break; case MapBlockType.NPC: NPCs.Add((MapNPC)block); break; case MapBlockType.Building: Buildings.Add((MapBuilding)block); break; case MapBlockType.Sound: Sounds.Add((MapSound)block); break; case MapBlockType.Effect: Effects.Add((MapEffect)block); break; case MapBlockType.Animation: Animations.Add((MapAnimation)block); break; case MapBlockType.MonsterSpawn: MonsterSpawns.Add((MapMonsterSpawn)block); break; case MapBlockType.WaterPlane: WaterPlanes.Add((MapWaterPlane)block); break; case MapBlockType.WarpPoint: WarpPoints.Add((MapWarpPoint)block); break; case MapBlockType.CollisionObject: CollisionObjects.Add((MapCollisionObject)block); break; case MapBlockType.EventObject: EventObjects.Add((MapEventObject)block); break; } } } if (i < blockCount - 1) { stream.Seek(nextBlock, SeekOrigin.Begin); } } }
public EventPageInstance( EventBase myEvent, EventPage myPage, Guid mapId, Event eventIndex, Player player ) : base(Guid.NewGuid()) { BaseEvent = myEvent; Id = BaseEvent.Id; MyPage = myPage; MapId = mapId; X = eventIndex.X; Y = eventIndex.Y; Name = myEvent.Name; MovementType = MyPage.Movement.Type; MovementFreq = MyPage.Movement.Frequency; MovementSpeed = MyPage.Movement.Speed; DisablePreview = MyPage.DisablePreview; Trigger = MyPage.Trigger; Passable = MyPage.Passable; HideName = MyPage.HideName; MyEventIndex = eventIndex; MoveRoute = new EventMoveRoute(); MoveRoute.CopyFrom(MyPage.Movement.Route); mPathFinder = new Pathfinder(this); SetMovementSpeed(MyPage.Movement.Speed); MyGraphic.Type = MyPage.Graphic.Type; MyGraphic.Filename = MyPage.Graphic.Filename; MyGraphic.X = MyPage.Graphic.X; MyGraphic.Y = MyPage.Graphic.Y; MyGraphic.Width = MyPage.Graphic.Width; MyGraphic.Height = MyPage.Graphic.Height; Sprite = MyPage.Graphic.Filename; mDirectionFix = MyPage.DirectionFix; mWalkingAnim = MyPage.WalkingAnimation; mRenderLayer = MyPage.Layer; if (MyGraphic.Type == EventGraphicType.Sprite) { switch (MyGraphic.Y) { case 0: Dir = 1; break; case 1: Dir = 2; break; case 2: Dir = 3; break; case 3: Dir = 0; break; } } if (myPage.AnimationId != Guid.Empty) { Animations.Add(myPage.AnimationId); } Face = MyPage.FaceGraphic; mPageNum = BaseEvent.Pages.IndexOf(MyPage); Player = player; SendToPlayer(); }
public virtual void ReadChildData(BinaryReader reader) { int x = 0; _renderModel.ReadString(reader); _animationGraph.ReadString(reader); for (x = 0; (x < _cubeMap.Count); x = (x + 1)) { CubeMap.Add(new SkyCubemapBlockBlock()); CubeMap[x].Read(reader); } for (x = 0; (x < _cubeMap.Count); x = (x + 1)) { CubeMap[x].ReadChildData(reader); } for (x = 0; (x < _atmosphericFog.Count); x = (x + 1)) { AtmosphericFog.Add(new SkyAtmosphericFogBlockBlock()); AtmosphericFog[x].Read(reader); } for (x = 0; (x < _atmosphericFog.Count); x = (x + 1)) { AtmosphericFog[x].ReadChildData(reader); } for (x = 0; (x < _secondaryFog.Count); x = (x + 1)) { SecondaryFog.Add(new SkyAtmosphericFogBlockBlock()); SecondaryFog[x].Read(reader); } for (x = 0; (x < _secondaryFog.Count); x = (x + 1)) { SecondaryFog[x].ReadChildData(reader); } for (x = 0; (x < _skyFog.Count); x = (x + 1)) { SkyFog.Add(new SkyFogBlockBlock()); SkyFog[x].Read(reader); } for (x = 0; (x < _skyFog.Count); x = (x + 1)) { SkyFog[x].ReadChildData(reader); } for (x = 0; (x < _patchyFog.Count); x = (x + 1)) { PatchyFog.Add(new SkyPatchyFogBlockBlock()); PatchyFog[x].Read(reader); } for (x = 0; (x < _patchyFog.Count); x = (x + 1)) { PatchyFog[x].ReadChildData(reader); } for (x = 0; (x < _lights.Count); x = (x + 1)) { Lights.Add(new SkyLightBlockBlock()); Lights[x].Read(reader); } for (x = 0; (x < _lights.Count); x = (x + 1)) { Lights[x].ReadChildData(reader); } for (x = 0; (x < _shaderFunctions.Count); x = (x + 1)) { ShaderFunctions.Add(new SkyShaderFunctionBlockBlock()); ShaderFunctions[x].Read(reader); } for (x = 0; (x < _shaderFunctions.Count); x = (x + 1)) { ShaderFunctions[x].ReadChildData(reader); } for (x = 0; (x < _animations.Count); x = (x + 1)) { Animations.Add(new SkyAnimationBlockBlock()); Animations[x].Read(reader); } for (x = 0; (x < _animations.Count); x = (x + 1)) { Animations[x].ReadChildData(reader); } }
public void AddAnimation(Animation anim) { Animations.Add(anim); }
public void AddAnimation(Animation newAnim) { Animations.Add(newAnim); }
public void AddAnimation(string key, Animation newAnim) { AnimationLookup.Add(key, Animations.Count); Animations.Add(newAnim); }
/// <summary> /// Given the name, starting frame, and ending frame, creates a new /// <see cref="Animation"/> instances and adds it to the animation dictionary. /// </summary> /// <param name="name"> /// The name of the animation /// </param> /// <param name="from"> /// The starting frame /// </param> /// <param name="to"> /// The ending frame /// </param> /// <remarks> /// Animations are stored in the ditionary by name, so each animation /// must have a unique name /// </remarks> /// <exception cref="ArgumentException"> /// Thrown if the animation provided has a name that is already present in /// the animation dictionary /// </exception> public void AddAnimation(string name, int from, int to) { Animations.Add(name, new Animation(name, from, to)); }
/// <summary> /// Adds the given <see cref="Animation"/> to the animations dictionary /// </summary> /// <param name="animation"> /// The <see cref="Animation"/> to add /// </param> /// <remarks> /// Animations are stored in the dictionary by name, so each animation /// must have a unique name /// </remarks> /// <exception cref="ArgumentException"> /// Thrown if the animation provided has a name that is already present in /// the animation dictionary /// </exception> public void AddAnimation(Animation animation) { Animations.Add(animation.Name, animation); }
public void InitializeAnimation(string state, Texture2D sprite, int frameWidth, int frameHeight, int frameCount, int frametime, Color color, float scale, bool looping) { var anime = new Animation(sprite, Position, frameWidth, frameHeight, frameCount, frametime, color, scale, looping); Animations.Add(state, anime); }
public void ImportModel() { if (IsLoading) { return; } string selectedFilePath = OpenFileDialogWithFilter(MainViewModel.SUPPORTED_3D_FILE_FILTER); if (selectedFilePath == null) { return; } //TODO StopAnimation here IsLoading = true; Task.Run(() => { Importer importer = new Importer(); //true로 설정하면 뼈대가 보인다 importer.Configuration.CreateSkeletonForBoneSkinningMesh = true; //importer.Configuration.SkeletonSizeScale = 0.04f; //importer.Configuration.GlobalScale = 0.1f; //Importer의 Load 메소드는 선택된 파일의 유효성 (호환성)을 검사한다. //내부에서 BuildScene이라는 Node를 조립하는 메소드를 호출한다. return(importer.Load(selectedFilePath)); }).ContinueWith((resultScene) => { IsLoading = false; if (resultScene.IsCompleted) { scene = resultScene.Result; Animations.Clear(); GroupModel.Clear(); if (scene != null) { GroupModel.AddNode(scene.Root); if (scene.HasAnimation) { foreach (var ani in scene.Animations) { Animations.Add(ani); } } if (scene.Root != null) { foreach (var node in scene.Root.Traverse()) { if (node is BoneSkinMeshNode boneNode) { if (boneNode.IsSkeletonNode) { skeletonNodes.Add(boneNode); boneNode.Visible = false; } else { boneNode.IsThrowingShadow = true; boneNode.WireframeColor = new SharpDX.Color4(0, 0, 1, 1); boneSkinNodes.Add(boneNode); //boneNode.MouseDown += OnMouseDown_Model; } } node.Tag = new CustomDataModel(node); } } } } else if (resultScene.IsFaulted && resultScene.Exception != null) { MessageBox.Show(resultScene.Exception.Message); } }, TaskScheduler.FromCurrentSynchronizationContext()); return; }
public Coin() : base(QuickGameScene.Current, Textures.CoinTexture) { Position.SetWidth(16, GameEngine.AnchorOrigin.Left); Position.SetHeight(16, GameEngine.AnchorOrigin.Top); Animations.Add(AnimationKeys.Stand, this, TextureFlipBehavior.FlipWhenFacingLeft, 0, 1, 2, 3); }
public LoadBlockMeshDialog(Screen screen) : base(screen) { // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; ShadowOffset = new Vector2(4); Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; Content = stackPanel; var pageButtonPanel = new StackPanel(screen) { HorizontalAlignment = HorizontalAlignment.Right }; stackPanel.Children.Add(pageButtonPanel); var backPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Left, Content = new Image(screen) { Texture = screen.Content.Load <Texture2D>("UI/ArrowLeft") } }; backPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.BackPage(); }; pageButtonPanel.Children.Add(backPageButton); pageTextBlock = new TextBlock(screen) { Width = BlockViewerGame.SpriteSize * 2, ForegroundColor = Color.White, BackgroundColor = Color.Black, ShadowOffset = new Vector2(2) }; pageButtonPanel.Children.Add(pageTextBlock); var forwardPageButton = new Button(screen) { Focusable = false, Width = BlockViewerGame.SpriteSize, HorizontalAlignment = HorizontalAlignment.Right, Content = new Image(screen) { Texture = screen.Content.Load <Texture2D>("UI/ArrowRight") } }; forwardPageButton.Click += (Control s, ref RoutedEventContext c) => { ViewModel.ForwardPage(); }; pageButtonPanel.Children.Add(forwardPageButton); var fileListPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; stackPanel.Children.Add(fileListPanel); for (int i = 0; i < fileButtons.Length; i++) { fileButtons[i] = new FileButton(screen) { HorizontalAlignment = HorizontalAlignment.Stretch }; fileButtons[i].Click += OnFileButtonClick; fileButtons[i].KeyDown += OnFileNameButtonKeyDown; fileListPanel.Children.Add(fileButtons[i]); } var separator = ControlUtil.CreateDefaultSeparator(screen); stackPanel.Children.Add(separator); cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton); cancelButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(cancelButton); const float windowWidth = 480; openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = windowWidth, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = windowWidth, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => base.Close(); Animations.Add(closeAnimation); }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="backgroundAlpha"></param> public DownloadingReplayDialog() : base(0) { Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, Alpha, 0.35f, 200)); CreateContent(); }
/// <summary> /// Default constructor /// </summary> /// <param name="texture"> Texture.</param> /// <param name="position"> Location in game.</param> /// <param name="width"> Width.</param> /// <param name="height"> Height.</param> /// <param name="keyboard"> Keyboard device.</param> /// <param name="level"> The level the player is in.</param> /// <param name="content"> The content manager.</param> public Player(Texture2D texture, Vector2 position, int width, int height, KeyboardInput keyboard, Level level, ContentManager content) : base(position, width, height, level) { Sprite = new MonoSprite(texture, new Rectangle(80, 10, width, height), position, width, height); Padding = new Vector2(3, 3); Invulnerable = false; EnableInput(); MaxLives = 3; Lives = MaxLives; _keyboard = keyboard; _timesFlickered = 0; _flickerTimer = new TimedEvent(Flicker, 80); _sounds = new Dictionary <string, SoundEffect>() { { "jump", content.Load <SoundEffect>("Audio/smw_jump") }, { "grow", content.Load <SoundEffect>("Audio/smw_powerup") }, { "shrink", content.Load <SoundEffect>("Audio/smw_powerdown") }, { "death", content.Load <SoundEffect>("Audio/smw_lostalife") }, { "peace", content.Load <SoundEffect>("Audio/smw_courseclear") } }; TerminalVelocity = new Vector2(150, 350); Acceleration = 290; JumpImpulse = _smallJumpImpulse; Grounded = false; _allowWalking = true; Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_LOOKUP, baseFrame: new Vector2(114, 10), frameSize: new Vector2(width, height), rows: 1, columns: 1, msPerFrame: 50 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_WALK, baseFrame: new Vector2(0, 10), frameSize: new Vector2(width, height), rows: 1, columns: 2, msPerFrame: 110 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_IDLE, baseFrame: new Vector2(0, 10), frameSize: new Vector2(width, height), rows: 1, columns: 1, msPerFrame: 50 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_DUCK, baseFrame: new Vector2(96, 10), frameSize: new Vector2(width, height), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_JUMP, baseFrame: new Vector2(64, 10), frameSize: new Vector2(width, height), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_FALL, baseFrame: new Vector2(80, 10), frameSize: new Vector2(width, height), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_LOOKUP, baseFrame: new Vector2(145, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 1, msPerFrame: 50 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_WALK, baseFrame: new Vector2(0, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 2, msPerFrame: 110 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_IDLE, baseFrame: new Vector2(0, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_DUCK, baseFrame: new Vector2(128, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_JUMP, baseFrame: new Vector2(96, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_FALL, baseFrame: new Vector2(112, 32), frameSize: new Vector2(_bigWidth, _bigHeight), rows: 1, columns: 1, msPerFrame: 175 )); Animations.Add(new Animation( id: (int)PlayerAnimation.DEATH, baseFrame: new Vector2(131, 8), frameSize: new Vector2(15, 24), rows: 1, columns: 2, msPerFrame: 135 )); Animations.Add(new Animation( id: (int)PlayerAnimation.SMALL_PEACE, baseFrame: new Vector2(162, 10), frameSize: new Vector2(16, 21), rows: 1, columns: 1, msPerFrame: 0 )); Animations.Add(new Animation( id: (int)PlayerAnimation.BIG_PEACE, baseFrame: new Vector2(162, 36), frameSize: new Vector2(16, 28), rows: 1, columns: 1, msPerFrame: 0 )); }
/// <summary> /// Adds the animation /// </summary> /// <param name="animation">The animation</param> public void Add(Animation animation) { Animations.Add(animation); }
public override void InitAnimations() { base.InitAnimations(); Animations.Add("Attack"); Animations.Add("Moving"); }
public ThirdWindow(Screen screen) : base(screen) { Width = unit * 15; Height = unit * 10; BackgroundColor = Color.Blue; var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(8) }; Content = stackPanel; var title = new TextBlock(screen) { Text = "3rd window", HorizontalAlignment = HorizontalAlignment.Stretch, ForegroundColor = Color.White, BackgroundColor = Color.Black, ShadowOffset = new Vector2(2), TextOutlineWidth = 1, FontStretch = new Vector2(1.5f) }; stackPanel.Children.Add(title); var changingLookAndFeelDemoButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Changing look & feel demo", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; changingLookAndFeelDemoButton.Click += (Control s, ref RoutedEventContext c) => { (screen as WindowDemoScreen).SwitchLookAndFeelSource(); }; stackPanel.Children.Add(changingLookAndFeelDemoButton); var overlayDialogDemoButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Overlay dialog demo", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; overlayDialogDemoButton.Click += (Control sender, ref RoutedEventContext context) => { var dialog = new FirstOverlayDialog(Screen); dialog.Overlay.Opacity = 0.5f; dialog.Show(); }; stackPanel.Children.Add(overlayDialogDemoButton); var drawing3DDemoButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Drawing 3D demo", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; drawing3DDemoButton.Click += (Control s, ref RoutedEventContext c) => { var window = new CubeWindow(Screen); window.Show(); }; stackPanel.Children.Add(drawing3DDemoButton); var listBoxDemoButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "ListBox demo", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; listBoxDemoButton.Click += (Control s, ref RoutedEventContext c) => { var window = new ListBoxDemoWindow(screen); window.Show(); }; stackPanel.Children.Add(listBoxDemoButton); var switchScreenButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Switch screen", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; switchScreenButton.Click += OnSwitchScreenButtonClick; stackPanel.Children.Add(switchScreenButton); var exitButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Exit", ForegroundColor = Color.White, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Left } }; exitButton.Click += OnExitButtonClick; stackPanel.Children.Add(exitButton); var startWidthAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, To = Width, Duration = TimeSpan.FromSeconds(0.3f), Enabled = true }; Animations.Add(startWidthAnimation); var startHeightAnimation = new FloatLerpAnimation { Action = (current) => { Height = current; }, To = Height, Duration = TimeSpan.FromSeconds(0.3f), Enabled = true }; Animations.Add(startHeightAnimation); overlayDialogDemoButton.Focus(); }
public MainMenuWindow(Screen screen) : base(screen) { // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; Height = 480; Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Orientation = Orientation.Vertical }; Content = stackPanel; var title = new TextBlock(screen) { Text = Strings.MainMenuTitle, Padding = new Thickness(4), ForegroundColor = Color.Yellow, BackgroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Stretch, TextHorizontalAlignment = HorizontalAlignment.Left, ShadowOffset = new Vector2(2) }; stackPanel.Children.Add(title); var separator = ControlUtil.CreateDefaultSeparator(screen); stackPanel.Children.Add(separator); tab = new TabControl(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, SelectedIndex = mainMenuIndex }; stackPanel.Children.Add(tab); var mainMenuPanel = CreateMainMenuPanel(); tab.Items.Add(mainMenuPanel); var modeMenuPanel = CreateModeMenuPanel(); tab.Items.Add(modeMenuPanel); var lodMenuPanel = CreateLodMenuPanel(); tab.Items.Add(lodMenuPanel); openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = 240, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 240, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => { base.Close(); // Screen は最前面の Window をアクティブにするので、 // 強制的に Desktop をアクティブにします。 //Screen.Desktop.Activate(); }; Animations.Add(closeAnimation); // デフォルト フォーカス。 loadButton.Focus(); }
/// <summary> /// インスタンスを生成します。 /// </summary> /// <param name="screen"></param> public PredefinedColorDialog(Screen screen) : base(screen) { PredefinedColors = new List <PredefinedColor>(); PredefinedColors.AddRange(PredefinedColor.PredefinedColors); PredefinedColors.Sort((x, y) => x.Name.CompareTo(y.Name)); // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; ShadowOffset = new Vector2(4); Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Stretch }; Content = stackPanel; tab = new TabControl(screen) { SelectedIndex = 0 }; stackPanel.Children.Add(tab); predefinedColorGrid = new PredefinedColorGrid(screen, this) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; tab.Items.Add(predefinedColorGrid); predefinedColorList = new PredefinedColorList(screen, this) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; tab.Items.Add(predefinedColorList); var separator = ControlUtil.CreateDefaultSeparator(screen); stackPanel.Children.Add(separator); viewModeButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.ListViewModeButton); viewModeButton.Click += OnViewModeButtonClick; stackPanel.Children.Add(viewModeButton); var sortByNameButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.SortByNameButton); sortByNameButton.Click += OnSortByNameClick; stackPanel.Children.Add(sortByNameButton); var sortByColorButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.SortByColorButton); sortByColorButton.Click += OnSortByColorClick; stackPanel.Children.Add(sortByColorButton); cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton); cancelButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(cancelButton); const float windowWidth = 400; openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = windowWidth, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = windowWidth, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => base.Close(); Animations.Add(closeAnimation); }
//--------------------------------------------------------------------------------------------------------- /// <summary> /// Открытие файла /// </summary> //--------------------------------------------------------------------------------------------------------- public void OpenFile(TreeView model_tree_view) { if (mIsLoading) { return; } String path = XFileDialog.OpenUseExtension("Открыть 3D файл", OpenFileFilter); if (path == null) { return; } StopAnimation(); // Create the FBX SDK manager FbxManager lSdkManager = FbxManager.Create(); // Create an IOSettings object. FbxIOSettings ios = FbxIOSettings.Create(lSdkManager, Globals.IOSROOT); lSdkManager.SetIOSettings(ios); // ... Configure the FbxIOSettings object ... // Create an importer. FbxImporter lImporter = FbxImporter.Create(lSdkManager, ""); // Initialize the importer. bool lImportStatus = lImporter.Initialize(path, -1, lSdkManager.GetIOSettings()); mIsLoading = true; Task.Run(() => { var loader = new Importer(); //loader.Configuration.AssimpPostProcessSteps = //loader.Configuration.AssimpPostProcessSteps | //Assimp.PostProcessSteps.OptimizeGraph; return(loader.Load(path)); }).ContinueWith((result) => { mIsLoading = false; if (result.IsCompleted) { HelixToolkitScene helix_toolkit_scene = result.Result; if (helix_toolkit_scene == null) { return; } mSceneRoot = helix_toolkit_scene.Root; mSceneAnimations = helix_toolkit_scene.Animations; Animations.Clear(); GroupModel.Clear(); if (helix_toolkit_scene != null) { if (helix_toolkit_scene.Root != null) { foreach (var node in helix_toolkit_scene.Root.Traverse()) { if (node is MaterialGeometryNode m) { if (m.Material is PBRMaterialCore pbr) { pbr.RenderEnvironmentMap = RenderEnvironmentMap; } else if (m.Material is PhongMaterialCore phong) { phong.RenderEnvironmentMap = RenderEnvironmentMap; } } } } GroupModel.AddNode(helix_toolkit_scene.Root); if (helix_toolkit_scene.HasAnimation) { var dict = helix_toolkit_scene.Animations.CreateAnimationUpdaters(); foreach (var animation in dict.Values) { Animations.Add(animation); } } foreach (var node in helix_toolkit_scene.Root.Traverse()) { //node.Tag = new AttachedNodeViewModel(node); } } Boolean is_y_up = threeViewer.IsModelUpDirectionY(); checkBoxYUpModel.IsChecked = is_y_up; if (is_y_up) { } model_tree_view.ItemsSource = mSceneRoot.Items; //Scene = new CScene3D() } else if (result.IsFaulted && result.Exception != null) { MessageBox.Show(result.Exception.Message); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
public Swoosh() : base(QuickGameScene.Current, Textures.SwooshTexture) { Position.Set(0, 0, 32, 32); Animations.Add(AnimationKeys.Stand, this, TextureFlipBehavior.FlipWhenFacingLeft, 0, 1, 2, 3); new DestroyOnAnimationFinished(this); }
public override void AddAnimations() { string basePath = "Stands/GoldenWind/KingCrimson/"; #region Mandatory Animations.Add(ANIMATION_SUMMON, new SpriteAnimation(basePath + "KCSpawn", 7, 4)); Animations.Add(ANIMATION_IDLE, new SpriteAnimation(basePath + "KCIdle", 5, 22)); Animations.Add(ANIMATION_DESPAWN, new SpriteAnimation(basePath + "KCSpawn", 7, 4)); #endregion #region Punch Animations.Add("PUNCH_R", new SpriteAnimation(basePath + "KCPunchRight", 4, 5)); Animations.Add("PUNCH_L", new SpriteAnimation(basePath + "KCPunchLeft", 4, 5)); Animations.Add("PUNCH_RU", new SpriteAnimation(basePath + "KCPunchRightU", 4, 5)); Animations.Add("PUNCH_LU", new SpriteAnimation(basePath + "KCPunchLeftU", 4, 5)); Animations.Add("PUNCH_RD", new SpriteAnimation(basePath + "KCPunchRightD", 4, 5)); Animations.Add("PUNCH_LD", new SpriteAnimation(basePath + "KCPunchLeftD", 4, 5)); Animations["PUNCH_R"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["PUNCH_L"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["PUNCH_RU"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["PUNCH_LU"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["PUNCH_RD"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["PUNCH_LD"].SetNextAnimation(Animations[ANIMATION_IDLE]); #endregion #region Donut Animations.Add("DONUT_PREP", new SpriteAnimation(basePath + "KCDonutPrep", 15, 4)); Animations.Add("DONUT_IDLE", new SpriteAnimation(basePath + "KCDonutIdle", 7, 15, true)); Animations.Add("DONUT_ATT", new SpriteAnimation(basePath + "KCDonutCommit", 6, 4)); Animations.Add("DONUT_UNDO", new SpriteAnimation(basePath + "KCDonutUndo", 12, 4)); Animations.Add("DONUT_MISS", new SpriteAnimation(basePath + "KCDonutMiss", 7, 4)); Animations["DONUT_PREP"].SetNextAnimation(Animations["DONUT_IDLE"]); Animations["DONUT_ATT"].SetNextAnimation(Animations["DONUT_MISS"]); Animations["DONUT_UNDO"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["DONUT_MISS"].SetNextAnimation(Animations[ANIMATION_IDLE]); #endregion Animations.Add("POSE_PREP", new SpriteAnimation(basePath + "KCPoseTransition", 8, 5)); Animations.Add("POSE_END", new SpriteAnimation(basePath + "KCPoseTransition", 8, 5, false, null, true)); Animations.Add("POSE_IDLE", new SpriteAnimation(basePath + "KCPoseIdle", 10, 22, true)); Animations["POSE_PREP"].SetNextAnimation(Animations["POSE_IDLE"]); Animations["POSE_END"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["POSE_END"].ReversePlayback = true; #region Rush Animations.Add("RUSH_MID", new SpriteAnimation(basePath + "KCRush", 4, 4)); Animations.Add("RUSH_UP", new SpriteAnimation(basePath + "KCRushUp", 4, 4)); Animations.Add("RUSH_DOWN", new SpriteAnimation(basePath + "KCRushDown", 4, 4)); Animations["RUSH_UP"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["RUSH_MID"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["RUSH_DOWN"].SetNextAnimation(Animations[ANIMATION_IDLE]); #endregion Animations[ANIMATION_SUMMON].SetNextAnimation(Animations[ANIMATION_IDLE]); #region Cut Animations.Add("CUT_IDLE", new SpriteAnimation(basePath + "KCCutIdle", 5, 25, true)); Animations.Add("CUT_PREP", new SpriteAnimation(basePath + "KCCut", 20, 3)); Animations.Add("CUT_ATT", new SpriteAnimation(basePath + "KCYeet", 13, 3)); Animations["CUT_ATT"].SetNextAnimation(Animations[ANIMATION_IDLE]); Animations["CUT_PREP"].SetNextAnimation(Animations["CUT_IDLE"]); Animations["CUT_IDLE"].SetNextAnimation(Animations["CUT_ATT"]); #endregion }