Example #1
0
        public IActionResult GetEmojisPosition(EmojiType emojiType)
        {
            ICollection <EditEmojiPositionViewModel> result =
                this.editEmojiPositionService.GetAllEmojisByType(emojiType);

            return(new JsonResult(result));
        }
Example #2
0
        /// <summary>
        /// 通过文字的size,计算图片的尺寸,这个尺寸这里写的是固定
        /// </summary>
        public TagData(string param, int size)
        {
            string[] splitArray = param.Split(',');
            this.Type = (EmojiType)int.Parse(splitArray[0]);
            this.Size = size;
            switch (this.Type)
            {
            case EmojiType.icon:
                this.Id = int.Parse(splitArray [1]);
                SetEmojiPopulateText(ICON_SCALE);
                break;

            case EmojiType.emoji:
                this.Id = int.Parse(splitArray [1]);
                SetEmojiPopulateText(EMOJI_SCALE);
                break;

            case EmojiType.button:
                this.Id      = int.Parse(splitArray[1]);
                PopulateText = string.Format("<quad Size={0}, Width={1}>", size.ToString(), BUTTON_SCALE.ToString());
                Width        = size * 2;
                Height       = size;
                break;

            case EmojiType.hyperlink:
                PopulateText = string.Format("<color=#{1}>{0}</color>", splitArray[1], splitArray[2]);
                break;
            }
            this.Length = PopulateText == null ? 0:PopulateText.Length;
        }
Example #3
0
        /// <summary>
        /// Desc : Update Status
        /// </summary>
        /// <param name="status"></param>
        public bool AddWhatIsInYourMind(string status)
        {
            try
            {
                Utils.driver.FindElement(By.LinkText("Home")).Click();
                StatusInput.DoClick();
                StatusInput.SendChar(status);

                if (EmojiButton.Displayed)
                {
                    EmojiButton.Click();
                }

                EmojiType.Click();
                StatusInput.Click();
                PostButton.Click();
                System.Threading.Thread.Sleep(3000);
                if (Utils.driver.FindElements(By.XPath("//p[contains(text(),'" + status + "')]")).Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #4
0
 public async Task <AdminCommandResult> SetSpecialEmojiAsync(EmojiType type, [RequireUsableEmoji] IEmoji emoji)
 {
     if (await Context.Database.SpecialEmojis.FindAsync(Context.Guild.Id.RawValue, type) is { } specialEmoji)
     {
         specialEmoji.Emoji = emoji;
         Context.Database.SpecialEmojis.Update(specialEmoji);
     }
Example #5
0
        public async Task <string> DeleteEmojisByType(EmojiType emojiType)
        {
            var targetEmojis = this.db.Emojis.Where(x => x.EmojiType == emojiType).ToList();
            int count        = 0;

            foreach (var emoji in targetEmojis)
            {
                var emojiSkins = this.db.EmojiSkins.Where(x => x.EmojiId == emoji.Id).ToList();
                foreach (var emojiSkin in emojiSkins)
                {
                    ApplicationCloudinary.DeleteImage(
                        this.cloudinary,
                        string.Format(GlobalConstants.EmojiSkin, emojiSkin.Id),
                        GlobalConstants.EmojisFolder);
                }

                ApplicationCloudinary.DeleteImage(
                    this.cloudinary,
                    string.Format(GlobalConstants.EmojiName, emoji.Id),
                    GlobalConstants.EmojisFolder);
                this.db.EmojiSkins.RemoveRange(emojiSkins);
                this.db.Emojis.Remove(emoji);
                this.db.SaveChanges();
                await this.db.SaveChangesAsync();

                count++;
            }

            return(string.Format(
                       SuccessMessages.SuccessfullyDeletedEmojisByType,
                       count,
                       emojiType.ToString().ToUpper()));
        }
Example #6
0
 public EmojiItem(EmojiType type, string path, string title, string code)
 {
     Type    = type;
     ImgPath = path;
     Title   = title;
     Code    = code;
 }
Example #7
0
    /// <summary>
    /// Reaction to show above an Employee
    /// </summary>
    /// <param name="type">The type of reaction to display</param>
    /// <param name="emp">The employee to show the reaction above</param>
    /// <param name="offset">Defines an offset for the reaction, so it is not shown right on top of the employee sprite</param>
    /// <param name="displayTime">Defines for how long the reaction appears</param>
    public void EmpReaction(EmojiType type, Employee emp, Vector3 offset, float displayTime)
    {
        // Remove a possibly already existing emoji
        if (EmployeeCoroutineMap.ContainsKey(emp) && EmployeeCoroutineMap[emp] != null)
        {
            StopCoroutine(EmployeeCoroutineMap[emp]);
            EmployeeCoroutineMap[emp] = null;
            Destroy(emp.reaction.gameObject);
            emp.reaction = null;
        }

        if (2 * fadeTime > displayTime)
        {
            Debug.Log("Your specified displayTime is smaller than the time for fade in and out together!");
        }
        var reaction = InitReaction(type, emp.transform.position, offset);

        emp.reaction = reaction.GetComponent <EmployeeReaction>();
        PlayEmojiSound(type);

        var coroutine = StartCoroutine(FadeAndCountdown(reaction, displayTime, emp));

        if (EmployeeCoroutineMap.ContainsKey(emp))
        {
            EmployeeCoroutineMap[emp] = coroutine;
        }
        else
        {
            EmployeeCoroutineMap.Add(emp, coroutine);
        }
    }
 public bool Next()
 {
     if (_current < Rounds)
     {
         Items.Clear();
         EmojiType        answer     = _selected[_current];
         List <EmojiItem> selections = new List <EmojiItem>
         {
             new EmojiItem(answer, true)
         };
         Text = GetText(answer);
         List <int> indexes  = ChooseOptions(_options);
         int        indexOne = indexes[0];
         int        indexTwo = indexes[1];
         EmojiType  one      = _options[indexOne];
         EmojiType  two      = _options[indexTwo];
         _options.RemoveAt(indexOne);
         _options.RemoveAt(indexTwo);
         selections.Add(new EmojiItem(one, false));
         selections.Add(new EmojiItem(two, false));
         Shuffle(selections);
         foreach (EmojiItem item in selections)
         {
             Items.Add(item);
         }
         _current++;
         return(true);
     }
     return(false);
 }
Example #9
0
 public void Init(EmojiType type, List <string> selections, Vector3 velocity, int correctSelectionIndex)
 {
     this.type       = type;
     this.selections = selections;
     this.GetComponent <Rigidbody2D>().velocity = velocity;
     this.correctSelectionIndex = correctSelectionIndex;
     SetSprite();
 }
        public async Task <IEmoji> GetSpecialEmojiAsync(ulong guildId, EmojiType type)
        {
            if (!(await SpecialEmojis.FindAsync(guildId, type) is { } emoji))
            {
                return(new LocalEmoji(type.GetDescription()));
            }

            return(emoji.Emoji);
        }
Example #11
0
 private void Reset()
 {
     Type        = EmojiType.None;
     Prefix      = string.Empty;
     Width       = 0;
     Height      = 0;
     mUpColorStr = string.Empty;
     Url         = string.Empty;
     CustomInfo  = string.Empty;
 }
Example #12
0
    public void MakeEmojiInput()
    {
        EmojiType     type    = (EmojiType)rand.Next(2);
        List <string> choices = new List <string>();
        int           indx    = GetChoiceList(type, choices);
        //List<string> choices = null;
        GameObject newEmoji = Instantiate(cloneMoji, colliders["Top"].position, Quaternion.identity);

        newEmoji.GetComponent <EmojiHelper>().Init(type, choices, new Vector3(rand.Next(-1, 1), 0, 0), indx);
    }
Example #13
0
 private void RefreshEmoji(EmojiType emojiType)
 {
     if (emojiType == EmojiType.None)
     {
         emojiTrans.Com.gameObject.SetActive(false);
         BindModel.isPlaying.Value = false;
         return;
     }
     BindModel.isPlaying.Value = false;
 }
Example #14
0
    /// <summary>
    /// Emoji to show at any arbitrary position
    /// </summary>
    /// <param name="type">The type of reaction</param>
    /// <param name="position">Position of the emoji</param>
    /// <param name="displayTime">Defines for how long the reaction appears</param>
    public void NonEmpReaction(EmojiType type, Vector3 position, float displayTime)
    {
        if (2 * fadeTime > displayTime)
        {
            Debug.Log("Your specified displayTime is smaller than the time for fade in and out together!");
        }
        var reaction = InitReaction(type, position, Vector3.zero);

        StartCoroutine(FadeAndCountdown(reaction, displayTime));
    }
Example #15
0
 public void Parse(Match match, int fontSize)
 {
     Reset();
     if (!match.Success || match.Groups.Count != 8)
     {
         return;
     }
     Prefix = match.Groups[1].Value;
     if (match.Groups[2].Success)
     {
         var widthHeigthStr = match.Groups[2].Value;
         var sp             = widthHeigthStr.Split('|');
         Width  = sp.Length > 1 ? int.Parse(sp[1]) : fontSize;
         Height = sp.Length == 3 ? int.Parse(sp[2]) : Width;
     }
     else
     {
         Width  = fontSize;
         Height = Width;
     }
     if (match.Groups[4].Success && !string.IsNullOrEmpty(match.Groups[4].Value))
     {
         mUpColorStr = match.Groups[4].Value.Substring(0, 7);
     }
     if (match.Groups[5].Success)
     {
         mDownColorStr = match.Groups[5].Value;
     }
     if (match.Groups[6].Success)
     {
         Url = match.Groups[6].Value.Substring(1);
     }
     if (match.Groups[7].Success)
     {
         CustomInfo = match.Groups[7].Value.Substring(1);
     }
     if (Prefix.Equals("0x01"))
     {
         if (!string.IsNullOrEmpty(Url) && !string.IsNullOrEmpty(CustomInfo))
         {
             Type = EmojiType.HyperLink;
         }
     }
     else if (Prefix.Equals("0x02"))
     {
         if (!string.IsNullOrEmpty(CustomInfo))
         {
             Type = EmojiType.Texture;
         }
     }
     else
     {
         Type = EmojiType.Emoji;
     }
 }
Example #16
0
    public void Initialize(DM.EmojiTableManager.EmojiEntry entry, Action <string> OnEmojiClick)
    {
        this.emojiId = entry.Id;
        this.type    = entry.Type;
        string path = GetEmojiPrefabPath();

        Debug.Log(path);


        btn.onClick.AddListener(() => OnEmojiClick(GetEmojiDescription()));
    }
Example #17
0
    /// <summary>
    /// Initializes any type of reaction
    /// </summary>
    /// <param name="type">The type of reaction</param>
    /// <param name="position">Position of the reaction</param>
    /// <param name="offset">Offset for the reaction</param>
    /// <returns>GameObject which holds the reaction</returns>
    protected internal GameObject InitReaction(EmojiType type, Vector3 position, Vector3 offset)
    {
        Sprite     reactionSprite = GetSpriteFromEmojiType(type);
        GameObject reactionObject = new GameObject("Reaction");
        var        reaction       = reactionObject.AddComponent <EmployeeReaction>();

        reaction.offset   = offset;
        reaction.Position = position;
        reaction.ShowReaction(reactionSprite);
        return(reactionObject);
    }
Example #18
0
        public virtual async Task AddAwardEmoji(int projectId, int mergeRequestIid, EmojiType emojiType)
        {
            var createNoteRequest = new RestRequest($"/projects/{projectId}/merge_requests/{mergeRequestIid}/award_emoji", Method.POST)
                                    .AddQueryParameter("name", emojiType.ToString().ToLower());

            var restResponse = await createNoteRequest.Execute(_client);

            if (!restResponse.IsSuccessful)
            {
                throw new GitLabApiFailedException(createNoteRequest, restResponse);
            }
        }
Example #19
0
        public bool Contains(int id, EmojiType type)
        {
            if (dataDic.ContainsKey(id))
            {
                if (dataDic [id] != null && dataDic [id].Type == type)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #20
0
        public static void SingleImp(EmojiType type)
        {
            var factory = new EmojiFactory();

            IEmoji emoji = factory.Create(type);

            emoji.Express();

            if (emoji.isHappy())
            {
                Console.WriteLine("HAHAHAHAHHAHAHAHHAA");
            }
        }
Example #21
0
    /// <summary>
    /// Play the matching sound to a given emoji type.
    /// </summary>
    /// <param name="type">The emoji type to play the sound to.</param>
    /// <exception cref="ArgumentOutOfRangeException"></exception>
    private void PlayEmojiSound(EmojiType type)
    {
        switch (type)
        {
        case EmojiType.SUCCESS:
            if (SuccessEvent != null)
            {
                SuccessEvent.Raise();
            }
            break;

        case EmojiType.ANGRY:
            if (AngryEvent != null)
            {
                AngryEvent.Raise();
            }
            break;

        case EmojiType.OK:
            if (OkEvent != null)
            {
                OkEvent.Raise();
            }
            break;

        case EmojiType.NO:
            if (NoEvent != null)
            {
                NoEvent.Raise();
            }
            break;

        case EmojiType.BUBBLE:
            break;

        case EmojiType.LEVELUP:
            if (LevelUpEvent != null)
            {
                LevelUpEvent.Raise();
            }
            break;

        case EmojiType.TWITTER:
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(type), type, null);
        }
    }
        public DiscordEmoji Get(EmojiType type)
        {
            var hasMs = this.DiscordBot.IsInGuild(MsEmojiGuildId);
            var name  = type switch
            {
                EmojiType.OkHand => hasMs ? OkHandMs : OkHandGeneric,
                EmojiType.RaisedHand => hasMs ? RaisedHandMs : RaisedHandGeneric,
                _ => null
            };

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

            return(this.DiscordBot.GetEmote(name));
        }
    }
Example #23
0
    private int GetChoiceList(EmojiType type, List <string> choices)
    {
        List <string> otherOptions;

        string toAdd = "";

        if (type == EmojiType.GOOD)
        {
            toAdd        = AssetManager.GetRandomGoodItem();
            otherOptions = AssetManager.GetBadList();
        }
        else
        {
            toAdd        = AssetManager.GetRandomBadItem();
            otherOptions = AssetManager.GetGoodList();
        }

        // Create a list of 4 choices with unique first letters
        while (choices.Count < 3)
        {
            bool   addPossible    = true;
            string possibleOption = otherOptions[rand.Next(otherOptions.Count)];

            // Don't allow duplicate options
            foreach (string choice in choices)
            {
                if (choice.Equals(possibleOption))
                {
                    addPossible = false;
                }
            }

            if (addPossible)
            {
                choices.Add(possibleOption);
            }
        }

        int correctIndx = rand.Next(3);

        choices.Insert(correctIndx, toAdd);

        return(correctIndx);
    }
        public ICollection <EditEmojiPositionViewModel> GetAllEmojisByType(EmojiType emojiType)
        {
            var emojis = this.db.Emojis.Where(x => x.EmojiType == emojiType).OrderBy(x => x.Position).ToList();
            var result = new List <EditEmojiPositionViewModel>();

            foreach (var emoji in emojis)
            {
                result.Add(new EditEmojiPositionViewModel
                {
                    Id        = emoji.Id,
                    Name      = emoji.Name,
                    Url       = emoji.Url,
                    Position  = emoji.Position,
                    EmojiType = emoji.EmojiType,
                });
            }

            return(result);
        }
Example #25
0
        /// <summary>
        /// Desc : Update Status
        /// </summary>
        /// <param name="status"></param>
        public bool AddWhatIsInYourMind(string status)
        {
            try
            {
                Utils.driver.FindElement(By.LinkText("Home")).Click();

                var textArea = Utils.driver.FindElements(By.XPath("//textarea[contains(@title,'Write something here')]"));
                if (textArea.Count > 0)
                {
                    textArea[0].Click();
                }
                else
                {
                    StatusInput.DoClick();
                }

                StatusInput.SendChar(status);

                if (EmojiButton.Displayed)
                {
                    EmojiButton.Click();
                }

                EmojiType.Click();
                StatusInput.Click();
                PostButton.Click();
                System.Threading.Thread.Sleep(3000);
                if (Utils.driver.FindElements(By.XPath("//p[contains(text(),'" + status + "')]")).Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                return(false);
            }
        }
    private void Start()
    {
        type      = GetComponent <T6_EmojiInteractions>().emojiType;
        emojiList = emojiSpawner.GetComponent <T6_EmojiSpawner>().GetWave().GetEmojiList();

        for (int i = 0; i < emojiList.Count; i++)
        {
            if (emojiList[i].type == type)
            {
                minSpeed = emojiList[i].minSpeed;
                maxSpeed = emojiList[i].maxSpeed;
            }
        }

        globalSpeed = emojiSpawner.GetComponent <T6_EmojiSpawner>().GetWave().GetGlobalSpeed();

        emojiTransform = GetComponent <Transform>();

        randomSpeed = Random.Range(minSpeed, maxSpeed) * globalSpeed;
    }
Example #27
0
    //takes in true for if the emoji was given a good fate and false if given a bad fate
    public void MakeEmojiOutput(int isGood)
    {
        EmojiType  type     = (EmojiType)(EmojiType.BADOUT + isGood);
        GameObject newEmoji = Instantiate(cloneMoji, outputTransforms[isGood].position, Quaternion.identity);
        Vector3    temp     = new Vector3(outputTransforms[isGood].position.x, outputTransforms[isGood].position.y - 1f + (2 * isGood), 0);

        Instantiate(particleEffects[isGood], temp, Quaternion.identity);
        Vector3 vel = new Vector3(0, 0, 0);

        if (isGood == 0)
        {
            vel = new Vector3(2, 0, 0);
        }
        else
        {
            vel = new Vector3(-2, 25, 0);
        }
        //newEmoji.transform = outputTransforms[isGood];
        newEmoji.GetComponent <EmojiHelper>().Init(type, null, vel, -1);
    }
Example #28
0
    public string GetRandomText(EmojiType type)
    {
        switch (type)
        {
        case EmojiType.SCARED:
        case EmojiType.SCREAMING:
        case EmojiType.THUMBSUP:
            return(scaredTexts [Random.Range(0, scaredTexts.Length)]);

        case EmojiType.MORBID:
        case EmojiType.CRYING:
            return(superScaredTexts [Random.Range(0, superScaredTexts.Length)]);

        case EmojiType.DISAPPOINTED:
        case EmojiType.THUMBSDOWN:
            return(disappointedTexts [Random.Range(0, disappointedTexts.Length)]);

        case EmojiType.HEARTATTACK:
            return("HEART ATTACK");

        default:
            return("ERROR");
        }
    }
 private string GetText(EmojiType type)
 {
     return(string.Join(" ", SplitCapital(Enum.GetName(typeof(EmojiType), type))));
 }
 public EmojiItem(EmojiType type, bool correct)
 {
     Type    = type;
     Correct = correct;
     State   = EmojiState.None;
 }