資源簡介
Unity編輯器語言開發的,拖入項目Assest目錄下,點擊Unity編輯器上方欄的“我的拓展編輯器”即可打開使用。項目展示寫了一個博客:https://blog.csdn.net/qq_37835111/article/details/86083860
歡迎大家討論

代碼片段和文件信息
using?System.Collections;
using?System.Collections.Generic;
using?UnityEngine;
using?UnityEditor;
using?System.IO;
using?System;
using?System.Linq;
using?System.Text;
namespace?MyHong
{
????public?class?Hong?:?EditorWindow
????{
????????private?AllDefine?allDefine;
????????private?AllChannel?allChannel;
????????private?bool?isEditing?=?false;
????????private?string[]?currentArrCurrentPresetStr?=?new?string[]?{?};//設置模式下繪制預設所用
????????private?int?currentChooseIndex;//設置模式下繪制預設所用
????????private?Channel?currentChannel;//設置模式下的暫時變量,因為應用過后才改變txt,所以定義一個暫時變量
????????private?Vector2?currentScrollPosition?=?Vector2.zero;//當前滾軸的位置,繪制宏列表所用
????????private?AllChannel?tempAllChannel;//編輯模式下的temp
????????private?string?tempNotice?=?““;//編輯模式下添加或者移除的?警告
????????private?string?tempInputName;//編輯模式下輸入的名稱
????????private?Channel?tempChannel;//編輯模式下的temp預設
????????private?string[]?tempArrCurrentPresetStr?=?new?string[]?{?};//編輯模式下temp
????????private?int?tempCurrentChooseIndex;//編輯模式下的temp
????????[MenuItem(“我的擴展工具/我的宏定義管理器“)]
????????private?static?void?MenuInit()
????????{
????????????//展示窗口
????????????Hong?window?=?EditorWindow.GetWindow(“宏定義管理器“);
????????????window.minSize?=?new?Vector2(500?500);
????????}
????????void?OnEnable()
????????{
????????????//讀取Json格式的配置表
????????????TextAsset?defineTextAsset?=?Resources.Load(“Define“);
????????????TextAsset?presetTextAsset?=?Resources.Load(“Channel“);
????????????try
????????????{
????????????????allDefine?=?JsonUtility.FromJson(defineTextAsset.text)????new?AllDefine();
????????????}
????????????catch?(Exception)
????????????{
????????????????allDefine?=?new?AllDefine();
????????????}
????????????try
????????????{
????????????????allChannel?=?JsonUtility.FromJson(presetTextAsset.text)????new?AllChannel();
????????????}
????????????catch?(Exception)
????????????{
????????????????allChannel?=?new?AllChannel();
????????????}
????????????currentArrCurrentPresetStr?=?new?string[allChannel.lisChannel.Count];
????????????for?(int?i?=?0;?i?????????????{
????????????????currentArrCurrentPresetStr[i]?=?allChannel.lisChannel[i].channelName;
????????????}
????????????currentChooseIndex?=?allChannel.currentChooseIndex;
????????????currentChannel?=?allChannel.lisChannel.Count?>?currentChooseIndex???allChannel.lisChannel[currentChooseIndex]?:?null;
????????????//allDefine.lisDefine.Add(new?Define()?{?name?=?“TEST1“?describe?=?“Test1Describe“?});
????????????//allDefine.lisDefine.Add(new?Define()?{?name?=?“TEST2“?describe?=?“Test2Describe“?});
????????????//allDefine.lisDefine.Add(new?Define()?{?name?=?“TEST3“?describe?=?“Test3Describe“?});
????????????//allDefine.lisDefine.Add(new?Define()?{?name?=?“TEST4“?describe?=?“Test4Describe“?});
????????????//allDefine.lisDefine.Add(new?Define()?{?name?=?“TEST5“?describe?=?“Test5Describe“?});
????????????//s
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-05?16:35??hong\
?????目錄???????????0??2019-01-07?17:46??hong\Editor\
?????文件???????24872??2019-01-07?17:46??hong\Editor\Hong.cs
?????文件?????????284??2019-01-05?16:32??hong\Editor\Hong.cs.me
?????文件?????????213??2019-01-05?16:35??hong\Editor.me
?????目錄???????????0??2019-01-07?17:35??hong\Resources\
?????文件?????????284??2019-01-08?16:25??hong\Resources\Channel.json
?????文件?????????199??2019-01-07?14:43??hong\Resources\Channel.json.me
?????文件?????????503??2019-01-07?14:43??hong\Resources\Define.json
?????文件?????????199??2019-01-07?14:43??hong\Resources\Define.json.me
?????文件?????????213??2019-01-05?16:35??hong\Resources.me
- 上一篇:并行粒子群優化算法的設計與實現
- 下一篇:基于改進煙花算法的web服務組合優化
評論
共有 條評論