public override void Init() { base.Init(); Engine.Instance.StateRenderer.GameEffect = null; Engine.Instance.StateRenderer.UiEffect = null; WindowManager.LevelEditor = true; Engine.EditingLevel = true; Physics.Init(); Lights.Init(); Tilesets.Load(); Ui.Add(Camera = new Camera(new FollowingDriver())); Console = new Console(Area); Editor = new EditorWindow(new Editor { Area = Area, Level = Level, Camera = Camera }); Level = Editor.Editor.Level; for (var i = 0; i < Level.Explored.Length; i++) { Level.Explored[i] = true; } }
private void ComputeIntegratedPTC() { ComputeTransitionProbabilities(); Wi = ComputeIntegralChar(Ws); for (int stream = 0; stream < StreamsCount; stream++) { Ui.Add(ComputeIntegralChar(Us[stream])); Li.Add(ComputeIntegralChar(Ls[stream])); Ni.Add(ComputeIntegralChar(Ns[stream])); } }
public override void Init() { base.Init(); var anim = Animations.Get("monitor"); frame = anim.GetSlice("frame"); fill = anim.GetSlice("fill"); var c = new Camera(new FollowingDriver()); Ui.Add(c); Ui.Add(new Cursor()); c.Position = new Vector2(Display.Width / 2f, Display.Height / 2f); }
public override void Init() { base.Init(); floors = new string[FloorRegistry.Instance.Size + 2]; floors[0] = "Random"; floors[1] = "None"; for (var i = 0; i < FloorRegistry.Instance.Size; i++) { floors[i + 2] = FloorRegistry.Instance.Get(i).GetType().Name.Replace("Floor", ""); } walls = new string[WallRegistry.Instance.Size + 2]; walls[0] = "Random"; walls[1] = "None"; for (var i = 0; i < WallRegistry.Instance.Size; i++) { walls[i + 2] = WallRegistry.Instance.Get(i).GetType().Name.Replace("Walls", "").Replace("Wall", ""); } Tilesets.Load(); Ui.Add(new Camera(new FollowingDriver()) { Position = new Vector2(Display.Width / 2f, Display.Height / 2f) }); level = new RegularLevel { Width = Display.Width / 16, Height = Display.Height / 16 + 1, NoLightNoRender = false, DrawLight = false }; Area.Add(level); level.SetBiome(BiomeRegistry.Get(Biome.Castle)); level.Setup(); Paint(); }
public override void Init() { base.Init(); TopUi = new Area(); Shaders.Ui.Parameters["black"].SetValue(0f); Shaders.Ui.Parameters["bx"].SetValue(0.333f); Shaders.Ui.Parameters["by"].SetValue(0.333f); Tween.To(1, 0, x => Shaders.Ui.Parameters["black"].SetValue(x), 0.7f, Ease.QuadIn); Area.Add(new GobboCutsceneController { State = this }); Ui.Add(Camera = new Camera(new FollowingDriver())); Camera.Position = new Vector2(Display.Width / 2f, Display.Height / 2f) + new Vector2(32); black = CommonAse.Ui.GetSlice("black"); }
static void Main(string[] args) { Ui.Setup("Test project"); var standardModule = new UiModuleSettings { borderColor = ConsoleColor.Cyan, borderThickness = 1, bottomBorderActive = true, heightPercentage = 0, horizontalBorderCharacter = '#', leftBorderActive = true, rightBorderActive = true, topBorderActive = true, verticalBorderCharacter = '#' }; Ui ui = new Ui(new List <List <UiModuleSettings> > { new List <UiModuleSettings> { standardModule, standardModule }, new List <UiModuleSettings> { standardModule, standardModule, standardModule }, new List <UiModuleSettings> { standardModule } }); ui.Add("This is the center in this current layout", ConsoleColor.DarkCyan, 1, 1); ui.Add("This is another test", ConsoleColor.DarkGray, 0, 1, true); ui.Add("Hello", ConsoleColor.Magenta, 1, 0); ui.Add("First", ConsoleColor.Yellow, 1, 0); ui.Add("Second", ConsoleColor.Blue, 1, 0); ui.Add("Third", ConsoleColor.Green, 1, 0); ui.Add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec interdum aliquam quam vitae blandit. Vivamus eu ipsum sit amet tortor pretium blandit. Pellentesque accumsan augue eget magna lacinia consequat. Aliquam molestie dui vel erat vestibulum, varius blandit nisl pellentesque. Fusce at tellus aliquam, ultrices metus in, lobortis quam. Donec id consectetur ex. Pellentesque nec maximus dui, a dictum diam. Nunc sed tempus felis. Pellentesque scelerisque lacus ac est fringilla maximus. Donec augue massa, rhoncus in risus non, congue pharetra nunc. Quisque quis quam quis mauris pulvinar imperdiet. Nulla finibus nec massa a pulvinar. Etiam commodo felis eget leo malesuada, eu egestas odio scelerisque. Morbi sed fermentum urna. Aenean ut mi id elit mattis molestie non vel odio.\r\n\r\nDuis a massa vitae est tincidunt imperdiet eu nec turpis. Quisque justo dui, facilisis vulputate ante a, interdum vehicula mauris. Quisque sed lobortis risus, vitae consequat nisi. Pellentesque sed ipsum turpis. Duis enim nibh, consequat a enim et, gravida aliquet arcu. Vivamus viverra, erat sit amet porttitor molestie, ipsum magna mattis lectus, a ultrices lacus lectus non enim. Suspendisse pharetra ligula vitae scelerisque dictum. Aliquam erat nisl, vehicula sit amet pellentesque et, vestibulum a nibh. Maecenas mauris nunc, viverra at vehicula vitae, mattis eu elit.\r\n\r\nDuis rhoncus purus euismod tellus ornare, ac faucibus quam semper. Donec aliquam molestie felis, a finibus libero lobortis sed. Quisque dictum suscipit viverra. Donec molestie commodo augue. Quisque at dolor sit amet elit sollicitudin tempus. Vivamus et urna ut magna lacinia condimentum eu ut metus. In hac habitasse platea dictumst. Fusce ornare mi vitae ante bibendum, non pulvinar ipsum aliquam. Curabitur a placerat tellus. ", ConsoleColor.DarkCyan, 0, 2); ui.Flush(); }
public void Update(Control control, Camera camera, Player player, NpcPackage npcs, Ui.FloatingTextCollection floatingText, ref Map map) { #region Initialize Weapons if (player.Inventory.Quickbar.UsingItem.Type == "useweapon") { ItemUse use = player.Inventory.Quickbar.UsingItem; Weapon weapon = GetWeaponById(int.Parse(use.Value)); if (weapon.Type.Name == "Sword" && !player.Inventory.Quickbar.IsUsingItem) { LiveWeapons.Add(new LiveSword(GetWeaponById(player.Inventory.Quickbar.UsingItem.IntValue),new Vector2(player.Movement.Area.Center.X, player.Movement.Area.Center.Y - 5), player.Movement.Direction)); player.Inventory.Quickbar.IsUsingItem = true; } if (weapon.Type.Name == "Arrow") { if(control.currentMouse.LeftButton == ButtonState.Pressed){ if(!player.Inventory.Quickbar.IsUsingItem) { player.Inventory.Quickbar.IsUsingItem = true; use.Charge = 10f; } else { use.Charge += 0.1f; } } else { LiveProjectile liveWeapon = new LiveProjectile(Weapons[2], new Vector2(player.Movement.Area.Center.X, player.Movement.Area.Center.Y), (float)use.Charge, control, camera); use.Charge = 0; LiveWeapons.Add(liveWeapon); player.Inventory.Quickbar.IsUsingItem = false; Player = player; } } } #endregion #region Update weapons for ( int i = 0; i < LiveWeapons.Count; i++) { if (LiveWeapons[i].Weapon.Type.Name == "Sword") { LiveSword weapon = LiveWeapons[i]; weapon.Rotation += LiveWeapons[i].Speed; LiveWeapons[i].Location += player.Movement.Moved; if ((LiveWeapons[i].SwingEnd > 0 && LiveWeapons[i].Rotation > LiveWeapons[i].SwingEnd) || (LiveWeapons[i].SwingEnd < 0 && LiveWeapons[i].Rotation < LiveWeapons[i].SwingEnd)) { LiveWeapons.RemoveAt(i); player.Inventory.Quickbar.IsUsingItem = false; } } else if(LiveWeapons[i].Weapon.Type.Name == "Arrow") { LiveProjectile weapon = LiveWeapons[i]; if (weapon.Movement.Velocity != Vector2.Zero) { weapon.Movement.Update(map); } else { weapon.TimeToLive -= 1; if (weapon.TimeToLive <= 0) { LiveWeapons.RemoveAt(i); } } } } #endregion #region Check for weapon collisions // Npc Collisions for (int w = 0; w < LiveWeapons.Count; w++) { var weapon = LiveWeapons[w]; for (int i = 0; i < npcs.ActiveNpcs.Count; i++) { if (weapon.Weapon.Type.Name == "Sword") { LiveSword sword = weapon; if (weapon.currentLocation.Intersects(npcs.ActiveNpcs[i].Movement.Area)) { if (npcs.Damage(npcs.ActiveNpcs[i], 10, weapon.Location)) { floatingText.Add("10", weapon.Location); } } } else if(weapon.Weapon.Type.Name == "Arrow" && weapon.Movement.Velocity != Vector2.Zero) { LiveProjectile projectile = weapon; if (projectile.Movement.Area.Intersects(npcs.ActiveNpcs[i].Movement.Area)) { if (npcs.Damage(npcs.ActiveNpcs[i], 10, weapon.Location)) { floatingText.Add("10", new Vector2(projectile.Movement.Area.Center.X, projectile.Movement.Area.Center.Y)); LiveWeapons.RemoveAt(w); } } } } // X/Y Collisions int startx = (int)MathHelper.Clamp(camera.X * -1 / 24f, 0, map.SizeX); int endx = startx + camera.Width / 24; int starty = (int)MathHelper.Clamp(camera.Y * -1 / 24f, 0, map.SizeY); int endy = starty + camera.Height / 24; for (int x = startx; x < endx; x++) { for (int y = starty; y < endy; y++) { Rectangle area = new Rectangle(x * 24, y * 24, 24,24); if (map.Flora.Flora[x, y] != null) { if (weapon.Weapon.Type.Name == "Sword") { if (weapon.currentLocation.Intersects(area)) { map.Flora.Flora[x, y] = null; } } else if (weapon.Weapon.Type.Name == "Arrow") { if (weapon.Movement.Area.Intersects(area)) { map.Flora.Flora[x, y] = null; } } } } } } #endregion }
public override void Init() { base.Init(); pixel = new TextureRegion(Textures.FastLoad("Content/pixel.png")); Ui.Add(logoCard = new PhotoCard { Region = new TextureRegion(Textures.FastLoad("Content/logo.png")), Url = "https://twitter.com/rexcellentgames", Name = "Rexcellent Games", Position = new Vector2(240, Display.UiHeight + 60), Target = new Vector2(240, 115), Scale = 1 }); Ui.Add(tipLabel = new UiString(Font.Small)); GenerateNewTip(); logoCard.Start.Y = -90; progress = 0; var thread = new Thread(() => { var sw = Stopwatch.StartNew(); Log.Info("Starting asset loading thread"); LoadSection(() => SaveManager.Load(gameArea, SaveType.Global), "Global saves"); checkFullscreen = true; if (Assets.LoadMusic) { LoadSection(() => Audio.ThreadLoad("Void"), "Audio"); } else { progress++; } LoadSection(() => Assets.Load(ref progress), "Assets"); if (Assets.LoadMusic) { LoadSection(() => Audio.ThreadLoad("Menu", false), "More audio"); } else { progress++; } LoadSection(Dialogs.Load, "Dialogs"); CommonAse.Load(); progress++; try { ImGuiHelper.BindTextures(); } catch (Exception e) { Log.Error(e); } progress++; LoadSection(Shaders.Load, "Shaders"); LoadSection(Prefabs.Load, "Prefabs"); LoadSection(Items.Load, "Items"); LoadSection(LootTables.Load, "Loot tables"); LoadSection(Mods.Load, "Mods"); Log.Info("Done loading assets! Loading level now."); LoadSection(() => { Lights.Init(); Physics.Init(); }, "Lights & physics"); gameArea = new Area(); Run.Level = null; LoadSection(Tilesets.Load, "Tilesets"); LoadSection(Achievements.Load, "Achievements"); LoadSection(() => { SaveManager.Load(gameArea, SaveType.Game); }, "Game saves"); Rnd.Seed = $"{Run.Seed}_{Run.Depth}"; LoadSection(() => { SaveManager.Load(gameArea, SaveType.Level); }, "Level saves"); LoadSection(() => { if (Run.Depth > 0) { SaveManager.Load(gameArea, SaveType.Player); } else { SaveManager.Generate(gameArea, SaveType.Player); } }, "Player saves"); Log.Info($"Done loading level in {sw.ElapsedMilliseconds} ms! Going to menu."); ready = true; }); thread.Start(); }