为ui中的面板添加枚举类型脚本与json来保存信息

按照Prafeb里面的面板名给命名枚举类型

新建一个代码

 

using UnityEngine;
using System.Collections;

public enum UIPanleType
{
    MainMenu,
    Bag,
    ItemMessage,
    Skill,
    Store,
    System,
    Task

}

 然后在代码文件夹新建一个json信息文本(新建txt文本文件,后缀改成.json)

然后进入unity进行编译得到

接着打开下面的json文件输入以下代码

[
{
"PanelType": "Bag",
"Path": "UIPanel/BagPanle",

"PanelType": "ItemMessage",
"Path": "UIPanel/ItemMessagePanle",

"PanelType": "Skill",
"Path": "UIPanel/Skill_Panel",

"PanelType": "Store",
"Path": "UIPanel/Store_Panel",

"PanelType": "System",
"Path": "UIPanel/System_Panel",

"PanelType": "Task",
"Path": "UIPanel/Task_Panel",

"PanelType": "MainMenu",
"Path": "UIPanel/MainMenuPanel"

}


]

 上为面板名,下面是他所代表的路径分别代表下图中的位置

 

posted @ 2016-04-28 15:52  礼桀  阅读(459)  评论(0)    收藏  举报