Esempio n. 1
0
 /// <summary>
 /// Get a list of synonyms for the given meme.
 /// </summary>
 /// <param name="meme">The meme for which to look for attached synonyms</param>
 /// <returns>A list of the Synonyms</returns>
 public List<Synonym> For(Meme meme)
 {
     return _client.Request("synonyms").
         AddParameter("opco", meme.Opco).
         AddParameter("definition", meme.Definition).
         AddParameter("slug", meme.Slug).
         MakeRequest<List<Synonym>>();
 }
Esempio n. 2
0
		protected void CreateMeme(object sender, EventArgs args)
		{
			const string HasEror = "has-error";

			bool memeValid = true;

			var titleFormGroupClasses = new HashSet<string>(this.TitleFormGroup.CssClass.Split(' '));

			var memeUrlFormGroupClasses = new HashSet<string>(this.MemeUrlFormGroup.CssClass.Split(' '));

			if (this.Title.Text.Length < ValidationConstants.MemeTitleMinLength || ValidationConstants.MemeTitleMaxLength < this.Title.Text.Length)
			{
				titleFormGroupClasses.Add(HasEror);
				memeValid = false;
			}
			else
			{
				titleFormGroupClasses.Remove(HasEror);
			}

			if (this.MemeUrl.Text == string.Empty || ValidationConstants.MemeImageUrlMaxLength < this.MemeUrl.Text.Length || 
				!AddMeme.ValidMemeUrlExtensions.Contains(Path.GetExtension(this.MemeUrl.Text)))
			{
				memeUrlFormGroupClasses.Add(HasEror);
				memeValid = false;
			}
			else
			{
				memeUrlFormGroupClasses.Remove(HasEror);
			}

			if (memeValid)
			{
				Meme meme = new Meme()
				{
					Title = this.Title.Text,
					ImageUrl = this.MemeUrl.Text,
					CreationDate = DateTime.Now,
					UserId = this.User.Identity.GetUserId()
				};

				this.dbContext.Memes.Add(meme);

				this.dbContext.SaveChanges();

				this.Response.Redirect("MemeDetails?id=" + meme.Id);
			}

			this.TitleFormGroup.CssClass = string.Join(" ", titleFormGroupClasses);
			this.MemeUrlFormGroup.CssClass = string.Join(" ", memeUrlFormGroupClasses);
		}
        protected int HasUserVoted(Meme Item)
        {
            var userID = this.User.Identity.GetUserId();
            var hasUserVoted = Item.Likes
                .Where(x => x.UserId == userID)
                .FirstOrDefault();

            if (hasUserVoted == null)
            {
                return -1;
            }

            return 1;
        }
Esempio n. 4
0
        public IActionResult Index(int id)
        {
            Meme meme = new Meme();

            try
            {
                meme.pageIndex = id;
                var memesCount = _context.Meme.Count <Meme>();
                if ((id + 1) * 10 < memesCount)
                {
                    meme.nextPageExists = true;
                }
                int i;
                if (memesCount % 10 == 0)
                {
                    i = 0;
                }
                else
                {
                    i = 1;                                              //Troche kombinacji z racji tego, że memy zapisywane są w kolejce FIFO, a ściągać
                }
                meme.lastPage = (memesCount / 10) + i;                  //musimy je jako LIFO, obliczenia to jedynie wyznaczenie indeksów odkąd zaczać pobieranie
                int j    = memesCount - (meme.pageIndex * 10) - 10;     //nie są to skomplikowane obliczenia, więc nie ma to wpływu na szybkość pobierania memów z serwera
                int take = j >= 0 ? 10 : 10 + j;
                j = take < 10 ? 0 : j;
                var list = _context.Meme.Skip(j).Take((take));
                meme.displayMemes = list.ToList <Meme>();
                meme.displayMemes.Reverse();            //Odwracamy, bo elementy pobrały sie prawidłowo od końca, ale nadal ostatni dodany jest ostatni a ma być pierwszy
            }
            catch
            {
                meme.displayMemes = new List <Meme>();
            }

            return(View(meme));
        }
        public (string path, MemeCreatorStatus status) CreateMeme(Meme m, string upper, string lower)
        {
            string inPath  = Path + "\\Meme.in";
            string outPath = Path + "\\Meme.jpg";

            if (AllowedExtensions != null && !AllowedExtensions.Any(x => m.URL.EndsWith(x)))
            {
                return(null, MemeCreatorStatus.InvalidExtension);
            }

            MemeCreatorStatus status = MemeCreatorStatus.Other;

            using (var wc = new WebClient())
            {
                using (var st = wc.OpenRead(m.URL))
                {
                    Bitmap bm = new Bitmap(st);
                    if (bm != null)
                    {
                        bm.Save(inPath, System.Drawing.Imaging.ImageFormat.Jpeg);
                    }
                    else
                    {
                        status = MemeCreatorStatus.FileNotAvaiable;
                    }
                }
            }

            if (status == MemeCreatorStatus.FileNotAvaiable)
            {
                return(null, status);
            }

            MemeBuilder.Build(inPath, outPath, upper, lower);
            return(outPath, MemeCreatorStatus.Success);
        }
Esempio n. 6
0
 public static string SuccessfullyRemoved(Meme meme)
 {
     return(SuccessfullyRemoved("meme"));
 }
Esempio n. 7
0
 public void AddMeme(Meme meme)
 {
     Context.Memes.Add(meme);
     SaveChanges();
 }
 public void Add(Meme meme)
 {
     db.Memes.Add(meme);
     db.SaveChanges();
 }
Esempio n. 9
0
 public async Task CreateMemeAsync(Meme meme)
 {
     _memeRepository.AddMeme(meme);
     await _memeRepository.SaveAsync();
 }
Esempio n. 10
0
        /// <summary>
        /// Returns a Enumarable from an excel in the assets folder
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static List <Meme> GetExcelFile(string playList)
        {
            int    cutPoint = "https://www.youtube.com/watch?v=".Length;
            string filePath = GetFilePath(playList);

            if (filePath == null)
            {
                return(null);
            }

            var fileLocation = string.Format("{0}\\..\\MemeFlix\\assets\\{1}", Directory.GetCurrentDirectory(), filePath);

            IWorkbook workbook;

            using (FileStream stream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read))
            {
                workbook = new HSSFWorkbook(stream);
            }

            ISheet    sheet = workbook.GetSheetAt(0); // zero-based index of your target sheet
            DataTable dt    = new DataTable(sheet.SheetName);

            // write header row
            IRow headerRow = sheet.GetRow(0);

            foreach (ICell headerCell in headerRow)
            {
                dt.Columns.Add(headerCell.ToString());
            }

            // write the rest
            int rowIndex = 0;

            foreach (IRow row in sheet)
            {
                // skip header row
                if (rowIndex++ == 0)
                {
                    continue;
                }
                DataRow dataRow = dt.NewRow();
                dataRow.ItemArray = row.Cells.Select(c => c.ToString()).ToArray();
                dt.Rows.Add(dataRow);
            }

            int rowCount = dt.Rows.Count;
            int colCount = dt.Columns.Count;

            List <Meme> MemeList = new List <Meme>();

            for (int row = 1; row < rowCount; row++)
            {
                if (row == 0)
                {
                    continue;
                }
                Meme meme = new Meme()
                {
                };
                for (int collumn = 1; collumn < colCount; collumn++)
                {
                    if (collumn == 1)
                    {
                        string value = GetValue(row, collumn);
                        if (value.Length > cutPoint)
                        {
                            meme.Url = GetValue(row, collumn).Remove(0, cutPoint);
                        }
                        else
                        {
                            meme.Url = "";
                        }
                    }
                    if (collumn == 3)
                    {
                        meme.Name = GetValue(row, collumn);
                    }
                }
                MemeList.Add(meme);
            }

            string GetValue(int row, int collumn)
            {
                var value = (string)dt.Rows[row][collumn];

                return(value);
            }

            return(MemeList);
        }
 public void POstMeme([FromBody] Meme meme)
 {
     memes.Add(meme);
 }
 private void _dataStorage_OnAddMeme(Meme meme)
 {
 }
Esempio n. 13
0
 private async Task ResumeAfterMemeSelectionClarification(IDialogContext context, IAwaitable <Meme> result)
 {
     _meme = await result;
     PromptDialog.Text(context, ResumeAfterTopTextClarification, "Awesome, I can work with that. What will the *top text* be?");
 }
        public async Task <IActionResult> CustomAddSecret([FromBody] Meme meme)
        {
            await memeHubContext.Clients.Group("secret").ReceiveMeme(meme);

            return(Ok());
        }
        public async Task <IActionResult> CustomAdd([FromBody] Meme meme)
        {
            await memeHubContext.Clients.All.ReceiveMeme(meme);

            return(Ok());
        }
Esempio n. 16
0
 public void UpdateMeme(Meme meme)
 {
     pictureBox2.Load(meme.url);
     pictureBox2.Tag = meme;
 }
 protected int GetDislikes(Meme item)
 {
     return(item.Likes.Where(x => x.Value == false)
            .ToList()
            .Count());
 }
 protected List <Comment> GetComments(Meme item)
 {
     return(item.Comments
            .OrderByDescending(x => x.CreationDate)
            .ToList());
 }
 protected List<Comment> GetComments(Meme item)
 {
     return item.Comments
         .OrderByDescending(x => x.CreationDate)
         .ToList();
 }
 protected int GetDislikes(Meme item)
 {
     return item.Likes.Where(x => x.Value == false)
         .ToList()
         .Count();
 }
Esempio n. 21
0
 public ActionResult <bool> Post([FromBody] Meme newMeme)
 {
     repo.Add(newMeme);
     return(true);
 }
Esempio n. 22
0
 protected override async Task ExecuteAsync(object parameter)
 {
     Meme meme = (Meme)parameter;
     await _dataStorage.RemoveMeme(meme);
 }
 private void _dataStorage_OnRemoveMeme(Meme meme)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
        public async Task AddAsync(Meme meme)
        {
            await _context.Memes.AddAsync(meme);

            await _context.SaveChangesAsync();
        }
Esempio n. 25
0
        private static void AddOldBotDataToNewDB(BotData oldBotData)
        {
            /* Macros */
            Console.WriteLine("Begin importing macros...");
            int macroCount = 0;

            foreach (KeyValuePair <string, string> macros in oldBotData.Macros)
            {
                Console.WriteLine($"Importing macro \"{macros.Key}\" to new data.");

                using (BotDBContext context = DatabaseManager.OpenContext())
                {
                    InputMacro newMacro = context.Macros.FirstOrDefault(m => m.MacroName == macros.Key);
                    if (newMacro == null)
                    {
                        newMacro = new InputMacro();
                        context.Macros.Add(newMacro);
                    }

                    newMacro.MacroName  = macros.Key;
                    newMacro.MacroValue = macros.Value;

                    context.SaveChanges();
                }

                macroCount++;
            }

            Console.WriteLine($"Completed importing {macroCount} macros!");

            /* Memes */
            Console.WriteLine("Begin importing memes...");
            int memeCount = 0;


            foreach (KeyValuePair <string, string> memes in oldBotData.Memes)
            {
                Console.WriteLine($"Importing meme \"{memes.Key}\" to new data.");

                using (BotDBContext context = DatabaseManager.OpenContext())
                {
                    Meme newMeme = context.Memes.FirstOrDefault(m => m.MemeName == memes.Key);
                    if (newMeme == null)
                    {
                        newMeme = new Meme();
                        context.Memes.Add(newMeme);
                    }

                    newMeme.MemeName  = memes.Key;
                    newMeme.MemeValue = memes.Value;

                    context.SaveChanges();
                }

                memeCount++;
            }

            Console.WriteLine($"Completed importing {memeCount} memes!");

            /* Users */
            Console.WriteLine("Begin importing user data...");
            int userCount = 0;

            //Migrate users
            foreach (KeyValuePair <string, TRBotDataMigrationTool.User> oldUser in oldBotData.Users)
            {
                string oldUserName = oldUser.Key;
                TRBotDataMigrationTool.User oldUserObj = oldUser.Value;

                Console.WriteLine($"Importing user \"{oldUserName}\" to new data.");

                using (BotDBContext context = DatabaseManager.OpenContext())
                {
                    TRBot.Data.User newUser = DataHelper.GetUserNoOpen(oldUserName, context);
                    if (newUser == null)
                    {
                        newUser = new TRBot.Data.User(oldUserName);
                        context.Users.Add(newUser);

                        //Save changes here so the navigation properties are applied
                        context.SaveChanges();
                    }

                    //Migrate the user data
                    MigrateUserFromOldToNew(oldUserObj, newUser);

                    context.SaveChanges();
                }

                //Update user abilities
                DataHelper.UpdateUserAutoGrantAbilities(oldUserName);

                userCount++;
            }

            Console.WriteLine($"Completed importing {userCount} users!");

            /* Game Logs */
            Console.WriteLine("Begin importing game logs...");

            int logCount = 0;

            foreach (TRBotDataMigrationTool.GameLog log in oldBotData.Logs)
            {
                //The DateTime in the old logs were not standardized, so we have to parse them manually
                int separatorLength = DATETIME_AT_PARSE.Length;

                if (string.IsNullOrEmpty(log.DateTimeString) == true)
                {
                    continue;
                }

                int middleIndex = log.DateTimeString.IndexOf(DATETIME_AT_PARSE);
                if (middleIndex < 0)
                {
                    continue;
                }

                //Parse date
                string date = log.DateTimeString.Substring(0, middleIndex + 1);
                int.TryParse(date.Substring(0, 2), out int month);
                int.TryParse(date.Substring(3, 2), out int day);
                int.TryParse(date.Substring(6, 4), out int year);

                int endIndex = middleIndex + separatorLength;

                //Parse time
                string time = log.DateTimeString.Substring(endIndex, log.DateTimeString.Length - endIndex);
                int.TryParse(time.Substring(0, 2), out int hour);
                int.TryParse(time.Substring(3, 2), out int minute);
                int.TryParse(time.Substring(6, 2), out int seconds);

                DateTime newDateTime = new DateTime(year, month, day, hour, minute, seconds);

                TRBot.Data.GameLog newLog = new TRBot.Data.GameLog();
                newLog.LogDateTime = newDateTime;
                newLog.LogMessage  = log.LogMessage;
                newLog.User        = log.User;

                using (BotDBContext context = DatabaseManager.OpenContext())
                {
                    context.GameLogs.Add(newLog);
                    context.SaveChanges();
                }

                logCount++;
            }

            Console.WriteLine($"Completed importing {logCount} game logs!");

            /* Savestate Logs */
            Console.WriteLine("Skipping importing savestate logs, as they don't exist in TRBot 2.0+.");

            /* Silenced Users */
            Console.WriteLine($"Skipping importing silenced users, as TRBot 2.0+ has a new ability system (see the \"{TRBot.Permissions.PermissionConstants.SILENCED_ABILITY}\" ability).");

            /* Input Callbacks */
            Console.WriteLine("Skipping importing input callbacks, as they don't exist in TRBot 2.0+.");

            /* Input Access */
            Console.WriteLine("Skipping importing InputAccess, as input access is console-specific in TRBot 2.0+.");

            /* Invalid Button Combos */
            Console.WriteLine("Begin importing invalid button combos...");
            int invalidButtonCombos = 0;

            foreach (KeyValuePair <int, List <string> > kvPair in oldBotData.InvalidBtnCombos.InvalidCombos)
            {
                int           oldConsoleId  = kvPair.Key;
                List <string> invalidCombos = kvPair.Value;

                if (EnumUtility.TryParseEnumValue(oldConsoleId.ToString(), out InputConsoles inputConsole) == true)
                {
                    //Find a console with this name
                    string consoleName = inputConsole.ToString().ToLowerInvariant();

                    using (BotDBContext context = DatabaseManager.OpenContext())
                    {
                        GameConsole console = context.Consoles.FirstOrDefault(c => c.Name == consoleName);

                        //Couldn't find the console
                        if (console == null)
                        {
                            continue;
                        }

                        List <InvalidCombo> newInvalidCombo = new List <InvalidCombo>();

                        for (int i = 0; i < invalidCombos.Count; i++)
                        {
                            string inputName = invalidCombos[i];

                            //Try to find a valid input containing this name
                            InputData inpData = console.InputList.FirstOrDefault(inp => inp.Name == inputName);
                            if (inpData == null)
                            {
                                continue;
                            }

                            //Check if this button is already in an invalid combo and ignore if so
                            InvalidCombo existing = console.InvalidCombos.FirstOrDefault(ivc => ivc.InputID == inpData.ID);
                            if (existing != null)
                            {
                                continue;
                            }

                            //Add the invalid combo
                            console.InvalidCombos.Add(new InvalidCombo(inpData));

                            context.SaveChanges();

                            invalidButtonCombos++;
                        }
                    }
                }
            }

            Console.WriteLine($"Completed importing {invalidButtonCombos} invalid button combos!");

            /* Input Synonyms */
            Console.WriteLine("Begin importing input synonyms...");
            int importedSynonyms = 0;

            foreach (KeyValuePair <InputConsoles, Dictionary <string, string> > kvPair in oldBotData.InputSynonyms.SynonymDict)
            {
                //Skip if there are none for this console
                if (kvPair.Value.Count == 0)
                {
                    continue;
                }

                string consoleName = kvPair.Key.ToString();
                Dictionary <string, string> synonyms = kvPair.Value;

                using (BotDBContext context = DatabaseManager.OpenContext())
                {
                    GameConsole console = context.Consoles.FirstOrDefault(c => c.Name == consoleName);

                    //Couldn't find the console
                    if (console == null)
                    {
                        continue;
                    }

                    //Add all synonyms if they don't exist
                    foreach (KeyValuePair <string, string> synonymKV in synonyms)
                    {
                        string       synonymName = synonymKV.Key;
                        InputSynonym synonym     = context.InputSynonyms.FirstOrDefault(s => s.SynonymName == synonymName);

                        if (synonym != null)
                        {
                            continue;
                        }

                        InputSynonym newSyn = new InputSynonym(console.ID, synonymName, synonymKV.Value);
                        context.InputSynonyms.Add(newSyn);

                        context.SaveChanges();
                    }
                }

                importedSynonyms++;
            }

            Console.WriteLine($"Completed importing {importedSynonyms} input synonyms!");

            /* Other changes */
            Console.WriteLine("Now importing remaining bot data...");

            AddSettingStrHelper(SettingsConstants.GAME_MESSAGE, oldBotData.GameMessage);
            AddSettingStrHelper(SettingsConstants.INFO_MESSAGE, oldBotData.InfoMessage);
            AddSettingIntHelper(SettingsConstants.LAST_CONSOLE, oldBotData.LastConsole);
            AddSettingIntHelper(SettingsConstants.DEFAULT_INPUT_DURATION, oldBotData.DefaultInputDuration);
            AddSettingIntHelper(SettingsConstants.MAX_INPUT_DURATION, oldBotData.MaxInputDuration);
            AddSettingIntHelper(SettingsConstants.JOYSTICK_COUNT, oldBotData.JoystickCount);

            Console.WriteLine($"Skipping importing the last virtual controller type, as the values don't line up with 2.0+.");

            AccessLevels.Levels inputPermLvl = (AccessLevels.Levels)oldBotData.InputPermissions;
            long finalPermVal = oldBotData.InputPermissions;

            if (AccessLvlMap.TryGetValue(inputPermLvl, out PermissionLevels permLvl) == true)
            {
                finalPermVal = (long)permLvl;
            }

            AddSettingIntHelper(SettingsConstants.GLOBAL_INPUT_LEVEL, finalPermVal);

            Console.WriteLine("Finished importing all bot data!");
        }
Esempio n. 26
0
 public async Task UpdateAsync(Meme meme)
 {
     _context.Memes.Update(meme);
     await _context.SaveChangesAsync();
 }
Esempio n. 27
0
        public new void EnableBehaviour(bool value)
        {
            base.EnableBehaviour(value);
            if (value)
            {
                // An animal see around him, possibly several objects
                m_VisionSense = new Sense <List <GameObject> >();
                var res = new Collider[100];
                Func <List <GameObject> > collector = () =>
                {
                    Physics.OverlapSphereNonAlloc(transform.position,
                                                  characteristics.AnimalCharacteristics.SightRange,
                                                  res,
                                                  LayerMask.GetMask("Animal", "Plant"));
                    return(res.Where(c => c != null).Select(c => c.gameObject).ToList());
                };
                m_VisionSense.ListenTo(collector);

                // It append the seen data in current memory
                m_VisionMemory           = new Memory <GameObject>();
                m_VisionSense.Triggered += o => m_VisionMemory.Input(o);


                // Collect data before update only
                controller.BeforeUpdated += () =>
                {
                    m_VisionSense.Update();
                    m_VisionMemory.Update();
                };

                var foodAround    = new Transition("FoodAround", 0, FoodAround);
                var partnerAround = new Transition("PartnerAround", -2, PartnerAround);
                var timeout       = new Transition("Timeout", -1, Timeout);
                var n             = "Wander";
                Memes[n] = new Meme(
                    n,
                    new List <Action>
                {
                    new Action("RandomMovement", RandomMovement)
                },
                    new List <Transition>
                {
                    foodAround,
                    partnerAround
                },
                    Color.white
                    );
                n        = "ReachFood";
                Memes[n] = new Meme(
                    n,
                    new List <Action>
                {
                    new Action("ReachFood", ReachFood)
                },
                    new List <Transition>
                {
                    new Transition("IsCloseEnoughForEating", 0, IsCloseEnoughForEating),
                    // timeout
                },
                    Color.red
                    );
                n        = "ReachPartner";
                Memes[n] = new Meme(
                    n,
                    new List <Action>
                {
                    new Action("ReachPartner", ReachPartner)
                },
                    new List <Transition>
                {
                    new Transition("IsCloseEnoughForBreeding", -1, IsCloseEnoughForBreeding),
                    // timeout
                },
                    Color.red
                    );
                n        = "Eat";
                Memes[n] = new Meme(
                    n,
                    new List <Action>
                {
                    // Reach,
                    new Action("Eat", Eat)
                },
                    new List <Transition>
                {
                    new Transition("IsTargetAlive", 0, IsTargetAlive),
                    partnerAround     // While eating, if it can breed, go for it
                },
                    Color.blue
                    );
                n        = "Breed";
                Memes[n] = new Meme(
                    n,
                    new List <Action>
                {
                    new Action("Reproduce", Reproduce)
                    // Reach,
                },
                    new List <Transition>
                {
                    foodAround,
                    partnerAround
                },
                    Color.magenta
                    );
            }
            else
            {
                // ?
            }
        }
Esempio n. 28
0
 public async Task AddAsync(Guid memeId, string title, Guid userId)
 {
     var meme = new Meme(memeId, title, userId);
     await _memeRepository.AddAsync(meme);
 }
Esempio n. 29
0
        public void Entity_Meme_Is_Null_Should_Throw_EntityValidationException()
        {
            Meme meme = null;

            Assert.ThrowsException <EntityValidationException>(() => MemeValidator.Validate(meme));
        }
Esempio n. 30
0
 public void Add(Meme newMeme)
 {
     context.TMeme.Add(newMeme);
     context.SaveChanges();
 }
Esempio n. 31
0
        protected new void OnEnable()
        {
            base.OnEnable();
            var foodAround    = new Transition("FoodAround", 0, FoodAround);
            var partnerAround = new Transition("PartnerAround", -2, PartnerAround);
            var timeout       = new Transition("Timeout", -1, Timeout);
            var n             = "Wander";

            memes[n] = new Meme(
                n,
                new List <Action>
            {
                new Action("RandomMovement", RandomMovement)
            },
                new List <Transition>
            {
                foodAround,
                partnerAround
            },
                Color.white
                );
            n        = "ReachFood";
            memes[n] = new Meme(
                n,
                new List <Action>
            {
                new Action("ReachFood", ReachFood)
            },
                new List <Transition>
            {
                new Transition("IsCloseEnoughForEating", 0, IsCloseEnoughForEating),
                // timeout
            },
                Color.red
                );
            n        = "ReachPartner";
            memes[n] = new Meme(
                n,
                new List <Action>
            {
                new Action("ReachPartner", ReachPartner)
            },
                new List <Transition>
            {
                new Transition("IsCloseEnoughForBreeding", -1, IsCloseEnoughForBreeding),
                // timeout
            },
                Color.red
                );
            n        = "Eat";
            memes[n] = new Meme(
                n,
                new List <Action>
            {
                // Reach,
                new Action("Eat", Eat)
            },
                new List <Transition>
            {
                new Transition("IsTargetAlive", 0, IsTargetAlive),
                partnerAround                         // While eating, if it can breed, go for it
            },
                Color.blue
                );
            n        = "Breed";
            memes[n] = new Meme(
                n,
                new List <Action>
            {
                new Action("Reproduce", Reproduce)
                // Reach,
            },
                new List <Transition>
            {
                foodAround,
                partnerAround
            },
                Color.magenta
                );
        }
Esempio n. 32
0
 public void Delete(Meme meme)
 {
     context.TMeme.Remove(meme);
     context.SaveChanges();
 }
Esempio n. 33
0
 public void Post([FromBody] Meme meme)
 {
     memeRepo.Add(meme);
 }
Esempio n. 34
0
 void ShowDebug(Meme meme)
 {
     Debug.Log(meme.topLine + "\n" + bottomLine);
 }
Esempio n. 35
0
 public void Update(Meme newMeme)
 {
     context.TMeme.Update(newMeme);
     context.SaveChanges();
 }
 protected int GetLikes(Meme item)
 {
     return item.Likes.Where(x => x.Value == true)
         .ToList()
         .Count();
 }