public SerializeEntity Serialize() { SerializeEntity se = new SerializeEntity(); se.Type = "Text"; se.Add("info", text); //TODO 字体和字体暂时不支持序列化,后期自定义字体时再做支持 se.Add("FStyle", fontStyle.ToString()) .Add("FSize", fontSize) .Add("LS", lineSpacing) .Add("RT", supportRichText) .Add("AG", alignment.ToString()) .Add("ABG", alignByGeometry) .Add("HO", horizontalOverflow.ToString()) .Add("VO", verticalOverflow.ToString()) .Add("col", SerializeUitls.S_Color(color)) .Add("RayT", raycastTarget) .Add("BF", resizeTextForBestFit); if (resizeTextForBestFit) { se.Add("MinS", resizeTextMinSize) .Add("MaxS", resizeTextMaxSize); } return(se); }
public static SerializeEntity Serialize(this Transform trans) { SerializeEntity se = new SerializeEntity(); if (trans is RectTransform) { se.Type = "RectTrans"; } else { se.Type = "Trans"; } if (trans is RectTransform) { var rTrans = trans as RectTransform; se.Add("AnMin", SerializeUitls.S_Vector2(rTrans.anchorMin)); se.Add("AnMax", SerializeUitls.S_Vector2(rTrans.anchorMax)); se.Add("pivot", SerializeUitls.S_Vector2(rTrans.pivot)); se.Add("W", rTrans.rect.width); se.Add("H", rTrans.rect.height); } se.Add("p", SerializeUitls.S_Vector3(trans.localPosition)); se.Add("r", SerializeUitls.S_Vector3(trans.localEulerAngles)); se.Add("s", SerializeUitls.S_Vector3(trans.localScale)); se.Add("active", trans.gameObject.activeSelf); return(se); }
public static SerializeEntity Ser_MaskableGraphic(this MaskableGraphic mg) { SerializeEntity se = new SerializeEntity(); se.Add("m", SerializeUitls.GetResPath(mg.material)) .Add("col", SerializeUitls.S_Color(mg.color)) .Add("RT", mg.raycastTarget); return(se); }
private void Start() { SerializeEntity data = new SerializeEntity(); data.Add("int1", "22.2") .Add("str", "str111") .Add("float", 1.244f) .Add("double", 2.55); }
public SerializeEntity Serialize() { SerializeEntity data = new SerializeEntity(); LitButton defBtn = DefValueMgr.Instance.GetDefComp <LitButton>(); data.Type = "Btn"; data.Add("AN", audioName, defBtn.audioName) .Add("AT", (int)this.animationType, (int)defBtn.animationType) .Add("TD", tweenDuration, defBtn.tweenDuration) .Add("SF", scaleFactor, defBtn.scaleFactor) .Add("CI", clickInterval, defBtn.clickInterval); return(data); }