Unity 프로그래머를 위한 합법적인 휴식 편집기
                                            
                                                
                                                
                                                
                                                
                                                
                                                 16853 단어  UnityEditorUnity
                    
쉬고 싶다 
일본인의 평균 근무시간은 8시간이다.이 와중에 계속 집중할 수 없겠죠?
아, 좀 게으름 피웠어, 트위터처럼!
지금이야말로 정력이 쌓일 때다. 매일의 임무를 소화하고 싶다!
그만큼 합법적인 휴식 시간을 얻기 위해 유니티 에디터를 만들었다.
 
 
무슨 일을 기다리고 있는 것처럼 보이는 합법적인 숨 돌리는 편집기다.
사용법 
 
 
 
 간단 2단계!
이외의 속성은 모두 겉만 번지르르한 것이다.
그나저나 1분 주기에 술집이 꽉 차요.
리셋 버튼을 누르면 중간에 가로대를 끌 수도 있다.
소스 코드 
적힌 문자열이 비교적 적합하니 노출되지 않도록 여러 가지 개조를 해 주십시오.
FindingPizza.csusing System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CanEditMultipleObjects]
public class FindingPizza : EditorWindow
{
    string path = "";
    float progress = 1;     //進捗状況 0~1
    float  totalTime = 1;   // min
    float dummyNum = 1;
    float timer;
    int idx = 0;
    float turnupTime = 1;
    float fullConter = 0;
    bool[] dummyToggles = new bool[5];
    List<string> infos = new List<string>() {
        "the process of adapting to something."
        , "ordering my lunch"
        , "finding mr.right. the process is up to population density"
         , "Transrating"
    };
    [MenuItem("Window/Custom/FindingPizza")]
    static void Create()
    {
        UnityEditor.EditorWindow window = GetWindow(typeof(FindingPizza));
        window.Show();
    }
    void OnGUI()
    {
        //無意味なフォルダ指定
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Folder Path", GUILayout.MaxWidth(100));
        GUILayout.TextField(path);
        if (GUILayout.Button("...", GUILayout.MaxWidth(30)))
        {
            path = EditorUtility.OpenFolderPanel("Folder Path", path, "");
        }
        EditorGUILayout.EndHorizontal();
        //パーセントとか書いてるけど単位は分
        totalTime = EditorGUILayout.Slider("total (%)", totalTime, 1, 200);
        UIBar(totalTime / 200.0f, "total");
        //何の意味もない値
        dummyNum = EditorGUILayout.Slider("accuracy", dummyNum, 1, 100);
        UIBar(dummyNum / 100, "accuracy (secure)");
        //必要のないToDoリスト
        dummyToggles[0] = GUILayout.Toggle(dummyToggles[0], "Eat breakfast.");
        dummyToggles[1] = GUILayout.Toggle(dummyToggles[1], "Walk around without f**kin' phone.");
        dummyToggles[2] = GUILayout.Toggle(dummyToggles[2], "Call to your mom");
        dummyToggles[3] = GUILayout.Toggle(dummyToggles[3], "See a baby cat.");
        dummyToggles[4] = GUILayout.Toggle(dummyToggles[4], "Love yourself.");
        if (progress < 1)
        {
            var temp = string.Format(" {0} / {1}", fullConter, totalTime );
            EditorUtility.DisplayProgressBar("Optimization" + temp, infos[idx] , progress); //プログレスバー表示
            Progress();
        }
        if (GUILayout.Button("launch"))
        {
            progress = 0;
            timer = 0;
            fullConter = 0;
            turnupTime = fullConter + 1 < totalTime ? 1 : totalTime - fullConter;
        }
        if (GUILayout.Button("reset"))
        {
            progress = 1;
            ResetProgress();
        }
    }
    void ResetProgress()
    {
        //プログレスバー削除
        EditorUtility.ClearProgressBar();       
    }
        //ここでプログレスバーが進む処理
    void Progress() {
        timer += Time.deltaTime;
        progress = timer /(turnupTime * 60f);
        idx = Mathf.FloorToInt(timer/60) % infos.Count;
        //バーが満タンになったら設定時間が過ぎたかをチェック
        if (progress >= 1) {
            fullConter += turnupTime;
            if (fullConter >= totalTime)
            {
                ResetProgress();
            }
            else
            {
                turnupTime = fullConter + 1 < totalTime ? 1 : totalTime - fullConter;
                progress = 0;
                timer = 0;
            }
        }
    }
    void OnInspectorUpdate()
    {
        Repaint();
    }
    void UIBar(float value, string label)
    {
        Rect rect = GUILayoutUtility.GetRect(18, 18, "TextField");
        EditorGUI.ProgressBar(rect, value, label);
        EditorGUILayout.Space();
    }
}
#endif
쉬다 
적당한 휴식을 틈타 즐겁게 일해라!
생활을 즐기다~
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Unity 프로그래머를 위한 합법적인 휴식 편집기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/Namagomi_Guria/items/1656636a74b5cc5e3a3a
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CanEditMultipleObjects]
public class FindingPizza : EditorWindow
{
    string path = "";
    float progress = 1;     //進捗状況 0~1
    float  totalTime = 1;   // min
    float dummyNum = 1;
    float timer;
    int idx = 0;
    float turnupTime = 1;
    float fullConter = 0;
    bool[] dummyToggles = new bool[5];
    List<string> infos = new List<string>() {
        "the process of adapting to something."
        , "ordering my lunch"
        , "finding mr.right. the process is up to population density"
         , "Transrating"
    };
    [MenuItem("Window/Custom/FindingPizza")]
    static void Create()
    {
        UnityEditor.EditorWindow window = GetWindow(typeof(FindingPizza));
        window.Show();
    }
    void OnGUI()
    {
        //無意味なフォルダ指定
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Folder Path", GUILayout.MaxWidth(100));
        GUILayout.TextField(path);
        if (GUILayout.Button("...", GUILayout.MaxWidth(30)))
        {
            path = EditorUtility.OpenFolderPanel("Folder Path", path, "");
        }
        EditorGUILayout.EndHorizontal();
        //パーセントとか書いてるけど単位は分
        totalTime = EditorGUILayout.Slider("total (%)", totalTime, 1, 200);
        UIBar(totalTime / 200.0f, "total");
        //何の意味もない値
        dummyNum = EditorGUILayout.Slider("accuracy", dummyNum, 1, 100);
        UIBar(dummyNum / 100, "accuracy (secure)");
        //必要のないToDoリスト
        dummyToggles[0] = GUILayout.Toggle(dummyToggles[0], "Eat breakfast.");
        dummyToggles[1] = GUILayout.Toggle(dummyToggles[1], "Walk around without f**kin' phone.");
        dummyToggles[2] = GUILayout.Toggle(dummyToggles[2], "Call to your mom");
        dummyToggles[3] = GUILayout.Toggle(dummyToggles[3], "See a baby cat.");
        dummyToggles[4] = GUILayout.Toggle(dummyToggles[4], "Love yourself.");
        if (progress < 1)
        {
            var temp = string.Format(" {0} / {1}", fullConter, totalTime );
            EditorUtility.DisplayProgressBar("Optimization" + temp, infos[idx] , progress); //プログレスバー表示
            Progress();
        }
        if (GUILayout.Button("launch"))
        {
            progress = 0;
            timer = 0;
            fullConter = 0;
            turnupTime = fullConter + 1 < totalTime ? 1 : totalTime - fullConter;
        }
        if (GUILayout.Button("reset"))
        {
            progress = 1;
            ResetProgress();
        }
    }
    void ResetProgress()
    {
        //プログレスバー削除
        EditorUtility.ClearProgressBar();       
    }
        //ここでプログレスバーが進む処理
    void Progress() {
        timer += Time.deltaTime;
        progress = timer /(turnupTime * 60f);
        idx = Mathf.FloorToInt(timer/60) % infos.Count;
        //バーが満タンになったら設定時間が過ぎたかをチェック
        if (progress >= 1) {
            fullConter += turnupTime;
            if (fullConter >= totalTime)
            {
                ResetProgress();
            }
            else
            {
                turnupTime = fullConter + 1 < totalTime ? 1 : totalTime - fullConter;
                progress = 0;
                timer = 0;
            }
        }
    }
    void OnInspectorUpdate()
    {
        Repaint();
    }
    void UIBar(float value, string label)
    {
        Rect rect = GUILayoutUtility.GetRect(18, 18, "TextField");
        EditorGUI.ProgressBar(rect, value, label);
        EditorGUILayout.Space();
    }
}
#endif
적당한 휴식을 틈타 즐겁게 일해라!
생활을 즐기다~
Reference
이 문제에 관하여(Unity 프로그래머를 위한 합법적인 휴식 편집기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Namagomi_Guria/items/1656636a74b5cc5e3a3a텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)