protected override void OnGUI() { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("fnt文件:", GUILayout.MinWidth(60)); _fnt = (TextAsset)EditorGUILayout.ObjectField(_fnt, typeof(TextAsset), false); GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Space(45); GUIStyle tmpBtStyle = new GUIStyle(GUI.skin.button); tmpBtStyle.fontSize = 15; using (var bg = new BgColor(Color.green)) { if (GUILayout.Button("生成字体信息", tmpBtStyle, GUILayout.Width(160), GUILayout.Height(30))) { doMakeBMFont(); } } GUILayout.EndHorizontal(); }
private void OnSceneGUI() { if (editingCollider) { //开始绘制UI Handles.BeginGUI(); GUILayout.BeginArea(new Rect(20, 20, 300, 300)); using (var bg = new BgColor(Color.green)) { GUIStyle tmpStyle = new GUIStyle(GUI.skin.box); tmpStyle.fontSize = 15; tmpStyle.normal.textColor = Color.white; GUILayout.Box("当前动画:" + animationName.stringValue, tmpStyle, GUILayout.MinWidth(300)); } GUILayout.Label("总帧数:" + _frames.get(animationName.stringValue)); GUILayout.BeginHorizontal(); GUIStyle btStyle1 = new GUIStyle(GUI.skin.button); btStyle1.fontSize = 15; if (GUILayout.Button("-", btStyle1, GUILayout.MinHeight(26))) { prevFrame(); } using (var bg = new BgColor(Color.yellow)) { GUIStyle tmpStyle = new GUIStyle(GUI.skin.box); tmpStyle.fontSize = 15; tmpStyle.normal.textColor = Color.white; GUILayout.Box(_curFrameIndex.ToString(), tmpStyle, GUILayout.MinWidth(200)); } if (GUILayout.Button("+", btStyle1, GUILayout.MinHeight(26))) { nextFrame(); } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); using (var bg = new BgColor(Color.yellow)) { using (var cont = new ContentColor(Color.green)) { if (GUILayout.Button("复制矩形")) { StringBuilder sb = new StringBuilder(); sb.Append(_target.offset.x); sb.Append(","); sb.Append(_target.offset.y); sb.Append(","); sb.Append(_target.size.x); sb.Append(","); sb.Append(_target.size.y); TextEditor te = new TextEditor(); te.text = sb.ToString(); te.OnFocus(); te.Copy(); } } } using (var bg = new BgColor(Color.yellow)) { if (GUILayout.Button("复制动作矩形")) { StringBuilder sb = new StringBuilder(animationName.stringValue); sb.Append(":"); sb.Append(_target.offset.x); sb.Append(","); sb.Append(_target.offset.y); sb.Append(","); sb.Append(_target.size.x); sb.Append(","); sb.Append(_target.size.y); TextEditor te = new TextEditor(); te.text = sb.ToString(); te.OnFocus(); te.Copy(); } } GUILayout.EndHorizontal(); GUILayout.EndArea(); Handles.EndGUI(); //开始编辑矩形 Matrix4x4 localToWorldMatrix = _target.transform.localToWorldMatrix; localToWorldMatrix.SetRow(0, Vector4.Scale(localToWorldMatrix.GetRow(0), new Vector4(1f, 1f, 0f, 1f))); localToWorldMatrix.SetRow(1, Vector4.Scale(localToWorldMatrix.GetRow(1), new Vector4(1f, 1f, 0f, 1f))); localToWorldMatrix.SetRow(2, new Vector4(0f, 0f, 1f, _target.transform.position.z)); using (new Handles.DrawingScope(localToWorldMatrix)) { this.m_BoundsHandle.center = _target.offset; this.m_BoundsHandle.size = _target.size; this.m_BoundsHandle.SetColor(Color.red); EditorGUI.BeginChangeCheck(); this.m_BoundsHandle.DrawHandle(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_target, string.Format("Modify {0}", ObjectNames.NicifyVariableName(base.target.GetType().Name))); Vector2 size = _target.size; _target.size = this.m_BoundsHandle.size; if (_target.size != size) { _target.offset = this.m_BoundsHandle.center; } } } } }
public override void OnInspectorGUI() { if (_imageFrameContainer) { serializedObject.Update(); EditorGUILayout.PropertyField(frame); showSprites = EditorGUILayout.Foldout(showSprites, "图片集"); if (showSprites) { Sprite[] sprites = _imageFrameContainer.sprites; for (int i = 0; i < sprites.Length; ++i) { GUILayout.BeginHorizontal(); using (var color = new ContentColor(Color.green)) { GUILayout.Label(i.ToString(), GUILayout.MaxWidth(20)); } sprites[i] = EditorGUILayout.ObjectField(sprites[i], typeof(Sprite), false, GUILayout.Height(32), GUILayout.Width(32)) as Sprite; // ReSharper disable once UnusedVariable using (var color = new BgColor(Color.red)) { if (GUILayout.Button("X", GUILayout.Width(22f))) { ArrayUtility.RemoveAt(ref sprites, i); _imageFrameContainer.sprites = sprites; } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); newSprite = EditorGUILayout.ObjectField(newSprite, typeof(Sprite), false, GUILayout.Height(32), GUILayout.Width(32)) as Sprite; // ReSharper disable once UnusedVariable using (var color = new BgColor(Color.green)) { if (GUILayout.Button("添加", GUILayout.Width(35f))) { if (sprites.Length > 0) { Sprite[] arr = new Sprite[sprites.Length + 1]; sprites.CopyTo(arr, 0); arr[sprites.Length] = newSprite; _imageFrameContainer.sprites = arr; } else { _imageFrameContainer.sprites = new[] { newSprite }; } newSprite = null; } } GUILayout.EndHorizontal(); } serializedObject.ApplyModifiedProperties(); _imageFrameContainer.frame = frame.intValue; } }
protected override void OnGUI() { GUILayout.Label("选择平台", EditorUtils.labelCenterStyle); _selectTargetIndex = GUILayout.Toolbar(_selectTargetIndex, _targetNameArr); GUILayout.Space(18); _isAll = GUILayout.Toggle(_isAll, new GUIContent("是否全部执行", "是:全量执行,否:增量执行"), GUILayout.Width(100)); _isReleasePack = GUILayout.Toggle(_isReleasePack, new GUIContent("是否正式打包", "是:会成成到cdn目录,并且覆盖版本记录文件,否:本地调试用"), GUILayout.Width(100)); if (_isReleasePack) { _isNewApp = GUILayout.Toggle(_isNewApp, new GUIContent("是否新app", "正式发布用,标记是否有主工程更新"), GUILayout.Width(100)); if (_isNewApp) { _isAppNeedUpdate = GUILayout.Toggle(_isAppNeedUpdate, new GUIContent("是否是必须更新的app", "正式发布用,标记主工程的更新是否客户端必须下载"), GUILayout.Width(200)); } else { _isAppNeedUpdate = false; } _isResourceNeedUpdate = GUILayout.Toggle(_isResourceNeedUpdate, new GUIContent("是否有必更资源", "正式发布用,标记是否变更最低允许资源版本"), GUILayout.Width(100)); makeVersionText(); } else { _isNewApp = false; _isAppNeedUpdate = false; _isResourceNeedUpdate = false; } bool clickPack; GUILayout.BeginHorizontal(); { GUILayout.Space(150); GUIStyle tmpBtStyle = new GUIStyle(GUI.skin.button) { fontSize = 20 }; // ReSharper disable once UnusedVariable using (BgColor bg = new BgColor(Color.green)) { clickPack = GUILayout.Button("资源打包", tmpBtStyle, GUILayout.Width(100), GUILayout.Height(30)); } } GUILayout.EndHorizontal(); GUILayout.Space(30); bool clickBuild; GUILayout.BeginHorizontal(); { GUILayout.Space(150); GUIStyle tmpBtStyle = new GUIStyle(GUI.skin.button) { fontSize = 20 }; // ReSharper disable once UnusedVariable using (BgColor bg = new BgColor(Color.yellow)) { clickBuild = GUILayout.Button("一键出包", tmpBtStyle, GUILayout.Width(100), GUILayout.Height(30)); } } GUILayout.EndHorizontal(); if (clickPack) { if (string.IsNullOrEmpty(_version)) { _version = "1.01"; } PackControl.instance().pack(_targetArr[_selectTargetIndex], _isAll, _isReleasePack, _isNewApp, _isAppNeedUpdate, _isResourceNeedUpdate, makeVersion); Close(); } if (clickBuild) { if (string.IsNullOrEmpty(_version)) { _version = "1.01"; } PackControl.instance().pack(_targetArr[_selectTargetIndex], _isAll, _isReleasePack, _isNewApp, _isAppNeedUpdate, _isResourceNeedUpdate, makeVersion); PackControl.instance().build(_targetArr[_selectTargetIndex]); Close(); } }