void Awake()
 {
     tmpro    = GetComponent <TMPro.TextMeshPro>();
     uiText   = GetComponent <UnityEngine.UI.Text>();
     textMesh = GetComponent <TextMesh>();
     CustomLog.OnLogUpdate += LogUpdate;
 }
Example #2
0
        public void Notify(string Text, int notificationNo, string textureName = null, float showtime=3)
        {
           
            time = showtime;
            this.notificationNo = notificationNo;
            if (tmpro==null)
            {
                tmpro = GetComponentInChildren<TMPro.TextMeshPro>();
            }
            if (tmpro != null)
            {
                tmpro.text = Text;
                transform.position = Camera.main.transform.position + Camera.main.transform.forward * Slam.Instance.DeviceManager.PresentationDistanceCorrection;
            }
            if(textureName != null)
            {
                var imgCubeT = transform.Find("imgCube");
                if (imgCubeT != null)
                {
                    imgCube = imgCubeT.gameObject;
                
                    Renderer renderer = imgCube.GetComponent<Renderer>();
                    renderer.material.mainTexture = Resources.Load(textureName, typeof(Texture2D)) as Texture2D;
                }

            }
        }
 public static void resetOverlays()
 {
     hideBlackBG();
     hideInfoOverlay();
     hideRoleOverlay();
     UnityEngine.Object.Destroy(meetingUnderlay);
     UnityEngine.Object.Destroy(infoUnderlay);
     UnityEngine.Object.Destroy(infoOverlayRules);
     UnityEngine.Object.Destroy(infoOverlayRoles);
     UnityEngine.Object.Destroy(roleUnderlay);
     if (roleOverlayList != null)
     {
         foreach (var roleOverlay in roleOverlayList)
         {
             UnityEngine.Object.Destroy(roleOverlay);
         }
     }
     meetingUnderlay  = infoUnderlay = null;
     infoOverlayRules = infoOverlayRoles = null;
     overlayShown     = false;
     roleUnderlay     = null;
     roleOverlayList  = null;
     rolePage         = 0;
     maxRolePage      = 0;
     roleDatas        = null;
 }
Example #4
0
        private void InitPlayer(string name)
        {
            // Set player's name
            gameObject.name = name;
            var label = NetUtils.Find(gameObject, "Top/Label");

            if (label != null)
            {
                if (!photonView.isMine)
                {
                    TMPro.TextMeshPro text = label.GetComponent <TMPro.TextMeshPro>();
                    if (text != null)
                    {
                        text.text = name;
                    }
                }
                else
                {
                    // We deactivate the label because we don't show a label on our own local avatar
                    label.SetActive(false);
                }
            }
            var icon = NetUtils.Find(gameObject, "Top/Icon");

            if (icon != null && photonView.isMine)
            {
                // We deactivate the icon because we don't show a speaker icon on our own local avatar
                icon.SetActive(false);
            }
        }
Example #5
0
        public static void updateGhostInfo()
        {
            foreach (PlayerControl p in PlayerControl.AllPlayerControls)
            {
                if (p != PlayerControl.LocalPlayer && !PlayerControl.LocalPlayer.Data.IsDead)
                {
                    continue;
                }

                Transform         playerGhostInfoTransform = p.transform.FindChild("GhostInfo");
                TMPro.TextMeshPro playerGhostInfo          = playerGhostInfoTransform != null?playerGhostInfoTransform.GetComponent <TMPro.TextMeshPro>() : null;

                if (playerGhostInfo == null)
                {
                    playerGhostInfo = UnityEngine.Object.Instantiate(p.nameText, p.nameText.transform.parent);
                    playerGhostInfo.transform.localPosition += Vector3.up * 0.25f;
                    playerGhostInfo.fontSize       *= 0.75f;
                    playerGhostInfo.gameObject.name = "GhostInfo";
                }

                PlayerVoteArea playerVoteArea            = MeetingHud.Instance?.playerStates?.FirstOrDefault(x => x.TargetPlayerId == p.PlayerId);
                Transform      meetingGhostInfoTransform = playerVoteArea != null?playerVoteArea.transform.FindChild("GhostInfo") : null;

                TMPro.TextMeshPro meetingGhostInfo = meetingGhostInfoTransform != null?meetingGhostInfoTransform.GetComponent <TMPro.TextMeshPro>() : null;

                if (meetingGhostInfo == null && playerVoteArea != null)
                {
                    meetingGhostInfo = UnityEngine.Object.Instantiate(playerVoteArea.NameText, playerVoteArea.NameText.transform.parent);
                    meetingGhostInfo.transform.localPosition += Vector3.down * (MeetingHud.Instance.playerStates.Length > 10 ? 0.4f : 0.25f);
                    meetingGhostInfo.fontSize       *= 0.75f;
                    meetingGhostInfo.gameObject.name = "GhostInfo";
                }

                var(tasksCompleted, tasksTotal) = TasksHandler.taskInfo(p.Data);
                string roleNames = String.Join(", ", RoleInfo.getRoleInfoForPlayer(p).Select(x => Helpers.cs(x.color, x.name)).ToArray());
                string taskInfo  = tasksTotal > 0 ? $"<color=#FAD934FF>({tasksCompleted}/{tasksTotal})</color>" : "";

                string info = "";
                if (p == PlayerControl.LocalPlayer || (MapOptions.ghostsSeeRoles && MapOptions.ghostsSeeTasks))
                {
                    info = $"{roleNames} {taskInfo}".Trim();
                }
                else if (MapOptions.ghostsSeeTasks)
                {
                    info = $"{taskInfo}".Trim();
                }
                else if (MapOptions.ghostsSeeRoles)
                {
                    info = $"{roleNames}";
                }

                playerGhostInfo.text = info;
                playerGhostInfo.gameObject.SetActive(p.Visible);
                if (meetingGhostInfo != null)
                {
                    meetingGhostInfo.text = MeetingHud.Instance.state == MeetingHud.VoteStates.Results ? "" : info;
                }
            }
        }
Example #6
0
 public static void ResetData()
 {
     if (TimeRemaining != null)
     {
         UnityEngine.Object.Destroy(TimeRemaining);
         TimeRemaining = null;
     }
 }
Example #7
0
    public void ReplaceTextMeshPro(TMPro.TextMeshPro newValue)
    {
        var index     = GameComponentsLookup.TextMeshPro;
        var component = (Code.Scenes.BattleScene.ECS.Components.Game.ViewComponents.TextMeshProComponent)CreateComponent(index, typeof(Code.Scenes.BattleScene.ECS.Components.Game.ViewComponents.TextMeshProComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Example #8
0
        public override void FixedUpdate()
        {
            if (player == PlayerControl.LocalPlayer)
            {
                currentTarget = setTarget();
                setPlayerOutline(currentTarget, BomberA.color);
                arrowUpdate();

                foreach (PoolablePlayer pp in MapOptions.playerIcons.Values)
                {
                    pp.gameObject.SetActive(false);
                }
                foreach (PoolablePlayer pp in playerIcons.Values)
                {
                    pp.gameObject.SetActive(false);
                }
                if (player.isAlive() && BomberA.isAlive())
                {
                    if (bombTarget != null && MapOptions.playerIcons.ContainsKey(bombTarget.PlayerId) && MapOptions.playerIcons[bombTarget.PlayerId].gameObject != null)
                    {
                        var     icon       = MapOptions.playerIcons[bombTarget.PlayerId];
                        Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                        icon.gameObject.SetActive(true);
                        icon.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0);
                        icon.transform.localScale    = Vector3.one * 0.4f;
                        if (targetText == null)
                        {
                            targetText = GameObject.Instantiate(icon.NameText, icon.NameText.transform.parent);
                            targetText.enableWordWrapping       = false;
                            targetText.transform.localScale     = Vector3.one * 1.5f;
                            targetText.transform.localPosition += new Vector3(0f, 1.7f, 0);
                        }
                        targetText.text = ModTranslation.getString("bomberTarget");
                        targetText.gameObject.SetActive(true);
                        targetText.transform.parent = icon.gameObject.transform;
                    }
                    // 相方の設置したターゲットを表示する
                    if (BomberA.bombTarget != null && playerIcons.ContainsKey(BomberA.bombTarget.PlayerId) && playerIcons[BomberA.bombTarget.PlayerId].gameObject != null)
                    {
                        var     icon       = playerIcons[BomberA.bombTarget.PlayerId];
                        Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                        icon.gameObject.SetActive(true);
                        icon.transform.localPosition = bottomLeft + new Vector3(1.0f, 0f, 0);
                        icon.transform.localScale    = Vector3.one * 0.4f;
                        if (partnerTargetText == null)
                        {
                            partnerTargetText = GameObject.Instantiate(icon.NameText, icon.NameText.transform.parent);
                            partnerTargetText.enableWordWrapping       = false;
                            partnerTargetText.transform.localScale     = Vector3.one * 1.5f;
                            partnerTargetText.transform.localPosition += new Vector3(0f, 1.7f, 0);
                        }
                        partnerTargetText.text = ModTranslation.getString("bomberPartnerTarget");
                        partnerTargetText.gameObject.SetActive(true);
                        partnerTargetText.transform.parent = icon.gameObject.transform;
                    }
                }
            }
        }
Example #9
0
        public void Initialize()
        {
            LocalizationManager.OnChangeLocalization += OnChangeLocalization;

            UiText          = gameObject.GetComponent <Text>();
            MeshText        = gameObject.GetComponent <TextMesh>();
            MeshTextPro     = gameObject.GetComponent <TMPro.TextMeshPro>();
            MeshTextProUGUI = gameObject.GetComponent <TMPro.TextMeshProUGUI>();

            OnChangeLocalization();
        }
Example #10
0
 public static void Clear()
 {
     bombTarget        = null;
     currentTarget     = null;
     tmpTarget         = null;
     arrows            = new List <Arrow>();
     players           = new List <BomberB>();
     playerIcons       = new Dictionary <byte, PoolablePlayer>();
     targetText        = null;
     partnerTargetText = null;
 }
Example #11
0
 private static void initializeRoleOverlay(TMPro.TextMeshPro roleOverlay)
 {
     roleOverlay.maxVisibleLines       = 29;
     roleOverlay.fontSize              = roleOverlay.fontSizeMin = roleOverlay.fontSizeMax = 1.15f;
     roleOverlay.autoSizeTextContainer = false;
     roleOverlay.enableWordWrapping    = false;
     roleOverlay.alignment             = TMPro.TextAlignmentOptions.TopLeft;
     roleOverlay.transform.position    = Vector3.zero;
     roleOverlay.transform.localScale  = Vector3.one;
     roleOverlay.color   = Palette.White;
     roleOverlay.enabled = false;
 }
Example #12
0
 /// <summary>
 /// Sets the field name, which is the key to use in the localized text table.
 /// By default, the field name is the initial value of the Text component.
 /// </summary>
 /// <param name="fieldName"></param>
 public override void UpdateFieldName(string newFieldName = "")
 {
     if (textMeshPro == null)
     {
         textMeshPro = GetComponent <TMPro.TextMeshPro>();
     }
     if (textMeshProUGUI == null)
     {
         textMeshProUGUI = GetComponent <TMPro.TextMeshProUGUI>();
     }
     fieldName = !string.IsNullOrEmpty(newFieldName) ? newFieldName
         : ((textMeshPro != null) ? textMeshPro.text : ((textMeshProUGUI != null) ? textMeshProUGUI.text : string.Empty));
 }
Example #13
0
        public static void ResetData()
        {
            adminTimer = 0f;
            if (TimeRemaining != null)
            {
                UnityEngine.Object.Destroy(TimeRemaining);
                TimeRemaining = null;
            }

            if (OutOfTime != null)
            {
                UnityEngine.Object.Destroy(OutOfTime);
                OutOfTime = null;
            }
        }
Example #14
0
        public static void GiveUniqueAppearances(SteamId userID, Transform root, TMPro.TextMeshPro text)
        {
            Color32 DevRed   = new Color32(230, 0, 10, 255);
            Color32 AquaBlue = new Color32(64, 224, 208, 255);
            Color32 LGPurple = new Color32(155, 89, 182, 255);

            // Someone Somewhere
            if (userID == 76561198078346603)
            {
                GameObject crownObj = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/Neck_01SHJnt/Neck_02SHJnt/Neck_TopSHJnt/Head_Crown").gameObject;
                //GameObject glassesObj = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/Neck_01SHJnt/Neck_02SHJnt/Neck_TopSHJnt/Head_Glasses").gameObject;
                crownObj.SetActive(true);
                //glassesObj.SetActive(true);

                text.color = DevRed;
            }

            // zCubed
            if (userID == 76561198078927044)
            {
                text.color = DevRed;
            }

            //Maranara
            if (userID == 76561198088708478)
            {
                root.parent.parent.parent.Find("geoGrp/brett_body").GetComponent <SkinnedMeshRenderer>().materials[1].color = new Color(0.5141f, 1, 0.6199f);
                GameObject weaponWings = PlayerRep.fordBundle.LoadAsset("Assets/WeaponWings.prefab").Cast <GameObject>();
                if (weaponWings == null)
                {
                    MelonLogger.LogError("Failed to load WeaponWings from bundle.");
                }
                else
                {
                    GameObject wingInstance = GameObject.Instantiate(weaponWings);
                    wingInstance.transform.parent           = root.Find("Spine_01SHJnt");
                    wingInstance.transform.localPosition    = Vector3.zero;
                    wingInstance.transform.localEulerAngles = new Vector3(-0.042f, 0.057f, 30.129f);
                }
                text.color = DevRed;
            }

            // Camobiwon
            if (userID == 76561198060337335)
            {
                text.color = LGPurple;
            }
        }
Example #15
0
 private static void ClearTimerText()
 {
     if (AdminTimerText != null)
     {
         UnityEngine.Object.Destroy(AdminTimerText);
     }
     AdminTimerText = null;
     if (CamerasTimerText != null)
     {
         UnityEngine.Object.Destroy(CamerasTimerText);
     }
     CamerasTimerText = null;
     if (VitalsTimerText != null)
     {
         UnityEngine.Object.Destroy(VitalsTimerText);
     }
     VitalsTimerText = null;
 }
Example #16
0
        private IEnumerator FadeIn(TMPro.TextMeshPro textMeshPro)
        {
            if (textMeshPro == null)
            {
                yield break;
            }
            var startTime = Time.time;
            var endTime   = startTime + fadeInDuration;

            while (Time.time < endTime)
            {
                var elapsed = Time.time - startTime;
                var a       = originalColor.a * (elapsed / fadeInDuration);
                textMeshPro.color = new Color(originalColor.r, originalColor.b, originalColor.g, a);
                yield return(null);
            }
            textMeshPro.color = originalColor;
        }
Example #17
0
            static void Postfix(VitalsMinigame __instance)
            {
                vitalsTimer = 0f;

                if (Hacker.hacker != null && PlayerControl.LocalPlayer == Hacker.hacker)
                {
                    hackerTexts = new List <TMPro.TextMeshPro>();
                    foreach (VitalsPanel panel in __instance.vitals)
                    {
                        TMPro.TextMeshPro text = UnityEngine.Object.Instantiate(__instance.SabText, panel.transform);
                        hackerTexts.Add(text);
                        UnityEngine.Object.DestroyImmediate(text.GetComponent <AlphaBlink>());
                        text.gameObject.SetActive(false);
                        text.transform.localScale    = Vector3.one * 0.75f;
                        text.transform.localPosition = new Vector3(-0.75f, -0.23f, 0f);
                    }
                }
            }
        private GameObject CreateLabel(
            int id,
            string text,
            string fontName,
            float fontSize,
            TMPro.FontStyles fontStyle,
            TMPro.TextAlignmentOptions alignment,
            Transform labelTransform,
            Vector3 labelPositionOffset,
            Quaternion labelRotationOffset,
            Vector2 rectPivot,
            Vector2 rectSize)
        {
            string labelName = internalProp.name + "-" + internalProp.propID + "-" + id;

            GameObject labelGameObject = new GameObject(labelName);

            labelGameObject.layer = 20;
            labelGameObject.transform.SetParent(labelTransform);

            TMPro.TextMeshPro tmpLabel = labelGameObject.AddComponent <TMPro.TextMeshPro>();
            tmpLabel.SetText(text);
            tmpLabel.fontSize  = fontSize;
            tmpLabel.fontStyle = fontStyle;
            tmpLabel.alignment = alignment;

            tmpLabel.rectTransform.pivot         = rectPivot;
            tmpLabel.rectTransform.localPosition = labelPositionOffset;
            tmpLabel.rectTransform.localRotation = labelRotationOffset;
            tmpLabel.rectTransform.sizeDelta     = rectSize;

            // find and set font
            TMPro.TMP_FontAsset tmpFont = AssetLoader.Instance.GetFont(fontName);
            if (tmpFont != null)
            {
                tmpLabel.font = tmpFont;
            }
            else
            {
                Utils.LogWarning("KVR_DigitalIndicator font not found!");
            }

            return(labelGameObject);
        }
Example #19
0
        /// <summary>
        /// setup
        /// </summary>
        public override void Awake()
        {
            _textComponent = GetComponent <UnityEngine.UI.Text>();
#if TEXTMESH_PRO
            if (_textComponent == null)
            {
                _textMeshProUGUI = GetComponent <TMPro.TextMeshProUGUI>();
                if (_textMeshProUGUI == null)
                {
                    _textMeshPro = GetComponent <TMPro.TextMeshPro>();
                    if (_textMeshPro == null)
                    {
                        MyDebug.LogErrorF("LocaliseText: No text or TextMesh Pro component found on {0}", gameObject.name);
                    }
                }
            }
#else
            if (_textComponent == null)
            {
                Debug.LogErrorFormat("LocaliseText: No text component found on {0}", gameObject.name);
            }
#endif


            // If no localization key has been specified, use the text value as the key
            if (string.IsNullOrEmpty(Key))
            {
                if (_textComponent != null)
                {
                    Key = _textComponent.text;
                }
#if TEXTMESH_PRO
                if (_textMeshProUGUI != null)
                {
                    Key = _textMeshProUGUI.text;
                }
                if (_textMeshPro != null)
                {
                    Key = _textMeshPro.text;
                }
#endif
            }
            base.Awake();
        }
Example #20
0
 public void Awake()
 {
     if (textMeshPro == null && textMeshProUGUI == null)
     {
         textMeshPro = GetComponentInChildren <TMPro.TextMeshPro>();
         if (textMeshPro == null)
         {
             textMeshProUGUI = GetComponentInChildren <TMPro.TextMeshProUGUI>();
         }
     }
     if (textMeshPro == null && textMeshProUGUI == null)
     {
         if (DialogueDebug.LogWarnings)
         {
             Debug.LogWarning("Dialogue System: Assign a TextMeshPro component to the TextMeshProBarkUI on " + name, this);
         }
         enabled = false;
     }
 }
Example #21
0
        private IEnumerator FadeOut(TMPro.TextMeshPro textMeshPro)
        {
            if (textMeshPro == null)
            {
                yield break;
            }
            textMeshPro.gameObject.SetActive(true);
            var startTime = Time.time;
            var endTime   = startTime + fadeOutDuration;

            while (Time.time < endTime)
            {
                var elapsed = fadeOutDuration - (Time.time - startTime);
                var a       = originalColor.a * (elapsed / fadeOutDuration);
                textMeshPro.color = new Color(originalColor.r, originalColor.b, originalColor.g, a);
                yield return(null);
            }
            textMeshPro.color = originalColor;
            textMeshPro.gameObject.SetActive(false);
        }
Example #22
0
        private void Update()
        {
            string displayText = "" + StateManager.Instance.editModes[StateManager.Instance.editMode] + " ";

            if (StateManager.Instance.controlledObject != null)
            {
                StateManager.Instance.controlledObject.transform.position  += StateManager.Instance.direction;
                StateManager.Instance.controlledObject.transform.localScale = StateManager.Instance.controlledObject.transform.localScale * StateManager.Instance.scaleDirection;
                if (StateManager.Instance.rotationEnabled)
                {
                    StateManager.Instance.controlledObject.transform.rotation = transform.rotation * StateManager.Instance.deltaRotation; // set in line with controller
                }


                displayText += StateManager.Instance.controlledObject.name;

                if (StateManager.Instance.moveEnabled)
                {
                    StateManager.Instance.controlledObject.transform.position = transform.position - StateManager.Instance.moveDelta;
                }
            }

            if (StateManager.Instance.controlledObject == null && StateManager.Instance.instatiateObject != null)
            {
                displayText += StateManager.Instance.instatiateObject.name;
            }

            TMPro.TextMeshPro textmeshPro = GameObject.Find("EditModeState").GetComponent <TMPro.TextMeshPro>();
            textmeshPro.SetText(displayText);

            for (int count = 0; count < StateManager.Instance.editModeIndicator.Length; count++)
            {
                StateManager.Instance.editModeIndicator[count].SetActive(false);
            }
            StateManager.Instance.editModeIndicator[StateManager.Instance.editMode].SetActive(true);

            if (StateManager.Instance.updateView)
            {
                StateManager.Instance.updateView = false; setSelectedObject();
            }
        }
Example #23
0
        public static GameObject GeneratePlayerIconAbstract(Player p, GameObject prefab)
        {
            GameObject obj = PlayerIcon.CreatePlayerIcon(p, prefab);

            // Set Background color
            var            child     = obj.transform.GetChild(0).gameObject;
            SpriteRenderer renderer  = child.GetComponent <SpriteRenderer>();
            string         c0        = p.IsHome ? FFB.Instance.Settings.Color.HomeColor : FFB.Instance.Settings.Color.AwayColor;
            bool           parseable = ColorUtility.TryParseHtmlString(c0, out Color c1);

            if (parseable)
            {
                renderer.color = c1;
            }
            ;

            // Set text
            TMPro.TextMeshPro text = obj.GetComponentInChildren <TMPro.TextMeshPro>();
            text.text = p.Position?.AbstractLabel ?? "*";
            return(obj);
        }
        private void CreateLink(Anchor one, Anchor two)
        {
            GameObject   s  = new GameObject();
            LineRenderer lr = s.AddComponent <LineRenderer>();

            lr.SetPositions(
                new Vector3[] { one.transform.position,
                                two.transform.position });
            lr.widthMultiplier = 0.13f;
            lr.material        = mat_line;

            GameObject ts = new GameObject();

            TMPro.TextMeshPro tsp = ts.AddComponent <TMPro.TextMeshPro>();
            tsp.fontSize           = 10;
            tsp.transform.position = ((one.transform.position - two.transform.position) / 2) + two.transform.position;
            tsp.transform.rotation = Quaternion.Euler(-90, 0, 0);
            float distance = (one.transform.position - two.transform.position).magnitude;

            tsp.text = "" + distance;
        }
Example #25
0
        static StackObject *Add_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            TMPro.TextMeshPro @value = (TMPro.TextMeshPro) typeof(TMPro.TextMeshPro).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @key = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Collections.Generic.Dictionary <System.Int32, TMPro.TextMeshPro> instance_of_this_method = (System.Collections.Generic.Dictionary <System.Int32, TMPro.TextMeshPro>) typeof(System.Collections.Generic.Dictionary <System.Int32, TMPro.TextMeshPro>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Add(@key, @value);

            return(__ret);
        }
Example #26
0
        public static void GiveUniqueAppearances(SteamId userID, Transform root, TMPro.TextMeshPro text)
        {
            Color32 DevRed   = new Color32(230, 0, 10, 255);
            Color32 AquaBlue = new Color32(64, 224, 208, 255);
            Color32 LGPurple = new Color32(155, 89, 182, 255);

            // Someone Somewhere
            if (userID == 76561198078346603)
            {
                GameObject crownObj = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/Neck_01SHJnt/Neck_02SHJnt/Neck_TopSHJnt/Head_Crown").gameObject;
                //GameObject glassesObj = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/Neck_01SHJnt/Neck_02SHJnt/Neck_TopSHJnt/Head_Glasses").gameObject;
                crownObj.SetActive(true);
                //glassesObj.SetActive(true);

                text.color = DevRed;
            }

            // zCubed
            if (userID == 76561198078927044)
            {
                text.color = DevRed;
            }

            // Aqua
            if (userID == 76561198383037191)
            {
                //GameObject hlLogo = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/HL_Logo").gameObject;
                //GameObject hlId = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/HL_ID").gameObject;
                GameObject helmetObj = root.Find("Spine_01SHJnt/Spine_02SHJnt/Spine_TopSHJnt/Neck_01SHJnt/Neck_02SHJnt/Neck_TopSHJnt/Head_Helmet").gameObject;
                helmetObj.SetActive(true);

                text.color = AquaBlue;
            }

            // Camobiwon
            if (userID == 76561198060337335)
            {
                text.color = LGPurple;
            }
        }
Example #27
0
        private void InitPlayer(string name)
        {
            // Set player's name
            gameObject.name = name;
            var label = NetUtils.Find(gameObject, "Top/Label");

            if (label != null)
            {
                if (!photonView.isMine)
                {
                    TMPro.TextMeshPro text = label.GetComponent <TMPro.TextMeshPro>();
                    if (text != null)
                    {
                        text.text = name;
                    }
                }
                else
                {
                    label.SetActive(false);
                }
            }
        }
        private void CreateLabels()
        {
            // font style (bold, italics, etc)
            TMPro.FontStyles labelDisplayFontStyle = TMPro.FontStyles.Normal;
            bool             success = moduleConfigNode.TryGetEnum("labelDisplayFontStyle",
                                                                   ref labelDisplayFontStyle, TMPro.FontStyles.Normal);

            // label
            GameObject labelTextGameObject = CreateLabel(
                0, labelDisplayText, labelDisplayFont, labelDisplayFontSize, labelDisplayFontStyle,
                TMPro.TextAlignmentOptions.TopLeft, labelDisplayGameObject.transform,
                labelDisplayOffset, Quaternion.identity, labelDisplayPivot, labelDisplaySize);

            labelDisplayTextLabel = labelDisplayGameObject.GetComponent <TMPro.TextMeshPro>();

            // digit display
            GameObject displayTextGameObject = CreateLabel(
                1, "0.0", digitDisplayFont, digitDisplayFontSize, TMPro.FontStyles.Normal,
                TMPro.TextAlignmentOptions.TopLeft, digitDisplayGameObject.transform,
                digitDisplayOffset, Quaternion.identity, digitDisplayPivot, digitDisplaySize);

            digitDisplayTextLabel = displayTextGameObject.GetComponent <TMPro.TextMeshPro>();
        }
Example #29
0
        /// <summary>
        /// setup
        /// </summary>
        public void Awake()
        {
            _textComponent = GetComponent <UnityEngine.UI.Text>();

            if (_textComponent == null)
            {
                _textMeshProUGUI = GetComponent <TMPro.TextMeshProUGUI>();
                if (_textMeshProUGUI == null)
                {
                    _textMeshPro = GetComponent <TMPro.TextMeshPro>();
                    if (_textMeshPro == null)
                    {
                        Debug.LogError("LocaliseText: No text or TextMesh Pro component found on" + this.gameObject.name);
                    }
                }
            }



            // If no localization key has been specified, use the text value as the key
            if (string.IsNullOrEmpty(Key))
            {
                if (_textComponent != null)
                {
                    Key = _textComponent.text;
                }

                if (_textMeshProUGUI != null)
                {
                    Key = _textMeshProUGUI.text;
                }
                if (_textMeshPro != null)
                {
                    Key = _textMeshPro.text;
                }
            }
        }
Example #30
0
        protected GameObject CreateLabel(
            string gameObjectName,
            string text,
            TMPro.TMP_FontAsset font,
            float fontSize,
            TMPro.FontStyles fontStyle,
            TMPro.TextAlignmentOptions textAlignment,
            Transform parentTransform,
            Vector3 positionOffset,
            Quaternion rotationOffset,
            Vector2 rectPivot,
            Vector2 rectSize)
        {
            GameObject labelGameObject = new GameObject(gameObjectName);

            labelGameObject.layer = 20;
            labelGameObject.transform.SetParent(parentTransform);

            TMPro.TextMeshPro tmpLabel = labelGameObject.AddComponent <TMPro.TextMeshPro>();
            tmpLabel.SetText(text);
            tmpLabel.fontSize  = fontSize;
            tmpLabel.fontStyle = fontStyle;
            tmpLabel.alignment = textAlignment;

            tmpLabel.rectTransform.pivot         = rectPivot;
            tmpLabel.rectTransform.localPosition = positionOffset;
            tmpLabel.rectTransform.localRotation = rotationOffset;
            tmpLabel.rectTransform.sizeDelta     = rectSize;

            // find and set font
            if (font != null)
            {
                tmpLabel.font = font;
            }

            return(labelGameObject);
        }