Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     guiStyle                = new GUIStyle();
     guiStyle.fontSize       = 30;
     guiStyleState           = new GUIStyleState();
     guiStyleState.textColor = Color.black;        //Color.white;
     guiStyle.normal         = guiStyleState;
 }
Exemplo n.º 2
0
 private static void ResetDeprecatedBackgroundImage(GUIStyleState state)
 {
     state.background = null;
     if (state.scaledBackgrounds != null && state.scaledBackgrounds.Length >= 1)
     {
         state.scaledBackgrounds[0] = null;
     }
 }
Exemplo n.º 3
0
        ///<summary>パーツラベル描画</summary>
        void DrawPartsLabel()
        {
            List <enPartsType> drawList = BasePosition.GenGetZSortList(sendMotion_.stPassive.isLeft, sendMotion_.stPassive.isBack);

            foreach (var item in drawList)
            {
                DrawParts(item, false);
            }

            const int MAG = 5;

            foreach (var item in drawList)
            {
                PartsObject partsObject = GetPartsObject(item);

                Vector2 pos = partsObject.pos;
                pos.y = -pos.y;                 //上下反転
                //bool mirror = partsObject.partsTransform.mirror;
                Sprite sp = parent_.GetSprite(item, sendMotion_.stPassive.isBack, sendMotion_.stPassive.faceNo);

                if (sp == null)
                {
                    break;
                }

                Vector2 basepos = new Vector2(-sp.pivot.x, +sp.pivot.y - sp.rect.height);
                //Vector2 size = new Vector2(sp.rect.width, sp.rect.height);

                Vector2 labelpos = new Vector2(128, 256) / MAG;
                Vector2 drawPos  = (basepos + labelpos + pos);
                // GUIの見た目を変える。
                GUIStyle      guiStyle   = new GUIStyle();
                GUIStyleState styleState = new GUIStyleState();

                string vecstr = "";
                if (isSabunPos_)
                {
                    // テキストの色を設定
                    styleState.textColor = Color.yellow;
                    vecstr = "(" + ((int)(sendMotion_.stPos.GetPos(item).x)).ToString() + "," + ((int)(sendMotion_.stPos.GetPos(item).y)).ToString() + ")";
                }
                else
                {
                    // テキストの色を設定
                    styleState.textColor = Color.white;
                    vecstr = "(" + ((int)(drawPos.x)).ToString() + "," + ((int)(drawPos.y)).ToString() + ")";
                }

                // スタイルの設定。
                guiStyle.normal    = styleState;
                guiStyle.alignment = TextAnchor.MiddleCenter;

                Vector2 labelPos  = new Vector2(drawPos.x, drawPos.y);
                Rect    labelRect = new Rect(labelPos * MAG, new Vector2(sp.rect.width, sp.rect.height) * MAG);

                GUI.Label(labelRect, vecstr, guiStyle);
            }
        }
Exemplo n.º 4
0
 private void Start()
 {
     this.style = new GUIStyle();
     this.style.set_fontSize(20);
     this.styleState = new GUIStyleState();
     this.styleState.set_textColor(new Color(1f, 1f, 1f));
     this.style.set_normal(this.styleState);
     ((Behaviour)this).set_enabled(false);
 }
Exemplo n.º 5
0
    /// <summary>
    /// GUI Draw
    /// </summary>
    private async void OnGUI()
    {
        var toggleText = toggle ? "Custom Setting" : "Default Setting";

        toggle = EditorGUILayout.BeginToggleGroup(toggleText, toggle);
        if (toggle)
        {
            targetPath      = EditorGUILayout.TextField("Bundle Path", targetPath);
            compressingPath = EditorGUILayout.TextField("SVN Path", targetPath);
        }
        else
        {
            EditorGUILayout.TextField("Bundle Path", AssetBundlePath.BundlePath);
            EditorGUILayout.TextField("SVN Path", AssetBundlePath.SVNPath);
        }
        EditorGUILayout.EndToggleGroup();

        if (GUILayout.Button("Compress"))
        {
            if (toggle)
            {
                AssetBundlePath.SetBundlePath(targetPath);
                AssetBundlePath.SetSVNPath(compressingPath);
            }

            _onCompressing = true;
            result         = "압축중";
            result         = await Task.Run(AssetBundleCompressor.Instance.MakeAssetBundleZipFile);

            _onCompressing = false;
            AssetBundleCompressor.Instance.Delete();
        }
        var           style = new GUIStyle();
        GUIStyleState state = new GUIStyleState();

        state.background = GUI.skin.button.normal.background;
        state.textColor  = Color.blue;
        style.active     = GUI.skin.button.active;
        style.normal     = state;
        style.alignment  = TextAnchor.MiddleCenter;
        style.padding    = new RectOffset(5, 5, 3, 3);
        style.margin     = new RectOffset(160, 5, 5, 0);
        style.border     = new RectOffset(5, 5, 1, 1);
        style.clipping   = TextClipping.Clip;

        if (GUILayout.Button("Show in Explorer", style))
        {
            System.Diagnostics.Process.Start(AssetBundlePath.SVNPath);
        }

        EditorGUILayout.LabelField(result ?? "");

        if (_onCompressing)
        {
            EditorGUILayout.LabelField(AssetBundleCompressor.Instance.progress + "/" + AssetBundleCompressor.Instance.nOfFile);
        }
    }
        void InitStyles()
        {
            errorTextStyle.richText = true;

            GUIStyleState _styleState = new GUIStyleState();

            _styleState.textColor = Color.yellow;
            errorTextStyle.normal = _styleState;
        }
Exemplo n.º 7
0
    void Update()
    {
        style          = new GUIStyle();
        style.fontSize = 40;
        GUIStyleState styleState = new GUIStyleState();

        styleState.textColor = new Color(1f, 1f, 1f);
        style.normal         = styleState;
    }
Exemplo n.º 8
0
        static GUIStyleState CopyStyleState(GUIStyleState styleOther)
        {
            GUIStyleState newStyle = new GUIStyleState();

            newStyle.background        = styleOther.background;
            newStyle.scaledBackgrounds = styleOther.scaledBackgrounds;
            newStyle.textColor         = styleOther.textColor;
            return(newStyle);
        }
Exemplo n.º 9
0
    ///---------------------------------------------------------------------
    /// <summary>
    /// 状態アイコン表示
    /// </summary>
    /// <param name="selectionRect"></param>
    private static void ShowStatusLabel(VCSStatus status, Rect selectionRect)
    {
        // アイコンの位置
        const int size = 13;
        var       pos  = selectionRect;

        pos.y      = selectionRect.position.y;
        pos.x      = selectionRect.position.x;
        pos.width  = size;
        pos.height = size;
        pos.yMin++;

        // ラベル表示
        string text   = StatusIconString[(int)status];
        Color  mColor = StatusIconColor[(int)status];

        if (status == VCSStatus.NORMAL)
        {
            if (Settings.IconOverlayOnlyModified)
            {
                return;
            }
        }

        GUIStyleState styleState = new GUIStyleState();

        styleState.textColor = Color.white;

        GUIStyle style = new GUIStyle();

        style.fontSize  = 14;
        style.fontStyle = FontStyle.Bold;
        style.normal    = styleState;


        float offset = -12 + 3 * (selectionRect.height / 16.0f);

        // 小さいアイコンのときは端っこに寄せる
        pos.y = selectionRect.height > 16.0f ? selectionRect.position.y + offset : selectionRect.position.y + 1;
        pos.x = selectionRect.height > 16.0f ? selectionRect.position.x + offset : 0;


        // BG
        var color = GUI.color;

        GUI.color = mColor;
        GUI.DrawTexture(pos, EditorGUIUtility.whiteTexture);
        GUI.color = color;

        // テキストは少し中に寄せる
        pos.y -= 2;
        pos.x += 2;

        // アイコン
        GUI.Label(pos, text, style);
    }
Exemplo n.º 10
0
        public static GUIStyleState InvertTextColor(this GUIStyleState current, float intensityCompare, float difference = 0.6f)
        {
            var comparison = Mathf.Abs(intensityCompare - current.textColor.GetIntensity());

            if (comparison < difference)
            {
                current.textColor = current.textColor.Invert();
            }
            return(current);
        }
Exemplo n.º 11
0
 public void Start()
 {
     m_guiStyle   = new GUIStyle();
     m_styleState = new GUIStyleState();
     if (this.AlignBottom)
     {
         this.GuiRect.y = Screen.height - this.GuiRect.height;
     }
     script = GameObject.Find("ScoreManager").GetComponent <ScoreScript>();
 }
Exemplo n.º 12
0
    public static GUIStyle WithHoveredState(this GUIStyle style, string textureName, Color textColor)
    {
        var state = new GUIStyleState()
        {
            background = !string.IsNullOrEmpty(textureName) ? ElementDesignerStyles.GetSkinTexture(textureName) : null, textColor = textColor
        };

        style.hover = style.onHover = state;
        return(style);
    }
Exemplo n.º 13
0
    public static GUIStyle WithAllStates(this GUIStyle style, Color textColor)
    {
        var state = new GUIStyleState()
        {
            textColor = textColor
        };

        style.normal = style.active = style.hover = style.focused = style.onNormal = style.onActive = style.onHover = style.onFocused = state;
        return(style);
    }
Exemplo n.º 14
0
    public static GUIStyle WithAllStates(this GUIStyle style, string textureName, Color textColor)
    {
        var state = new GUIStyleState()
        {
            background = !string.IsNullOrEmpty(textureName) ? ElementDesignerStyles.GetSkinTexture(textureName) : null, textColor = textColor
        };

        style.normal = style.active = style.hover = style.focused = style.onNormal = style.onActive = style.onHover = style.onFocused = state;
        return(style);
    }
Exemplo n.º 15
0
    static HierarchyView()
    {
        s_ElementNameStyle = new GUIStyle();
        GUIStyleState elementNameNormal  = new GUIStyleState();
        GUIStyleState elementStyleNormal = new GUIStyleState();

        elementNameNormal.textColor  = UIForiaEditorTheme.elementNameNormal;
        elementStyleNormal.textColor = UIForiaEditorTheme.elementStyleNormal;
        s_ElementNameStyle.normal    = elementNameNormal;
    }
Exemplo n.º 16
0
    /// <summary>
    /// Returns a new GUIStyleState.
    /// </summary>
    /// <param name="background"></param>
    /// <param name="scaleBackgrounds"></param>
    /// <param name="textColor"></param>
    public static GUIStyleState NewGUIStyleState(Texture2D background, Texture2D[] scaleBackgrounds, Color textColor)
    {
        GUIStyleState styleState = new GUIStyleState();

        styleState.background        = background;
        styleState.scaledBackgrounds = scaleBackgrounds;
        styleState.textColor         = textColor;

        return(styleState);
    }
Exemplo n.º 17
0
 public static void SetScaledBackground(this GUIStyleState state, Texture2D image)
 {
     if (state.scaledBackgrounds.Length > 0)
     {
         state.scaledBackgrounds[0] = image;
     }
     else
     {
         state.scaledBackgrounds = new[] { image };
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// This function is called when the object becomes enabled and active.
        /// </summary>
        void OnEnable()
        {
            GUIStyleState headingNormalStyle = new GUIStyleState();

            headingNormalStyle.textColor = Color.white;

            _guiStyleHeading.fontSize  = 15;
            _guiStyleHeading.alignment = TextAnchor.MiddleCenter;
            _guiStyleHeading.margin    = new RectOffset(0, 0, 5, 5);
            _guiStyleHeading.normal    = headingNormalStyle;
        }
Exemplo n.º 19
0
        public GUIStyleState Create(Action <Texture2D> action, int width, int height, Color color)
        {
            GUIStyleState state   = new GUIStyleState();
            Texture2D     texture = new Texture2D(width, height, TextureFormat.ARGB32, false);

            action.Invoke(texture);
            texture.Apply();
            state.background = texture;
            state.textColor  = color;
            return(state);
        }
Exemplo n.º 20
0
 private void OnGUIInWindow(GUIStyleState state)
 {
     GUILayout.Label(string.Format("PlayerId : {0:D4}", myPlayerID), new GUIStyle()
     {
         fontSize = 20, fontStyle = FontStyle.Bold, normal = state
     });
     GUILayout.Label(string.Format("Score : {0}", myScore), new GUIStyle()
     {
         fontSize = 20, fontStyle = FontStyle.Bold, normal = state
     });
 }
Exemplo n.º 21
0
 public static Texture2D GetScaledBackground(this GUIStyleState state)
 {
     if (state.scaledBackgrounds.Length > 0)
     {
         return(state.scaledBackgrounds[0]);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 22
0
    void Start()
    {
        Apply();

        style           = new GUIStyle();
        style.fontSize  = 30;
        style.fontStyle = FontStyle.Bold;

        styleState           = new GUIStyleState();
        styleState.textColor = Color.white;
    }
Exemplo n.º 23
0
 void Start()
 {
     // Application.logMessageReceivedに関数を登録しておくと、
     // ログが出力される際に呼んでくれる
     Application.logMessageReceived += LogReceived;
     m_guiStyle             = new GUIStyle();
     m_guiStyle.fontSize    = 25;
     m_styleState           = new GUIStyleState();
     m_styleState.textColor = Color.green;   // 文字色の変更.
     m_guiStyle.normal      = m_styleState;
 }
Exemplo n.º 24
0
    void OnGUI()
    {
        GUIStyle      guiStyle   = new GUIStyle();
        GUIStyleState styleState = new GUIStyleState();

        styleState.textColor = Color.black;

        guiStyle.normal   = styleState;
        guiStyle.fontSize = 120;

        GUI.Label(new Rect(10, 10, 300, 100), "Game Over !!", guiStyle);
    }
Exemplo n.º 25
0
    void OnGUI()
    {
        GUIStyleState styleState = new GUIStyleState();

        styleState.textColor = Color.black;

        GUIStyle guiStyle = new GUIStyle();

        guiStyle.normal = styleState;

        GUILayout.Label("FPS: " + m_fps.ToString("f2"), guiStyle);
    }
        private static GUIStyle GetIconStyle()
        {
            GUIStyleState iconStyleState = new GUIStyleState();

            iconStyleState.textColor  = Color.white;
            iconStyleState.background = Texture2D.blackTexture;
            GUIStyle boxStyle = new GUIStyle(GUI.skin.box);

            boxStyle.alignment = TextAnchor.MiddleCenter;
            boxStyle.normal    = iconStyleState;
            return(boxStyle);
        }
 // Start is called before the first frame update
 void Start()
 {
     color                = Color.black;
     color.r              = 1f;
     color.g              = 1f;
     text_color           = new GUIStyleState();
     text_color.textColor = color;
     text          = new GUIStyle();
     text.font     = font1;
     text.fontSize = 50;
     text.normal   = text_color;
 }
Exemplo n.º 28
0
 public GUIStyle(bool _) :
     this()
 {
     Normal    = new GUIStyleState(true);
     Hover     = new GUIStyleState(true);
     Active    = new GUIStyleState(true);
     Focused   = new GUIStyleState(true);
     OnNormal  = new GUIStyleState(true);
     OnHover   = new GUIStyleState(true);
     OnActive  = new GUIStyleState(true);
     OnFocused = new GUIStyleState(true);
 }
Exemplo n.º 29
0
    protected virtual void Start()
    {
        result_ = new smartar.RecognitionResult();
        result_.maxInitPoints_ = smartar.Recognizer.MAX_NUM_INITIALIZATION_POINTS;
        result_.initPoints_    = initPointBuffer_;

        style_          = new GUIStyle();
        style_.fontSize = 30;

        styleState_           = new GUIStyleState();
        styleState_.textColor = Color.yellow;
    }
    private void OnEnable()
    {
        _target = (OperationBaseItem)target;
        GUIStyleState normal = new GUIStyleState()
        {
            textColor = c3
        };

        titleStyle3.normal    = normal;
        titleStyle3.fontStyle = FontStyle.Italic;
        titleStyle3.fontSize  = 10;
    }