NLDClient-yudde/ProjectNLD/Assets/Editor/Tools/UIComponentTool/UIInfo.cs

73 lines
1.8 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//UI脚本内容,包括内部填入参数
public class UIInfo
{
private string file1;
private string body1;
private string body2;
public string File1
{
get { return file1; }
set { file1 = value; }
}
public string Body1
{
get { return body1; }
set { body1 = value; }
}
public string Body2
{
get { return body2; }
set { body2 = value; }
}
public UIInfo(string name, string contrastKey, string path)
{
string key = GetUIPath.typMap[contrastKey];
file1 = string.Format("public {0} {1}", key, name); //类名
body1 = string.Format("{0} = GetComponent<{1}>(\"{2}\")", name, key, path); //获取对象
body2 = string.Format("{0} = null", name);
}
}
public class UIBinderInfo
{
private string _file1;
private string _body1;
private string _body2;
public string File1
{
get { return _file1; }
set { _file1 = value; }
}
public string Body1
{
get { return _body1; }
set { _body1 = value; }
}
public string Body2
{
get { return _body2; }
set { _body2 = value; }
}
public UIBinderInfo(string name, string contrastKey, string path)
{
string key = GetUIPath.typMap[contrastKey];
_body1 = "";
_body2 = "";
_file1 = "";
//file1 = string.Format("public {0} {1}", key, name); //类名
_body1 = string.Format("_compMap.Add(\"{0}\", \"{1}\")", name, path); //获取对象
_body2 = string.Format("window.{0} = window.GetComponent<{1}>(\"{2}\")", name, key, path); //获取对象
_file1 = string.Format("public {0} {1}", key, name); //定义变量
}
}