private void LoadUIPanelTypeJson() { //加载json文件 TextAsset t = Resources.Load <TextAsset>("UIPanelType"); json = JsonUtility.FromJson <UIPanelTypeJson>(t.text); Debug.LogError(json.PanelList.Length); Debug.LogError(json.PanelList[5].PanelPath); }
public static UIPanelTypeJson ParseUIPanelTypeJson() { if (json == null) { TextAsset t = Resources.Load <TextAsset>("UIPanelType"); Debug.Log(t.text); json = JsonUtility.FromJson <UIPanelTypeJson>(t.text); } return(json); }
private void ParseUIPanelTypeJson() { TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo info in jsonObject.infoList) { panelPathDict.Add(info.PanelType, info.Path); } }
/// <summary> /// 解析Json,获取面板路径 /// </summary> private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UITypePanel"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo item in jsonObject.infoList) { panelPathDict.Add(item.panelType, item.path); } }
private void ParseUIPanelTypeJson() { _panelPathDic = new Dictionary <UIPanelType, PanelInfo>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson json = JsonUtility.FromJson <UIPanelTypeJson> (ta.text); foreach (PanelInfo info in json.infoList) { _panelPathDic.Add(info.panelType, info); } }
private void ParseUIPanelTypeJson() { panelPathDic = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelInfo/UIPanelTypeInfo"); UIPanelTypeJson panelTypeJson = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo info in panelTypeJson.infoList) { panelPathDic.Add(info.uiPanelType, info.path); } }
private void ParseUIPanelTypeJson() { mPanelPathDictionary = new Dictionary <UIPanelType, string>(); TextAsset textAsset = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(textAsset.text); foreach (UIPanelInformation info in jsonObject.infoList) { //Debug.Log(info.path); mPanelPathDictionary.Add(info.panelType, info.path); } }
/// <summary> /// 从json配置文件解析为相对应的object类 /// </summary> private void ParseUIPanelTypeJson() { mPanelPathDictionary = new Dictionary <UIPanelType, string>(); TextAsset textAsset = Resources.Load <TextAsset>("Demo1_UIFramework/UIPanelType"); //将json对象转化为UIPanelTypeJson类 UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(textAsset.text); foreach (UIPanelInformation info in jsonObject.infoList) { mPanelPathDictionary.Add(info.panelType, info.path); } }
//把所有页面和对应的perfab地址放到字典中去 private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>();//创建一个新的字典 TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); //解析json信息,把json内容都放到list里 foreach (UIPanelInfo info in jsonObject.infoList) //这里遍历list都放到Dict中,便于查找 { panelPathDict.Add(info.panelType, info.path); } }
/// <summary> /// 解析 Json /// </summary> private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); // new 一个空的字典 TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); // Json 文本 UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); // json 转 对象 // 遍历 json 中的面板信息[面板,路径],添加到字典里 foreach (UIPanelInfo info in jsonObject.infoList) { panelPathDict.Add(info.panelType, info.path); } }
//解析UIPanelType.json的信息 private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); //实例化一个字典对象 TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); //获取UIPanelType.json文件的文本信息 UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); //把UIPanel.json文本信息转化为一个内部类的对象,对象里面的链表里面对应的是每个Json信息对应的类 foreach (UIPanelInfo info in jsonObject.infoList) { //Debug.Log(info.panelType); panelPathDict.Add(info.panelType, info.path);//把每一个进过json文件转化过来的类存入字典里面(键值对的形式) } }
private void ParsecJson() { planePathDict = new Dictionary <UiPaneltype, string>();//定义字典 TextAsset ts = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson JsonTypeObject = JsonUtility.FromJson <UIPanelTypeJson>(ts.text); foreach (UIPaneInfol info in JsonTypeObject.Infols) { //Debug.Log(info.panelType); planePathDict.Add(info.panelType, info.path);//增加元素 } }
private void ParseUIPanelTypeJson() { m_PanelPathDict = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson panelInfoList = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo info in panelInfoList.InfoList) { m_PanelPathDict.Add(info.PanelType, info.Path); } }
private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); //读取Resources目录下的UIPanelType文件 TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo info in jsonObject.infoList) { //Debug.Log(info.panelType); panelPathDict.Add(info.panelType, info.path); } }
//将PanelTypeJson文本中的UI界面加载路径实例化出来,并转存到界面路径字典中 private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>();//实例化字典对象 TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); foreach (UIPanelInfo info in jsonObject.infoList) { if (!panelPathDict.ContainsKey(info.panelType)) { panelPathDict.Add(info.panelType, info.path); } } }
/// <summary> /// 解析获取 UIPanel 的路径信息 /// </summary> private void ParseUIPanelTypeJson() { //UIPanel 字典初始化 //Resources 加载 UIPanel 的路径 Json 数据,名称根据自己爆粗你的名称填写 //Json 获取数据 panelPathDic = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelPathData"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson> (ta.text); //逐个解析Json数据,并添加进 UIPanel 路径字典 foreach (UIPanelPathJsonFormat jsonData in jsonObject.jsonInfoList) { panelPathDic.Add(jsonData.panelType, jsonData.path); } }
private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); //空字典,存到字典方便查找,方便根据paneltype(Key)取查找路径(value) TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); //通过TextAsset属性获取UIPanelType.json的所有文本信息,并进行解析 UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); //对象 //读取json,<>表示要转化为什么类型(List或数组),把json信息转递过来,再把信息转化到字典中。 foreach (UIPanelInfo info in jsonObject.infoList) { //Debug.Log(info.panelType); panelPathDict.Add(info.panelType, info.path); //每个Info包含两个信息:Type(Key)和Path(Value) } }
private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); //得到我们的UPanelType.json文件 UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); //将json数据转换成类中的数据,并返回一个list //Debug.Log(ta.text); foreach (UIPanelInfo info in jsonObject.infoList) { //if(info==null) Debug.Log("info nothing!!!!!!!!!!!!"); //Debug.Log(info.panelType); panelPathDict.Add(info.panelType, info.path);//保存路径 } }
private void ParseUIPanelTypeJson() { panelPathDict = new Dictionary <UIPanelType, string>(); TextAsset ta = Resources.Load <TextAsset>("UIPanelType"); UIPanelTypeJson jsonObject = JsonUtility.FromJson <UIPanelTypeJson>(ta.text); // for (int i = 0; i < jsonObject.infoList.Count; i++) // { // Debug.Log(jsonObject.infoList[i].panelType); // panelPathDict.Add(jsonObject.infoList[i].panelType,jsonObject.infoList[i].path); // } foreach (UIPanelInfo info in jsonObject.infoList) { //Debug.Log(info.panelType); panelPathDict.Add(info.panelType, info.path); } }
private void ParseUIPanelTypeJson() { json = AssetManager.ParseUIPanelTypeJson(); }