【Unity 확장】Unity 에디터로 오미쿠지가 당기고 싶은 【소재】
4892 단어 UnityEditor재료Unity 확장Unity
소개
Unity에서 오미 복권을 당기고 싶었기 때문에 만들었습니다.
만든 것에 대해
모든 창에 오미쿠지가 표시됩니다.
소스 코드
텍스트 표시 주위의 처리는 대초원 클래스( htps : // 기 st. 기주 b. 코m/안짱828/7970330 ) 를 참고로 했습니다.
EditorOmikuji.csusing UnityEngine;
using UnityEditor;
using System.Collections;
public class EditorOmikuji
{
static EditorWindow[] windows;
static string text;
[MenuItem("Omikuji/Omikuji")]
static void Omikuji()
{
text = texts[Random.Range(0, texts.Length)];
windows = Resources.FindObjectsOfTypeAll<EditorWindow> ();
EditorApplication.update += () => {
if (windows.Length != 0) {
try {
windows [0].Focus ();
windows [0].ShowNotification (new GUIContent (text));
ArrayUtility.RemoveAt (ref windows, 0);
} catch (System.NullReferenceException) {
}
}
};
}
static readonly string[] texts = new string []
{
"大吉",
"中吉",
"小吉",
"吉",
"末吉",
"凶",
"大凶"
};
}
대흉이 나오면 조금 충격 ...
Reference
이 문제에 관하여(【Unity 확장】Unity 에디터로 오미쿠지가 당기고 싶은 【소재】), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/r-ngtm/items/1ff2101dc6225c6d0f5b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
모든 창에 오미쿠지가 표시됩니다.
소스 코드
텍스트 표시 주위의 처리는 대초원 클래스( htps : // 기 st. 기주 b. 코m/안짱828/7970330 ) 를 참고로 했습니다.
EditorOmikuji.csusing UnityEngine;
using UnityEditor;
using System.Collections;
public class EditorOmikuji
{
static EditorWindow[] windows;
static string text;
[MenuItem("Omikuji/Omikuji")]
static void Omikuji()
{
text = texts[Random.Range(0, texts.Length)];
windows = Resources.FindObjectsOfTypeAll<EditorWindow> ();
EditorApplication.update += () => {
if (windows.Length != 0) {
try {
windows [0].Focus ();
windows [0].ShowNotification (new GUIContent (text));
ArrayUtility.RemoveAt (ref windows, 0);
} catch (System.NullReferenceException) {
}
}
};
}
static readonly string[] texts = new string []
{
"大吉",
"中吉",
"小吉",
"吉",
"末吉",
"凶",
"大凶"
};
}
대흉이 나오면 조금 충격 ...
Reference
이 문제에 관하여(【Unity 확장】Unity 에디터로 오미쿠지가 당기고 싶은 【소재】), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/r-ngtm/items/1ff2101dc6225c6d0f5b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
using UnityEngine;
using UnityEditor;
using System.Collections;
public class EditorOmikuji
{
static EditorWindow[] windows;
static string text;
[MenuItem("Omikuji/Omikuji")]
static void Omikuji()
{
text = texts[Random.Range(0, texts.Length)];
windows = Resources.FindObjectsOfTypeAll<EditorWindow> ();
EditorApplication.update += () => {
if (windows.Length != 0) {
try {
windows [0].Focus ();
windows [0].ShowNotification (new GUIContent (text));
ArrayUtility.RemoveAt (ref windows, 0);
} catch (System.NullReferenceException) {
}
}
};
}
static readonly string[] texts = new string []
{
"大吉",
"中吉",
"小吉",
"吉",
"末吉",
"凶",
"大凶"
};
}
Reference
이 문제에 관하여(【Unity 확장】Unity 에디터로 오미쿠지가 당기고 싶은 【소재】), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/r-ngtm/items/1ff2101dc6225c6d0f5b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)