/// <summary> /// 获取指定的自定义配置 /// </summary> /// <param name="type"></param> /// <param name="typeName"></param> /// <returns></returns> public static CustomDefineData GetDataByTypeAndName(CustomDefineType type, string typeName) { Dictionary <string, CustomDefineData> dic = customDefineDic[type]; CustomDefineData data = null; dic.TryGetValue(typeName, out data); return(data); }
public override string ToLuaHead() { string typeName = _attrs[0].GetValueString(); CustomDefineData data = CustomDefine.GetDataByTypeAndName(CustomDefineType.SimpleBullet, typeName); return(string.Format("last = CreateCustomizedBullet(\"{0}\",{1},{2}{3})\n", typeName, _attrs[1].GetValueString(), _attrs[2].GetValueString(), _attrs[3].GetValueString() == "" ? "" : "," + _attrs[3].GetValueString())); }
private void InitParas() { CustomDefineType type = CustomDefine.GetTypeByNodeType(_nodeAttr.Node.GetNodeType()); string typeName = _nodeAttr.Node.GetAttrByIndex(0).GetValueString(); CustomDefineData data = CustomDefine.GetDataByTypeAndName(type, typeName); // 获取参数名称的列表 if (data == null) { _paraNameList = new List <string>(); } else { if (data.paraListStr == "") { _paraNameList = new List <string>(); } else { _paraNameList = new List <string>(data.paraListStr.Split(',')); } } // 获取参数值的列表 List <string> paraValueList = GetParaValuesFromParaStr(_nodeAttr.GetValueString()); for (int i = 0; i < _paraNameList.Count; i++) { GameObject item = ResourceManager.GetInstance().GetPrefab("Prefabs/Views/EditViews", "EditParaItem"); RectTransform tf = item.GetComponent <RectTransform>(); tf.SetParent(_itemContainerTf, false); EditParaItem itemSt = new EditParaItem { go = item, valueText = tf.Find("ParaValueField").GetComponent <InputField>(), }; Text paraNameText = tf.Find("ParaNameText").GetComponent <Text>(); paraNameText.text = _paraNameList[i]; if (i < paraValueList.Count) { itemSt.valueText.text = paraValueList[i]; } else { itemSt.valueText.text = ""; } _itemList.Add(itemSt); } }
public override string ToLuaHead() { string typeName = _attrs[0].GetValueString(); CustomDefineData data = CustomDefine.GetDataByTypeAndName(CustomDefineType.Collider, typeName); int paraCount = 0; if (data != null) { if (data.paraListStr.IndexOf(',') != -1) { paraCount = data.paraListStr.Split(',').Length; } } return(string.Format("last = CreateCustomizedCollider(\"{0}\",{1}{2})\n", typeName, _attrs[1].GetValueString(), _attrs[2].GetValueString() == "" ? "" : _attrs[4].GetValueString() + ",")); }
public static bool AddData(CustomDefineType type, string typeName, string paraList) { if (typeName == "") { return(false); } CustomDefineData data = new CustomDefineData { type = type, typeName = typeName, paraListStr = paraList, }; Dictionary <string, CustomDefineData> dic = customDefineDic[type]; if (dic.ContainsKey(typeName)) { return(false); } dic.Add(typeName, data); return(true); }