public OracleRoller(IServiceProvider services, GameName game, Random rnd = null) { OracleService = services.GetRequiredService <OracleService>(); Game = game; RollerRandom = rnd ?? BotRandom.Instance; }
//В конструкторе инициализируется колода для заданной игры //и устанавливается козырная масть public CardsPack(GameName game, SuitName trump) { if (game == GameName.FOOL) { for (int suit = 0; suit <= 3; suit++) { for (int card = 0; card <= 8; card++) { pack.Add(new Card((CardName)card, (SuitName)suit, ((SuitName)suit == trump ? true : false))); } } } if (game == GameName.DEBERTZ) { for (int suit = 0; suit <= 3; suit++) { for (int card = 1; card <= 8; card++) { pack.Add(new DebertzGameCard((CardName)card, (SuitName)suit, ((SuitName)suit == trump ? true : false))); } } } }
internal static void Setup(AppDomain domain) { GameDeveloper = string.Copy(Internal_GetGameDeveloper()); GameName = string.Copy(Internal_GetGameName()); HashCode = string.Copy(Internal_GetHashCode()); CurrentGameAttribute = new MelonGameAttribute(GameDeveloper, GameName); BaseDirectory = string.Copy(Internal_GetBaseDirectory()); GameDirectory = string.Copy(Internal_GetGameDirectory()); SetCurrentDomainBaseDirectory(GameDirectory, domain); UserDataDirectory = Path.Combine(BaseDirectory, "UserData"); if (!Directory.Exists(UserDataDirectory)) { Directory.CreateDirectory(UserDataDirectory); } UserLibsDirectory = Path.Combine(BaseDirectory, "UserLibs"); if (!Directory.Exists(UserLibsDirectory)) { Directory.CreateDirectory(UserLibsDirectory); } IsBONEWORKS = (!string.IsNullOrEmpty(GameDeveloper) && GameDeveloper.Equals("Stress Level Zero") && !string.IsNullOrEmpty(GameName) && GameName.Equals("BONEWORKS")); Main.IsBoneworks = IsBONEWORKS; IsDemeo = (!string.IsNullOrEmpty(GameDeveloper) && GameDeveloper.Equals("Resolution Games") && !string.IsNullOrEmpty(GameName) && GameName.Equals("Demeo")); }
public void SetGameName(List <string> gamenames) { foreach (string name in gamenames) { Game = (GameName)Enum.Parse(typeof(GameName), name); } }
public async Task SetDefaultGame(GameName game) { using var db = new DiscordChannelContext(); var existingSettings = await db.ChannelSettings.FirstOrDefaultAsync(cs => cs.ChannelID == Context.Channel.Id); if (existingSettings != null) { existingSettings.DefaultGame = game; await db.SaveChangesAsync().ConfigureAwait(false); await Context.Message.AddReactionAsync(new Emoji("🆗")).ConfigureAwait(false); return; } else { ChannelSettings cs = new ChannelSettings { ChannelID = Context.Channel.Id, DefaultGame = game }; db.ChannelSettings.Add(cs); await db.SaveChangesAsync().ConfigureAwait(false); await Context.Message.AddReactionAsync(new Emoji("🆗")).ConfigureAwait(false); } }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (SharedDataDir.Length != 0) { hash ^= SharedDataDir.GetHashCode(); } if (GameName.Length != 0) { hash ^= GameName.GetHashCode(); } hash ^= targets_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public OracleRoller(OracleService oracleService, GameName game, Random rnd = null) { OracleService = oracleService; Game = game; RollerRandom = rnd ?? BotRandom.Instance; }
/// <summary> /// Generates and returns a new game board. /// </summary> /// <returns></returns> public bool[][] GetNewGame() { currentGame = new GameName(); currentBoard = new bool[nrRows][]; Random random = new Random(); for (int i = 0; i < nrRows; i++) { currentBoard[i] = new bool[nrColumns]; for (int j = 0; j < nrColumns; j++) { // Generate a random number to determine whether a cell will be alive or not at the beginning of the game // Odd numbers are alive, even are not int nr = random.Next(0, 2); if (nr % 2 == 0) { currentBoard[i][j] = false; } else { currentBoard[i][j] = true; } } } Generation gen = new Generation { Board = currentBoard, Game = currentGame }; currentGame.generations.Add(gen); return(currentBoard); }
public async Task OracleRollCommand([Remainder] string TableNameAndOptionalGame) { ChannelSettings channelSettings = await ChannelSettings.GetChannelSettingsAsync(Context.Channel.Id); GameName game = Utilities.GetGameContainedInString(TableNameAndOptionalGame); string oracleTable = Utilities.RemoveGameNamesFromString(TableNameAndOptionalGame); if (game == GameName.None && channelSettings != null) { game = channelSettings.DefaultGame; } OracleRoller roller = new OracleRoller(Services, game); try { var msg = await ReplyAsync("", false, roller.BuildRollResults(oracleTable).GetEmbed()); if (roller.RollResultList.Count == 1 && roller.RollResultList[0].ParentTable.Pair?.Length > 0) { await msg.AddReactionAsync(new Emoji("\uD83E\uDDE6")); } } catch (ArgumentException ex) { Console.WriteLine($"{Context.User} triggered an ArgumentException: {ex.Message}"); await ReplyAsync(ex.Message); } }
private void SetUpImgForCategory(GameName _game, string _categoryKey) { gameName = _game; categoryKey = _categoryKey; var categoryData = categoryStorage.Categories[_categoryKey]; Sprite sprite = null; NativeGallery.GetImageFromGallery((path) => { if (path != null) { Texture2D texture = NativeGallery.LoadImageAtPath(path, -1, false); var size = (texture.width < texture.height) ? texture.width : texture.height; sprite = Sprite.Create(texture, new Rect(0, 0, size, size), Vector2.zero); if (categoryData.IsCustom) { UpdateCategoryImage(_categoryKey, sprite); } else { SetUpImgToBaseCategory(_game, _categoryKey, sprite); } } }); }
public void Initialize(string _categoryKey, CategoryData _data) { game = (GameName)_data.game; categoryKey = _categoryKey; img.sprite = _data.img; title.text = _data.title; }
public CategoryData GetData(GameName _game, string _categoryKey) { CategoryData data = new CategoryData(); switch (_game) { case GameName.Variant: data = VariantCategories[_categoryKey]; break; case GameName.Buttons: data = ButtonsCategories[_categoryKey]; break; case GameName.WordBook: data = WordBookCategories[_categoryKey]; break; case GameName.WordComposing: data = WordComposingCategories[_categoryKey]; break; default: break; } return(data); }
//METHODS private bool ValidateGameName() { if (GameName.ToUpper().Equals("BASTION")) { return(true); } return(false); }
public Tournament(int id, string name, GameName game, DateTime startdate, string description, User admin) { this.ID = id; this.Name = name; this.Game = game; this.StartDate = startdate; this.description = description; }
// Start is called before the first frame update void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; BlackScreen.SetActive(false); GameName.SetActive(false); }
/// <summary> /// Saves a game and all related generations /// </summary> /// <param name="game"></param> public void SaveGame(GameName game) { using (GameContext context = new GameContext()) { context.GameNames.Add(game); context.SaveChanges(); } }
public INpcGenerator GetNPCGenerator(GameName game) { if (game == GameName.Starforged) { return(new StarforgedNPC(serviceProvider)); } return(new IronNPC(serviceProvider)); }
// Use this for initialization void Start() { _components = new Component[_PLAYER_MAX]; if (_debug) { gameName = _initGameName; } }
public ActiveGameData() { const GameName game = Enums.GameName.None; GameName = game.ToString(); GameDescription = GameList.GetGameDescription(game); GameIcon = GameList.GetGameIcon(game); GameCustomControl = GameList.GetGameControls(game); }
public void Serialize(BitWriter bw) { string.Join(",", Mutators).Serialize(bw); bw.Write(Unknown1); bw.Write(Unknown2); GameName.Serialize(bw); Password.Serialize(bw); bw.Write(Unknown3); }
IEnumerator ShowGameNameWhenNecessary() { yield return(new WaitForSeconds(50.0f)); VHS.Stop(); ELEKTRICITY.Stop(); BlackScreen.SetActive(true); GameName.SetActive(true); }
public override int GetHashCode() { unchecked { var hashCode = Name?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (KeyboardSlug?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (GameName?.GetHashCode() ?? 0); return(hashCode); } }
private void SetStartButton(GameName gameName) { if (gameName == GameName.None || gameName == GameName.Template) { ToggleGameButton.IsEnabled = false; return; } ToggleGameButton.IsEnabled = true; }
public IEnumerator WHEN_GameNameSet_THEN_GameNameGetFunctionWorks() { testSubscoreStorage = new SubscoreStorage(); testSubscoreStorage.GameName = GameName.SQUARES; GameName expectedGameName = GameName.SQUARES; yield return(null); Assert.AreEqual(expectedGameName, testSubscoreStorage.GameName); }
public override void Initialize(GameName _game, string _categoryKey, string _cardKey, CardData _data) { game = _game; categoryKey = _categoryKey; if (title == null) { return; } title.text = "Add new card"; }
public void SelectAddMethod(GameName _game) { gameName = _game; createPanel = createCategoryPanel; libraryPanel = categoryLibrary; currentAddedObj = AddedObj.Category; categoryLibraryControl.FillLibrary(_game); transitionController.ActivatePanel(categoryMethodSelectorPanel); StartSelectMethodRoutine(); Signals.SelectCreateMethodCategory.Invoke(); }
public void SelectAddMethod(GameName game, string _categoryKey) { Debug.Log("save game and category"); gameName = game; categoryKey = _categoryKey; createPanel = createCardPanel; libraryPanel = cardLibrary; currentAddedObj = AddedObj.Card; transitionController.ActivatePanel(cardMethodSelectorPanel); StartSelectMethodRoutine(); Signals.SelectCreateMethodCard.Invoke(); }
/// <summary> /// Sets the current game and game board in the gameLogicInstance to the parameter gameToLoad /// </summary> /// <param name="gameToLoad"></param> public void SetLoadedGame(GameName gameToLoad) { gameLogicInstance.SetLoadedGame(gameToLoad); nrLoadedGens = gameToLoad.generations.Count; nrPlayedGens = 0; gameRunning = true; GridView.Visible = true; currentBoard = gameLogicInstance.UpdateCurrentBoard(); ConvertArrayTo2D(); updateGameBoard(); }
public override void Initialize(GameName _game, string _categoryKey, string cardKey, CardData _data) { Key = cardKey; rect = GetComponent <RectTransform>(); image.sprite = _data.img1; selectBtn.onClick.AddListener(Active); if (_data.audioClip1 != null) { clip = _data.audioClip1; } }
public virtual void Initialize(GameName _game, string _categoryKey, string cardKey, CardData data) { editableElement = GetComponent <EditableElement>(); ConfigurateUI(data); categoryKey = _categoryKey; Key = cardKey; if (data.audioClip1 != null) { Clip = data.audioClip1; } BindBtns(data); }
public void AddTask() { //if (TaskCount < MaxTasks) { int requiredWork = (int)random.NextFloat(1000, 2000); if (!bAreGameNamesExhausted) { GameName name = new GameName(); //do int i; do { i = random.Next(GameNames.Count); name = GameNames[i]; if (name.Used) { //if (ExhaustedNames.Contains(name)) ExhaustedNames.Add(name); } else { break; } } while (true); //if (name.Used) if (ExhaustedNames.Count >= GameNames.Count) bAreGameNamesExhausted = true; name.Used = true; GameNames[i] = name; Tasks.Add(new Task(requiredWork, name.Name, this)); //Hypeometer.Instance.AddHype(requiredWork); } else { int i = random.Next(NumericalGameNames.Count); NumericalGameName name = NumericalGameNames[i]; Tasks.Add(new Task(requiredWork, name.Name + " " + name.Number, this)); name.Number++; NumericalGameNames[i] = name; } TaskCount++; } }