Esempio n. 1
0
    private void FormatTextForDisplay(string modifiedText)
    {
        if (isPasswordField)
        {
            int  charLength          = modifiedText.Length;
            char passwordReplaceChar = (passwordChar.Length > 0) ? passwordChar[0] : '*';
            modifiedText = "";
            modifiedText = modifiedText.PadRight(charLength, passwordReplaceChar);
        }

        inputLabel.text = modifiedText;
        inputLabel.Commit();

        float actualLabelWidth = inputLabel.GetComponent <Renderer>().bounds.size.x / inputLabel.transform.lossyScale.x;

        while (actualLabelWidth > fieldLength)
        {
            modifiedText    = modifiedText.Substring(1, modifiedText.Length - 1);
            inputLabel.text = modifiedText;
            inputLabel.Commit();

            actualLabelWidth = inputLabel.GetComponent <Renderer>().bounds.size.x / inputLabel.transform.lossyScale.x;
        }

        if (modifiedText.Length == 0 && !listenForKeyboardText)
        {
            ShowDisplayText();
        }
        else
        {
            HideDisplayText();
        }
    }
 protected void Show_Internal(string message)
 {
     SetTransparency(0);
     textMesh.text = message;
     Timer         = FadeTimer;
     state         = WindowState.FadeIn;
     textMesh.GetComponent <Renderer>().enabled = true;
     window.GetComponent <Renderer>().enabled   = true;
 }
    IEnumerator _Coro_ViewHint(string ErroStr)
    {
        //Text_Hint.renderer.enabled = false;
        Text_Hint.GetComponent <Renderer>().enabled = true;
        Text_Hint.text = ErroStr;
        Text_Hint.Commit();
        yield return(new WaitForSeconds(3F));

        Text_Hint.GetComponent <Renderer>().enabled = false;
    }
Esempio n. 4
0
    void OnEnable()
    {
        Rd_AddTime.enabled = false;
        Text_AddTimeCountDown.GetComponent <Renderer>().enabled = false;

        mIsInputable          = true;
        GameMain.EvtInputKey += Handle_InputKey;

        if (CursorLocals != null && CursorLocals.Length != 0)
        {
            BackstageMain.Singleton.UpdateCursor(CursorLocals[mCurCursorIdx]);
        }
    }
Esempio n. 5
0
    private void FormatTextForDisplay(string modifiedText)
    {
        if (isPasswordField)
        {
            int  charLength          = modifiedText.Length;
            char passwordReplaceChar = (passwordChar.Length > 0) ? passwordChar[0] : '*';
            modifiedText = "";
            modifiedText = modifiedText.PadRight(charLength, passwordReplaceChar);
        }

        inputLabel.text = modifiedText;

        while (inputLabel.GetComponent <Renderer>().bounds.extents.x * 2 > fieldLength)
        {
            modifiedText    = modifiedText.Substring(1, modifiedText.Length - 1);
            inputLabel.text = modifiedText;
        }

        if (modifiedText.Length == 0 && !listenForKeyboardText)
        {
            ShowDisplayText();
        }
        else
        {
            HideDisplayText();
        }
    }
Esempio n. 6
0
    void Update()
    {
        if (m_point.dead)
        {
            m_popText.SetActive(false);
        }
        else
        {
            // Check if the mouse is hovering
            Vector3 hoverPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            if (GetComponent <Collider2D>().OverlapPoint(hoverPos))
            {
                SetOpen(true);
            }
            else
            {
                SetOpen(false);
            }

            tk2dTextMesh mesh = m_popText.GetComponent <tk2dTextMesh>();
            mesh.GetComponent <Renderer>().enabled = true;
            if (IsOpen())
            {
                mesh.text = "Population: " + m_point.population;
            }
            else
            {
                mesh.text = "" + m_point.population;
            }
            mesh.Commit();
        }
    }
        void DoSetFont()
        {
            if (_textMesh == null)
            {
                LogWarning("Missing tk2dTextMesh component: " + _textMesh.gameObject.name);
                return;
            }

            GameObject go = font.Value;

            if (go == null)
            {
                return;
            }

            tk2dFont _font = go.GetComponent <tk2dFont>();


            if (_font == null)
            {
                return;
            }

            _textMesh.font = _font.data;
            _textMesh.GetComponent <Renderer>().material = _font.material;
            _textMesh.Init(true);
        }
Esempio n. 8
0
    public void SetNum(int numScore)
    {
        if (numScore <= 0)
        {
            mRdPileCoin.enabled = false;
            Text_CoinNum.GetComponent <Renderer>().enabled = false;
            return;
        }

        int curStackHeightNum = Mathf.RoundToInt(CoinNumToPileNumCurve.Evaluate((float)numScore / 1000F));

        mRdPileCoin.enabled = true;
        Text_CoinNum.GetComponent <Renderer>().enabled = true;
        Text_CoinNum.text = numScore.ToString();
        Text_CoinNum.Commit();
        SliSpr_CoinNumBG.dimensions = new Vector2(10F + (10F * Text_CoinNum.NumDrawnCharacters()), 20F);

        Text_CoinNum.transform.localPosition = new Vector3(0F, OneCoinHeight * curStackHeightNum + OneCoinHeight * 0.02F, 0F);
        GO_PileCoin.transform.localScale     = new Vector3(1F, 0.0333333333333333F * curStackHeightNum, 1F);//��ͼ��30����. ���Ե������Ÿ߶���: 1/30 = 0.03333
    }
Esempio n. 9
0
        IEnumerator _Coro_Pileup()
        {
            IsRoleToHead = false;
            //Ani_PileTopCoin.Play(Ani_PileTopCoin.clipId);
            Ani_PileTopCoin.Play();
            Ani_PileTopCoin.GetComponent <Renderer>().enabled  = true;
            Text_CoinNum.GetComponent <Renderer>().enabled     = false;
            SliSpr_CoinNumBG.GetComponent <Renderer>().enabled = false;
            int currentNum = 0;

            while (true)
            {
                //上升
                TsPileCoin.localScale = new Vector3(1F, 0.0333333333333333F * currentNum, 1F);//贴图有30个币. 所以单币缩放高度是: 1/30 = 0.03333

                Ani_PileTopCoin.transform.localPosition = new Vector3(0F, OneCoinHeight * currentNum + OneCoinHeight * 0.02F, 0F);
                //Ani_PileTopCoin.Play(Ani_PileTopCoin.clipId);
                if (currentNum >= mNumToTop)
                {
                    Ani_PileTopCoin.GetComponent <Renderer>().enabled = false;
                    Text_CoinNum.transform.localPosition           = new Vector3(0F, OneCoinHeight * currentNum + OneCoinHeight * 0.25F, -0.05F);
                    Text_CoinNum.GetComponent <Renderer>().enabled = true;
                    Text_CoinNum.text = mCoinNum.ToString();
                    Text_CoinNum.Commit();

                    SliSpr_CoinNumBG.GetComponent <Renderer>().enabled = true;
                    yield return(new WaitForSeconds(PileUpViewTime));

                    IsRoleToHead = true;
                    if (EvtRoleToHead != null)
                    {
                        EvtRoleToHead(this);
                    }
                    //Destroy(gameObject);
                    yield break;
                }
                ++currentNum;

                yield return(new WaitForSeconds(PileUpOneCoinElapse));
            }
        }
Esempio n. 10
0
    public LanguageItem LI_TileCtrlCodeInput;//������������������
    //void OnEnable()
    public void Enter()
    {
        gameObject.SetActiveRecursively(true);
        //������ʾ������
        UpdateView();

        Text_ResultCode.GetComponent <Renderer>().enabled      = false;
        Text_ResultMsg.GetComponent <Renderer>().enabled       = false;
        Text_ResultInfo.GetComponent <Renderer>().enabled      = false;
        Text_ResultCountDown.GetComponent <Renderer>().enabled = false;

        Rd_PrintCodeSuccessHint.enabled   = false;
        Rd_PrintCodeSuccessHintBG.enabled = false;

        Ctrl_CodeInputer.gameObject.SetActiveRecursively(true);
        Ctrl_CodeInputer.EvtConfirm += Handle_InputConfirm;
        BackstageMain.Singleton.Cursor.gameObject.SetActiveRecursively(false);


        GameMain.Singleton.BSSetting.IsNeedPrintCodeAtGameStart.SetImmdiately(true);
    }
Esempio n. 11
0
    void OnEnable()
    {
        //mArenaStrs = new string[] { "С�ͳ���ר�ó���", "���ͳ���ר�ó���", "���ͳ���ר�ó���" };
        GameMain.EvtInputKey                  += Handle_InputKey;
        Box_Decoder.Ctrl_DecodeNum.Num         = 12;//12�
        Box_Decoder.Ctrl_DecodeNum.EvtConfirm += Handle_DecodeNumInputConfirm;

        if (CursorLocals != null && CursorLocals.Length != 0)
        {
            BackstageMain.Singleton.UpdateCursor(CursorLocals[mCurCursorIdx]);
        }
        BackStageSetting bs = GameMain.Singleton.BSSetting;

        //��ȡ��Ϣ
        Text_InsertCoinRatio.text = string.Format("1 {0:s} {1:d} {2:s}", BackstageMain.Singleton.Unit_Coin.CurrentText, bs.InsertCoinScoreRatio.Val, BackstageMain.Singleton.Unit_Score.CurrentText);//"1  " + bs.InsertCoinScoreRatio.Val.ToString();
        Text_InsertCoinRatio.Commit();

        Text_ArenaType.text = ArenaTexts[(int)bs.ArenaType_.Val].CurrentText;
        Text_ArenaType.Commit();

        Text_CodePrintDay.text = bs.CodePrintDay.Val.ToString() + "  " + BackstageMain.Singleton.Unit_Day.CurrentText;
        Text_CodePrintDay.Commit();

        System.DateTime now = System.DateTime.Now; //2009-01-01 00:00:00
        Text_SystemTime.text = string.Format("{0:d}-{1:d2}-{2:d2} {3:d2}:{4:d2}:{5:d2}"
                                             , now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
        Text_SystemTime.Commit();

        Text_IsViewCodeBeatSuccess.text = bs.IsViewCodebeatSuccess.Val ? ViewCodeBeatSuccessTexts[1].CurrentText:ViewCodeBeatSuccessTexts[0].CurrentText;
        Text_IsViewCodeBeatSuccess.Commit();


        Text_DeCodeSuccessInfo.GetComponent <Renderer>().enabled = false;
        Rd_DecodeSuccessBG.enabled = false;

        StartCoroutine("_Coro_TimeUpdateView");
    }
Esempio n. 12
0
    IEnumerator WaitForRequest()
    {
        WWW www = new WWW(url);

        yield return(www);

        // check for errors

        if (www.error == null)
        {
            ParseAccessData(www.text);
        }
        else
        {
            txtLoading.GetComponent <tk2dTextMesh>().text = "Not Connected";
        }
    }
    static void DoCreateTextMesh()
    {
        tk2dFontData fontData = null;
        Material     material = null;

        // Find reference in scene
        tk2dTextMesh dupeMesh = GameObject.FindObjectOfType(typeof(tk2dTextMesh)) as tk2dTextMesh;

        if (dupeMesh)
        {
            fontData = dupeMesh.font;
            material = dupeMesh.GetComponent <MeshRenderer>().sharedMaterial;
        }

        // Find in library
        if (fontData == null)
        {
            tk2dFont[] allFontData = tk2dEditorUtility.GetOrCreateIndex().GetFonts();
            foreach (var v in allFontData)
            {
                if (v.data != null)
                {
                    fontData = v.data;
                    material = fontData.material;
                }
            }
        }

        if (fontData == null)
        {
            EditorUtility.DisplayDialog("Create TextMesh", "Unable to create text mesh as no Fonts have been found.", "Ok");
            return;
        }

        GameObject   go       = tk2dEditorUtility.CreateGameObjectInScene("TextMesh");
        tk2dTextMesh textMesh = go.AddComponent <tk2dTextMesh>();

        textMesh.font = fontData;
        textMesh.text = "New TextMesh";
        textMesh.Commit();
        textMesh.GetComponent <MeshRenderer>().material = material;

        Selection.activeGameObject = go;
        Undo.RegisterCreatedObjectUndo(go, "Create TextMesh");
    }
Esempio n. 14
0
    public void OnSceneGUI()
    {
        tk2dTextMesh textMesh = (tk2dTextMesh)target;

        if (textMesh.formatting && textMesh.wordWrapWidth > 0)
        {
            DrawWordWrapSceneGUI(textMesh);
        }

        if (tk2dPreferences.inst.enableSpriteHandles == true)
        {
            MeshFilter meshFilter = textMesh.GetComponent <MeshFilter>();
            if (!meshFilter || meshFilter.sharedMesh == null)
            {
                return;
            }
            Transform t         = textMesh.transform;
            Bounds    b         = meshFilter.sharedMesh.bounds;
            Rect      localRect = new Rect(b.min.x, b.min.y, b.size.x, b.size.y);

            // Draw rect outline
            Handles.color = new Color(1, 1, 1, 0.5f);
            tk2dSceneHelper.DrawRect(localRect, t);

            Handles.BeginGUI();
            // Resize handles
            if (tk2dSceneHelper.RectControlsToggle())
            {
                EditorGUI.BeginChangeCheck();
                Rect resizeRect = tk2dSceneHelper.RectControl(132546, localRect, t);
                if (EditorGUI.EndChangeCheck())
                {
                    Vector3 newScale = new Vector3(textMesh.scale.x * (resizeRect.width / localRect.width),
                                                   textMesh.scale.y * (resizeRect.height / localRect.height));
                    float scaleMin = 0.001f;
                    if (textMesh.scale.x > 0.0f && newScale.x < scaleMin)
                    {
                        newScale.x = scaleMin;
                    }
                    if (textMesh.scale.x < 0.0f && newScale.x > -scaleMin)
                    {
                        newScale.x = -scaleMin;
                    }
                    if (textMesh.scale.y > 0.0f && newScale.y < scaleMin)
                    {
                        newScale.y = scaleMin;
                    }
                    if (textMesh.scale.y < 0.0f && newScale.y > -scaleMin)
                    {
                        newScale.y = -scaleMin;
                    }
                    if (newScale != textMesh.scale)
                    {
                        tk2dUndo.RecordObjects(new Object[] { t, textMesh }, "Resize");
                        float   factorX = (Mathf.Abs(textMesh.scale.x) > Mathf.Epsilon) ? (newScale.x / textMesh.scale.x) : 0.0f;
                        float   factorY = (Mathf.Abs(textMesh.scale.y) > Mathf.Epsilon) ? (newScale.y / textMesh.scale.y) : 0.0f;
                        Vector3 offset  = new Vector3(resizeRect.xMin - localRect.xMin * factorX,
                                                      resizeRect.yMin - localRect.yMin * factorY, 0.0f);
                        Vector3 newPosition = t.TransformPoint(offset);
                        if (newPosition != t.position)
                        {
                            t.position = newPosition;
                        }
                        textMesh.scale = newScale;
                        textMesh.Commit();
                        EditorUtility.SetDirty(textMesh);
                    }
                }
            }
            // Rotate handles
            if (!tk2dSceneHelper.RectControlsToggle())
            {
                EditorGUI.BeginChangeCheck();
                float theta = tk2dSceneHelper.RectRotateControl(645231, localRect, t, new List <int>());
                if (EditorGUI.EndChangeCheck())
                {
                    if (Mathf.Abs(theta) > Mathf.Epsilon)
                    {
                        tk2dUndo.RecordObject(t, "Rotate");
                        t.Rotate(t.forward, theta, Space.World);
                    }
                }
            }
            Handles.EndGUI();

            // Sprite selecting
            tk2dSceneHelper.HandleSelectSprites();

            // Move targeted sprites
            tk2dSceneHelper.HandleMoveSprites(t, localRect);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Esempio n. 15
0
    void UpdateCursor()
    {
        if (mIsEditing)
        {
            StopCoroutine("_Coro_CursorFlash");
            Text_Cursor.GetComponent <Renderer>().enabled = false;


            string strFront   = "";
            string strCurrent = "";
            string strBack    = "";
            for (int i = 0; i != mNumEdited; ++i)
            {
                if (i < mIdxCursor)//ǰ���ַ�
                {
                    strFront   += mDigits[i].ToString();
                    strCurrent += ' ';
                    strBack    += ' ';
                }
                else if (i > mIdxCursor)//�����ַ�
                {
                    strBack += mDigits[i].ToString();
                }
                else//���ڱ༭���ַ�
                {
                    strCurrent += mDigits[i].ToString();
                    strBack    += ' ';
                }
            }

            Text_ViewFront.text = strFront;
            Text_ViewFront.Commit();
            Text_ViewCurrent.text = strCurrent.ToString();
            Text_ViewCurrent.Commit();
            Text_ViewBack.text = strBack;
            Text_ViewBack.Commit();
            StopCoroutine("_Coro_DigitFlash");
            StartCoroutine("_Coro_DigitFlash", Text_ViewCurrent.GetComponent <Renderer>());
        }
        else
        {
            Text_Cursor.GetComponent <Renderer>().enabled = true;
            string cursorStr = new string(' ', mIdxCursor);
            cursorStr       += '-';
            Text_Cursor.text = cursorStr;
            Text_Cursor.Commit();
            StopCoroutine("_Coro_CursorFlash");
            StartCoroutine("_Coro_CursorFlash", Text_Cursor.GetComponent <Renderer>());

            StopCoroutine("_Coro_DigitFlash");
            Text_ViewCurrent.GetComponent <Renderer>().enabled = true;
            string strAll = "";
            for (int i = 0; i != mNumEdited; ++i)
            {
                strAll += mDigits[i].ToString();
            }
            Text_ViewFront.text = strAll;
            Text_ViewFront.Commit();
            Text_ViewBack.text = "";
            Text_ViewBack.Commit();
            Text_ViewCurrent.text = "";
            Text_ViewCurrent.Commit();
        }
    }