void OnServerInitialized() { int iWorldHalfSize = Convert.ToInt32(World.Size / 2); MinX = -iWorldHalfSize + 300; MaxX = iWorldHalfSize - 300; MinZ = -iWorldHalfSize + 300; MaxZ = iWorldHalfSize - 300; MinY = 250; MaxY = 400; //Puts(" X:" + MinX + " " + MaxX + " Y:" + MinY + " " + MaxY + " Z:" + MinZ + " " + MaxZ); blueprintDefinitions = ItemManager.bpList; foreach (var bp in blueprintDefinitions) { Blueprints.Add(bp.targetItem.shortname, bp.time); } itemDefinitions = ItemManager.itemList; Puts(itemDefinitions.Count.ToString()); foreach (var itemdef in itemDefinitions) { Items.Add(itemdef.displayName.english); } CraftingRate = 100; GatherRate = 100; FWEnabled = true; UpdateCraftingRate(); LoadConfigVariables(); SaveConfig(); StartBuildPhase(); }
public virtual void Create(IWorld world, IRoom room, IFaction faction, RoomBlueprint roomBlueprintIfAny) { var max = roomBlueprintIfAny?.OptionalActorsMax ?? 5; if (max <= 0) { return; } var min = roomBlueprintIfAny?.OptionalActorsMin ?? 1; if (min > max) { throw new ArgumentOutOfRangeException($"OptionalActorsMin should be lower than OptionalActorsMax for room blueprint '{roomBlueprintIfAny}'"); } int numberOfNpc = world.R.Next(min, max + 1); var pickFrom = Blueprints.Where(b => b.SuitsFaction(faction)).ToList(); if (roomBlueprintIfAny != null) { pickFrom = pickFrom.Union(roomBlueprintIfAny.OptionalActors).ToList(); } if (pickFrom.Any()) { for (int i = 0; i < numberOfNpc; i++) { Create(world, room, faction, pickFrom.GetRandom(world.R), roomBlueprintIfAny); } } }
public override void Draw(SpriteBatch g) { g.Draw(sprBackground, new Vector2(0, 0), Color.White); if (Stage == 0) { g.Draw(sprRectangle, new Rectangle(320, 40, 320, 440), Color.FromNonPremultiplied(255, 255, 255, 100)); } else if (Stage == 1) { g.Draw(sprRectangle, new Rectangle(0, 297, 320, 183), Color.FromNonPremultiplied(255, 255, 255, 200)); } //Draw the item list with its filters and get the lowest Y position. int Index = 0; int Y = DrawFilter(g, MainFilter, 305, 41, ref Index); g.DrawString(fntArial10, "Requirements:", new Vector2(10, 315), Color.White); //Item description if (CursorFilter.CursorIndex >= 0 && CursorFilter.CursorIndex < CursorFilter.ListItem.Count) { g.DrawString(fntArial10, CursorFilter.ListItem[CursorFilter.CursorIndex].Name, new Vector2(10, 45), Color.White); g.DrawString(fntArial10, '"' + CursorFilter.ListItem[CursorFilter.CursorIndex].Name + '"' + " Blueprint", new Vector2(50, 330), Color.White); Blueprints Item = (Blueprints)CursorFilter.ListItem[CursorFilter.CursorIndex]; for (int i = 0; i < Item.ListRequirement.Count; i++) { } } }
public ICollectionView FilterView(Kind kind, ICollectionView view) { view.Filter = o => { var entry = ((KeyValuePair <string, Entry>)o).Value; return(entry.Data.Kind == kind && (ShowZeroes || entry.Count > 0) && (!ShowOnlyForFavorites || favoritedBlueprints.Any(b => b.Ingredients.Any(i => i.Entry == entry)))); }; PropertyChanged += (o, e) => { if (e.PropertyName == nameof(ShowZeroes) || e.PropertyName == nameof(ShowOnlyForFavorites)) { view.Refresh(); } }; Blueprints.ForEach(b => b.PropertyChanged += (o, e) => { if (ShowOnlyForFavorites && e.PropertyName == "Favorite") { Application.Current.Dispatcher.Invoke(view.Refresh); } }); return(view); }
private void LoadGame() { Time.timeScale = 1; // restarts the game // clear existing room blueprints Blueprints.ClearAll(); SceneManager.LoadScene("Loading"); }
private static void Main() { Stopwatch stopwatch = Stopwatch.StartNew(); // Setting a standard format for the generated files Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); // Create tables from database Database.CreateTables(); Console.WriteLine(); // Generate datafiles Properties.GenerateDatafile(); Skills.GenerateDatafile(); Certificates.GenerateDatafile(); Masteries.GenerateDatafile(); Geography.GenerateDatafile(); Blueprints.GenerateDatafile(); Items.GenerateDatafile(); // Requires GenerateProperties() Reprocessing.GenerateDatafile(); // Requires GenerateItems() // Generate MD5 Sums file Util.CreateMD5SumsFile("MD5Sums.txt"); // Generate support xml files Flags.GenerateXmlfile(); Console.WriteLine(@"Generating files completed in {0:g}", stopwatch.Elapsed); Console.WriteLine(); Console.Write(@"Press any key to exit."); Console.ReadKey(true); }
private void InitData() { var cloudshareAccount = new CloudshareAccount { ApiId = ConfigurationManager.AppSettings["ApiId"], ApiKey = ConfigurationManager.AppSettings["ApiKey"], ServerUrl = ConfigurationManager.AppSettings["ServerUrl"] }; this.client = new CloudshareAPIWrapper.CloudshareClient(cloudshareAccount); this.environmentStates = this.client.GetAllAvailableBlueprints(); this.cloudFoldersInfo = this.client.GetCloudFoldersInfo(); var env = client.GetEnvironmentsList(); _blueprints = (from data in this.environmentStates.data from blueprint in data.Blueprints orderby blueprint.Name select blueprint.Name).Distinct().ToList(); _snapshots = (from data in this.environmentStates.data from blueprint in data.Blueprints from snapshot in blueprint.Snapshots where blueprint.Name == this.BlueprintsComboBox.SelectedItem orderby snapshot.Name select snapshot.Name).ToList(); _aliveEnvironments = (from data in env.data where data.status_code == 0 && data.owner == tbOwner.Text select data.name).Distinct().ToList(); }
public ICollectionView FilterView(MainWindowViewModel parentViewModel, Kind kind, CollectionViewSource source) { source.Filter += (o, e) => { var entry = ((KeyValuePair<string, Entry>)e.Item).Value; e.Accepted = entry.Data.Kind == kind && (parentViewModel.ShowZeroes || entry.Count > 0) && (!parentViewModel.ShowOnlyForFavorites || favoritedBlueprints.Any(b => b.Ingredients.Any(i => i.Entry == entry))); }; parentViewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(parentViewModel.ShowZeroes) || e.PropertyName == nameof(parentViewModel.ShowOnlyForFavorites)) { source.View.Refresh(); } }; Blueprints.ForEach(b => b.PropertyChanged += (o, e) => { if (parentViewModel.ShowOnlyForFavorites && e.PropertyName == "Favorite") { Application.Current.Dispatcher.Invoke(source.View.Refresh); } }); return source.View; }
private void BlueprintButtons_Click(object sender, EventArgs e) { sbyte[] ButtonData = (sbyte[])((Button)sender).Tag; switch (ButtonData[0]) { case 0: Rotation += ButtonData[1]; if (Rotation == -1) { Rotation = 3; } if (Rotation == 4) { Rotation = 0; } break; case 1: int BlueprintCount = Blueprints.GetLength(0); SelectedBlueprint += ButtonData[1]; if (SelectedBlueprint == -1) { SelectedBlueprint = BlueprintCount - 1; } if (SelectedBlueprint == BlueprintCount) { SelectedBlueprint = 0; } break; } clearSprites(); MakeBlueprint(SelectedBlueprint, Rotation); }
public CommanderViewModel(string commanderName, List <string> logs, Languages languages) { CommanderName = commanderName; var entryDatas = JsonConvert.DeserializeObject <List <EntryData> >(IOUtils.GetEntryDatasJson()); var converter = new ItemNameConverter(entryDatas); State = new State(entryDatas, languages); journalEntryConverter = new JournalEntryConverter(converter, State.Cargo, languages); blueprintConverter = new BlueprintConverter(State.Cargo); LoadBlueprints(); languages.PropertyChanged += (o, e) => OnPropertyChanged(nameof(Filters)); LoadState(logs); var datas = State.Cargo.Select(c => c.Value.Data); var ingredientUsed = Blueprints.SelectMany(blueprint => blueprint.Ingredients); var ingredientUsedNames = ingredientUsed.Select(ingredient => ingredient.Entry.Data.Name).Distinct(); var unusedIngredients = datas.Where(data => !ingredientUsedNames.Contains(data.Name)); foreach (var data in unusedIngredients) { data.Unused = true; } }
private void LoadGame() { // clear existing room blueprints Blueprints.ClearAll(); // during the loading scene, the config files will be read. SceneManager.LoadScene("Loading"); }
private void BlueprintsTargetUpdated(object sender, DataTransferEventArgs e) { BlueprintNameColumn.Width = 0; BlueprintProgressColumn.Width = 0; Blueprints.UpdateLayout(); BlueprintNameColumn.Width = new DataGridLength(1, DataGridLengthUnitType.Auto); BlueprintProgressColumn.Width = new DataGridLength(1, DataGridLengthUnitType.Auto); }
private void addRoom(IRoom room) { displayMessage("Located " + room.GetName()); if (Blueprints.AddRoom(room)) { GameConstants.TotalTreasures += room.GetItemCount(); GameConstants.TotalCreatures += room.GetCreatureCount(); } }
private void NewGame() { // delete any previously saved game Blueprints.ClearAll(); gameState.DeleteAll(); gameState.Save(); ChooseDifficulty(); }
public ArkItemTypeGroup(ArkItem[] all) { All = all ?? new ArkItem[] { }; _items = new Lazy <ArkItem[]>(() => All.Where(x => !x.IsBlueprint).ToArray()); _blueprints = new Lazy <ArkItem[]>(() => All.Where(x => x.IsBlueprint).ToArray()); _countItems = new Lazy <int>(() => Items.Any() ? (int)Items.Sum(x => x.Quantity) : 0); _countBlueprints = new Lazy <int>(() => Blueprints.Any() ? (int)Blueprints.Sum(x => x.Quantity) : 0); _count = new Lazy <int>(() => CountItems + CountBlueprints); }
public NewProductionBatchViewModel(Services.EveProfiteerRepository eveProfiteerRepository) { _eveProfiteerRepository = eveProfiteerRepository; DisplayName = "New production batch"; ProductionDate = DateTime.UtcNow; Blueprints = _eveProfiteerRepository.GetBlueprints().AsNoTracking().ToList(); PropertyChanged += OnPropertyChanged; Blueprint = Blueprints.First(); _dataErrorInfoHelper = new DataErrorInfoHelper(this); Runs = 1; }
public IRoom Create(IWorld world, Point3 location) { var exact = Blueprints.FirstOrDefault(b => Equals(location, b.FixedLocation)); if (exact != null) { return(Create(world, exact)); } return(Create(world)); }
/// <summary>Returns the type ID of the product made from the blueprint</summary> /// <param name="blueprintTypeId">The type ID of the blueprint</param> /// <returns>An integer representing the typeID of the product</returns> public static int GetTypeId(int blueprintTypeId) { Blueprint item; if (Blueprints.TryGetValue(blueprintTypeId, out item)) { return(item.ProductId); } return(-1); }
protected virtual T1 GetBlueprint(string name) { //if the user passed a string that was actually a Guid if (Guid.TryParse(name, out Guid g)) { return(GetBlueprint(g)); } return(Blueprints.FirstOrDefault(b => b.Is(name)) ?? throw new NamedObjectNotFoundException($"Could not find {typeof(T1).Name} Named {name}", name)); }
public void HideElements() { foreach (GameObject item in OptionsTable.GetChildren()) { if (!Blueprints.Contains(item)) { UIWidget widget = item.GetOrAddComponent <UIWidget>(); widget.alpha = 0; } } }
/// <summary> /// Player has entered the next room; get ready for a new roomState /// </summary> public void NextRoom(string nextRoom, string prevRoom, bool playDoorSound) { IRoom pRoom = Blueprints.GetRoom(prevRoom); pRoom.Visited = true; IRoom nRoom = Blueprints.GetRoom(nextRoom); nRoom.Visited = true; this.roomState = string.Empty; Logger.Log("UPDATED GAME STATE: " + Dump()); }
// Use this for initialization void Start() { //Debug.Log("RoomBuilder Start"); gameState = Camera.main.GetComponent <GameState>(); gameState.Load(); Logger.Log("NEW GAME: " + gameState.Dump()); if (Overrides.Enabled) { START_ROOM = Overrides.InitialRoom; START_POSITION = Overrides.StartPosition; } Blueprints.ResetRooms(gameState); if (!gameState.CurrentRoom.Equals(GameConstants.GAMEOVER)) { Vector3 startPosition = START_POSITION; if (gameState.HasSavedState) { currentRoom = Blueprints.GetRoom(gameState.CurrentRoom); startPosition = gameState.CurrentPosition; } else { currentRoom = Blueprints.GetRoom(START_ROOM); } if (currentRoom != null) { currentRoom.Visited = true; } // build the first room BuildRoom(currentRoom, startPosition); // initialize the screen boundaries ScreenUtils.Initialize(); // start room music //PlayMusic(); // Listen for when we need to build a new room EventManager.AddNextRoomListener(buildNextRoom); } else { isGameOver = true; } this.gameOverEvent = new GameOverEvent(); EventManager.AddGameOverInvoker(this); }
internal static Menu PrepareMenu(ModToggleDelegates toggleDelegates) { return(new Menu("Custom Knight", new Element[] { Blueprints.CreateToggle(toggleDelegates, "Custom Skins", "", "Enabled", "Disabled"), new HorizontalOption( "Swapper", "Apply skin to bosses, enemies & areas", new string[] { "Disabled", "Enabled" }, (setting) => { CustomKnight.toggleSwap(setting == 1); }, () => CustomKnight.swapManager.enabled ? 1 : 0, Id: "SwapperEnabled"), new HorizontalOption( "Select Skin", "The skin will be used for current save and any new saves.", getSkinNameArray(), (setting) => { selectedSkin = setting; }, () => selectedSkin, Id: "SelectSkinOption"), new MenuButton("PreloadButton", "Will Preload objects for modifying events", (_) => TogglePreloads(), Id: "PreloadButton"), new MenuRow( new List <Element> { Blueprints.NavigateToMenu("Skin List", "Opens a list of Skins", () => SkinsList.GetMenu(MenuRef.menuScreen)), new MenuButton("Apply Skin", "Apply The currently selected skin.", (_) => ApplySkin()), }, Id: "ApplyButtonGroup" ) { XDelta = 400f }, new TextPanel("To Add more skins, copy the skins into your Skins folder."), new MenuRow( new List <Element> { new MenuButton("Open Folder", "Open skins folder", (_) => OpenSkins()), new MenuButton("Fix / Reload", "Fix skin structure and reload", (_) => FixSkins()), new MenuButton("Need Help?", "Join the HK Modding Discord", (_) => OpenLink("https://discord.gg/J4SV6NFxAA")), }, Id: "HelpButtonGroup" ) { XDelta = 425f }, new MenuRow( new List <Element> { new MenuButton("Dump", "Dumps the sprites that Swapper supports (Expect lag)", (_) => ToggleDumping(), Id: "DumpButton"), //new MenuButton("Generate Cache","Generates Cache for Everything (Can take hours)",(_)=>DumpAll(),Id:"DumpAllButton"), //new MenuButton("Need Help?","Join the HK Modding Discord",(_)=>OpenLink("https://discord.gg/J4SV6NFxAA")), }, Id: "AdditonalButtonGroup" ) { XDelta = 425f }, })); }
public static Entity CreateEntity(this Pool pool, Blueprints.IBlueprint blueprint) { var entity = pool.CreateEntity(); foreach (var componentTypeName in blueprint.ComponentTypes) { var componentId = ComponentNameToId[componentTypeName]; switch (componentId) { case ComponentIds.Movable: entity.IsMovable(true); break; case ComponentIds.Position: entity.AddPosition(blueprint.PropertyValues); break; case ComponentIds.Destroy: entity.IsDestroy(true); break; case ComponentIds.GameBoardCache: entity.AddGameBoardCache(blueprint.PropertyValues); break; case ComponentIds.GameBoard: entity.AddGameBoard(blueprint.PropertyValues); break; case ComponentIds.GameBoardElement: entity.IsGameBoardElement(true); break; case ComponentIds.Input: entity.AddInput(blueprint.PropertyValues); break; case ComponentIds.Interactive: entity.IsInteractive(true); break; case ComponentIds.Resource: entity.AddResource(blueprint.PropertyValues); break; case ComponentIds.View: entity.AddView(blueprint.PropertyValues); break; case ComponentIds.Score: entity.AddScore(blueprint.PropertyValues); break; case ComponentIds.ScoreValue: entity.AddScoreValue(blueprint.PropertyValues); break; } } return entity; }
/// <summary> /// If user has left previous room; need to load the next room /// </summary> private void buildNextRoom(string nextRoom, string prevRoom, bool playDoorSound) { IRoom room = Blueprints.GetRoom(nextRoom); if (playDoorSound) { //Debug.Log(prevRoom + " > " + nextRoom); if ((prevRoom.Equals("TheFilingCabinet") && nextRoom.Equals("TheResultOfTheQuirkafleeg")) || (prevRoom.Equals("TheResultOfTheQuirkafleeg") && nextRoom.Equals("TheFilingCabinet"))) { //Debug.Log("play portal sound"); AudioManager.Instance.PlayOneShot(AudioClipName.Portal); } else { //Debug.Log("play door sound"); AudioManager.Instance.PlayOneShot(AudioClipName.Door); } } // if a room is not found, return to the prevRoom if (room == null) { // get previous room room = Blueprints.GetRoom(prevRoom); // so what was the next room becomes the previous room prevRoom = nextRoom; // get id of the room we are returning to nextRoom = room.GetID(); } if (room != null) { Vector3 startPosition = room.GetStartPosition(prevRoom); Logger.Log("ENTERING " + nextRoom + " FROM " + prevRoom); room.Visited = true; gameState.CurrentRoom = room.GetID(); gameState.CurrentPosition = startPosition; Logger.Log("SAVING STATE: " + gameState.Dump(), LogType.TO_DEBUG_ONLY); gameState.Save(); Logger.Log("SAVED STATE: " + gameState.Dump(), LogType.TO_DEBUG_ONLY); BuildRoom(room, startPosition); } else { SceneManager.LoadScene(GameConstants.MAINMENU); } }
/// <summary> /// Creates a new factory for turning <see cref="ActionBlueprint"/> into <see cref="IAction"/> instances /// </summary> public ActionFactory() { _types = Compiler.Instance.TypeFactory.Create <IAction>(); //add the basic Type blueprints foreach (var type in _types) { Blueprints.Add(new ActionBlueprint() { Name = type.Name.Replace("Action", ""), Type = type.Name }); } }
private void ShowFinalScore() { int itemsCollected = GameConstants.TotalTreasures; int creaturesKilled = GameConstants.TotalCreatures; DateTime inGameTime = DateTime.Now; bool bedReached = true; GameState gameState = Camera.main.GetComponent <GameState>(); if (gameState.DifficultyMultiplier == GameConstants.EasyDifficulty) { GameObject.FindGameObjectWithTag("Background").GetComponent <Image>().color = Color.gray; } else if (gameState.DifficultyMultiplier == GameConstants.MediumDifficulty) { GameObject.FindGameObjectWithTag("Background").GetComponent <Image>().color = Color.red; } // else, as defined in Inspector itemsCollected = gameState.ItemsCollected; creaturesKilled = gameState.CreaturesKilled; inGameTime = gameState.InGameTime; bedReached = gameState.BedReached; if (itemsCollected >= GameConstants.TotalTreasures && bedReached) { AudioManager.Instance.PlayOneShot(AudioClipName.GameWon, 0.3f); Text finalStateText = GameObject.FindGameObjectWithTag(GameConstants.FINALSTATETEXT).GetComponent <Text>(); finalStateText.text = "Sleep at last.\nSweet dreams."; } else { AudioManager.Instance.PlayOneShot(AudioClipName.GameLost); Text finalStateText = GameObject.FindGameObjectWithTag(GameConstants.FINALSTATETEXT).GetComponent <Text>(); finalStateText.text = "YOU DIED!\nAh well, at least you are finally getting some rest."; Blueprints.ClearAll(); gameState.DeleteAll(); gameState.Save(); } Text gameOverText = GameObject.FindGameObjectWithTag(GameConstants.FINALSCORETEXT).GetComponent <Text>(); gameOverText.text = "You collected " + itemsCollected + " of " + GameConstants.TotalTreasures + " treasures.\n" + "You killed " + creaturesKilled + " of " + GameConstants.TotalCreatures + " creatures.\n" + "Task completed at: " + inGameTime.ToString("hh:mmtt", CultureInfo.InvariantCulture).ToLower(); }
private void OnTriggerExit2D(Collider2D collision) { // if player exits the door, let the RoomBuilder know to build // the next room if (collision.gameObject.CompareTag(GameConstants.PLAYER)) { // if there is no next room, show the "under construction" message if (nextRoom.Equals(currentRoom) || Blueprints.GetRoom(nextRoom) == null) { ShowMissingRoomMessage(); } this.nextRoomEvent.Invoke(nextRoom, currentRoom, playSound); } }
private void OnServerInitialized() { blueprintDefinitions = ItemManager.bpList; foreach (var bp in blueprintDefinitions) { Blueprints.Add(bp.targetItem.shortname, bp.time); } itemDefinitions = ItemManager.itemList; foreach (var itemdef in itemDefinitions) { Items.Add(itemdef.displayName.english); } UpdateCraftingRate(); }
internal static Menu PrepareMenu() => new Menu("EnemyHPBar", new Element[] { new HorizontalOption( "Select Skin", "The skin will be used for current", GetSkinNameArray(), (setting) => { selectedSkin = setting; }, () => selectedSkin, Id: "SelectSkinOption"), new MenuRow( new List <Element> { Blueprints.NavigateToMenu("Skin List", "Opens a list of Skins", () => HPBarList.GetMenu(MenuRef.menuScreen)), new MenuButton("Apply Skin", "Apply The currently selected skin.", _ => ApplySkin()), }, Id: "ApplyButtonGroup" ) { XDelta = 400f }, });
static Game() { rng = new System.Random(); Data.Awake(); CalcHandPoolSize(); UnityEngine.Object.Destroy(GameObject.Find("Tile")); UnityEngine.Object.Destroy(GameObject.Find("Storage")); board = GameObject.Find("PlayArea").GetComponent <Board>(); mainCanvas = GameObject.Find("Main Canvas").GetComponent <Canvas>(); cursor = GameObject.Find("Hand").GetComponent <Tile>(); blueprints = GameObject.Find("CodexContainer").GetComponent <Blueprints>(); mouseover = null; cursor.transform.localScale = new Vector3(0.75f, 0.75f, 1); settings = new Settings(); PlaySound("Startup"); }
private void Load() { using (var r = _blueprintsRepos()) { _blueprints = new Blueprints(r.GetAll().OrderBy(b=>b.Name).ToList()); BPList.ItemsSource = _blueprints; _toRemove.Clear(); } }