Ejemplo n.º 1
0
        public static void ShowNotification(string text, long time)
        {
            if (Text == null)
            {
                Text = new CustomText(TextX, TextY, text);
                Text.TextRenderer.Centered = true;
                Text.TextRenderer.scale    = TextScale;
            }

            CancelNotification();

            Text.Text = text;

            NotificationTask = Task.Run(async() =>
            {
                Text.SetActive(true);
                Text.Color = new UnityEngine.Color(1, 1, 1, 0);

                CustomStopwatch stopwatch = new CustomStopwatch(true);

                while (stopwatch.ElapsedMilliseconds < time)
                {
                    float a = stopwatch.ElapsedMilliseconds / (time / 2f);

                    if (stopwatch.ElapsedMilliseconds > (time / 2))
                    {
                        a = (time - stopwatch.ElapsedMilliseconds) / (time / 2f);
                    }

                    Text.Color = new UnityEngine.Color(1, 1, 1, a);

                    await Task.Delay(1);
                }
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Cria os inimigos e os posiciona na tela
        /// </summary>
        public void criarInimigos()
        {
            //Limpar inimigos atuais
            inimigos.Clear();

            //Criar Inimigos
            XMLinimigos = new XmlDocument();

            CustomText xml = principal.Content.Load <CustomText>(caminho + "_Inimigos");

            XMLinimigos.LoadXml(xml.SourceCode);

            for (int i = 0; i < XMLinimigos.DocumentElement.ChildNodes.Count; i++)
            {
                String  texturaItem = XMLinimigos.DocumentElement.ChildNodes[i].Attributes["sprite"].Value;
                int     X           = int.Parse(XMLinimigos.DocumentElement.ChildNodes[i].Attributes["x"].Value);
                int     Y           = int.Parse(XMLinimigos.DocumentElement.ChildNodes[i].Attributes["y"].Value);
                float   velocidade  = float.Parse(XMLinimigos.DocumentElement.ChildNodes[i].Attributes["velocidade"].Value);
                Inimigo novoInimigo = new Inimigo(principal, new Vector2(X * Tile.Dimensoes.X, Y * Tile.Dimensoes.Y) - new Vector2(0, 1), velocidade, texturaItem);
                novoInimigo.EsperaMax = float.Parse(XMLinimigos.DocumentElement.ChildNodes[i].Attributes["espera"].Value);
                novoInimigo.Initialize();
                novoInimigo.LoadContent(principal.Content);
                inimigos.Add(novoInimigo);
            }
        }
Ejemplo n.º 3
0
 internal static void StartNotifier()
 {
     LobbyBehaviourStartedEvent.Listener += () =>
     {
         Text = null;
     };
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        InputManager.Instance.AddGlobalListener(gameObject);
        arialFont        = Resources.Load("Fonts & Materials/Calibri SDF", typeof(TMP_FontAsset)) as TMP_FontAsset;
        orderedPositions = new Vector3[characters.Length];
        float startPos = -1.4f;

        customTexts = new CustomText[characters.Length];
        for (int i = 0; i < customTexts.Length; ++i)
        {
            Color tempColor = Color.white;
            bool  isItalics = false;
            if (characters[i] == "i")
            {
                tempColor = Color.blue;
                isItalics = true;
            }
            var ct = new CustomText(gameObject, arialFont, characters[i], tempColor, isItalics);
            customTexts[i] = ct;

            startPos += ct.Text.rectTransform.sizeDelta.x;

            if (characters[i] == "l")
            {
                orderedPositions[i] = new Vector3(startPos + 0.11f, 0, 10);
            }
            else
            {
                orderedPositions[i] = new Vector3(startPos, 0, 10);
            }
        }
    }
Ejemplo n.º 5
0
        private static CustomText CreateText(float x, float y, string text)
        {
            var ctext = new CustomText(x, y, text);

            ctext.TextRenderer.Centered = true;

            return(ctext);
        }
        public IHttpActionResult PostCustomText(CustomText customText)
        {
            CustomTextService customTextService = new CustomTextService();

            customTextService.UpsertCustomText(customText, db);

            return(CreatedAtRoute("DefaultApi", new { id = customText.TextId }, customText));
        }
        private IEnumerator AddNewChatMessage(string msg, ChatMessage messageInfo)
        {
            _messageRendering = true;
            CustomText currentMessage = null;

            _testMessage.text = msg;
            _testMessage.cachedTextGenerator.Populate(msg, _testMessage.GetGenerationSettings(_testMessage.rectTransform.rect.size));
            yield return(null);

            for (int i = 0; i < _testMessage.cachedTextGenerator.lineCount; i++)
            {
                int index = Config.Instance.ReverseChatOrder ? _testMessage.cachedTextGenerator.lineCount - 1 - i : i;
                msg = _testMessage.text.Substring(_testMessage.cachedTextGenerator.lines[index].startCharIdx);
                if (index < _testMessage.cachedTextGenerator.lineCount - 1)
                {
                    msg = msg.Substring(0, _testMessage.cachedTextGenerator.lines[index + 1].startCharIdx - _testMessage.cachedTextGenerator.lines[index].startCharIdx);
                }

                // Italicize action messages and make the whole message the color of the users name
                if (messageInfo.isActionMessage)
                {
                    msg = $"<i><color={messageInfo.twitchMessage.user.color}>{msg}</color></i>";
                }

                currentMessage             = _chatMessages.Dequeue();
                currentMessage.hasRendered = false;
                currentMessage.text        = msg;
                currentMessage.messageInfo = messageInfo;
                currentMessage.material    = Drawing.noGlowMaterialUI;
                currentMessage.color       = Config.Instance.TextColor;
                _chatMessages.Enqueue(currentMessage);

                FreeImages(currentMessage);
                UpdateChatUI();
                yield return(null);

                foreach (BadgeInfo b in messageInfo.parsedBadges)
                {
                    Drawing.OverlayImage(currentMessage, b);
                }

                foreach (EmoteInfo e in messageInfo.parsedEmotes)
                {
                    Drawing.OverlayImage(currentMessage, e);
                }

                currentMessage.hasRendered = true;

                _waitForFrames = 5;
                yield return(_delay);
            }
            _testMessage.text = "";

            _messageRendering = false;
        }
Ejemplo n.º 8
0
    static void CreateCustomText(MenuCommand menuCommand)
    {
        GameObject go         = new GameObject("Text");
        CustomText CustomText = go.AddComponent <CustomText>();

        CustomText.texture   = AssetDatabase.LoadAssetAtPath <Texture>("Assets/Fonts/font.png");
        CustomText.fontAtlas = AssetDatabase.LoadAssetAtPath <FontAtlas>("Assets/Fonts/FontAtlas.asset");
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
        Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
        Selection.activeGameObject = go;
    }
Ejemplo n.º 9
0
        /// <summary>
        /// Lê o XML carregado e monta o mapa de tiles
        /// </summary>
        public void LerXML()
        {
            XMLdoc = new XmlDocument();
            CustomText xml = principal.Content.Load <CustomText>(caminho);

            XMLdoc.LoadXml(xml.SourceCode);

            ((TelaJogo)tela).Fundo = principal.Content.Load <Texture2D>(XMLdoc.DocumentElement.Attributes["fundo"].Value);
            tileSet = principal.Content.Load <Texture2D>(XMLdoc.DocumentElement.Attributes["tileset"].Value);

            montarMapa();
        }
        private void FreeImages(CustomText currentMessage)
        {
            if (currentMessage.emoteRenderers.Count > 0)
            {
                foreach (CustomImage image in currentMessage.emoteRenderers)
                {
                    imagePool.Free(image);
                }

                currentMessage.emoteRenderers.Clear();
            }
        }
Ejemplo n.º 11
0
        private IEnumerator AddNewChatMessage(string msg, MessageInfo messageInfo)
        {
            _messageRendering = true;
            CustomText currentMessage = null;

            if (_chatMessages.Count < Plugin.Instance.Config.MaxMessages)
            {
                currentMessage = Drawing.InitText(msg, Color.clear, Plugin.Instance.Config.ChatScale, new Vector2(Plugin.Instance.Config.ChatWidth, 1), new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 0), _gameObject.transform, TextAnchor.UpperLeft, _noGlowMaterialUI);
                if (!Plugin.Instance.Config.ReverseChatOrder)
                {
                    _chatMessages.Add(currentMessage);
                }
                else
                {
                    _chatMessages.Insert(0, currentMessage);
                }
            }
            else
            {
                if (!Plugin.Instance.Config.ReverseChatOrder)
                {
                    currentMessage = _chatMessages.First();
                    _chatMessages.RemoveAt(0);
                    _chatMessages.Add(currentMessage);
                }
                else
                {
                    currentMessage = _chatMessages.Last();
                    _chatMessages.Remove(currentMessage);
                    _chatMessages.Insert(0, currentMessage);
                }
                currentMessage.text = msg;
            }
            currentMessage.messageInfo = messageInfo;

            if (currentMessage.emoteRenderers.Count > 0)
            {
                currentMessage.emoteRenderers.ForEach(e => Destroy(e.gameObject));
                currentMessage.emoteRenderers.Clear();
            }

            UpdateChatUI();

            yield return(null);

            currentMessage.color = Plugin.Instance.Config.TextColor;
            messageInfo.parsedEmotes.ForEach(e => Drawing.OverlayEmote(currentMessage, e.swapChar, _noGlowMaterialUI, _animationController, e.cachedSpriteInfo));
            messageInfo.parsedBadges.ForEach(b => Drawing.OverlayEmote(currentMessage, b.swapChar, _noGlowMaterialUI, _animationController, new CachedSpriteData(b.sprite)));


            _messageRendering = false;
            _waitForFrames    = 2;
        }
Ejemplo n.º 12
0
        public static Vector3 GetAverageCharacterPos(CustomText textComp, int i)
        {
            try {
                TextGenerator textGen        = textComp.cachedTextGenerator;
                Vector2       locUpperLeft   = new Vector2(textGen.verts[i * 4].position.x, textGen.verts[i * 4].position.y);
                Vector2       locBottomRight = new Vector2(textGen.verts[i * 4 + 2].position.x, textGen.verts[i * 4 + 2].position.y);

                return((locUpperLeft + locBottomRight) / 2.0f);
            }
            catch (Exception) { }
            return(new Vector3(0, 0, 0));
        }
Ejemplo n.º 13
0
        public static CustomText GetDemoMessageText()
        {
            CustomText customText = new CustomText()
            {
                FontSize              = 14,
                Align                 = TextAlign.Left,
                PageNumber            = 1,
                StartingPointPosition = new Point(50, 50),
                Text = "KryptoSigner DEMO VERSION"
            };

            return(customText);
        }
Ejemplo n.º 14
0
        public override void OnEnd()
        {
            base.OnEnd();

            if (EnableDisableCollision != null)
            {
                EnableDisableCollision.Destroy();
                EnableDisableCollision = null;

                CollisionTextRenderer.Destroy();
                CollisionTextRenderer = null;
            }
        }
        public IHttpActionResult DeleteCustomText(int id)
        {
            CustomText customText = db.CustomTexts.Find(id);

            if (customText == null)
            {
                return(NotFound());
            }

            db.CustomTexts.Remove(customText);
            db.SaveChanges();

            return(Ok(customText));
        }
        private bool PurgeChatMessage(CustomText currentMessage)
        {
            string userName = $"<color={currentMessage.messageInfo.displayColor}><b>{currentMessage.messageInfo.origMessage.user.displayName}</b></color>:";

            if (currentMessage.text.Contains(userName))
            {
                currentMessage.text = $"{userName} <message deleted>";
            }
            else
            {
                currentMessage.text = "";
            }

            FreeImages(currentMessage);
            return(true);
        }
        public CustomText UpsertCustomText(CustomText customText, CustomTextDBEntities2 db)
        {
            using (db)
            {
                if (customText.TextId == default(int))
                {
                    db.CustomTexts.Add(customText);
                }
                else
                {
                    db.Entry(customText).State = EntityState.Modified;
                }

                db.SaveChanges();
                return(customText);
            }
        }
Ejemplo n.º 18
0
        IEnumerator DisplayText(int value, float time)
        {
            CustomText text = Instantiate(texts[6]).GetComponent <CustomText>();

            text.Display(value);
            text.gameObject.transform.position = new Vector3(0, -0.25f);
            float current = 0;
            float alpha   = 1;

            while (current < time)
            {
                text.gameObject.transform.localScale = new Vector3(0.1f, 0.1f) + alpha * new Vector3(0.1f, 0.1f);
                text.gameObject.GetComponent <Renderer>().material.color = new Color(1, 1, 1, alpha);
                alpha    = 1f - current / time;
                current += 0.05f;
                yield return(new WaitForSeconds(0.025f));
            }
            Destroy(text.gameObject);
        }
Ejemplo n.º 19
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ Bool.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ (ByteArray != null ? ByteArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CharArray != null ? CharArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringArray != null ? StringArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntArray != null ? IntArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LongArray != null ? LongArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringList != null ? StringList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringMap != null ? StringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntStringMap != null ? IntStringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubType != null ? SubType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTypes != null ? SubTypes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomText != null ? CustomText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MaxText != null ? MaxText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomDecimal.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 20
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        serializedObject.Update();

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(m_languageId);
        EditorGUILayout.PropertyField(m_language);
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            for (int i = 0; i < targets.Length; i++)
            {
                CustomText text = targets[i] as CustomText;
                if (text != null)
                {
                    text.SetContent();
                }
            }
        }
    }
        public override void OnEnd()
        {
            base.OnEnd();

            foreach (var playerId in InvisiblePlayers)
            {
                var player = PlayerController.FromPlayerId(playerId);
                player.SetOpacity(1);
                player.IsVisible = true;
            }

            InvisiblePlayers.Clear();

            if (EnableDisableInvisibility != null)
            {
                EnableDisableInvisibility.Destroy();
                EnableDisableInvisibility = null;

                InvisibilityTextRenderer.Destroy();
                InvisibilityTextRenderer = null;
            }
        }
Ejemplo n.º 22
0
        public override void Loop()
        {
            base.Loop();

            GameModeSettingsAddition =
                $"\nAbility Active Period: {Functions.ColorPurple}{OnTime}s[]\n" +
                $"Ability Cooldown: {Functions.ColorPurple}{UseCooldown}s[]";

            if (!IsInGame)
            {
                return;
            }

            if (!PlayerController.LocalPlayer.PlayerData.IsImpostor)
            {
                return;
            }

            if (EnableDisableCollision == null)
            {
                EnableDisableCollision = new CustomButton(ButtonOffsetX, ButtonOffsetY, Functions.LoadSpriteFromAssemblyResource(Assembly.GetExecutingAssembly(), "QuantumTunnelingGameMode.Assets.collision.png"));
            }

            if (CollisionTextRenderer == null)
            {
                CollisionTextRenderer = new CustomText(TextOffsetX, TextOffsetY, $"{UseCooldown}");
                CollisionTextRenderer.TextRenderer.scale    = 2;
                CollisionTextRenderer.TextRenderer.Centered = true;
                CollisionTextRenderer.SetActive(false);
            }

            if (PlayerController.LocalPlayer.PlayerData.IsDead)
            {
                if (CollisionTextRenderer.Active)
                {
                    CollisionTextRenderer.SetActive(false);
                }

                if (EnableDisableCollision.Active)
                {
                    EnableDisableCollision.SetActive(false);
                }

                return;
            }

            string toDisplay = "--- [7a31f7ff]Quantum Tunneling[]---\n";

            if (IsEnabled)
            {
                toDisplay += $"Collision in [11c5edff]{ OnTime - (Functions.GetUnixTime() - LastEnabled) }s[]";

                CollisionTextRenderer.SetActive(true);
                CollisionTextRenderer.Text  = $"{ OnTime - (Functions.GetUnixTime() - LastEnabled) }";
                CollisionTextRenderer.Color = new Color(0, 1, 0);

                if (OnTime - (Functions.GetUnixTime() - LastEnabled) <= 0)
                {
                    PlayerController ctrl = PlayerController.LocalPlayer;
                    IsEnabled = false;

                    RpcManager.SendRpc(QuantumTunneling.QuantumTunnelingRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) });
                    PlayerHudManager.HudManager.ShadowQuad.gameObject.SetActive(!IsEnabled);

                    ctrl.HasCollision = !IsEnabled;
                }
            }
            else
            {
                bool CanEnable = LastEnabled + OnTime + UseCooldown <= Functions.GetUnixTime();

                if (CanEnable)
                {
                    // ----- Can enable demat -----
                    if (((EnableDisableCollision.InBounds && Functions.GetKey(KeyCode.Mouse0)) || Functions.GetKey(UseKey)) && PlayerController.LocalPlayer.Moveable)
                    {
                        // ----- User pressed key -----
                        LastEnabled = Functions.GetUnixTime();

                        PlayerController ctrl = PlayerController.LocalPlayer;
                        IsEnabled = true;

                        EnableDisableCollision.SpriteRenderer.color = new Color(0.75f, 0.75f, 0.75f, 0.75f);

                        RpcManager.SendRpc(QuantumTunneling.QuantumTunnelingRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) });
                        PlayerHudManager.HudManager.ShadowQuad.gameObject.SetActive(!IsEnabled);

                        ctrl.HasCollision = !IsEnabled;
                    }
                    else
                    {
                        // ----- Display can press key -----
                        toDisplay += $"Use [11c5edff]The Button[] to activate.";
                        EnableDisableCollision.SpriteRenderer.color = new Color(1, 1, 1);
                        CollisionTextRenderer.gameObject.SetActive(false);
                    }
                }
                else
                {
                    // ----- Cannot enable demat -----
                    toDisplay += $"Cooldown: [11c5edff]{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }s[]";

                    CollisionTextRenderer.Text  = $"{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }";
                    CollisionTextRenderer.Color = new Color(1, 1, 1);
                }
            }

            string curText = PlayerHudManager.TaskText;

            if (!curText.Contains(Delimiter))
            {
                PlayerHudManager.TaskText = toDisplay + Delimiter + PlayerHudManager.TaskText;
            }
            else if (!curText.Contains(toDisplay))
            {
                string toReplace = curText.Split(new string[] { Delimiter }, StringSplitOptions.None)[0];

                PlayerHudManager.TaskText = curText.Replace(toReplace, toDisplay);
            }
        }
Ejemplo n.º 23
0
        private IEnumerator AddNewChatMessage(string origMsg, ChatMessage messageInfo)
        {
            _messageRendering = true;
            CustomText currentMessage = null;

            _testMessage.text = origMsg;
            _testMessage.cachedTextGenerator.Populate(origMsg, _testMessage.GetGenerationSettings(_testMessage.rectTransform.rect.size));
            yield return(null);

            Dictionary <string, string> openTags = new Dictionary <string, string>();

            for (int i = 0; i < _testMessage.cachedTextGenerator.lineCount; i++)
            {
                int index = ChatConfig.instance.ReverseChatOrder ? _testMessage.cachedTextGenerator.lineCount - 1 - i : i;

                string msg;
                if (index < _testMessage.cachedTextGenerator.lineCount - 1)
                {
                    msg = _testMessage.text.Substring(_testMessage.cachedTextGenerator.lines[index].startCharIdx, _testMessage.cachedTextGenerator.lines[index + 1].startCharIdx - _testMessage.cachedTextGenerator.lines[index].startCharIdx);
                }
                else
                {
                    msg = _testMessage.text.Substring(_testMessage.cachedTextGenerator.lines[index].startCharIdx);
                }

                if (msg.IsAllWhitespace())
                {
                    continue;
                }

                if (openTags.Count > 0)
                {
                    foreach (var tag in openTags.ToArray())
                    {
                        msg = msg.Insert(0, $"<{tag.Key}{(tag.Value != null? $"={tag.Value}" : "")}>");
                        var closingTag = $"</{tag.Key}>";
                        if (msg.Contains(closingTag))
                        {
                            openTags.Remove(tag.Key);
                        }
                        else
                        {
                            msg += closingTag;
                        }
                    }
                }

                var matches = _htmlTagRegex.Matches(msg).Cast <Match>().Reverse();
                foreach (Match m in matches)
                {
                    var tag = m.Groups["Tag"].Value;
                    if (openTags.ContainsKey(tag))
                    {
                        continue;
                    }

                    var closingTag = $"</{tag}>";
                    if (msg.Contains(closingTag))
                    {
                        continue;
                    }

                    string value = null;
                    if (m.Groups["Value"].Success)
                    {
                        value = m.Groups["Value"].Value;
                    }
                    openTags.Add(tag, value);
                    msg += closingTag;
                }

                currentMessage             = _chatMessages.Dequeue();
                currentMessage.hasRendered = false;
                currentMessage.text        = msg;
                currentMessage.messageInfo = messageInfo;
                currentMessage.material    = Drawing.noGlowMaterialUI;
                currentMessage.color       = ChatConfig.instance.TextColor;
                _chatMessages.Enqueue(currentMessage);

                FreeImages(currentMessage);
                UpdateChatUI();
                yield return(null);

                foreach (BadgeInfo b in messageInfo.parsedBadges.Values)
                {
                    Drawing.OverlayImage(currentMessage, b);
                }

                foreach (EmoteInfo e in messageInfo.parsedEmotes.Values)
                {
                    Drawing.OverlayImage(currentMessage, e);
                }

                currentMessage.hasRendered = true;

                _waitForFrames = 5;
                yield return(_delay);
            }
            _testMessage.text = "";
            _messageRendering = false;
        }
Ejemplo n.º 24
0
 public static void UpdateTextGenerator(CustomText text)
 {
     text.cachedTextGenerator.Populate(text.text, text.GetGenerationSettings(text.rectTransform.rect.size));
 }
Ejemplo n.º 25
0
 public override void ResetValues()
 {
     base.ResetValues();
     CollisionTextRenderer  = null;
     EnableDisableCollision = null;
 }
Ejemplo n.º 26
0
        private async Task <ServerCustomText> GetServerCustomTextAsync(ulong discordGuildId, CustomText type)
        {
            var guildId    = (long)discordGuildId;
            var serverText = await _botContext.ServerCustomTexts
                             .FirstOrDefaultAsync(sct => sct.Server.DiscordGuildId == guildId &&
                                                  sct.Type == type).ConfigureAwait(false);

            if (serverText != null)
            {
                return(serverText);
            }

            var server = await _botContext.Servers.FirstOrDefaultAsync(s => s.DiscordGuildId == guildId).ConfigureAwait(false);

            serverText = new ServerCustomText
            {
                Server = server,
                Type   = type
            };
            _botContext.ServerCustomTexts.Add(serverText);
            await _botContext.SaveChangesAsync().ConfigureAwait(false);

            return(serverText);
        }
Ejemplo n.º 27
0
 //конструктор
 public TestActionList(IComponent component) : base(component)
 {
     //сохраняем ссылку на редактируемый компонент
     customText = component as CustomText;
     service    = GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
 }
Ejemplo n.º 28
0
 void Awake()
 {
     slotNameText  = transform.GetChild(0).GetComponent <CustomText>();
     slotPriceText = transform.GetChild(1).GetComponent <CustomText>();
 }
        private void InitializeChatUI()
        {
            // Precache a pool of images objects that will be used for displaying emotes/badges later on
            imagePool = new ObjectPool <CustomImage>(0,
                                                     // FirstAlloc
                                                     null,
                                                     // OnAlloc
                                                     ((CustomImage image) =>
            {
                image.shadow.enabled = false;
            }),
                                                     // OnFree
                                                     ((CustomImage image) =>
            {
                image.material = null;
                image.enabled = false;
            })
                                                     );

            _lastFontName = ChatConfig.Instance.FontName;
            StartCoroutine(Drawing.Initialize(gameObject.transform));

            _lockedSprite = Utilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.LockedIcon.png");
            _lockedSprite.texture.wrapMode = TextureWrapMode.Clamp;
            _unlockedSprite = Utilities.LoadSpriteFromResources("EnhancedStreamChat.Resources.UnlockedIcon.png");
            _unlockedSprite.texture.wrapMode = TextureWrapMode.Clamp;

            _twitchChatCanvas            = gameObject.AddComponent <Canvas>();
            _twitchChatCanvas.renderMode = RenderMode.WorldSpace;
            var collider = gameObject.AddComponent <MeshCollider>();
            var scaler   = gameObject.AddComponent <CanvasScaler>();

            scaler.dynamicPixelsPerUnit     = Drawing.pixelsPerUnit;
            _canvasRectTransform            = _twitchChatCanvas.GetComponent <RectTransform>();
            _canvasRectTransform.localScale = new Vector3(0.012f * ChatConfig.Instance.ChatScale, 0.012f * ChatConfig.Instance.ChatScale, 0.012f * ChatConfig.Instance.ChatScale);

            background = new GameObject("EnhancedStreamChatBackground").AddComponent <Image>();
            background.rectTransform.SetParent(gameObject.transform, false);
            background.color = ChatConfig.Instance.BackgroundColor;
            background.rectTransform.pivot         = new Vector2(0, 0);
            background.rectTransform.sizeDelta     = new Vector2(ChatConfig.Instance.ChatWidth + ChatConfig.Instance.BackgroundPadding, 0);
            background.rectTransform.localPosition = new Vector3(0 - (ChatConfig.Instance.ChatWidth + ChatConfig.Instance.BackgroundPadding) / 2, 0, 0);

            var lockButtonGameObj = new GameObject("EnhancedStreamChatLockButton");

            lockButtonImage = lockButtonGameObj.AddComponent <Image>();
            lockButtonImage.preserveAspect          = true;
            lockButtonImage.rectTransform.sizeDelta = new Vector2(10, 10);
            lockButtonImage.rectTransform.SetParent(gameObject.transform, false);
            lockButtonImage.rectTransform.pivot = new Vector2(0, 0);
            lockButtonImage.color  = Color.white.ColorWithAlpha(0.05f);
            lockButtonImage.sprite = ChatConfig.Instance.LockChatPosition ? _lockedSprite : _unlockedSprite;
            lockButtonGameObj.AddComponent <Shadow>();

            chatMoverPrimitive = GameObject.CreatePrimitive(PrimitiveType.Cube);
            UnityEngine.Object.DontDestroyOnLoad(chatMoverPrimitive);
            _chatMoverCube = chatMoverPrimitive.transform;

            lockButtonPrimitive = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            UnityEngine.Object.DontDestroyOnLoad(lockButtonPrimitive);
            _lockButtonSphere            = lockButtonPrimitive.transform;
            _lockButtonSphere.localScale = new Vector3(0.15f * ChatConfig.Instance.ChatScale, 0.15f * ChatConfig.Instance.ChatScale, 0.001f);

            while (_chatMessages.Count < ChatConfig.Instance.MaxChatLines)
            {
                _chatMessages.Enqueue(Drawing.InitText("", Color.clear, ChatConfig.Instance.ChatScale, new Vector2(ChatConfig.Instance.ChatWidth, 1), new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 0), gameObject.transform, TextAnchor.UpperLeft, false));
            }

            var go = new GameObject();

            DontDestroyOnLoad(go);
            _testMessage         = Drawing.InitText("", Color.clear, ChatConfig.Instance.ChatScale, new Vector2(ChatConfig.Instance.ChatWidth, 1), new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 0), go.transform, TextAnchor.UpperLeft, true);
            _testMessage.enabled = false;
        }
Ejemplo n.º 30
0
 // Toewijzen waarden door middel van het verkrijgen van de bijbehorende componenten in de AppManager prefab.
 private void Awake()
 {
     customText = this.GetComponent <CustomText>();
     esp8266    = this.GetComponent <ESP8266>();
 }